route-graphics 1.7.3 → 1.7.4
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 +60 -41
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var $F=Object.create;var kp=Object.defineProperty;var XF=Object.getOwnPropertyDescriptor;var jF=Object.getOwnPropertyNames;var YF=Object.getPrototypeOf,qF=Object.prototype.hasOwnProperty;var y=(r,e)=>()=>(r&&(e=r(r=0)),e);var ee=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ob=(r,e)=>{for(var t in e)kp(r,t,{get:e[t],enumerable:!0})},KF=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of jF(e))!qF.call(r,s)&&s!==t&&kp(r,s,{get:()=>e[s],enumerable:!(i=XF(e,s))||i.enumerable});return r};var ds=(r,e,t)=>(t=r!=null?$F(YF(r)):{},KF(e||!r||!r.__esModule?kp(t,"default",{value:r,enumerable:!0}):t,r));var S,Fp,Tu,V,U=y(()=>{"use strict";S=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(S||{}),Fp=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Tu=(r,e)=>Fp(r).priority??e,V={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Fp).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(Fp).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(r,e,t=-1){return this.handle(r,i=>{e.findIndex(o=>o.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((o,n)=>Tu(n.value,t)-Tu(o.value,t)))},i=>{let s=e.findIndex(o=>o.name===i.name);s!==-1&&e.splice(s,1)})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Tu(o,t)-Tu(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})},mixin(r,...e){for(let t of e)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(t))}}});var Gb=ee((QV,Op)=>{"use strict";var QF=Object.prototype.hasOwnProperty,Ot="~";function da(){}Object.create&&(da.prototype=Object.create(null),new da().__proto__||(Ot=!1));function JF(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function Ub(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new JF(t,i||r,s),n=Ot?Ot+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Su(r,e){--r._eventsCount===0?r._events=new da:delete r._events[e]}function Pt(){this._events=new da,this._eventsCount=0}Pt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)QF.call(t,i)&&e.push(Ot?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Pt.prototype.listeners=function(e){var t=Ot?Ot+e:e,i=this._events[t];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};Pt.prototype.listenerCount=function(e){var t=Ot?Ot+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Pt.prototype.emit=function(e,t,i,s,o,n){var a=Ot?Ot+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,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,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,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,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};Pt.prototype.on=function(e,t,i){return Ub(this,e,t,i,!1)};Pt.prototype.once=function(e,t,i){return Ub(this,e,t,i,!0)};Pt.prototype.removeListener=function(e,t,i,s){var o=Ot?Ot+e:e;if(!this._events[o])return this;if(!t)return Su(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&Su(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Su(this,o)}return this};Pt.prototype.removeAllListeners=function(e){var t;return e?(t=Ot?Ot+e:e,this._events[t]&&Su(this,t)):(this._events=new da,this._eventsCount=0),this};Pt.prototype.off=Pt.prototype.removeListener;Pt.prototype.addListener=Pt.prototype.on;Pt.prefixed=Ot;Pt.EventEmitter=Pt;typeof Op<"u"&&(Op.exports=Pt)});var Lb,Ce,Ct=y(()=>{Lb=ds(Gb(),1),Ce=Lb.default});var e2,ci,pt,hr,Xb,Db,Up,t2,wu,jb,Yb,Nb,Hb,Vb,fa,r2,i2,s2,o2,Dp,Wb,n2,Gp,Lp,zb,Np,Qt,$b,Eu,Hp=y(()=>{e2={grad:.9,turn:360,rad:360/(2*Math.PI)},ci=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},pt=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},hr=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},Xb=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Db=function(r){return{r:hr(r.r,0,255),g:hr(r.g,0,255),b:hr(r.b,0,255),a:hr(r.a)}},Up=function(r){return{r:pt(r.r),g:pt(r.g),b:pt(r.b),a:pt(r.a,3)}},t2=/^#([0-9a-f]{3,8})$/i,wu=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},jb=function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=Math.max(e,t,i),n=o-Math.min(e,t,i),a=n?o===e?(t-i)/n:o===t?2+(i-e)/n:4+(e-t)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Yb=function(r){var e=r.h,t=r.s,i=r.v,s=r.a;e=e/360*6,t/=100,i/=100;var o=Math.floor(e),n=i*(1-t),a=i*(1-(e-o)*t),l=i*(1-(1-e+o)*t),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}},Nb=function(r){return{h:Xb(r.h),s:hr(r.s,0,100),l:hr(r.l,0,100),a:hr(r.a)}},Hb=function(r){return{h:pt(r.h),s:pt(r.s),l:pt(r.l),a:pt(r.a,3)}},Vb=function(r){return Yb((t=(e=r).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},fa=function(r){return{h:(e=jb(r)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},r2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,i2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,o2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dp={string:[[function(r){var e=t2.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?pt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?pt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=s2.exec(r)||o2.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Db({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(r){var e=r2.exec(r)||i2.exec(r);if(!e)return null;var t,i,s=Nb({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(e2[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Vb(s)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return ci(e)&&ci(t)&&ci(i)?Db({r:Number(e),g:Number(t),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var e=r.h,t=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!ci(e)||!ci(t)||!ci(i))return null;var n=Nb({h:Number(e),s:Number(t),l:Number(i),a:Number(o)});return Vb(n)},"hsl"],[function(r){var e=r.h,t=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!ci(e)||!ci(t)||!ci(i))return null;var n=function(a){return{h:Xb(a.h),s:hr(a.s,0,100),v:hr(a.v,0,100),a:hr(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(o)});return Yb(n)},"hsv"]]},Wb=function(r,e){for(var t=0;t<e.length;t++){var i=e[t][0](r);if(i)return[i,e[t][1]]}return[null,void 0]},n2=function(r){return typeof r=="string"?Wb(r.trim(),Dp.string):typeof r=="object"&&r!==null?Wb(r,Dp.object):[null,void 0]},Gp=function(r,e){var t=fa(r);return{h:t.h,s:hr(t.s+100*e,0,100),l:t.l,a:t.a}},Lp=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},zb=function(r,e){var t=fa(r);return{h:t.h,s:t.s,l:hr(t.l+100*e,0,100),a:t.a}},Np=function(){function r(e){this.parsed=n2(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return pt(Lp(this.rgba),2)},r.prototype.isDark=function(){return Lp(this.rgba)<.5},r.prototype.isLight=function(){return Lp(this.rgba)>=.5},r.prototype.toHex=function(){return e=Up(this.rgba),t=e.r,i=e.g,s=e.b,n=(o=e.a)<1?wu(pt(255*o)):"","#"+wu(t)+wu(i)+wu(s)+n;var e,t,i,s,o,n},r.prototype.toRgb=function(){return Up(this.rgba)},r.prototype.toRgbString=function(){return e=Up(this.rgba),t=e.r,i=e.g,s=e.b,(o=e.a)<1?"rgba("+t+", "+i+", "+s+", "+o+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,o},r.prototype.toHsl=function(){return Hb(fa(this.rgba))},r.prototype.toHslString=function(){return e=Hb(fa(this.rgba)),t=e.h,i=e.s,s=e.l,(o=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+o+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,o},r.prototype.toHsv=function(){return e=jb(this.rgba),{h:pt(e.h),s:pt(e.s),v:pt(e.v),a:pt(e.a,3)};var e},r.prototype.invert=function(){return Qt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),Qt(Gp(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),Qt(Gp(this.rgba,-e))},r.prototype.grayscale=function(){return Qt(Gp(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),Qt(zb(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),Qt(zb(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?Qt({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):pt(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=fa(this.rgba);return typeof e=="number"?Qt({h:e,s:t.s,l:t.l,a:t.a}):pt(t.h)},r.prototype.isEqual=function(e){return this.toHex()===Qt(e).toHex()},r}(),Qt=function(r){return r instanceof Np?r:new Np(r)},$b=[],Eu=function(r){r.forEach(function(e){$b.indexOf(e)<0&&(e(Np,Dp),$b.push(e))})}});function Au(r,e){var t={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 t)i[t[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=i[this.toHex()];if(c)return c;if(n?.closest){var u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in t)o[f]=new r(t[f]).toRgb();for(var p in t){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":t[a];return l?new r(l).toRgb():null},"name"])}var Vp=y(()=>{});var fo,oe,vt=y(()=>{Hp();Vp();Eu([Au]);fo=class pa{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 pa)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,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((o,n)=>o===t[n]);if(e!==null&&t!==null){let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?!1:o.every(a=>e[a]===t[a])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(t*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[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){let[e,t,i]=this.toUint8RgbArray();return(i<<16)+(t<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[t,i,s,o]=pa._temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(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 t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(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),[t,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),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=pa.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Qt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,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,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof pa||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}};fo.shared=new fo;fo._temp=new fo;fo.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;oe=fo});var qb,Kb=y(()=>{"use strict";qb={cullArea:null,cullable:!1,cullableChildren:!0}});var Zb,Qb,Jb,Wp=y(()=>{"use strict";Zb=Math.PI*2,Qb=180/Math.PI,Jb=Math.PI/180});var de,zp,dr=y(()=>{"use strict";de=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(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,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return zp.x=0,zp.y=0,zp}},zp=new de});var L,a2,l2,ge=y(()=>{Wp();dr();L=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,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,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||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,t){t=t||new de;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new de;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 t.x=n*c*u+-o*c*h+(l*o-a*n)*c,t.y=i*c*h+-s*c*u+(-l*i+a*s)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}appendFrom(e,t){let i=e.a,s=e.b,o=e.c,n=e.d,a=e.tx,l=e.ty,c=t.a,u=t.b,h=t.c,d=t.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+t.tx,this.ty=a*u+l*d+t.ty,this}setTransform(e,t,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=t-(i*this.b+s*this.d),this}prepend(e){let t=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=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(Zb-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(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*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 r;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 l2.identity()}static get shared(){return a2.identity()}},a2=new L,l2=new L});var Tt,Pu=y(()=>{"use strict";Tt=class r{constructor(e,t,i){this._x=t||0,this._y=i||0,this._observer=e}clone(e){return new r(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,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 he(r="default"){return $p[r]===void 0&&($p[r]=-1),++$p[r]}var $p,St=y(()=>{"use strict";$p={default:-1}});function X(r,e,t=3){if(ev[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1
|
+
var $F=Object.create;var kp=Object.defineProperty;var XF=Object.getOwnPropertyDescriptor;var jF=Object.getOwnPropertyNames;var YF=Object.getPrototypeOf,qF=Object.prototype.hasOwnProperty;var y=(r,e)=>()=>(r&&(e=r(r=0)),e);var ee=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ob=(r,e)=>{for(var t in e)kp(r,t,{get:e[t],enumerable:!0})},KF=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of jF(e))!qF.call(r,s)&&s!==t&&kp(r,s,{get:()=>e[s],enumerable:!(i=XF(e,s))||i.enumerable});return r};var ds=(r,e,t)=>(t=r!=null?$F(YF(r)):{},KF(e||!r||!r.__esModule?kp(t,"default",{value:r,enumerable:!0}):t,r));var S,Fp,Tu,V,U=y(()=>{"use strict";S=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(S||{}),Fp=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Tu=(r,e)=>Fp(r).priority??e,V={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Fp).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(Fp).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(r,e,t=-1){return this.handle(r,i=>{e.findIndex(o=>o.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((o,n)=>Tu(n.value,t)-Tu(o.value,t)))},i=>{let s=e.findIndex(o=>o.name===i.name);s!==-1&&e.splice(s,1)})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Tu(o,t)-Tu(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})},mixin(r,...e){for(let t of e)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(t))}}});var Gb=ee((JV,Op)=>{"use strict";var QF=Object.prototype.hasOwnProperty,Ot="~";function da(){}Object.create&&(da.prototype=Object.create(null),new da().__proto__||(Ot=!1));function JF(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function Ub(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new JF(t,i||r,s),n=Ot?Ot+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Su(r,e){--r._eventsCount===0?r._events=new da:delete r._events[e]}function Pt(){this._events=new da,this._eventsCount=0}Pt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)QF.call(t,i)&&e.push(Ot?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Pt.prototype.listeners=function(e){var t=Ot?Ot+e:e,i=this._events[t];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};Pt.prototype.listenerCount=function(e){var t=Ot?Ot+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Pt.prototype.emit=function(e,t,i,s,o,n){var a=Ot?Ot+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,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,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,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,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};Pt.prototype.on=function(e,t,i){return Ub(this,e,t,i,!1)};Pt.prototype.once=function(e,t,i){return Ub(this,e,t,i,!0)};Pt.prototype.removeListener=function(e,t,i,s){var o=Ot?Ot+e:e;if(!this._events[o])return this;if(!t)return Su(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&Su(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Su(this,o)}return this};Pt.prototype.removeAllListeners=function(e){var t;return e?(t=Ot?Ot+e:e,this._events[t]&&Su(this,t)):(this._events=new da,this._eventsCount=0),this};Pt.prototype.off=Pt.prototype.removeListener;Pt.prototype.addListener=Pt.prototype.on;Pt.prefixed=Ot;Pt.EventEmitter=Pt;typeof Op<"u"&&(Op.exports=Pt)});var Lb,Ce,Ct=y(()=>{Lb=ds(Gb(),1),Ce=Lb.default});var e2,ci,pt,hr,Xb,Db,Up,t2,wu,jb,Yb,Nb,Hb,Vb,fa,r2,i2,s2,o2,Dp,Wb,n2,Gp,Lp,zb,Np,Qt,$b,Eu,Hp=y(()=>{e2={grad:.9,turn:360,rad:360/(2*Math.PI)},ci=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},pt=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},hr=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},Xb=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Db=function(r){return{r:hr(r.r,0,255),g:hr(r.g,0,255),b:hr(r.b,0,255),a:hr(r.a)}},Up=function(r){return{r:pt(r.r),g:pt(r.g),b:pt(r.b),a:pt(r.a,3)}},t2=/^#([0-9a-f]{3,8})$/i,wu=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},jb=function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=Math.max(e,t,i),n=o-Math.min(e,t,i),a=n?o===e?(t-i)/n:o===t?2+(i-e)/n:4+(e-t)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Yb=function(r){var e=r.h,t=r.s,i=r.v,s=r.a;e=e/360*6,t/=100,i/=100;var o=Math.floor(e),n=i*(1-t),a=i*(1-(e-o)*t),l=i*(1-(1-e+o)*t),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}},Nb=function(r){return{h:Xb(r.h),s:hr(r.s,0,100),l:hr(r.l,0,100),a:hr(r.a)}},Hb=function(r){return{h:pt(r.h),s:pt(r.s),l:pt(r.l),a:pt(r.a,3)}},Vb=function(r){return Yb((t=(e=r).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},fa=function(r){return{h:(e=jb(r)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},r2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,i2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,o2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dp={string:[[function(r){var e=t2.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?pt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?pt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=s2.exec(r)||o2.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Db({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(r){var e=r2.exec(r)||i2.exec(r);if(!e)return null;var t,i,s=Nb({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(e2[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Vb(s)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return ci(e)&&ci(t)&&ci(i)?Db({r:Number(e),g:Number(t),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var e=r.h,t=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!ci(e)||!ci(t)||!ci(i))return null;var n=Nb({h:Number(e),s:Number(t),l:Number(i),a:Number(o)});return Vb(n)},"hsl"],[function(r){var e=r.h,t=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!ci(e)||!ci(t)||!ci(i))return null;var n=function(a){return{h:Xb(a.h),s:hr(a.s,0,100),v:hr(a.v,0,100),a:hr(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(o)});return Yb(n)},"hsv"]]},Wb=function(r,e){for(var t=0;t<e.length;t++){var i=e[t][0](r);if(i)return[i,e[t][1]]}return[null,void 0]},n2=function(r){return typeof r=="string"?Wb(r.trim(),Dp.string):typeof r=="object"&&r!==null?Wb(r,Dp.object):[null,void 0]},Gp=function(r,e){var t=fa(r);return{h:t.h,s:hr(t.s+100*e,0,100),l:t.l,a:t.a}},Lp=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},zb=function(r,e){var t=fa(r);return{h:t.h,s:t.s,l:hr(t.l+100*e,0,100),a:t.a}},Np=function(){function r(e){this.parsed=n2(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return pt(Lp(this.rgba),2)},r.prototype.isDark=function(){return Lp(this.rgba)<.5},r.prototype.isLight=function(){return Lp(this.rgba)>=.5},r.prototype.toHex=function(){return e=Up(this.rgba),t=e.r,i=e.g,s=e.b,n=(o=e.a)<1?wu(pt(255*o)):"","#"+wu(t)+wu(i)+wu(s)+n;var e,t,i,s,o,n},r.prototype.toRgb=function(){return Up(this.rgba)},r.prototype.toRgbString=function(){return e=Up(this.rgba),t=e.r,i=e.g,s=e.b,(o=e.a)<1?"rgba("+t+", "+i+", "+s+", "+o+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,o},r.prototype.toHsl=function(){return Hb(fa(this.rgba))},r.prototype.toHslString=function(){return e=Hb(fa(this.rgba)),t=e.h,i=e.s,s=e.l,(o=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+o+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,o},r.prototype.toHsv=function(){return e=jb(this.rgba),{h:pt(e.h),s:pt(e.s),v:pt(e.v),a:pt(e.a,3)};var e},r.prototype.invert=function(){return Qt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),Qt(Gp(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),Qt(Gp(this.rgba,-e))},r.prototype.grayscale=function(){return Qt(Gp(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),Qt(zb(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),Qt(zb(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?Qt({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):pt(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=fa(this.rgba);return typeof e=="number"?Qt({h:e,s:t.s,l:t.l,a:t.a}):pt(t.h)},r.prototype.isEqual=function(e){return this.toHex()===Qt(e).toHex()},r}(),Qt=function(r){return r instanceof Np?r:new Np(r)},$b=[],Eu=function(r){r.forEach(function(e){$b.indexOf(e)<0&&(e(Np,Dp),$b.push(e))})}});function Au(r,e){var t={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 t)i[t[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=i[this.toHex()];if(c)return c;if(n?.closest){var u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in t)o[f]=new r(t[f]).toRgb();for(var p in t){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":t[a];return l?new r(l).toRgb():null},"name"])}var Vp=y(()=>{});var fo,oe,vt=y(()=>{Hp();Vp();Eu([Au]);fo=class pa{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 pa)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,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((o,n)=>o===t[n]);if(e!==null&&t!==null){let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?!1:o.every(a=>e[a]===t[a])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(t*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[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){let[e,t,i]=this.toUint8RgbArray();return(i<<16)+(t<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[t,i,s,o]=pa._temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(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 t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(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),[t,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),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=pa.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Qt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,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,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof pa||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}};fo.shared=new fo;fo._temp=new fo;fo.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;oe=fo});var qb,Kb=y(()=>{"use strict";qb={cullArea:null,cullable:!1,cullableChildren:!0}});var Zb,Qb,Jb,Wp=y(()=>{"use strict";Zb=Math.PI*2,Qb=180/Math.PI,Jb=Math.PI/180});var de,zp,dr=y(()=>{"use strict";de=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(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,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return zp.x=0,zp.y=0,zp}},zp=new de});var G,a2,l2,ge=y(()=>{Wp();dr();G=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,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,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||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,t){t=t||new de;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new de;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 t.x=n*c*u+-o*c*h+(l*o-a*n)*c,t.y=i*c*h+-s*c*u+(-l*i+a*s)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}appendFrom(e,t){let i=e.a,s=e.b,o=e.c,n=e.d,a=e.tx,l=e.ty,c=t.a,u=t.b,h=t.c,d=t.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+t.tx,this.ty=a*u+l*d+t.ty,this}setTransform(e,t,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=t-(i*this.b+s*this.d),this}prepend(e){let t=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=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(Zb-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(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*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 r;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 l2.identity()}static get shared(){return a2.identity()}},a2=new G,l2=new G});var Tt,Pu=y(()=>{"use strict";Tt=class r{constructor(e,t,i){this._x=t||0,this._y=i||0,this._observer=e}clone(e){return new r(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,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 he(r="default"){return $p[r]===void 0&&($p[r]=-1),++$p[r]}var $p,St=y(()=>{"use strict";$p={default:-1}});function X(r,e,t=3){if(ev[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
2
2
|
Deprecated since v${r}`):(i=i.split(`
|
|
3
3
|
`).splice(t).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${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
6
|
-
Deprecated since v${r}`),console.warn(i))),ev[e]=!0}var ev,ie,tv,$e=y(()=>{"use strict";ev={},ie="8.0.0",tv="8.3.4"});var fs,Xp=y(()=>{"use strict";fs=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}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 jp,se,Ut=y(()=>{Xp();jp=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new fs(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},se=new jp});var rv,iv=y(()=>{$e();rv={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Cu(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s<o;++s)r[s]=r[s+t];r.length=o}var Yp=y(()=>{"use strict"});var sv,ov=y(()=>{Yp();$e();sv={allowChildren:!0,removeChildren(r=0,e){let t=e??this.children.length,i=t-r,s=[];if(i>0&&i<=t){for(let n=t-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Cu(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let e=this.getChildAt(r);return this.removeChild(e)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,e)},getChildIndex(r){let e=this.children.indexOf(r);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(r,e){this.allowChildren||X(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${r}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===e)return r;s!==-1&&r.parent.children.splice(s,1)}e===t.length?t.push(r):t.splice(e,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,e),r.emit("added",this),r},swapChildren(r,e){if(r===e)return;let t=this.getChildIndex(r),i=this.getChildIndex(e);this.children[t]=e,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(e=>this.reparentChildAt(e,this.children.length)),r[0])},reparentChildAt(r,e){if(r.parent===this)return this.setChildIndex(r,e),r;let t=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,e);let i=this.worldTransform.clone();return i.invert(),t.prepend(i),r.setFromMatrix(t),r}}});var nv,av=y(()=>{"use strict";nv={collectRenderables(r,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,e,t))},collectRenderablesSimple(r,e,t){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,e,t)},collectRenderablesWithEffects(r,e,t){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,e,t);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ui,Mu=y(()=>{"use strict";ui=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 qp,Ru,lv=y(()=>{U();Ut();qp=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 t=0;t<this._tests.length;t++){let i=this._tests[t];if(i.test(e))return se.get(i.maskClass,e)}return e}returnMaskEffect(e){se.return(e)}},Ru=new qp;V.handleByList(S.MaskEffect,Ru._effectClasses)});var cv,uv=y(()=>{Mu();lv();cv={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,i)=>t.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let e=this.effects.indexOf(r);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let e=this._maskEffect;e?.mask!==r&&(e&&(this.removeEffect(e),Ru.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=Ru.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let e=this._filterEffect||(this._filterEffect=new ui);r=r;let t=r?.length>0,i=e.filters?.length>0,s=t!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ui),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var hv,dv=y(()=>{$e();hv={label:null,get name(){return X(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(ie,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,e=!1){return this.getChildByLabel(r,e)},getChildByLabel(r,e=!1){let t=this.children;for(let i=0;i<t.length;i++){let s=t[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(e)for(let i=0;i<t.length;i++){let o=t[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,e=!1,t=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&t.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,t);return t}}});var Iu,Q,ct=y(()=>{dr();Iu=[new de,new de,new de,new de],Q=class r{constructor(e=0,t=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(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,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,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,g=a+o-u,_=l+u,v=l+n-u;return e>=h&&e<=d&&t>=f&&t<=p&&!(e>m&&e<g&&t>_&&t<v)}intersects(e,t){if(!t){let I=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=I)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=Iu[0].set(e.left,e.top),l=Iu[1].set(e.left,e.bottom),c=Iu[2].set(e.right,e.top),u=Iu[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.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,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=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=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=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=t,this.width=i-t,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new r),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return t>=this.x&&t<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 fv,Ee,zt=y(()=>{ge();ct();fv=new L,Ee=class r{constructor(e=1/0,t=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=fv,this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let 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=fv,this}set(e,t,i,s){this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}addFrame(e,t,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,g=n*e+l*t+u,_=a*e+c*t+h;g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*t+u,_=a*i+c*t+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*e+l*s+u,_=a*e+c*s+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*s+u,_=a*i+c*s+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}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 t=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*t+l*i+u,f=a*t+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*t+l*o+u,f=a*t+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,t,i,s){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}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,t,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=t;m<i;m+=2){let g=e[m],_=e[m+1],v=c*g+h*_+f,x=u*g+d*_+p;o=v<o?v:o,n=x<n?x:n,a=v>a?v:a,l=x>l?x:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}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 it,Jt,ps=y(()=>{ge();Xp();zt();it=new fs(L),Jt=new fs(Ee)});var c2,pv,mv=y(()=>{ge();zt();ps();c2=new L,pv={getFastGlobalBounds(r,e){e||(e=new Ee),e.clear(),this._getGlobalBoundsRecursive(!!r,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(r,e,t){let i=e;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Jt.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(r,i,t)}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(c2).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),Jt.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),Jt.return(i))}}});function po(r,e,t){t.clear();let i,s;return r.parent?e?i=r.parent.worldTransform:(s=it.get().identity(),i=Bu(r,s)):i=L.IDENTITY,gv(r,t,i,e),s&&it.return(s),t.isValid||t.set(0,0,0,0),t}function gv(r,e,t,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=it.get(),s.appendFrom(r.localTransform,t));let o=e,n=!!r.effects.length;if(n&&(e=Jt.get().clear()),r.boundsArea)e.addRect(r.boundsArea,s);else{r.bounds&&(e.matrix=s,e.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)gv(r.children[a],e,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(e);o.addBounds(e,L.IDENTITY),Jt.return(e)}i||it.return(s)}function Bu(r,e){let t=r.parent;return t&&(Bu(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}var ma=y(()=>{ge();ps()});function ku(r,e){if(r===16777215||!e)return e;if(e===16777215||!r)return r;let t=r>>16&255,i=r>>8&255,s=r&255,o=e>>16&255,n=e>>8&255,a=e&255,l=t*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Kp=y(()=>{"use strict"});function mo(r,e){return r===xv?e:e===xv?r:ku(r,e)}var xv,Zp=y(()=>{Kp();xv=16777215});function ga(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var yv,_v=y(()=>{ma();ps();Zp();yv={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(r,e){if(e)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let t=Bu(this,it.get().identity());return r.appendFrom(this.localTransform,t),it.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?ga(this.renderGroup.worldColor):this.parentRenderGroup?ga(mo(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=mo(e,t.localColor),t=t.parent;return ga(e)}}});function W(...r){Qp!==bv&&(Qp++,Qp===bv?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Qp,bv,Ae=y(()=>{"use strict";Qp=0,bv=500});function go(r,e,t){return e.clear(),t||(t=L.IDENTITY),vv(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function vv(r,e,t,i,s){let o;if(s)o=it.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=it.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=Jt.get().clear()),r.boundsArea)e.addRect(r.boundsArea,o);else{r.renderPipeId&&(e.matrix=o,e.addBounds(r.bounds));let l=r.children;for(let c=0;c<l.length;c++)vv(l[c],e,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(e,i);n.addBounds(e,L.IDENTITY),Jt.return(e)}it.return(o)}var Fu=y(()=>{ge();ps()});function Jp(r,e){let t=r.children;for(let i=0;i<t.length;i++){let s=t[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&&Jp(s,e)}return e.didChange}var Tv=y(()=>{"use strict"});var u2,Sv,wv=y(()=>{ge();zt();ma();Fu();Tv();u2=new L,Sv={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=r/e*t:this.scale.x=t},_setHeight(r,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=r/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ee});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Jp(this,r),r.didChange&&go(this,r.localBounds,u2),r.localBounds},getBounds(r,e){return po(this,r,e||new Ee)}}});var Ev,Av=y(()=>{"use strict";Ev={_onRender:null,set onRender(r){let e=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function h2(r,e){return r._zIndex-e._zIndex}var Pv,Cv=y(()=>{"use strict";Pv={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(h2))}}});var Mv,Rv=y(()=>{dr();ps();Mv={getGlobalPosition(r=new de,e=!1){return this.parent?this.parent.toGlobal(this._position,r,e):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,e,t=!1){let i=this.getGlobalTransform(it.get(),t);return e=i.apply(r,e),it.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(it.get(),i);return t=s.applyInverse(r,t),it.return(s),t}}});var xo,em=y(()=>{St();xo=class{constructor(){this.uid=he("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 hi(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function tm(r){return!(r&r-1)&&!!r}var xa=y(()=>{"use strict"});function Ou(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var rm=y(()=>{"use strict"});function d2(r){let e=Iv[r];return e===void 0&&(Iv[r]=he("resource")),e}var Iv,Bv,Uu,im=y(()=>{Ct();St();$e();Iv=Object.create(null);Bv=class kv extends Ce{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...kv.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){X(ie,"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=d2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Bv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Uu=Bv});var Fv,we,$t=y(()=>{Ct();xa();rm();St();im();Fv=class Ov extends Ce{constructor(e={}){super(),this.options=e,this.uid=he("textureSource"),this._resourceType="textureSource",this._resourceId=he("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={...Ov.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 Uu(Ou(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=he("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,t,i){i||(i=this._resolution),e||(e=this.width),t||(t=this.height);let s=Math.round(e*i),o=Math.round(t*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=he("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=tm(this.pixelWidth)&&tm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Fv.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};we=Fv});function f2(){for(let r=0;r<16;r++){let e=[];sm.push(e);for(let t=0;t<16;t++){let i=Gu(ms[r]*ms[t]+xs[r]*gs[t]),s=Gu(gs[r]*ms[t]+ys[r]*gs[t]),o=Gu(ms[r]*xs[t]+xs[r]*ys[t]),n=Gu(gs[r]*xs[t]+ys[r]*ys[t]);for(let a=0;a<16;a++)if(ms[a]===i&&gs[a]===s&&xs[a]===o&&ys[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new L;e.set(ms[r],gs[r],xs[r],ys[r],0,0),Uv.push(e)}}var ms,gs,xs,ys,sm,Uv,Gu,He,Gv=y(()=>{ge();ms=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],gs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ys=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sm=[],Uv=[],Gu=Math.sign;f2();He={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>ms[r],uY:r=>gs[r],vX:r=>xs[r],vY:r=>ys[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>sm[r][e],sub:(r,e)=>sm[r][He.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?He.S:He.N:Math.abs(e)*2<=Math.abs(r)?r>0?He.E:He.W:e>0?r>0?He.SE:He.SW:r>0?He.NE:He.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Uv[He.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var om,Lv=y(()=>{"use strict";om=()=>{}});var _s,nm=y(()=>{U();$t();_s=class extends we{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,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}};_s.extension=S.TextureSource});var Dv,yo,am=y(()=>{ge();Dv=new L,yo=class{constructor(e,t){this.mapCoord=new L,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,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,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let i=e.orig,s=e.trim;s&&(Dv.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Dv));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 k,ve=y(()=>{Ct();Gv();ct();St();$e();Lv();nm();$t();am();k=class extends Ce{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=he("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new we,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 yo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:s}=this._source,o=t.x/i,n=t.y/s,a=t.width/i,l=t.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=He.add(c,He.NW),e.x0=d+u*He.uX(c),e.y0=f+h*He.uY(c),c=He.add(c,2),e.x1=d+u*He.uX(c),e.y1=f+h*He.uY(c),c=He.add(c,2),e.x2=d+u*He.uX(c),e.y2=f+h*He.uY(c),c=He.add(c,2),e.x3=d+u*He.uX(c),e.y3=f+h*He.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 X(ie,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new we({label:"EMPTY"})});k.EMPTY.destroy=om;k.WHITE=new k({source:new _s({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=om});var p2,lm,Xe,Fi=y(()=>{xa();$t();ve();p2=0,lm=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new we({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${p2++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=hi(o),n=hi(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=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Xe=new lm});var Lu,Nv=y(()=>{ge();em();Fi();Lu=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new L,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 xo,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 t=e.children;for(let i=0;i<t.length;i++){let s=t[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Xe.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.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 t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,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 t=e.children;for(let i=0;i<t.length;i++)this.addChild(t[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 t=e.children;for(let i=0;i<t.length;i++)this.removeChild(t[i])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.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 t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._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 t=this.root.children;for(let i=0;i<t.length;i++)this._getChildren(t[i],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new L),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new L),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 L),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 Hv(r,e,t={}){for(let i in e)!t[i]&&e[i]!==void 0&&(r[i]=e[i])}var Vv=y(()=>{"use strict"});var cm,um,hm,_o,ya,bs,te,Ar=y(()=>{Ct();vt();Kb();U();ge();Wp();Pu();St();$e();Ut();iv();ov();av();uv();dv();mv();_v();wv();Av();Cv();Rv();Nv();Vv();cm=new Tt(null),um=new Tt(null),hm=new Tt(null,1,1),_o=1,ya=2,bs=4,te=class r extends Ce{constructor(e={}){super(),this.uid=he("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 L,this.relativeGroupTransform=new L,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Tt(this,0,0),this._scale=hm,this._pivot=um,this._skew=cm,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=[],Hv(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),V.mixin(r,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||X(ie,"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 t=e[0],i=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),i&&(i.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,i&&i.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let t=e[0],i=this.children.indexOf(t);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,i),t.emit("removed",this)),t}_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=se.get(Lu,this),this.groupTransform=L.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),se.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 L),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*Qb}set angle(e){this.rotation=e*Jb}get pivot(){return this._pivot===um&&(this._pivot=new Tt(this,0,0)),this._pivot}set pivot(e){this._pivot===um&&(this._pivot=new Tt(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===cm&&(this._skew=new Tt(this,0,0)),this._skew}set skew(e){this._skew===cm&&(this._skew=new Tt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===hm&&(this._scale=new Tt(this,1,1)),this._scale}set scale(e){this._scale===hm&&(this._scale=new Tt(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 t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let i=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,i.width),t!==void 0&&this._setHeight(t,i.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._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 t=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*a,t.d=this._sy*a,t.tx=o._x-(l*t.a+c*t.c),t.ty=o._y-(l*t.b+c*t.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=_o,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=oe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=_o,this._onUpdate())}get tint(){return ga(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ya,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=bs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=bs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=bs,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 t;if(this.children.length&&(t=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)&&t)for(let s=0;s<t.length;++s)t[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};V.mixin(te,sv,pv,Mv,Ev,Sv,cv,hv,Pv,qb,rv,yv,nv)});var Oi,Du=y(()=>{dr();Oi=class r{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new de,this.page=new de,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,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,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 m2(r){return function(e){return e.test(r)}}function Ui(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=m2(t),o={apple:{phone:s(dm)&&!s(di),ipod:s(Wv),tablet:!s(dm)&&(s(zv)||Jv(e))&&!s(di),universal:s($v),device:(s(dm)||s(Wv)||s(zv)||s($v)||Jv(e))&&!s(di)},amazon:{phone:s(bo),tablet:!s(bo)&&s(Nu),device:s(bo)||s(Nu)},android:{phone:!s(di)&&s(bo)||!s(di)&&s(fm),tablet:!s(di)&&!s(bo)&&!s(fm)&&(s(Nu)||s(Xv)),device:!s(di)&&(s(bo)||s(Nu)||s(fm)||s(Xv))||s(/\bokhttp\b/i)},windows:{phone:s(di),tablet:s(jv),device:s(di)||s(jv)},other:{blackberry:s(Yv),blackberry10:s(qv),opera:s(Kv),firefox:s(Qv),chrome:s(Zv),device:s(Yv)||s(qv)||s(Kv)||s(Qv)||s(Zv)},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 dm,Wv,zv,$v,fm,Xv,bo,Nu,di,jv,Yv,qv,Kv,Zv,Qv,Jv,pm=y(()=>{dm=/iPhone/i,Wv=/iPod/i,zv=/iPad/i,$v=/\biOS-universal(?:.+)Mac\b/i,fm=/\bAndroid(?:.+)Mobile\b/i,Xv=/Android/i,bo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Nu=/Silk/i,di=/Windows Phone/i,jv=/\bWindows(?:.+)ARM\b/i,Yv=/BlackBerry/i,qv=/BB10/i,Kv=/Opera Mini/i,Zv=/\b(CriOS|Chrome)(?:.+)Mobile/i,Qv=/Mobile(?:.+)Firefox\b/i,Jv=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var mm=y(()=>{pm();pm()});var g2,e0,t0=y(()=>{mm();g2=Ui.default??Ui,e0=g2(globalThis.navigator)});var x2,Hu,y2,_2,r0,i0,b2,v2,T2,gm,o0,n0=y(()=>{Du();U();t0();Yp();x2=9,Hu=100,y2=0,_2=0,r0=2,i0=1,b2=-1e3,v2=-1e3,T2=2,gm=class s0{constructor(e,t=e0){this._mobileInfo=t,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,(t.tablet||t.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=`${i0}px`,e.style.height=`${i0}px`,e.style.position="absolute",e.style.top=`${b2}px`,e.style.left=`${v2}px`,e.style.zIndex=T2.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=`${Hu}px`,this._div.style.height=`${Hu}px`,this._div.style.position="absolute",this._div.style.top=`${y2}px`,this._div.style.left=`${_2}px`,this._div.style.zIndex=r0.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 t=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),t.disconnect(),this._initAccessibilitySetup())});t.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 t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){let i={accessibilityOptions:{...s0.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 t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Cu(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:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(e.accessibleType==="button"?t=document.createElement("button"):(t=document.createElement(e.accessibleType),t.style.cssText=`
|
|
6
|
+
Deprecated since v${r}`),console.warn(i))),ev[e]=!0}var ev,ie,tv,$e=y(()=>{"use strict";ev={},ie="8.0.0",tv="8.3.4"});var fs,Xp=y(()=>{"use strict";fs=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}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 jp,se,Ut=y(()=>{Xp();jp=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new fs(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},se=new jp});var rv,iv=y(()=>{$e();rv={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Cu(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s<o;++s)r[s]=r[s+t];r.length=o}var Yp=y(()=>{"use strict"});var sv,ov=y(()=>{Yp();$e();sv={allowChildren:!0,removeChildren(r=0,e){let t=e??this.children.length,i=t-r,s=[];if(i>0&&i<=t){for(let n=t-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Cu(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let e=this.getChildAt(r);return this.removeChild(e)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,e)},getChildIndex(r){let e=this.children.indexOf(r);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(r,e){this.allowChildren||X(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${r}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===e)return r;s!==-1&&r.parent.children.splice(s,1)}e===t.length?t.push(r):t.splice(e,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,e),r.emit("added",this),r},swapChildren(r,e){if(r===e)return;let t=this.getChildIndex(r),i=this.getChildIndex(e);this.children[t]=e,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(e=>this.reparentChildAt(e,this.children.length)),r[0])},reparentChildAt(r,e){if(r.parent===this)return this.setChildIndex(r,e),r;let t=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,e);let i=this.worldTransform.clone();return i.invert(),t.prepend(i),r.setFromMatrix(t),r}}});var nv,av=y(()=>{"use strict";nv={collectRenderables(r,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,e,t))},collectRenderablesSimple(r,e,t){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,e,t)},collectRenderablesWithEffects(r,e,t){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,e,t);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ui,Mu=y(()=>{"use strict";ui=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 qp,Ru,lv=y(()=>{U();Ut();qp=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 t=0;t<this._tests.length;t++){let i=this._tests[t];if(i.test(e))return se.get(i.maskClass,e)}return e}returnMaskEffect(e){se.return(e)}},Ru=new qp;V.handleByList(S.MaskEffect,Ru._effectClasses)});var cv,uv=y(()=>{Mu();lv();cv={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,i)=>t.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let e=this.effects.indexOf(r);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let e=this._maskEffect;e?.mask!==r&&(e&&(this.removeEffect(e),Ru.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=Ru.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let e=this._filterEffect||(this._filterEffect=new ui);r=r;let t=r?.length>0,i=e.filters?.length>0,s=t!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ui),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var hv,dv=y(()=>{$e();hv={label:null,get name(){return X(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(ie,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,e=!1){return this.getChildByLabel(r,e)},getChildByLabel(r,e=!1){let t=this.children;for(let i=0;i<t.length;i++){let s=t[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(e)for(let i=0;i<t.length;i++){let o=t[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,e=!1,t=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&t.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,t);return t}}});var Iu,Q,ct=y(()=>{dr();Iu=[new de,new de,new de,new de],Q=class r{constructor(e=0,t=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(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,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,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,g=a+o-u,_=l+u,v=l+n-u;return e>=h&&e<=d&&t>=f&&t<=p&&!(e>m&&e<g&&t>_&&t<v)}intersects(e,t){if(!t){let I=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=I)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=Iu[0].set(e.left,e.top),l=Iu[1].set(e.left,e.bottom),c=Iu[2].set(e.right,e.top),u=Iu[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.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,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=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=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=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=t,this.width=i-t,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new r),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return t>=this.x&&t<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 fv,Ee,zt=y(()=>{ge();ct();fv=new G,Ee=class r{constructor(e=1/0,t=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=fv,this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let 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=fv,this}set(e,t,i,s){this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}addFrame(e,t,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,g=n*e+l*t+u,_=a*e+c*t+h;g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*t+u,_=a*i+c*t+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*e+l*s+u,_=a*e+c*s+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*s+u,_=a*i+c*s+h,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}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 t=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*t+l*i+u,f=a*t+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*t+l*o+u,f=a*t+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,t,i,s){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}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,t,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=t;m<i;m+=2){let g=e[m],_=e[m+1],v=c*g+h*_+f,x=u*g+d*_+p;o=v<o?v:o,n=x<n?x:n,a=v>a?v:a,l=x>l?x:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}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 it,Jt,ps=y(()=>{ge();Xp();zt();it=new fs(G),Jt=new fs(Ee)});var c2,pv,mv=y(()=>{ge();zt();ps();c2=new G,pv={getFastGlobalBounds(r,e){e||(e=new Ee),e.clear(),this._getGlobalBoundsRecursive(!!r,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(r,e,t){let i=e;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Jt.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(r,i,t)}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(c2).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),Jt.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),Jt.return(i))}}});function po(r,e,t){t.clear();let i,s;return r.parent?e?i=r.parent.worldTransform:(s=it.get().identity(),i=Bu(r,s)):i=G.IDENTITY,gv(r,t,i,e),s&&it.return(s),t.isValid||t.set(0,0,0,0),t}function gv(r,e,t,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=it.get(),s.appendFrom(r.localTransform,t));let o=e,n=!!r.effects.length;if(n&&(e=Jt.get().clear()),r.boundsArea)e.addRect(r.boundsArea,s);else{r.bounds&&(e.matrix=s,e.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)gv(r.children[a],e,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(e);o.addBounds(e,G.IDENTITY),Jt.return(e)}i||it.return(s)}function Bu(r,e){let t=r.parent;return t&&(Bu(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}var ma=y(()=>{ge();ps()});function ku(r,e){if(r===16777215||!e)return e;if(e===16777215||!r)return r;let t=r>>16&255,i=r>>8&255,s=r&255,o=e>>16&255,n=e>>8&255,a=e&255,l=t*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Kp=y(()=>{"use strict"});function mo(r,e){return r===xv?e:e===xv?r:ku(r,e)}var xv,Zp=y(()=>{Kp();xv=16777215});function ga(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var yv,_v=y(()=>{ma();ps();Zp();yv={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(r,e){if(e)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let t=Bu(this,it.get().identity());return r.appendFrom(this.localTransform,t),it.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?ga(this.renderGroup.worldColor):this.parentRenderGroup?ga(mo(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=mo(e,t.localColor),t=t.parent;return ga(e)}}});function W(...r){Qp!==bv&&(Qp++,Qp===bv?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Qp,bv,Ae=y(()=>{"use strict";Qp=0,bv=500});function go(r,e,t){return e.clear(),t||(t=G.IDENTITY),vv(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function vv(r,e,t,i,s){let o;if(s)o=it.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=it.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=Jt.get().clear()),r.boundsArea)e.addRect(r.boundsArea,o);else{r.renderPipeId&&(e.matrix=o,e.addBounds(r.bounds));let l=r.children;for(let c=0;c<l.length;c++)vv(l[c],e,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(e,i);n.addBounds(e,G.IDENTITY),Jt.return(e)}it.return(o)}var Fu=y(()=>{ge();ps()});function Jp(r,e){let t=r.children;for(let i=0;i<t.length;i++){let s=t[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&&Jp(s,e)}return e.didChange}var Tv=y(()=>{"use strict"});var u2,Sv,wv=y(()=>{ge();zt();ma();Fu();Tv();u2=new G,Sv={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=r/e*t:this.scale.x=t},_setHeight(r,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=r/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ee});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Jp(this,r),r.didChange&&go(this,r.localBounds,u2),r.localBounds},getBounds(r,e){return po(this,r,e||new Ee)}}});var Ev,Av=y(()=>{"use strict";Ev={_onRender:null,set onRender(r){let e=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function h2(r,e){return r._zIndex-e._zIndex}var Pv,Cv=y(()=>{"use strict";Pv={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(h2))}}});var Mv,Rv=y(()=>{dr();ps();Mv={getGlobalPosition(r=new de,e=!1){return this.parent?this.parent.toGlobal(this._position,r,e):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,e,t=!1){let i=this.getGlobalTransform(it.get(),t);return e=i.apply(r,e),it.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(it.get(),i);return t=s.applyInverse(r,t),it.return(s),t}}});var xo,em=y(()=>{St();xo=class{constructor(){this.uid=he("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 hi(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function tm(r){return!(r&r-1)&&!!r}var xa=y(()=>{"use strict"});function Ou(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var rm=y(()=>{"use strict"});function d2(r){let e=Iv[r];return e===void 0&&(Iv[r]=he("resource")),e}var Iv,Bv,Uu,im=y(()=>{Ct();St();$e();Iv=Object.create(null);Bv=class kv extends Ce{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...kv.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){X(ie,"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=d2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Bv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Uu=Bv});var Fv,we,$t=y(()=>{Ct();xa();rm();St();im();Fv=class Ov extends Ce{constructor(e={}){super(),this.options=e,this.uid=he("textureSource"),this._resourceType="textureSource",this._resourceId=he("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={...Ov.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 Uu(Ou(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=he("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,t,i){i||(i=this._resolution),e||(e=this.width),t||(t=this.height);let s=Math.round(e*i),o=Math.round(t*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=he("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=tm(this.pixelWidth)&&tm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Fv.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};we=Fv});function f2(){for(let r=0;r<16;r++){let e=[];sm.push(e);for(let t=0;t<16;t++){let i=Gu(ms[r]*ms[t]+xs[r]*gs[t]),s=Gu(gs[r]*ms[t]+ys[r]*gs[t]),o=Gu(ms[r]*xs[t]+xs[r]*ys[t]),n=Gu(gs[r]*xs[t]+ys[r]*ys[t]);for(let a=0;a<16;a++)if(ms[a]===i&&gs[a]===s&&xs[a]===o&&ys[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new G;e.set(ms[r],gs[r],xs[r],ys[r],0,0),Uv.push(e)}}var ms,gs,xs,ys,sm,Uv,Gu,He,Gv=y(()=>{ge();ms=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],gs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ys=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sm=[],Uv=[],Gu=Math.sign;f2();He={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>ms[r],uY:r=>gs[r],vX:r=>xs[r],vY:r=>ys[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>sm[r][e],sub:(r,e)=>sm[r][He.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?He.S:He.N:Math.abs(e)*2<=Math.abs(r)?r>0?He.E:He.W:e>0?r>0?He.SE:He.SW:r>0?He.NE:He.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Uv[He.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var om,Lv=y(()=>{"use strict";om=()=>{}});var _s,nm=y(()=>{U();$t();_s=class extends we{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,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}};_s.extension=S.TextureSource});var Dv,yo,am=y(()=>{ge();Dv=new G,yo=class{constructor(e,t){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,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,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let i=e.orig,s=e.trim;s&&(Dv.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Dv));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 k,ve=y(()=>{Ct();Gv();ct();St();$e();Lv();nm();$t();am();k=class extends Ce{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=he("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new we,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 yo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:s}=this._source,o=t.x/i,n=t.y/s,a=t.width/i,l=t.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=He.add(c,He.NW),e.x0=d+u*He.uX(c),e.y0=f+h*He.uY(c),c=He.add(c,2),e.x1=d+u*He.uX(c),e.y1=f+h*He.uY(c),c=He.add(c,2),e.x2=d+u*He.uX(c),e.y2=f+h*He.uY(c),c=He.add(c,2),e.x3=d+u*He.uX(c),e.y3=f+h*He.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 X(ie,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new we({label:"EMPTY"})});k.EMPTY.destroy=om;k.WHITE=new k({source:new _s({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=om});var p2,lm,Xe,Fi=y(()=>{xa();$t();ve();p2=0,lm=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new we({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${p2++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=hi(o),n=hi(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=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Xe=new lm});var Lu,Nv=y(()=>{ge();em();Fi();Lu=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new xo,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 t=e.children;for(let i=0;i<t.length;i++){let s=t[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Xe.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.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 t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,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 t=e.children;for(let i=0;i<t.length;i++)this.addChild(t[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 t=e.children;for(let i=0;i<t.length;i++)this.removeChild(t[i])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.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 t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._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 t=this.root.children;for(let i=0;i<t.length;i++)this._getChildren(t[i],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new G),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 Hv(r,e,t={}){for(let i in e)!t[i]&&e[i]!==void 0&&(r[i]=e[i])}var Vv=y(()=>{"use strict"});var cm,um,hm,_o,ya,bs,te,Ar=y(()=>{Ct();vt();Kb();U();ge();Wp();Pu();St();$e();Ut();iv();ov();av();uv();dv();mv();_v();wv();Av();Cv();Rv();Nv();Vv();cm=new Tt(null),um=new Tt(null),hm=new Tt(null,1,1),_o=1,ya=2,bs=4,te=class r extends Ce{constructor(e={}){super(),this.uid=he("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Tt(this,0,0),this._scale=hm,this._pivot=um,this._skew=cm,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=[],Hv(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),V.mixin(r,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||X(ie,"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 t=e[0],i=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),i&&(i.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,i&&i.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let t=e[0],i=this.children.indexOf(t);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,i),t.emit("removed",this)),t}_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=se.get(Lu,this),this.groupTransform=G.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),se.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 G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(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*Qb}set angle(e){this.rotation=e*Jb}get pivot(){return this._pivot===um&&(this._pivot=new Tt(this,0,0)),this._pivot}set pivot(e){this._pivot===um&&(this._pivot=new Tt(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===cm&&(this._skew=new Tt(this,0,0)),this._skew}set skew(e){this._skew===cm&&(this._skew=new Tt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===hm&&(this._scale=new Tt(this,1,1)),this._scale}set scale(e){this._scale===hm&&(this._scale=new Tt(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 t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let i=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,i.width),t!==void 0&&this._setHeight(t,i.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._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 t=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*a,t.d=this._sy*a,t.tx=o._x-(l*t.a+c*t.c),t.ty=o._y-(l*t.b+c*t.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=_o,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=oe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=_o,this._onUpdate())}get tint(){return ga(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ya,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=bs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=bs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=bs,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 t;if(this.children.length&&(t=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)&&t)for(let s=0;s<t.length;++s)t[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};V.mixin(te,sv,pv,Mv,Ev,Sv,cv,hv,Pv,qb,rv,yv,nv)});var Oi,Du=y(()=>{dr();Oi=class r{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new de,this.page=new de,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,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,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 m2(r){return function(e){return e.test(r)}}function Ui(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=m2(t),o={apple:{phone:s(dm)&&!s(di),ipod:s(Wv),tablet:!s(dm)&&(s(zv)||Jv(e))&&!s(di),universal:s($v),device:(s(dm)||s(Wv)||s(zv)||s($v)||Jv(e))&&!s(di)},amazon:{phone:s(bo),tablet:!s(bo)&&s(Nu),device:s(bo)||s(Nu)},android:{phone:!s(di)&&s(bo)||!s(di)&&s(fm),tablet:!s(di)&&!s(bo)&&!s(fm)&&(s(Nu)||s(Xv)),device:!s(di)&&(s(bo)||s(Nu)||s(fm)||s(Xv))||s(/\bokhttp\b/i)},windows:{phone:s(di),tablet:s(jv),device:s(di)||s(jv)},other:{blackberry:s(Yv),blackberry10:s(qv),opera:s(Kv),firefox:s(Qv),chrome:s(Zv),device:s(Yv)||s(qv)||s(Kv)||s(Qv)||s(Zv)},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 dm,Wv,zv,$v,fm,Xv,bo,Nu,di,jv,Yv,qv,Kv,Zv,Qv,Jv,pm=y(()=>{dm=/iPhone/i,Wv=/iPod/i,zv=/iPad/i,$v=/\biOS-universal(?:.+)Mac\b/i,fm=/\bAndroid(?:.+)Mobile\b/i,Xv=/Android/i,bo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Nu=/Silk/i,di=/Windows Phone/i,jv=/\bWindows(?:.+)ARM\b/i,Yv=/BlackBerry/i,qv=/BB10/i,Kv=/Opera Mini/i,Zv=/\b(CriOS|Chrome)(?:.+)Mobile/i,Qv=/Mobile(?:.+)Firefox\b/i,Jv=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var mm=y(()=>{pm();pm()});var g2,e0,t0=y(()=>{mm();g2=Ui.default??Ui,e0=g2(globalThis.navigator)});var x2,Hu,y2,_2,r0,i0,b2,v2,T2,gm,o0,n0=y(()=>{Du();U();t0();Yp();x2=9,Hu=100,y2=0,_2=0,r0=2,i0=1,b2=-1e3,v2=-1e3,T2=2,gm=class s0{constructor(e,t=e0){this._mobileInfo=t,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,(t.tablet||t.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=`${i0}px`,e.style.height=`${i0}px`,e.style.position="absolute",e.style.top=`${b2}px`,e.style.left=`${v2}px`,e.style.zIndex=T2.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=`${Hu}px`,this._div.style.height=`${Hu}px`,this._div.style.position="absolute",this._div.style.top=`${y2}px`,this._div.style.left=`${_2}px`,this._div.style.zIndex=r0.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 t=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),t.disconnect(),this._initAccessibilitySetup())});t.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 t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){let i={accessibilityOptions:{...s0.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 t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Cu(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:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(e.accessibleType==="button"?t=document.createElement("button"):(t=document.createElement(e.accessibleType),t.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -250,7 +250,7 @@ ${s.join(`
|
|
|
250
250
|
{
|
|
251
251
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
252
252
|
}
|
|
253
|
-
`}}});var tg,$T,XT=y(()=>{"use strict";tg=["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>"],$T=tg.reduce((r,e)=>(r[e]=!0,r),{})});function jT(r,e){switch(r){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 YT=y(()=>{"use strict"});var qT,be,Rt=y(()=>{St();Oa();XT();YT();qT=class KT{constructor(e,t){this._touched=0,this.uid=he("uniform"),this._resourceType="uniformGroup",this._resourceId=he("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...KT.defaultOptions,...t},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!$T[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${tg.join(", ")}`);o.value??(o.value=jT(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=gi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};qT.defaultOptions={ubo:!1,isStatic:!1};be=qT});function Uo(r){let e=ZT[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=i;return e=ZT[r]=new be({uTextures:{value:t,type:"i32",size:r}},{isStatic:!0}),e}var ZT,lh=y(()=>{Rt();ZT={}});var st,Xr=y(()=>{"use strict";st=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(st||{})});var Ke,Cr=y(()=>{Ct();St();Es();Hi();Io();Xr();Rt();Ke=class r extends Ce{constructor(e){super(),this.uid=he("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:t,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=t,this.glProgram=i,n===void 0&&(n=0,t&&(n|=st.WEBGPU),i&&(n|=st.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&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(t&&s&&!a){let c=t.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={},t&&t.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 mt,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 be(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new mt,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,t,i){var s,o;(s=this._uniformBindMap)[t]||(s[t]={}),(o=this._uniformBindMap[t])[i]||(o[i]=e),this.groups[t]||(this.groups[t]=new mt,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){let i={};for(let s in t){let o=t[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(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=gr.from(t)),i&&(n=mr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var ch,QT=y(()=>{zi();Ua();Ga();$i();lh();Cr();ch=class extends Ke{constructor(e){let t=Wr({name:"batch",bits:[ko,Oo(e),$r]}),i=Vr({name:"batch",bits:[Bo,Fo(e),zr]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:Uo(e)}})}}});var JT,eS,La,rg=y(()=>{U();Y0();Q0();QT();JT=null,eS=class tS extends j0{constructor(){super(...arguments),this.geometry=new oh,this.shader=JT||(JT=new ch(this.maxTextures)),this.name=tS.extension.name,this.vertexSize=6}packAttributes(e,t,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,g=e.color,_=e.attributeOffset,v=_+e.attributeSize;for(let x=_;x<v;x++){let T=x*2,b=p[T],w=p[T+1];t[s++]=l*b+u*w+d,t[s++]=h*w+c*b+f,t[s++]=m[T],t[s++]=m[T+1],i[s++]=g,i[s++]=n}}packQuadAttributes(e,t,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,g=p.minX,_=p.maxY,v=p.minY,x=n.uvs,T=e.color,b=o<<16|e.roundPixels&65535;t[s+0]=l*g+u*v+d,t[s+1]=h*v+c*g+f,t[s+2]=x.x0,t[s+3]=x.y0,i[s+4]=T,i[s+5]=b,t[s+6]=l*m+u*v+d,t[s+7]=h*v+c*m+f,t[s+8]=x.x1,t[s+9]=x.y1,i[s+10]=T,i[s+11]=b,t[s+12]=l*m+u*_+d,t[s+13]=h*_+c*m+f,t[s+14]=x.x2,t[s+15]=x.y2,i[s+16]=T,i[s+17]=b,t[s+18]=l*g+u*_+d,t[s+19]=h*_+c*g+f,t[s+20]=x.x3,t[s+21]=x.y3,i[s+22]=T,i[s+23]=b}};eS.extension={type:[S.Batcher],name:"default"};La=eS});function rS(r,e,t,i,s,o,n,a=null){let l=0;t*=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=r[t],g=r[t+1];i[s]=c*m+h*g+f,i[s+1]=u*m+d*g+p,s+=o,t+=e,l++}}function iS(r,e,t,i){let s=0;for(e*=t;s<i;)r[e]=0,r[e+1]=0,e+=t,s++}var sS=y(()=>{"use strict"});function ig(r,e,t,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;t||(t=0),i||(i=2),s||(s=r.length/i-t);let h=t*i;for(let d=0;d<s;d++){let f=r[h],p=r[h+1];r[h]=o*f+a*p+c,r[h+1]=n*f+l*p+u,h+=i}}var oS=y(()=>{"use strict"});var K2,Ps,sg=y(()=>{ge();Kp();K2=new L,Ps=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,t=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?ku(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||K2}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 Go,nS,aS,lS=y(()=>{U();Go={extension:{type:S.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let T=r;t=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;t=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,b=T.width/2,w=T.height/2;t=T.x+b,i=T.y+w,n=a=Math.max(0,Math.min(T.radius,Math.min(b,w))),s=b-n,o=w-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]=t+s,e[1]=e[3]=i+o,e[2]=e[4]=t-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,g=t+p,_=t-p,v=i+m;if(e[u++]=g,e[u++]=v,e[--h]=v,e[--h]=_,o){let T=i-m;e[d++]=_,e[d++]=T,e[--f]=T,e[--f]=g}for(let T=1;T<l;T++){let b=Math.PI/2*(T/l),w=s+Math.cos(b)*n,E=o+Math.sin(b)*a,I=t+w,B=t-w,C=i+E,A=i-E;e[u++]=I,e[u++]=C,e[--h]=C,e[--h]=B,e[d++]=B,e[d++]=A,e[--f]=A,e[--f]=I}p=s,m=o+a,g=t+p,_=t-p,v=i+m;let x=i-m;return e[u++]=g,e[u++]=v,e[--f]=x,e[--f]=g,s&&(e[u++]=_,e[u++]=v,e[--f]=x,e[--f]=_),e},triangulate(r,e,t,i,s,o){if(r.length===0)return;let n=0,a=0;for(let u=0;u<r.length;u+=2)n+=r[u],a+=r[u+1];n/=r.length/2,a/=r.length/2;let l=i;e[l*t]=n,e[l*t+1]=a;let c=l++;for(let u=0;u<r.length;u+=2)e[l*t]=r[u],e[l*t+1]=r[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}},nS={...Go,extension:{...Go.extension,name:"ellipse"}},aS={...Go,extension:{...Go.extension,name:"roundedRectangle"}}});function cS(r){let e=r.length;if(e<6)return 1;let t=0;for(let i=0,s=r[e-2],o=r[e-1];i<e;i+=2){let n=r[i],a=r[i+1];t+=(n-s)*(a+o),s=n,o=a}return t<0?-1:1}var uS=y(()=>{"use strict"});function hS(r,e,t,i,s,o,n,a){let l=r-t*s,c=e-i*s,u=r+t*o,h=e+i*o,d,f;n?(d=i,f=-t):(d=-i,f=t);let p=l+d,m=c+f,g=u+d,_=h+f;return a.push(p,m),a.push(g,_),2}function Cs(r,e,t,i,s,o,n,a){let l=t-r,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-r,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),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,e),n.push(t,i);for(let v=1,x=d;v<g;v++,x+=_)n.push(r,e),n.push(r+Math.sin(x)*m,e+Math.cos(x)*m);n.push(r,e),n.push(s,o)}else{n.push(t,i),n.push(r,e);for(let v=1,x=d;v<g;v++,x+=_)n.push(r+Math.sin(x)*m,e+Math.cos(x)*m),n.push(r,e);n.push(s,o),n.push(r,e)}return g*2}function dS(r,e,t,i,s,o){let n=1e-4;if(r.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let G=cS(r);t&&(G*=-1),l=(l-.5)*G+.5}let c=new de(r[0],r[1]),u=new de(r[r.length-2],r[r.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){r=r.slice(),d&&(r.pop(),r.pop(),u.set(r[r.length-2],r[r.length-1]));let G=(c.x+u.x)*.5,Y=(u.y+c.y)*.5;r.unshift(G,Y),r.push(G,Y)}let f=s,p=r.length/2,m=r.length,g=f.length/2,_=a.width/2,v=_*_,x=a.miterLimit*a.miterLimit,T=r[0],b=r[1],w=r[2],E=r[3],I=0,B=0,C=-(b-E),A=T-w,P=0,R=0,M=Math.sqrt(C*C+A*A);C/=M,A/=M,C*=_,A*=_;let F=l,O=(1-F)*2,D=F*2;h||(a.cap==="round"?m+=Cs(T-C*(O-D)*.5,b-A*(O-D)*.5,T-C*O,b-A*O,T+C*D,b+A*D,f,!0)+2:a.cap==="square"&&(m+=hS(T,b,C,A,O,D,!0,f))),f.push(T-C*O,b-A*O),f.push(T+C*D,b+A*D);for(let G=1;G<p-1;++G){T=r[(G-1)*2],b=r[(G-1)*2+1],w=r[G*2],E=r[G*2+1],I=r[(G+1)*2],B=r[(G+1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,P=-(E-B),R=w-I,M=Math.sqrt(P*P+R*R),P/=M,R/=M,P*=_,R*=_;let Y=w-T,ue=b-E,J=w-I,Be=B-E,ke=Y*J+ue*Be,Me=ue*J-Be*Y,ze=Me<0;if(Math.abs(Me)<.001*Math.abs(ke)){f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),ke>=0&&(a.join==="round"?m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4:m+=2,f.push(w-P*D,E-R*D),f.push(w+P*O,E+R*O));continue}let rt=(-C+T)*(-A+E)-(-C+w)*(-A+b),_t=(-P+I)*(-R+E)-(-P+w)*(-R+B),Le=(Y*_t-J*rt)/Me,bt=(Be*rt-ue*_t)/Me,kt=(Le-w)*(Le-w)+(bt-E)*(bt-E),At=w+(Le-w)*O,Ft=E+(bt-E)*O,Er=w-(Le-w)*D,hs=E-(bt-E)*D,WF=Math.min(Y*Y+ue*ue,J*J+Be*Be),Fb=ze?O:D,zF=WF+Fb*Fb*v;kt<=zF?a.join==="bevel"||kt/v>x?(ze?(f.push(At,Ft),f.push(w+C*D,E+A*D),f.push(At,Ft),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Er,hs),f.push(w-P*O,E-R*O),f.push(Er,hs)),m+=2):a.join==="round"?ze?(f.push(At,Ft),f.push(w+C*D,E+A*D),m+=Cs(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+4,f.push(At,Ft),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Er,hs),m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4,f.push(w-P*O,E-R*O),f.push(Er,hs)):(f.push(At,Ft),f.push(Er,hs)):(f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),a.join==="round"?ze?m+=Cs(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+2:m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+2:a.join==="miter"&&kt/v<=x&&(ze?(f.push(Er,hs),f.push(Er,hs)):(f.push(At,Ft),f.push(At,Ft)),m+=2),f.push(w-P*O,E-R*O),f.push(w+P*D,E+R*D),m+=2)}T=r[(p-2)*2],b=r[(p-2)*2+1],w=r[(p-1)*2],E=r[(p-1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),h||(a.cap==="round"?m+=Cs(w-C*(O-D)*.5,E-A*(O-D)*.5,w-C*O,E-A*O,w+C*D,E+A*D,f,!1)+2:a.cap==="square"&&(m+=hS(w,E,C,A,O,D,!1,f)));let N=1e-4*1e-4;for(let G=g;G<m+g-2;++G)T=f[G*2],b=f[G*2+1],w=f[(G+1)*2],E=f[(G+1)*2+1],I=f[(G+2)*2],B=f[(G+2)*2+1],!(Math.abs(T*(E-B)+w*(B-b)+I*(b-E))<N)&&o.push(G,G+1,G+2)}var fS=y(()=>{dr();uS()});function pS(r,e,t,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=e||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=t,h=r.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(r[f*2]),u.push(r[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 mS=y(()=>{});var ph=ee((sj,lg)=>{"use strict";lg.exports=dh;lg.exports.default=dh;function dh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=xS(r,0,s,t,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=iO(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;p<s;p+=t)h=r[p],d=r[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 Da(o,n,t,a,l,f,0),n}function xS(r,e,t,i,s){var o,n;if(s===ag(r,e,t,i)>0)for(o=e;o<t;o+=i)n=gS(o,r[o],r[o+1],n);else for(o=t-i;o>=e;o-=i)n=gS(o,r[o],r[o+1],n);return n&&fh(n,n.next)&&(Ha(n),n=n.next),n}function Ms(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(fh(t,t.next)||je(t.prev,t,t.next)===0)){if(Ha(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Da(r,e,t,i,s,o,n){if(r){!n&&o&&lO(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?eO(r,i,s,o):J2(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Ha(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=tO(Ms(r),e,t),Da(r,e,t,i,s,o,2)):n===2&&rO(r,e,t,i,s,o):Da(Ms(r),e,t,i,s,o,1);break}}}}function J2(r){var e=r.prev,t=r,i=r.next;if(je(e,t,i)>=0)return!1;for(var s=e.x,o=t.x,n=i.x,a=e.y,l=t.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&&Lo(s,a,o,l,n,c,p.x,p.y)&&je(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function eO(r,e,t,i){var s=r.prev,o=r,n=r.next;if(je(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,g=u>h?u>d?u:d:h>d?h:d,_=og(f,p,e,t,i),v=og(m,g,e,t,i),x=r.prevZ,T=r.nextZ;x&&x.z>=_&&T&&T.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Lo(a,u,l,h,c,d,x.x,x.y)&&je(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Lo(a,u,l,h,c,d,T.x,T.y)&&je(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Lo(a,u,l,h,c,d,x.x,x.y)&&je(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Lo(a,u,l,h,c,d,T.x,T.y)&&je(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function tO(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!fh(s,o)&&yS(s,i,i.next,o)&&Na(s,o)&&Na(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Ha(i),Ha(i.next),i=r=o),i=i.next}while(i!==r);return Ms(i)}function rO(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&hO(n,a)){var l=_S(n,a);n=Ms(n,n.next),l=Ms(l,l.next),Da(n,e,t,i,s,o,0),Da(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function iO(r,e,t,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:r.length,c=xS(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(uO(c));for(s.sort(sO),o=0;o<s.length;o++)t=oO(s[o],t);return t}function sO(r,e){return r.x-e.x}function oO(r,e){var t=nO(r,e);if(!t)return e;var i=_S(t,r);return Ms(i,i.next),Ms(t,t.next)}function nO(r,e){var t=e,i=r.x,s=r.y,o=-1/0,n;do{if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>o&&(o=a,n=t.x<t.next.x?t:t.next,a===i))return n}t=t.next}while(t!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;t=n;do i>=t.x&&t.x>=c&&i!==t.x&&Lo(s<u?i:o,s,c,u,s<u?o:i,s,t.x,t.y)&&(d=Math.abs(s-t.y)/(i-t.x),Na(t,r)&&(d<h||d===h&&(t.x>n.x||t.x===n.x&&aO(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function aO(r,e){return je(r.prev,r,e.prev)<0&&je(e.next,r,r.next)<0}function lO(r,e,t,i){var s=r;do s.z===0&&(s.z=og(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,cO(s)}function cO(r){var e,t,i,s,o,n,a,l,c=1;do{for(t=r,r=null,o=null,n=0;t;){for(n++,i=t,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||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;t=i}o.nextZ=null,c*=2}while(n>1);return r}function og(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function uO(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Lo(r,e,t,i,s,o,n,a){return(s-n)*(e-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function hO(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!dO(r,e)&&(Na(r,e)&&Na(e,r)&&fO(r,e)&&(je(r.prev,r,e.prev)||je(r,e.prev,e))||fh(r,e)&&je(r.prev,r,r.next)>0&&je(e.prev,e,e.next)>0)}function je(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function fh(r,e){return r.x===e.x&&r.y===e.y}function yS(r,e,t,i){var s=hh(je(r,e,t)),o=hh(je(r,e,i)),n=hh(je(t,i,r)),a=hh(je(t,i,e));return!!(s!==o&&n!==a||s===0&&uh(r,t,e)||o===0&&uh(r,i,e)||n===0&&uh(t,r,i)||a===0&&uh(t,e,i))}function uh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function hh(r){return r>0?1:r<0?-1:0}function dO(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&yS(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Na(r,e){return je(r.prev,r,r.next)<0?je(r,e,r.next)>=0&&je(r,r.prev,e)>=0:je(r,e,r.prev)<0||je(r,r.next,e)<0}function fO(r,e){var t=r,i=!1,s=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function _S(r,e){var t=new ng(r.i,r.x,r.y),i=new ng(e.i,e.x,e.y),s=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function gS(r,e,t,i){var s=new ng(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ha(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ng(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}dh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(ag(r,0,o,t));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,u=a<l-1?e[a+1]*t:r.length;n-=Math.abs(ag(r,c,u,t))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*t,f=i[a+1]*t,p=i[a+2]*t;h+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function ag(r,e,t,i){for(var s=0,o=e,n=t-i;o<t;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}dh.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<e;n++)t.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function mh(r,e,t,i,s,o,n){let a=(0,bS.default)(r,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<r.length;c+=2)t[l]=r[c],t[l+1]=r[c+1],l+=i}var bS,cg=y(()=>{bS=ds(ph(),1)});var pO,vS,TS=y(()=>{U();cg();pO=[],vS={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t<r.points.length;t++)e[t]=r.points[t];return e},triangulate(r,e,t,i,s,o){mh(r,pO,e,t,i,s,o)}}});var SS,wS=y(()=>{U();SS={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,e){let t=r,i=t.x,s=t.y,o=t.width,n=t.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(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[6],e[i+n+1]=r[7],n+=t,e[i+n]=r[4],e[i+n+1]=r[5],n+=t;let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var ES,AS=y(()=>{U();ES={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,e){return e[0]=r.x,e[1]=r.y,e[2]=r.x2,e[3]=r.y2,e[4]=r.x3,e[5]=r.y3,e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[4],e[i+n+1]=r[5];let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function CS(r,e){for(let t=0;t<e.length;t++){let i=e[t];r.addColorStop(i.offset,i.color)}}function MS(r,e){let t=j.get().createCanvas(r,e),i=t.getContext("2d");return{canvas:t,context:i}}function mO(r){let e=r[0]??{};return(typeof e=="number"||r[1])&&(X("8.5.2","use options object instead"),e={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Yt.defaultLinearOptions.textureSize}),e}var PS,hg,Yt,Do=y(()=>{vt();Re();ge();Eo();ve();St();$e();rm();PS=[{offset:0,color:"white"},{offset:1,color:"black"}],hg=class ug{constructor(...e){this.uid=he("fillGradient"),this.type="linear",this.colorStops=[];let t=mO(e);t={...t.type==="radial"?ug.defaultRadialOptions:ug.defaultLinearOptions,...Ou(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:oe.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-t,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=e;e=i,i=g,o*=-1}if(n<0){let g=t;t=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:PS,c=this._textureSize,{canvas:u,context:h}=MS(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);CS(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new k({source:new Xt({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new L;m.scale(f/c,1),m.rotate(p),m.translate(e,t),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:PS,t=this._textureSize,{canvas:i,context:s}=MS(t,t),{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=t/(u*2),p=(o-h)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);CS(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,t,t),this.texture=new k({source:new Xt({resource:i,addressMode:this._wrapMode})});let _=new L;_.scale(1/f,1/f),_.translate(h,d),this.textureSpace==="local"&&_.scale(t,t),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};hg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};hg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Yt=hg});function RS(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(xO);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,g=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*g+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 Yt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(gO.copyFrom(i).invert()),s}var gO,xO,IS=y(()=>{ge();ct();Do();gO=new L,xO=new Q});function kS(r,e){let{geometryData:t,batches:i}=e;i.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")bO(o.data,i,t);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&&BS(c.shapePath,l,!0,i,t),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),BS(a,l,n,i,t)}}}function bO(r,e,t){let{vertices:i,uvs:s,indices:o}=t,n=o.length,a=i.length/2,l=[],c=gh.rectangle,u=yO,h=r.image;u.x=r.dx,u.y=r.dy,u.width=r.dw,u.height=r.dh;let d=r.transform;c.build(u,l),d&&ig(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=se.get(Ps);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=h,p.geometryData=t,e.push(p)}function BS(r,e,t,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],p=gh[l.type],m="triangle-list";if(p.build(l,f),c&&ig(f,c),t){let x=l.closePath??!0,T=e;T.pixelLine?(pS(f,x,o,a),m="line-list"):dS(f,T,!1,x,o,a)}else if(u){let x=[],T=f.slice();vO(u).forEach(w=>{x.push(T.length/2),T.push(...w)}),mh(T,x,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let g=n.length/2,_=e.texture;if(_!==k.WHITE){let x=RS(_O,e,l,c);rS(o,2,d,n,g,2,o.length/2-d,x)}else iS(n,g,2,o.length/2-d);let v=se.get(Ps);v.indexOffset=h,v.indexSize=a.length-h,v.attributeOffset=d,v.attributeSize=o.length/2-d,v.baseColor=e.color,v.alpha=e.alpha,v.texture=_,v.geometryData=s,v.topology=m,i.push(v)})}function vO(r){let e=[];for(let t=0;t<r.length;t++){let i=r[t].shape,s=[];gh[i.type].build(i,s),e.push(s)}return e}var gh,yO,_O,FS=y(()=>{U();ge();ct();sS();oS();ve();Ut();sg();lS();fS();mS();TS();wS();AS();IS();cg();gh={};V.handleByMap(S.ShapeBuilder,gh);V.add(SS,vS,ES,Go,nS,aS);yO=new Q,_O=new L});var dg,fg,mg,No,xh=y(()=>{U();rh();rg();em();$e();Ut();FS();dg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},fg=class{constructor(){this.batcher=new La,this.instructions=new xo}init(){this.instructions.reset()}get geometry(){return X(tv,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},mg=class pg{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){pg.defaultOptions.bezierSmoothness=e?.bezierSmoothness??pg.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let t=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){t?this._cleanGraphicsContextData(e):t=this._initContext(e),kS(e,t);let i=e.batchMode;e.customShader||i==="no-batch"?t.isBatchable=!1:i==="auto"&&(t.isBatchable=t.geometryData.vertices.length<400),e.dirty=!1}return t}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let t=se.get(fg),{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=t.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(t.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=Co(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=t,t}_initContext(e){let t=new dg;return t.context=e,this._gpuContextHash[e.uid]=t,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 t=this._gpuContextHash[e.uid];t.isBatchable||this._graphicsDataContextHash[e.uid]&&(se.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),t.batches&&t.batches.forEach(i=>{se.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};mg.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};mg.defaultOptions={bezierSmoothness:.5};No=mg});var TO,gg,xg,yg,_g,bg,vg,Tg,Qe,Mr=y(()=>{"use strict";TO={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},gg=0,xg=1,yg=2,_g=3,bg=4,vg=5,Tg=class OS{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<gg)}set blend(e){!!(this.data&1<<gg)!==e&&(this.data^=1<<gg)}get offsets(){return!!(this.data&1<<xg)}set offsets(e){!!(this.data&1<<xg)!==e&&(this.data^=1<<xg)}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<<yg)}set culling(e){!!(this.data&1<<yg)!==e&&(this.data^=1<<yg)}get depthTest(){return!!(this.data&1<<_g)}set depthTest(e){!!(this.data&1<<_g)!==e&&(this.data^=1<<_g)}get depthMask(){return!!(this.data&1<<vg)}set depthMask(e){!!(this.data&1<<vg)!==e&&(this.data^=1<<vg)}get clockwiseFrontFace(){return!!(this.data&1<<bg)}set clockwiseFrontFace(e){!!(this.data&1<<bg)!==e&&(this.data^=1<<bg)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=TO[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 OS;return e.depthTest=!1,e.blend=!0,e}};Tg.default2d=Tg.for2d();Qe=Tg});function jr(r,e,t){let i=(r>>24&255)/255;e[t++]=(r&255)/255*i,e[t++]=(r>>8&255)/255*i,e[t++]=(r>>16&255)/255*i,e[t++]=i}var Ho=y(()=>{"use strict"});var Va,US=y(()=>{U();Mr();Ut();Ho();sg();Va=class{constructor(e,t){this.state=Qe.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i<t.length;i++){let s=t[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 t=this.renderer,i=e.context;if(!t.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=t._roundPixels|e._roundPixels,jr(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let t=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);t&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,t){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,t)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let t=e.context,i=this.renderer.graphicsContext.getGpuContext(t),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=se.get(Ps);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(t=>{se.return(t)}),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}};Va.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"}});var Sg=y(()=>{U();xh();US();V.add(Va);V.add(No)});var Xi,yh=y(()=>{"use strict";Xi=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 t=this.geometry.getBuffer("aUV"),i=t.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=t._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 Wa,GS=y(()=>{U();ge();Hi();Rt();ka();Ut();Ho();yh();Wa=class{constructor(e,t){this.localUniforms=new be({uTransformMatrix:{value:new L,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new mt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,s=e.batched;if(t.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==t.indexSize||o.positions.length!==t.vertexSize)return t.indexSize=o.indices.length,t.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,t){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,t)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(se.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=pi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),jr(e.groupColorAlpha,t.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 t=se.get(Xi);return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&se.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}};Wa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"}});var wg=y(()=>{U();GS();V.add(Wa)});var _h,LS=y(()=>{"use strict";_h=class{execute(e,t){let i=e.state,s=e.renderer,o=t.shader||e.defaultShader;o.resources.uTexture=t.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(t);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,t.particleChildren.length*6,c,0)}}});function Eg(r,e=null){let t=r*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i<t;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 DS=y(()=>{"use strict"});function HS(r){return{dynamicUpdate:NS(r,!0),staticUpdate:NS(r,!1)}}function NS(r,e){let t=[];t.push(`
|
|
253
|
+
`}}});var tg,$T,XT=y(()=>{"use strict";tg=["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>"],$T=tg.reduce((r,e)=>(r[e]=!0,r),{})});function jT(r,e){switch(r){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 YT=y(()=>{"use strict"});var qT,be,Rt=y(()=>{St();Oa();XT();YT();qT=class KT{constructor(e,t){this._touched=0,this.uid=he("uniform"),this._resourceType="uniformGroup",this._resourceId=he("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...KT.defaultOptions,...t},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!$T[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${tg.join(", ")}`);o.value??(o.value=jT(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=gi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};qT.defaultOptions={ubo:!1,isStatic:!1};be=qT});function Uo(r){let e=ZT[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=i;return e=ZT[r]=new be({uTextures:{value:t,type:"i32",size:r}},{isStatic:!0}),e}var ZT,lh=y(()=>{Rt();ZT={}});var st,Xr=y(()=>{"use strict";st=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(st||{})});var Ke,Cr=y(()=>{Ct();St();Es();Hi();Io();Xr();Rt();Ke=class r extends Ce{constructor(e){super(),this.uid=he("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:t,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=t,this.glProgram=i,n===void 0&&(n=0,t&&(n|=st.WEBGPU),i&&(n|=st.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&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(t&&s&&!a){let c=t.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={},t&&t.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 mt,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 be(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new mt,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,t,i){var s,o;(s=this._uniformBindMap)[t]||(s[t]={}),(o=this._uniformBindMap[t])[i]||(o[i]=e),this.groups[t]||(this.groups[t]=new mt,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){let i={};for(let s in t){let o=t[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(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=gr.from(t)),i&&(n=mr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var ch,QT=y(()=>{zi();Ua();Ga();$i();lh();Cr();ch=class extends Ke{constructor(e){let t=Wr({name:"batch",bits:[ko,Oo(e),$r]}),i=Vr({name:"batch",bits:[Bo,Fo(e),zr]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:Uo(e)}})}}});var JT,eS,La,rg=y(()=>{U();Y0();Q0();QT();JT=null,eS=class tS extends j0{constructor(){super(...arguments),this.geometry=new oh,this.shader=JT||(JT=new ch(this.maxTextures)),this.name=tS.extension.name,this.vertexSize=6}packAttributes(e,t,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,g=e.color,_=e.attributeOffset,v=_+e.attributeSize;for(let x=_;x<v;x++){let T=x*2,b=p[T],w=p[T+1];t[s++]=l*b+u*w+d,t[s++]=h*w+c*b+f,t[s++]=m[T],t[s++]=m[T+1],i[s++]=g,i[s++]=n}}packQuadAttributes(e,t,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,g=p.minX,_=p.maxY,v=p.minY,x=n.uvs,T=e.color,b=o<<16|e.roundPixels&65535;t[s+0]=l*g+u*v+d,t[s+1]=h*v+c*g+f,t[s+2]=x.x0,t[s+3]=x.y0,i[s+4]=T,i[s+5]=b,t[s+6]=l*m+u*v+d,t[s+7]=h*v+c*m+f,t[s+8]=x.x1,t[s+9]=x.y1,i[s+10]=T,i[s+11]=b,t[s+12]=l*m+u*_+d,t[s+13]=h*_+c*m+f,t[s+14]=x.x2,t[s+15]=x.y2,i[s+16]=T,i[s+17]=b,t[s+18]=l*g+u*_+d,t[s+19]=h*_+c*g+f,t[s+20]=x.x3,t[s+21]=x.y3,i[s+22]=T,i[s+23]=b}};eS.extension={type:[S.Batcher],name:"default"};La=eS});function rS(r,e,t,i,s,o,n,a=null){let l=0;t*=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=r[t],g=r[t+1];i[s]=c*m+h*g+f,i[s+1]=u*m+d*g+p,s+=o,t+=e,l++}}function iS(r,e,t,i){let s=0;for(e*=t;s<i;)r[e]=0,r[e+1]=0,e+=t,s++}var sS=y(()=>{"use strict"});function ig(r,e,t,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;t||(t=0),i||(i=2),s||(s=r.length/i-t);let h=t*i;for(let d=0;d<s;d++){let f=r[h],p=r[h+1];r[h]=o*f+a*p+c,r[h+1]=n*f+l*p+u,h+=i}}var oS=y(()=>{"use strict"});var K2,Ps,sg=y(()=>{ge();Kp();K2=new G,Ps=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,t=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?ku(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||K2}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 Go,nS,aS,lS=y(()=>{U();Go={extension:{type:S.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let T=r;t=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;t=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,b=T.width/2,w=T.height/2;t=T.x+b,i=T.y+w,n=a=Math.max(0,Math.min(T.radius,Math.min(b,w))),s=b-n,o=w-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]=t+s,e[1]=e[3]=i+o,e[2]=e[4]=t-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,g=t+p,_=t-p,v=i+m;if(e[u++]=g,e[u++]=v,e[--h]=v,e[--h]=_,o){let T=i-m;e[d++]=_,e[d++]=T,e[--f]=T,e[--f]=g}for(let T=1;T<l;T++){let b=Math.PI/2*(T/l),w=s+Math.cos(b)*n,E=o+Math.sin(b)*a,I=t+w,B=t-w,C=i+E,A=i-E;e[u++]=I,e[u++]=C,e[--h]=C,e[--h]=B,e[d++]=B,e[d++]=A,e[--f]=A,e[--f]=I}p=s,m=o+a,g=t+p,_=t-p,v=i+m;let x=i-m;return e[u++]=g,e[u++]=v,e[--f]=x,e[--f]=g,s&&(e[u++]=_,e[u++]=v,e[--f]=x,e[--f]=_),e},triangulate(r,e,t,i,s,o){if(r.length===0)return;let n=0,a=0;for(let u=0;u<r.length;u+=2)n+=r[u],a+=r[u+1];n/=r.length/2,a/=r.length/2;let l=i;e[l*t]=n,e[l*t+1]=a;let c=l++;for(let u=0;u<r.length;u+=2)e[l*t]=r[u],e[l*t+1]=r[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}},nS={...Go,extension:{...Go.extension,name:"ellipse"}},aS={...Go,extension:{...Go.extension,name:"roundedRectangle"}}});function cS(r){let e=r.length;if(e<6)return 1;let t=0;for(let i=0,s=r[e-2],o=r[e-1];i<e;i+=2){let n=r[i],a=r[i+1];t+=(n-s)*(a+o),s=n,o=a}return t<0?-1:1}var uS=y(()=>{"use strict"});function hS(r,e,t,i,s,o,n,a){let l=r-t*s,c=e-i*s,u=r+t*o,h=e+i*o,d,f;n?(d=i,f=-t):(d=-i,f=t);let p=l+d,m=c+f,g=u+d,_=h+f;return a.push(p,m),a.push(g,_),2}function Cs(r,e,t,i,s,o,n,a){let l=t-r,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-r,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),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,e),n.push(t,i);for(let v=1,x=d;v<g;v++,x+=_)n.push(r,e),n.push(r+Math.sin(x)*m,e+Math.cos(x)*m);n.push(r,e),n.push(s,o)}else{n.push(t,i),n.push(r,e);for(let v=1,x=d;v<g;v++,x+=_)n.push(r+Math.sin(x)*m,e+Math.cos(x)*m),n.push(r,e);n.push(s,o),n.push(r,e)}return g*2}function dS(r,e,t,i,s,o){let n=1e-4;if(r.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let L=cS(r);t&&(L*=-1),l=(l-.5)*L+.5}let c=new de(r[0],r[1]),u=new de(r[r.length-2],r[r.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){r=r.slice(),d&&(r.pop(),r.pop(),u.set(r[r.length-2],r[r.length-1]));let L=(c.x+u.x)*.5,Y=(u.y+c.y)*.5;r.unshift(L,Y),r.push(L,Y)}let f=s,p=r.length/2,m=r.length,g=f.length/2,_=a.width/2,v=_*_,x=a.miterLimit*a.miterLimit,T=r[0],b=r[1],w=r[2],E=r[3],I=0,B=0,C=-(b-E),A=T-w,P=0,R=0,M=Math.sqrt(C*C+A*A);C/=M,A/=M,C*=_,A*=_;let F=l,O=(1-F)*2,D=F*2;h||(a.cap==="round"?m+=Cs(T-C*(O-D)*.5,b-A*(O-D)*.5,T-C*O,b-A*O,T+C*D,b+A*D,f,!0)+2:a.cap==="square"&&(m+=hS(T,b,C,A,O,D,!0,f))),f.push(T-C*O,b-A*O),f.push(T+C*D,b+A*D);for(let L=1;L<p-1;++L){T=r[(L-1)*2],b=r[(L-1)*2+1],w=r[L*2],E=r[L*2+1],I=r[(L+1)*2],B=r[(L+1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,P=-(E-B),R=w-I,M=Math.sqrt(P*P+R*R),P/=M,R/=M,P*=_,R*=_;let Y=w-T,ue=b-E,J=w-I,Be=B-E,ke=Y*J+ue*Be,Me=ue*J-Be*Y,ze=Me<0;if(Math.abs(Me)<.001*Math.abs(ke)){f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),ke>=0&&(a.join==="round"?m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4:m+=2,f.push(w-P*D,E-R*D),f.push(w+P*O,E+R*O));continue}let rt=(-C+T)*(-A+E)-(-C+w)*(-A+b),_t=(-P+I)*(-R+E)-(-P+w)*(-R+B),Le=(Y*_t-J*rt)/Me,bt=(Be*rt-ue*_t)/Me,kt=(Le-w)*(Le-w)+(bt-E)*(bt-E),At=w+(Le-w)*O,Ft=E+(bt-E)*O,Er=w-(Le-w)*D,hs=E-(bt-E)*D,WF=Math.min(Y*Y+ue*ue,J*J+Be*Be),Fb=ze?O:D,zF=WF+Fb*Fb*v;kt<=zF?a.join==="bevel"||kt/v>x?(ze?(f.push(At,Ft),f.push(w+C*D,E+A*D),f.push(At,Ft),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Er,hs),f.push(w-P*O,E-R*O),f.push(Er,hs)),m+=2):a.join==="round"?ze?(f.push(At,Ft),f.push(w+C*D,E+A*D),m+=Cs(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+4,f.push(At,Ft),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Er,hs),m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4,f.push(w-P*O,E-R*O),f.push(Er,hs)):(f.push(At,Ft),f.push(Er,hs)):(f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),a.join==="round"?ze?m+=Cs(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+2:m+=Cs(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+2:a.join==="miter"&&kt/v<=x&&(ze?(f.push(Er,hs),f.push(Er,hs)):(f.push(At,Ft),f.push(At,Ft)),m+=2),f.push(w-P*O,E-R*O),f.push(w+P*D,E+R*D),m+=2)}T=r[(p-2)*2],b=r[(p-2)*2+1],w=r[(p-1)*2],E=r[(p-1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),h||(a.cap==="round"?m+=Cs(w-C*(O-D)*.5,E-A*(O-D)*.5,w-C*O,E-A*O,w+C*D,E+A*D,f,!1)+2:a.cap==="square"&&(m+=hS(w,E,C,A,O,D,!1,f)));let N=1e-4*1e-4;for(let L=g;L<m+g-2;++L)T=f[L*2],b=f[L*2+1],w=f[(L+1)*2],E=f[(L+1)*2+1],I=f[(L+2)*2],B=f[(L+2)*2+1],!(Math.abs(T*(E-B)+w*(B-b)+I*(b-E))<N)&&o.push(L,L+1,L+2)}var fS=y(()=>{dr();uS()});function pS(r,e,t,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=e||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=t,h=r.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(r[f*2]),u.push(r[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 mS=y(()=>{});var ph=ee((oj,lg)=>{"use strict";lg.exports=dh;lg.exports.default=dh;function dh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=xS(r,0,s,t,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=iO(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;p<s;p+=t)h=r[p],d=r[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 Da(o,n,t,a,l,f,0),n}function xS(r,e,t,i,s){var o,n;if(s===ag(r,e,t,i)>0)for(o=e;o<t;o+=i)n=gS(o,r[o],r[o+1],n);else for(o=t-i;o>=e;o-=i)n=gS(o,r[o],r[o+1],n);return n&&fh(n,n.next)&&(Ha(n),n=n.next),n}function Ms(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(fh(t,t.next)||je(t.prev,t,t.next)===0)){if(Ha(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Da(r,e,t,i,s,o,n){if(r){!n&&o&&lO(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?eO(r,i,s,o):J2(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Ha(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=tO(Ms(r),e,t),Da(r,e,t,i,s,o,2)):n===2&&rO(r,e,t,i,s,o):Da(Ms(r),e,t,i,s,o,1);break}}}}function J2(r){var e=r.prev,t=r,i=r.next;if(je(e,t,i)>=0)return!1;for(var s=e.x,o=t.x,n=i.x,a=e.y,l=t.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&&Lo(s,a,o,l,n,c,p.x,p.y)&&je(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function eO(r,e,t,i){var s=r.prev,o=r,n=r.next;if(je(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,g=u>h?u>d?u:d:h>d?h:d,_=og(f,p,e,t,i),v=og(m,g,e,t,i),x=r.prevZ,T=r.nextZ;x&&x.z>=_&&T&&T.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Lo(a,u,l,h,c,d,x.x,x.y)&&je(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Lo(a,u,l,h,c,d,T.x,T.y)&&je(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Lo(a,u,l,h,c,d,x.x,x.y)&&je(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Lo(a,u,l,h,c,d,T.x,T.y)&&je(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function tO(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!fh(s,o)&&yS(s,i,i.next,o)&&Na(s,o)&&Na(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Ha(i),Ha(i.next),i=r=o),i=i.next}while(i!==r);return Ms(i)}function rO(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&hO(n,a)){var l=_S(n,a);n=Ms(n,n.next),l=Ms(l,l.next),Da(n,e,t,i,s,o,0),Da(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function iO(r,e,t,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:r.length,c=xS(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(uO(c));for(s.sort(sO),o=0;o<s.length;o++)t=oO(s[o],t);return t}function sO(r,e){return r.x-e.x}function oO(r,e){var t=nO(r,e);if(!t)return e;var i=_S(t,r);return Ms(i,i.next),Ms(t,t.next)}function nO(r,e){var t=e,i=r.x,s=r.y,o=-1/0,n;do{if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>o&&(o=a,n=t.x<t.next.x?t:t.next,a===i))return n}t=t.next}while(t!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;t=n;do i>=t.x&&t.x>=c&&i!==t.x&&Lo(s<u?i:o,s,c,u,s<u?o:i,s,t.x,t.y)&&(d=Math.abs(s-t.y)/(i-t.x),Na(t,r)&&(d<h||d===h&&(t.x>n.x||t.x===n.x&&aO(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function aO(r,e){return je(r.prev,r,e.prev)<0&&je(e.next,r,r.next)<0}function lO(r,e,t,i){var s=r;do s.z===0&&(s.z=og(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,cO(s)}function cO(r){var e,t,i,s,o,n,a,l,c=1;do{for(t=r,r=null,o=null,n=0;t;){for(n++,i=t,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||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;t=i}o.nextZ=null,c*=2}while(n>1);return r}function og(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function uO(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Lo(r,e,t,i,s,o,n,a){return(s-n)*(e-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function hO(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!dO(r,e)&&(Na(r,e)&&Na(e,r)&&fO(r,e)&&(je(r.prev,r,e.prev)||je(r,e.prev,e))||fh(r,e)&&je(r.prev,r,r.next)>0&&je(e.prev,e,e.next)>0)}function je(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function fh(r,e){return r.x===e.x&&r.y===e.y}function yS(r,e,t,i){var s=hh(je(r,e,t)),o=hh(je(r,e,i)),n=hh(je(t,i,r)),a=hh(je(t,i,e));return!!(s!==o&&n!==a||s===0&&uh(r,t,e)||o===0&&uh(r,i,e)||n===0&&uh(t,r,i)||a===0&&uh(t,e,i))}function uh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function hh(r){return r>0?1:r<0?-1:0}function dO(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&yS(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Na(r,e){return je(r.prev,r,r.next)<0?je(r,e,r.next)>=0&&je(r,r.prev,e)>=0:je(r,e,r.prev)<0||je(r,r.next,e)<0}function fO(r,e){var t=r,i=!1,s=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function _S(r,e){var t=new ng(r.i,r.x,r.y),i=new ng(e.i,e.x,e.y),s=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function gS(r,e,t,i){var s=new ng(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ha(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ng(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}dh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(ag(r,0,o,t));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,u=a<l-1?e[a+1]*t:r.length;n-=Math.abs(ag(r,c,u,t))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*t,f=i[a+1]*t,p=i[a+2]*t;h+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function ag(r,e,t,i){for(var s=0,o=e,n=t-i;o<t;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}dh.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<e;n++)t.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function mh(r,e,t,i,s,o,n){let a=(0,bS.default)(r,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<r.length;c+=2)t[l]=r[c],t[l+1]=r[c+1],l+=i}var bS,cg=y(()=>{bS=ds(ph(),1)});var pO,vS,TS=y(()=>{U();cg();pO=[],vS={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t<r.points.length;t++)e[t]=r.points[t];return e},triangulate(r,e,t,i,s,o){mh(r,pO,e,t,i,s,o)}}});var SS,wS=y(()=>{U();SS={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,e){let t=r,i=t.x,s=t.y,o=t.width,n=t.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(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[6],e[i+n+1]=r[7],n+=t,e[i+n]=r[4],e[i+n+1]=r[5],n+=t;let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var ES,AS=y(()=>{U();ES={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,e){return e[0]=r.x,e[1]=r.y,e[2]=r.x2,e[3]=r.y2,e[4]=r.x3,e[5]=r.y3,e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[4],e[i+n+1]=r[5];let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function CS(r,e){for(let t=0;t<e.length;t++){let i=e[t];r.addColorStop(i.offset,i.color)}}function MS(r,e){let t=j.get().createCanvas(r,e),i=t.getContext("2d");return{canvas:t,context:i}}function mO(r){let e=r[0]??{};return(typeof e=="number"||r[1])&&(X("8.5.2","use options object instead"),e={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Yt.defaultLinearOptions.textureSize}),e}var PS,hg,Yt,Do=y(()=>{vt();Re();ge();Eo();ve();St();$e();rm();PS=[{offset:0,color:"white"},{offset:1,color:"black"}],hg=class ug{constructor(...e){this.uid=he("fillGradient"),this.type="linear",this.colorStops=[];let t=mO(e);t={...t.type==="radial"?ug.defaultRadialOptions:ug.defaultLinearOptions,...Ou(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:oe.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-t,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=e;e=i,i=g,o*=-1}if(n<0){let g=t;t=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:PS,c=this._textureSize,{canvas:u,context:h}=MS(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);CS(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new k({source:new Xt({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new G;m.scale(f/c,1),m.rotate(p),m.translate(e,t),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:PS,t=this._textureSize,{canvas:i,context:s}=MS(t,t),{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=t/(u*2),p=(o-h)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);CS(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,t,t),this.texture=new k({source:new Xt({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(h,d),this.textureSpace==="local"&&_.scale(t,t),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};hg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};hg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Yt=hg});function RS(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(xO);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,g=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*g+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 Yt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(gO.copyFrom(i).invert()),s}var gO,xO,IS=y(()=>{ge();ct();Do();gO=new G,xO=new Q});function kS(r,e){let{geometryData:t,batches:i}=e;i.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")bO(o.data,i,t);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&&BS(c.shapePath,l,!0,i,t),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),BS(a,l,n,i,t)}}}function bO(r,e,t){let{vertices:i,uvs:s,indices:o}=t,n=o.length,a=i.length/2,l=[],c=gh.rectangle,u=yO,h=r.image;u.x=r.dx,u.y=r.dy,u.width=r.dw,u.height=r.dh;let d=r.transform;c.build(u,l),d&&ig(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=se.get(Ps);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=h,p.geometryData=t,e.push(p)}function BS(r,e,t,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],p=gh[l.type],m="triangle-list";if(p.build(l,f),c&&ig(f,c),t){let x=l.closePath??!0,T=e;T.pixelLine?(pS(f,x,o,a),m="line-list"):dS(f,T,!1,x,o,a)}else if(u){let x=[],T=f.slice();vO(u).forEach(w=>{x.push(T.length/2),T.push(...w)}),mh(T,x,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let g=n.length/2,_=e.texture;if(_!==k.WHITE){let x=RS(_O,e,l,c);rS(o,2,d,n,g,2,o.length/2-d,x)}else iS(n,g,2,o.length/2-d);let v=se.get(Ps);v.indexOffset=h,v.indexSize=a.length-h,v.attributeOffset=d,v.attributeSize=o.length/2-d,v.baseColor=e.color,v.alpha=e.alpha,v.texture=_,v.geometryData=s,v.topology=m,i.push(v)})}function vO(r){let e=[];for(let t=0;t<r.length;t++){let i=r[t].shape,s=[];gh[i.type].build(i,s),e.push(s)}return e}var gh,yO,_O,FS=y(()=>{U();ge();ct();sS();oS();ve();Ut();sg();lS();fS();mS();TS();wS();AS();IS();cg();gh={};V.handleByMap(S.ShapeBuilder,gh);V.add(SS,vS,ES,Go,nS,aS);yO=new Q,_O=new G});var dg,fg,mg,No,xh=y(()=>{U();rh();rg();em();$e();Ut();FS();dg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},fg=class{constructor(){this.batcher=new La,this.instructions=new xo}init(){this.instructions.reset()}get geometry(){return X(tv,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},mg=class pg{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){pg.defaultOptions.bezierSmoothness=e?.bezierSmoothness??pg.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let t=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){t?this._cleanGraphicsContextData(e):t=this._initContext(e),kS(e,t);let i=e.batchMode;e.customShader||i==="no-batch"?t.isBatchable=!1:i==="auto"&&(t.isBatchable=t.geometryData.vertices.length<400),e.dirty=!1}return t}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let t=se.get(fg),{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=t.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(t.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=Co(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=t,t}_initContext(e){let t=new dg;return t.context=e,this._gpuContextHash[e.uid]=t,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 t=this._gpuContextHash[e.uid];t.isBatchable||this._graphicsDataContextHash[e.uid]&&(se.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),t.batches&&t.batches.forEach(i=>{se.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};mg.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};mg.defaultOptions={bezierSmoothness:.5};No=mg});var TO,gg,xg,yg,_g,bg,vg,Tg,Qe,Mr=y(()=>{"use strict";TO={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},gg=0,xg=1,yg=2,_g=3,bg=4,vg=5,Tg=class OS{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<gg)}set blend(e){!!(this.data&1<<gg)!==e&&(this.data^=1<<gg)}get offsets(){return!!(this.data&1<<xg)}set offsets(e){!!(this.data&1<<xg)!==e&&(this.data^=1<<xg)}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<<yg)}set culling(e){!!(this.data&1<<yg)!==e&&(this.data^=1<<yg)}get depthTest(){return!!(this.data&1<<_g)}set depthTest(e){!!(this.data&1<<_g)!==e&&(this.data^=1<<_g)}get depthMask(){return!!(this.data&1<<vg)}set depthMask(e){!!(this.data&1<<vg)!==e&&(this.data^=1<<vg)}get clockwiseFrontFace(){return!!(this.data&1<<bg)}set clockwiseFrontFace(e){!!(this.data&1<<bg)!==e&&(this.data^=1<<bg)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=TO[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 OS;return e.depthTest=!1,e.blend=!0,e}};Tg.default2d=Tg.for2d();Qe=Tg});function jr(r,e,t){let i=(r>>24&255)/255;e[t++]=(r&255)/255*i,e[t++]=(r>>8&255)/255*i,e[t++]=(r>>16&255)/255*i,e[t++]=i}var Ho=y(()=>{"use strict"});var Va,US=y(()=>{U();Mr();Ut();Ho();sg();Va=class{constructor(e,t){this.state=Qe.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i<t.length;i++){let s=t[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 t=this.renderer,i=e.context;if(!t.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=t._roundPixels|e._roundPixels,jr(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let t=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);t&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,t){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,t)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let t=e.context,i=this.renderer.graphicsContext.getGpuContext(t),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=se.get(Ps);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(t=>{se.return(t)}),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}};Va.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"}});var Sg=y(()=>{U();xh();US();V.add(Va);V.add(No)});var Xi,yh=y(()=>{"use strict";Xi=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 t=this.geometry.getBuffer("aUV"),i=t.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=t._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 Wa,GS=y(()=>{U();ge();Hi();Rt();ka();Ut();Ho();yh();Wa=class{constructor(e,t){this.localUniforms=new be({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new mt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,s=e.batched;if(t.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==t.indexSize||o.positions.length!==t.vertexSize)return t.indexSize=o.indices.length,t.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,t){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,t)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(se.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=pi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),jr(e.groupColorAlpha,t.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 t=se.get(Xi);return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&se.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}};Wa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"}});var wg=y(()=>{U();GS();V.add(Wa)});var _h,LS=y(()=>{"use strict";_h=class{execute(e,t){let i=e.state,s=e.renderer,o=t.shader||e.defaultShader;o.resources.uTexture=t.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(t);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,t.particleChildren.length*6,c,0)}}});function Eg(r,e=null){let t=r*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i<t;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 DS=y(()=>{"use strict"});function HS(r){return{dynamicUpdate:NS(r,!0),staticUpdate:NS(r,!1)}}function NS(r,e){let t=[];t.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -364,8 +364,8 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`});var vh,qS=y(()=>{vt();ge();Es();Io();Cr();ve();im();$S();jS();YS();vh=class extends Ke{constructor(){let e=mr.from({vertex:XS,fragment:zS}),t=gr.from({fragment:{source:Ag,entryPoint:"mainFragment"},vertex:{source:Ag,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new Uu({}),uniforms:{uTranslationMatrix:{value:new L,type:"mat3x3<f32>"},uColor:{value:new oe(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Vo,Pg=y(()=>{ge();Rt();ka();Mr();Ho();WS();qS();Vo=class{constructor(e,t){this.state=Qe.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new be({uTranslationMatrix:{value:new L,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=t,this.defaultShader=new vh,this.state=Qe.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new bh({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 t=e.particleChildren;if(t.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let o=this.state;s.update(t,e._childrenDirty),e._childrenDirty=!1,o.blendMode=pi(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,jr(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var za,KS=y(()=>{U();LS();Pg();za=class extends Vo{constructor(e){super(e,new _h)}};za.extension={type:[S.WebGLPipes],name:"particle"}});var Th,ZS=y(()=>{"use strict";Th=class{execute(e,t){let i=e.renderer,s=t.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(t.texture);let o=e.state,n=e.getBuffers(t);i.encoder.draw({geometry:n.geometry,shader:t.shader||e.defaultShader,state:o,size:t.particleChildren.length*6})}}});var $a,QS=y(()=>{U();ZS();Pg();$a=class extends Vo{constructor(e){super(e,new Th)}};$a.extension={type:[S.WebGPUPipes],name:"particle"}});var Cg=y(()=>{U();KS();QS();V.add(za);V.add($a)});var Yr,Xa=y(()=>{"use strict";Yr=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 ja(r,e){let{texture:t,bounds:i}=r;Yu(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Mg=y(()=>{Pm()});var Ya,JS=y(()=>{U();Ut();Xa();Mg();Ya=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 t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}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 t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1,ja(s,e)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:se.get(Yr)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};Ya.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"}});var Rg,qt,Wo=y(()=>{Re();xa();Rg=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=j.get().createCanvas();i.width=e,i.height=t;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=hi(e),t=hi(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,t)),o}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:s}=t,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},qt=new Rg});function ew(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function tw(r,e,t,i,s){let o=4*e;for(let n=i,a=i*o+4*t;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function rw(r,e=1){let{width:t,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,t,i).data,a=0,l=0,c=t-1,u=i-1;for(;l<i&&ew(n,t,l);)++l;if(l===i)return Q.EMPTY;for(;ew(n,t,u);)--u;for(;tw(n,t,a,l,u);)++a;for(;tw(n,t,c,l,u);)--c;return++c,++u,new Q(a/e,l/e,(c-a)/e,(u-l)/e)}var iw=y(()=>{ct()});var sw,xi,Sh=y(()=>{ge();St();sw={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"}},xi=class{constructor(e,t){this.uid=he("fillPattern"),this.transform=new L,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=sw[t].addressModeU,e.source.style.addressModeV=sw[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.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 nw=ee((Cq,ow)=>{ow.exports=EO;var Ig={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},wO=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function EO(r){var e=[];return r.replace(wO,function(t,i,s){var o=i.toLowerCase();for(s=PO(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Ig[o])return s.unshift(i),e.push(s);if(s.length<Ig[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,Ig[o])))}}),e}var AO=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function PO(r){var e=r.match(AO);return e?e.map(Number):[]}});function lw(r,e){let t=(0,aw.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<t.length;a++){let l=t[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:W(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var aw,cw=y(()=>{aw=ds(nw(),1);Ae()});var wh,uw=y(()=>{ct();wh=class r{constructor(e=0,t=0,i=0){this.type="circle",this.x=e,this.y=t,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}strokeContains(e,t,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-t,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 Q),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 Eh,hw=y(()=>{ct();Eh=class r{constructor(e=0,t=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(t-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,t,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=t-this.y,m=f*f/(c*c)+p*p/(u*u),g=f*f/(h*h)+p*p/(d*d);return m>1&&g<=1}getBounds(e){return e||(e=new Q),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 dw(r,e,t,i,s,o){let n=r-t,a=e-i,l=s-t,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=t,p=i):d>1?(f=s,p=o):(f=t+d*l,p=i+d*c);let m=r-f,g=e-p;return m*m+g*g}var fw=y(()=>{"use strict"});var CO,MO,zo,pw=y(()=>{fw();ct();zo=class r{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,i=t.length;for(let s=0;s<i;s+=2){let o=t[s],n=t[s+1],a=t[(s+2)%i],l=t[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let t=this.getBounds(CO),i=e.getBounds(MO);if(!t.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(),t=new r(e);return t.closePath=this.closePath,t}contains(e,t){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>t!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,t,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=dw(e,t,h,d,f,p),g=Math.sign((f-h)*(t-d)-(p-d)*(e-h));if(m<=(g<0?a:n))return!0}return!1}getBounds(e){e||(e=new Q);let t=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=t.length;a<l;a+=2){let c=t[a],u=t[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,t)=>`${e}, ${t}`,"")}]`}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 Ah,Ph,mw=y(()=>{ct();Ah=(r,e,t,i,s,o,n)=>{let a=r-t,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ph=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new Q),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new r(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,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(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=t-(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,t,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,g=o+a,_=n+l;return(e>=o-u&&e<=o+h||e>=g-h&&e<=g+u)&&t>=f&&t<=f+m||(t>=n-u&&t<=n+h||t>=_-h&&t<=_+u)&&e>=d&&e<=d+p?!0:e<d&&t<f&&Ah(e,t,d,f,c,h,u)||e>g-c&&t<f&&Ah(e,t,g-c,f,c,h,u)||e>g-c&&t>_-c&&Ah(e,t,g-c,_-c,c,h,u)||e<d&&t>_-c&&Ah(e,t,d,_-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 Mh(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??No.defaultOptions.bezierSmoothness)),d=(IO-h)/1;return d*=d,BO(e,t,i,s,o,n,a,l,r,d),r}function BO(r,e,t,i,s,o,n,a,l,c){kg(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function kg(r,e,t,i,s,o,n,a,l,c,u){if(u>RO)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,p=(t+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,v=(d+p)/2,x=(f+m)/2,T=(p+g)/2,b=(m+_)/2,w=(v+T)/2,E=(x+b)/2;if(u>0){let I=n-r,B=a-e,C=Math.abs((t-n)*B-(i-a)*I),A=Math.abs((s-n)*B-(o-a)*I),P,R;if(C>Ch&&A>Ch){if((C+A)*(C+A)<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}let M=Math.atan2(o-i,s-t);if(P=Math.abs(M-Math.atan2(i-e,t-r)),R=Math.abs(Math.atan2(a-o,n-s)-M),P>=h&&(P=2*h-P),R>=h&&(R=2*h-R),P+R<$o){l.push(w,E);return}if(Rs!==0){if(P>Rs){l.push(t,i);return}if(R>Rs){l.push(s,o);return}}}}else if(C>Ch){if(C*C<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}if(P=Math.abs(Math.atan2(o-i,s-t)-Math.atan2(i-e,t-r)),P>=h&&(P=2*h-P),P<$o){l.push(t,i),l.push(s,o);return}if(Rs!==0&&P>Rs){l.push(t,i);return}}}else if(A>Ch){if(A*A<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}if(P=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-t)),P>=h&&(P=2*h-P),P<$o){l.push(t,i),l.push(s,o);return}if(Rs!==0&&P>Rs){l.push(s,o);return}}}else if(I=w-(r+n)/2,B=E-(e+a)/2,I*I+B*B<=c){l.push(w,E);return}}kg(r,e,d,f,v,x,w,E,l,c,u+1),kg(w,E,T,b,g,_,n,a,l,c,u+1)}var RO,Ch,IO,Bg,$o,Rs,Fg=y(()=>{xh();RO=8,Ch=11920929e-14,IO=1,Bg=.01,$o=0,Rs=0});function xw(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??No.defaultOptions.bezierSmoothness)),u=(OO-c)/1;return u*=u,GO(e,t,i,s,o,n,r,u),r}function GO(r,e,t,i,s,o,n,a){Og(n,r,e,t,i,s,o,a,0),n.push(s,o)}function Og(r,e,t,i,s,o,n,a,l){if(l>kO)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,g=o-e,_=n-t,v=Math.abs((i-o)*_-(s-n)*g);if(v>FO){if(v*v<=a*(g*g+_*_)){if(gw<UO){r.push(p,m);return}let x=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-t,i-e));if(x>=c&&(x=2*c-x),x<gw){r.push(p,m);return}}}else if(g=p-(e+o)/2,_=m-(t+n)/2,g*g+_*_<=a){r.push(p,m);return}Og(r,e,t,u,h,p,m,a,l+1),Og(r,p,m,d,f,o,n,a,l+1)}var kO,FO,OO,UO,gw,yw=y(()=>{xh();kO=8,FO=11920929e-14,OO=1,UO=.01,gw=0});function Rh(r,e,t,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=t+f*i;r.push(p,m),u+=c}}var Ug=y(()=>{"use strict"});function _w(r,e,t,i,s,o){let n=r[r.length-2],l=r[r.length-1]-t,c=n-e,u=s-t,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(r[r.length-2]!==e||r[r.length-1]!==t)&&r.push(e,t);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,v=g*m/f,x=_*m/p,T=g*h+_*c,b=g*u+_*l,w=c*(_+v),E=l*(_+v),I=h*(g+x),B=u*(g+x),C=Math.atan2(E-b,w-T),A=Math.atan2(B-b,I-T);Rh(r,T+e,b+t,o,C,A,c*u>h*l)}var bw=y(()=>{Ug()});function LO(r,e){let t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:t,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+e),a=Math.sin(r+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Tw(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*qa/360),h=Math.cos(a*qa/360),d=h*(e-i)/2+u*(t-s)/2,f=-u*(e-i)/2+h*(t-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)),DO(e,t,i,s,o,n,l,c,u,h,d,f,Gg);let{ang1:m,ang2:g}=Gg,{centerX:_,centerY:v}=Gg,x=Math.abs(g)/(qa/4);Math.abs(1-x)<1e-7&&(x=1);let T=Math.max(Math.ceil(x),1);g/=T;let b=r[r.length-2],w=r[r.length-1],E={x:0,y:0};for(let I=0;I<T;I++){let B=LO(m,g),{x:C,y:A}=Lg(B[0],o,n,h,u,_,v,E),{x:P,y:R}=Lg(B[1],o,n,h,u,_,v,E),{x:M,y:F}=Lg(B[2],o,n,h,u,_,v,E);Mh(r,b,w,C,A,P,R,M,F),b=M,w=F,m+=g}}var qa,Gg,Lg,vw,DO,Sw=y(()=>{Fg();qa=Math.PI*2,Gg={centerX:0,centerY:0,ang1:0,ang2:0},Lg=({x:r,y:e},t,i,s,o,n,a,l)=>{r*=t,e*=i;let c=s*r-o*e,u=o*r+s*e;return l.x=c+n,l.y=u+a,l};vw=(r,e,t,i)=>{let s=r*i-e*t<0?-1:1,o=r*t+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},DO=(r,e,t,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),g=Math.pow(h,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let v=_*s/o*h,x=_*-o/s*u,T=c*v-l*x+(r+t)/2,b=l*v+c*x+(e+i)/2,w=(u-v)/s,E=(h-x)/o,I=(-u-v)/s,B=(-h-x)/o,C=vw(1,0,w,E),A=vw(w,E,I,B);a===0&&A>0&&(A-=qa),a===1&&A<0&&(A+=qa),d.centerX=T,d.centerY=b,d.ang1=C,d.ang2=A}});function ww(r,e,t){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?r.moveTo(a.x,a.y):r.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??t;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,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(u.len/2,h.len/2)?(_=Math.min(u.len/2,h.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let v=a.x+h.nx*_+-h.ny*g*f,x=a.y+h.ny*_+h.nx*g*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,b=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(v+Math.cos(T)*g,x+Math.sin(T)*g),r.arc(v,x,g,T,b,p),o=a}}function Ew(r,e,t,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??t;if(c<=0){a===0?r.moveTo(l.x,l.y):r.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 g=Math.min(d/2,c);f=o(l,u,g/d)}let p=s(h,l),m;if(p<1e-4)m=l;else{let g=Math.min(p/2,c);m=o(l,h,g/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var Aw=y(()=>{"use strict"});var NO,Ih,Pw=y(()=>{uw();hw();pw();ct();mw();zt();Fg();yw();Ug();bw();Sw();Aw();NO=new Q,Ih=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ee,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==t)&&i.push(e,t),this}arc(e,t,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Rh(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return _w(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return Tw(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,t,i,s,o),this}bezierCurveTo(e,t,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Mh(this._currentPoly.points,l.lastX,l.lastY,e,t,i,s,o,n,a),this}quadraticCurveTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly;return xw(this._currentPoly.points,n.lastX,n.lastY,e,t,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));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,t,i,s,o){return this.drawShape(new Q(e,t,i,s),o),this}circle(e,t,i,s){return this.drawShape(new wh(e,t,i),s),this}poly(e,t,i){let s=new zo(e);return s.closePath=t,this.drawShape(s,i),this}regularPoly(e,t,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),t+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,t,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,t,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=t+i*Math.sin(f),g=f+Math.PI+h,_=f-Math.PI-h,v=p+o*Math.cos(g),x=m+o*Math.sin(g),T=p+o*Math.cos(_),b=m+o*Math.sin(_);d===0?this.moveTo(v,x):this.lineTo(v,x),this.quadraticCurveTo(p,m,T,b,a)}return this.closePath()}roundShape(e,t,i=!1,s){return e.length<3?this:(i?Ew(this,e,t,s):ww(this,e,t),this.closePath())}filletRect(e,t,i,s,o){if(o===0)return this.rect(e,t,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=t+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,t+h).arcTo(e+u,t+u,e+h,t,h).lineTo(l-h,t).arcTo(l-u,t+u,l,t+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,t,i,s,o,n){if(o<=0)return this.rect(e,t,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=t+s,u=[e+a,t,l-a,t,l,t+a,l,c-a,l-a,c,e+a,c,e,c-a,e,t+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,t,i,s,o){return this.drawShape(new Eh(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new Ph(e,t,i,s,o),n),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new zo,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new zo,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,s=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let o=t.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 t=0;t<e.instructions.length;t++){let i=e.instructions[t];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let i=0;i<t.length;i++){let s=t[i],o=s.shape.getBounds(NO);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Ka(r,e){return r?r.prepend(e):e.clone()}var ji,Dg=y(()=>{dr();St();Ae();cw();Pw();ji=class r{constructor(e,t=!1){this.instructions=[],this.uid=he("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?lw(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ih(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),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,t,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(de.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,t,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,t,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(de.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,t,i]}),this._dirty=!0,this}rect(e,t,i,s,o){return this.instructions.push({action:"rect",data:[e,t,i,s,o]}),this._dirty=!0,this}circle(e,t,i,s){return this.instructions.push({action:"circle",data:[e,t,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,t,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),t+f*Math.sin(p))}return this.poly(h,!0,a),this}clone(e=!1){let t=new r;if(t.checkForHoles=this.checkForHoles,!e)t.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];t.instructions.push({action:s.action,data:s.data.slice()})}return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=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 g=0;g<this.instructions.length;g++){let _=this.instructions[g],v=_.data;switch(_.action){case"moveTo":case"lineTo":l=v[0],c=v[1],v[0]=t*l+s*c+n,v[1]=i*l+o*c+a;break;case"bezierCurveTo":u=v[0],h=v[1],d=v[2],f=v[3],l=v[4],c=v[5],v[0]=t*u+s*h+n,v[1]=i*u+o*h+a,v[2]=t*d+s*f+n,v[3]=i*d+o*f+a,v[4]=t*l+s*c+n,v[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=v[0],h=v[1],l=v[2],c=v[3],v[0]=t*u+s*h+n,v[1]=i*u+o*h+a,v[2]=t*l+s*c+n,v[3]=i*l+o*c+a;break;case"arcToSvg":l=v[5],c=v[6],p=v[0],m=v[1],v[0]=t*p+s*m,v[1]=i*p+o*m,v[5]=t*l+s*c+n,v[6]=i*l+o*c+a;break;case"circle":v[4]=Ka(v[3],e);break;case"rect":v[4]=Ka(v[4],e);break;case"ellipse":v[8]=Ka(v[8],e);break;case"roundRect":v[5]=Ka(v[5],e);break;case"addPath":v[0].transform(e);break;case"poly":v[2]=Ka(v[2],e);break;default:W("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,i=this.instructions[t];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(t--,t<0)return e.x=0,e.y=0,e;i=this.instructions[t]}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 Ve(r,e,t){let i=r.getAttribute(e);return i?Number(i):t}var Ng=y(()=>{"use strict"});function Cw(r,e){let t=r.querySelectorAll("defs");for(let i=0;i<t.length;i++){let s=t[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]=HO(n);break;case"radialgradient":e.defs[n.id]=VO(n);break;default:break}}}}function HO(r){let e=Ve(r,"x1",0),t=Ve(r,"y1",0),i=Ve(r,"x2",1),s=Ve(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Yt(e,t,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=Ve(l,"offset",0),u=oe.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function VO(r){return W("[SVG Parser] Radial gradients are not yet supported"),new Yt(0,0,1,0)}var Mw=y(()=>{vt();Ae();Do();Ng()});function Hg(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var Rw=y(()=>{"use strict"});function Vg(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Iw){let a=r.getAttribute(n);a&&Bw(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");Iw[c]&&Bw(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Bw(r,e,t,i){switch(t){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Hg(i);e.strokeStyle.fill=r.defs[s]}else e.strokeStyle.color=oe.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=Hg(i);e.fillStyle.fill=r.defs[s]}else e.fillStyle.color=oe.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 Iw,kw=y(()=>{vt();Rw();Iw={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Fw(r,e){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let t={context:e,defs:{},path:new ji};Cw(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Vg(r,t);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&Ow(a,t,s,o)}return e}function Ow(r,e,t,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Vg(r,e);o&&t?t={...t,...o}:o&&(t=o),n&&i?i={...i,...n}:n&&(i=n);let a=!t&&!i;a&&(t={color:0});let l,c,u,h,d,f,p,m,g,_,v,x,T,b,w,E,I;switch(r.nodeName.toLowerCase()){case"path":b=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&W("SVG Evenodd fill rule not supported, your svg may render incorrectly"),w=new ji(b,!0),e.context.path(w),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"circle":p=Ve(r,"cx",0),m=Ve(r,"cy",0),g=Ve(r,"r",0),e.context.ellipse(p,m,g,g),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"rect":l=Ve(r,"x",0),c=Ve(r,"y",0),E=Ve(r,"width",0),I=Ve(r,"height",0),_=Ve(r,"rx",0),v=Ve(r,"ry",0),_||v?e.context.roundRect(l,c,E,I,_||v):e.context.rect(l,c,E,I),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"ellipse":p=Ve(r,"cx",0),m=Ve(r,"cy",0),_=Ve(r,"rx",0),v=Ve(r,"ry",0),e.context.beginPath(),e.context.ellipse(p,m,_,v),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"line":u=Ve(r,"x1",0),h=Ve(r,"y1",0),d=Ve(r,"x2",0),f=Ve(r,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{W(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let B=0;B<s.length;B++)Ow(s[B],e,t,i)}var Uw=y(()=>{Ae();Dg();Mw();Ng();kw()});function WO(r){return oe.isColorLike(r)}function Gw(r){return r instanceof xi}function Lw(r){return r instanceof Yt}function zO(r){return r instanceof k}function $O(r,e,t){let i=oe.shared.setValue(e??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?t.alpha:i.alpha,r.texture=k.WHITE,{...t,...r}}function XO(r,e,t){return r.texture=e,{...t,...r}}function Dw(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function Nw(r,e,t){return e.buildGradient(),r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,r.textureSpace=e.textureSpace,{...t,...r}}function jO(r,e){let t={...e,...r},i=oe.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function yi(r,e){if(r==null)return null;let t={},i=r;return WO(r)?$O(t,r,e):zO(r)?XO(t,r,e):Gw(r)?Dw(t,r,e):Lw(r)?Nw(t,r,e):i.fill&&Gw(i.fill)?Dw(i,i.fill,e):i.fill&&Lw(i.fill)?Nw(i,i.fill,e):jO(i,e)}function Xo(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=yi(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Wg=y(()=>{vt();ve();Do();Sh()});var YO,Hw,zg,Nt,Bh=y(()=>{Ct();vt();ge();dr();ve();St();$e();zt();Dg();Uw();Wg();YO=new de,Hw=new L,zg=class qr extends Ce{constructor(){super(...arguments),this.uid=he("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ji,this._transform=new L,this._fillStyle={...qr.defaultFillStyle},this._strokeStyle={...qr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ee,this._boundsDirty=!0}clone(){let e=new qr;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=yi(e,qr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Xo(e,qr.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=yi(e,qr.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=yi(e,qr.defaultStrokeStyle),this}texture(e,t,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:t?oe.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ji,this}fill(e,t){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&&(t!==void 0&&typeof e=="number"&&(X(ie,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=yi(e,qr.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:t}=this._activePath.getLastPoint(de.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?t=i.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=Xo(e,qr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(i);else{t.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,t,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,i,s,o,n),this}arcTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,t,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+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,t,i,s){return this._tick++,this._activePath.ellipse(e,t,i,s,this._transform.clone()),this}circle(e,t,i){return this._tick++,this._activePath.circle(e,t,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty),this}moveTo(e,t){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*t+i.tx,n=i.b*e+i.d*t+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,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,t,i,s){return this._tick++,this._activePath.rect(e,t,i,s,this._transform.clone()),this}roundRect(e,t,i,s,o){return this._tick++,this._activePath.roundRect(e,t,i,s,o,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,t,i,s,o,n),this}roundPoly(e,t,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,t,i,s,o,n),this}roundShape(e,t,i,s){return this._tick++,this._activePath.roundShape(e,t,i,s),this}filletRect(e,t,i,s,o){return this._tick++,this._activePath.filletRect(e,t,i,s,o),this}chamferRect(e,t,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,t,i,s,o,n),this}star(e,t,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,t,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,Fw(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,t=e){return this._transform.scale(e,t),this}setTransform(e,t,i,s,o,n){return e instanceof L?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,i,s,o,n),this)}transform(e,t,i,s,o,n){return e instanceof L?(this._transform.append(e),this):(Hw.set(e,t,i,s,o,n),this._transform.append(Hw),this)}translate(e,t=e){return this._transform.translate(e,t),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 t=0;t<this.instructions.length;t++){let i=this.instructions[t],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 t=this.instructions,i=!1;for(let s=0;s<t.length;s++){let o=t[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,YO):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 g=0;g<m.length;g++)m[g].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}};zg.defaultFillStyle={color:16777215,alpha:1,texture:k.WHITE,matrix:null,fill:null,textureSpace:"local"};zg.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:k.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Nt=zg});function kh(r){let e=[],t=0;for(let i=0;i<Vw.length;i++){let s=`_${Vw[i]}`;e[t++]=r[s]}return t=Ww(r._fill,e,t),t=qO(r._stroke,e,t),t=KO(r.dropShadow,e,t),e.join("-")}function Ww(r,e,t){return r&&(e[t++]=r.color,e[t++]=r.alpha,e[t++]=r.fill?.styleKey),t}function qO(r,e,t){return r&&(t=Ww(r,e,t),e[t++]=r.width,e[t++]=r.alignment,e[t++]=r.cap,e[t++]=r.join,e[t++]=r.miterLimit),t}function KO(r,e,t){return r&&(e[t++]=r.alpha,e[t++]=r.angle,e[t++]=r.blur,e[t++]=r.distance,e[t++]=oe.shared.setValue(r.color).toNumber()),t}var Vw,$g=y(()=>{vt();Vw=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function ZO(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Oe.defaultDropShadow;r.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){X(ie,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(oe.isColorLike(t))i.color=t;else if(t instanceof Yt||t instanceof xi)i.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))i=t;else throw new Error("Invalid stroke value.");r.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){X(ie,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Oe.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new Yt({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>oe.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Xg,Oe,Is=y(()=>{Ct();vt();$e();Do();Sh();Bh();Wg();$g();Xg=class jo extends Ce{constructor(e={}){super(),ZO(e);let t={...jo.defaultTextStyle,...e};for(let i in t){let s=i;this[s]=t[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({...jo.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...jo.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({...Nt.defaultFillStyle,...e},()=>{this._fill=yi({...this._originalFill},Nt.defaultFillStyle)})),this._fill=yi(e===0?"black":e,Nt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Nt.defaultStrokeStyle,...e},()=>{this._stroke=Xo({...this._originalStroke},Nt.defaultStrokeStyle)})),this._stroke=Xo(e,Nt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=kh(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=jo.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new jo({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,t){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,t?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(oe.isColorLike(e)||e instanceof Yt||e instanceof xi)}};Xg.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Xg.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};Oe=Xg});function Fh(r,e,t,i){let s=QO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Xe.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=t/i,o.source.emit("update",o.source),o.updateUvs(),o}var QO,jg=y(()=>{Fi();zt();QO=new Ee});function Bs(r){let e=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,t=r.fontFamily;Array.isArray(r.fontFamily)||(t=r.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!JO.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var JO,Oh=y(()=>{"use strict";JO=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Yg,Rr,De,Za=y(()=>{Re();Oh();Yg={willReadFrequently:!0},Rr=class q{static get experimentalLetterSpacingSupported(){let e=q._experimentalLetterSpacingSupported;if(e!==void 0){let t=j.get().getCanvasRenderingContext2D().prototype;e=q._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,o,n,a,l,c){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",t,i=q._canvas,s=t.wordWrap){let o=`${e}:${t.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=Bs(t),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);let l=q.__context;l.font=n;let u=(s?q._wordWrap(e,t,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let v=0;v<u.length;v++){let x=q._measureText(u[v],t.letterSpacing,l);h[v]=x,d=Math.max(d,x)}let f=t._stroke?.width||0,p=d+f;t.dropShadow&&(p+=t.dropShadow.distance);let m=t.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(u.length-1)*(m+t.leading);return t.dropShadow&&(g+=t.dropShadow.distance),new q(e,t,p,g,u,h,m+t.leading,d,a)}static _measureText(e,t,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}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-=t,c-=t;else{let u=(q.graphemeSegmenter(e).length-1)*t;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,t,i=q._canvas){let s=i.getContext("2d",Yg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=q._collapseSpaces(u),d=q._collapseNewlines(u),f=!h,p=t.wordWrapWidth+c,m=q._tokenize(e);for(let g=0;g<m.length;g++){let _=m[g];if(q._isNewline(_)){if(!d){a+=q._addLine(n),f=!h,n="",o=0;continue}_=" "}if(h){let x=q.isBreakingSpace(_),T=q.isBreakingSpace(n[n.length-1]);if(x&&T)continue}let v=q._getFromCache(_,c,l,s);if(v>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,t.breakWords)){let x=q.wordWrapSplit(_);for(let T=0;T<x.length;T++){let b=x[T],w=b,E=1;for(;x[T+E];){let B=x[T+E];if(!q.canBreakChars(w,B,_,T,t.breakWords))b+=B;else break;w=B,E++}T+=E-1;let I=q._getFromCache(b,c,l,s);I+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=b,o+=I}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let x=g===m.length-1;a+=q._addLine(_,!x),f=!1,n="",o=0}else v+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=v)}return a+=q._addLine(n,!1),a}static _addLine(e,t=!0){return e=q._trimRight(e),e=t?`${e}
|
|
368
|
-
`:e,e}static _getFromCache(e,t,i,s){let o=i[e];return typeof o!="number"&&(o=q._measureText(e,t,s)+t,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 t=e.length-1;t>=0;t--){let i=e[t];if(!q.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:q._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:q._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let t=[],i="";if(typeof e!="string")return t;for(let s=0;s<e.length;s++){let o=e[s],n=e[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){i!==""&&(t.push(i),i=""),t.push(o);continue}i+=o}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,o){return!0}static wordWrapSplit(e){return q.graphemeSegmenter(e)}static measureFont(e){if(q._fonts[e])return q._fonts[e];let t=q._context;t.font=e;let i=t.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return q._fonts[e]=s,s}static clearMetrics(e=""){e?delete q._fonts[e]:q._fonts={}}static get _canvas(){if(!q.__canvas){let e;try{let t=new OffscreenCanvas(0,0);if(t.getContext("2d",Yg)?.measureText)return q.__canvas=t,t;e=j.get().createCanvas()}catch{e=j.get().createCanvas()}e.width=e.height=10,q.__canvas=e}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Yg)),q.__context}};Rr.METRICS_STRING="|\xC9q\xC5";Rr.BASELINE_SYMBOL="M";Rr.BASELINE_MULTIPLIER=1.4;Rr.HEIGHT_MULTIPLIER=2;Rr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Rr.experimentalLetterSpacing=!1;Rr._fonts={};Rr._newlines=[10,13];Rr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Rr._measurementCache={};De=Rr});function Yo(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return oe.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof xi){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(L.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Yt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&t&&(a=t.width+i,l=t.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&&t){let h=t.lineHeight/l;for(let d=0;d<t.lines.length;d++){let f=(d*t.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*h;c.addColorStop(Math.floor(m*zw)/zw,oe.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,oe.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(L.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return W("FillStyle not recognised",r),"red"}var zw,qg=y(()=>{vt();ge();ve();Ae();Do();Sh();zw=1e5});var Qa,$w=y(()=>{vt();U();xa();Wo();Fi();iw();$e();Is();jg();Za();Oh();qg();Qa=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=De.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*t),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*t);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=hi(o),n=hi(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Oe||(e.style=new Oe(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),qt.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=De.measureText(t||" ",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=qt.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=Fh(c,n,a,s);if(i.trim){let h=rw(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 t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",Xe.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(qt.returnCanvasAndContext(t.canvasAndContext),this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,s){let{canvas:o,context:n}=s,a=Bs(t),l=De.measureText(e||" ",t),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=t.textBaseline,t._stroke?.width){let v=t._stroke;n.lineWidth=v.width,n.miterLimit=v.miterLimit,n.lineJoin=v.join,n.lineCap=v.cap}n.font=a;let m,g,_=t.dropShadow?2:1;for(let v=0;v<_;++v){let x=t.dropShadow&&v===0,T=x?Math.ceil(Math.max(1,p)+t.padding*2):0,b=T*i;if(x){n.fillStyle="black",n.strokeStyle="black";let I=t.dropShadow,B=I.color,C=I.alpha;n.shadowColor=oe.shared.setValue(B).setAlpha(C).toRgbaString();let A=I.blur*i,P=I.distance*i;n.shadowBlur=A,n.shadowOffsetX=Math.cos(I.angle)*P,n.shadowOffsetY=Math.sin(I.angle)*P+b}else{if(n.fillStyle=t._fill?Yo(t._fill,n,l):null,t._stroke?.width){let I=t._stroke.width*t._stroke.alignment;n.strokeStyle=Yo(t._stroke,n,l,I)}n.shadowColor="black"}let w=(u-f.fontSize)/2;u-f.fontSize<0&&(w=0);let E=t._stroke?.width??0;for(let I=0;I<c.length;I++)m=E/2,g=E/2+I*u+f.ascent+w,t.align==="right"?m+=d-h[I]:t.align==="center"&&(m+=(d-h[I])/2),t._stroke?.width&&this._drawLetterSpacing(c[I],t,s,m+t.padding,g+t.padding-T,!0),t._fill!==void 0&&this._drawLetterSpacing(c[I],t,s,m+t.padding,g+t.padding-T)}}_drawLetterSpacing(e,t,i,s,o,n=!1){let{context:a}=i,l=t.letterSpacing,c=!1;if(De.experimentalLetterSpacingSupported&&(De.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=De.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 g="";for(let _=p+1;_<h.length;++_)g+=h[_];f=a.measureText(g).width,u+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Qa.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"canvasText"}});var Kg=y(()=>{U();JS();$w();V.add(Qa);V.add(Ya)});var Ue,Zg=y(()=>{$e();$u();Bh();Ue=class r extends Gi{constructor(e){e instanceof Nt&&(e={context:e});let{context:t,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",t?this._context=t:this._context=this._ownedContext=new Nt,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,t){return this.context[e](...t),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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(e,t,i){X(ie,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),t&&(s.color=t),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,t){X(ie,"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),t!==void 0&&(i.alpha=t),this.context.fillStyle=i,this}endFill(){X(ie,"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!==Nt.defaultStrokeStyle.width||e.color!==Nt.defaultStrokeStyle.color||e.alpha!==Nt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return X(ie,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return X(ie,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return X(ie,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return X(ie,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return X(ie,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return X(ie,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var Xw,jw,Yw=y(()=>{"use strict";Xw={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`});var vh,qS=y(()=>{vt();ge();Es();Io();Cr();ve();im();$S();jS();YS();vh=class extends Ke{constructor(){let e=mr.from({vertex:XS,fragment:zS}),t=gr.from({fragment:{source:Ag,entryPoint:"mainFragment"},vertex:{source:Ag,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new Uu({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new oe(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Vo,Pg=y(()=>{ge();Rt();ka();Mr();Ho();WS();qS();Vo=class{constructor(e,t){this.state=Qe.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new be({uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new vh,this.state=Qe.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new bh({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 t=e.particleChildren;if(t.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let o=this.state;s.update(t,e._childrenDirty),e._childrenDirty=!1,o.blendMode=pi(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,jr(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var za,KS=y(()=>{U();LS();Pg();za=class extends Vo{constructor(e){super(e,new _h)}};za.extension={type:[S.WebGLPipes],name:"particle"}});var Th,ZS=y(()=>{"use strict";Th=class{execute(e,t){let i=e.renderer,s=t.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(t.texture);let o=e.state,n=e.getBuffers(t);i.encoder.draw({geometry:n.geometry,shader:t.shader||e.defaultShader,state:o,size:t.particleChildren.length*6})}}});var $a,QS=y(()=>{U();ZS();Pg();$a=class extends Vo{constructor(e){super(e,new Th)}};$a.extension={type:[S.WebGPUPipes],name:"particle"}});var Cg=y(()=>{U();KS();QS();V.add(za);V.add($a)});var Yr,Xa=y(()=>{"use strict";Yr=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 ja(r,e){let{texture:t,bounds:i}=r;Yu(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Mg=y(()=>{Pm()});var Ya,JS=y(()=>{U();Ut();Xa();Mg();Ya=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 t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}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 t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1,ja(s,e)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:se.get(Yr)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};Ya.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"}});var Rg,qt,Wo=y(()=>{Re();xa();Rg=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=j.get().createCanvas();i.width=e,i.height=t;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=hi(e),t=hi(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,t)),o}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:s}=t,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},qt=new Rg});function ew(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function tw(r,e,t,i,s){let o=4*e;for(let n=i,a=i*o+4*t;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function rw(r,e=1){let{width:t,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,t,i).data,a=0,l=0,c=t-1,u=i-1;for(;l<i&&ew(n,t,l);)++l;if(l===i)return Q.EMPTY;for(;ew(n,t,u);)--u;for(;tw(n,t,a,l,u);)++a;for(;tw(n,t,c,l,u);)--c;return++c,++u,new Q(a/e,l/e,(c-a)/e,(u-l)/e)}var iw=y(()=>{ct()});var sw,xi,Sh=y(()=>{ge();St();sw={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"}},xi=class{constructor(e,t){this.uid=he("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=sw[t].addressModeU,e.source.style.addressModeV=sw[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.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 nw=ee((Mq,ow)=>{ow.exports=EO;var Ig={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},wO=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function EO(r){var e=[];return r.replace(wO,function(t,i,s){var o=i.toLowerCase();for(s=PO(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Ig[o])return s.unshift(i),e.push(s);if(s.length<Ig[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,Ig[o])))}}),e}var AO=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function PO(r){var e=r.match(AO);return e?e.map(Number):[]}});function lw(r,e){let t=(0,aw.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<t.length;a++){let l=t[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:W(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var aw,cw=y(()=>{aw=ds(nw(),1);Ae()});var wh,uw=y(()=>{ct();wh=class r{constructor(e=0,t=0,i=0){this.type="circle",this.x=e,this.y=t,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}strokeContains(e,t,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-t,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 Q),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 Eh,hw=y(()=>{ct();Eh=class r{constructor(e=0,t=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(t-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,t,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=t-this.y,m=f*f/(c*c)+p*p/(u*u),g=f*f/(h*h)+p*p/(d*d);return m>1&&g<=1}getBounds(e){return e||(e=new Q),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 dw(r,e,t,i,s,o){let n=r-t,a=e-i,l=s-t,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=t,p=i):d>1?(f=s,p=o):(f=t+d*l,p=i+d*c);let m=r-f,g=e-p;return m*m+g*g}var fw=y(()=>{"use strict"});var CO,MO,zo,pw=y(()=>{fw();ct();zo=class r{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,i=t.length;for(let s=0;s<i;s+=2){let o=t[s],n=t[s+1],a=t[(s+2)%i],l=t[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let t=this.getBounds(CO),i=e.getBounds(MO);if(!t.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(),t=new r(e);return t.closePath=this.closePath,t}contains(e,t){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>t!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,t,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=dw(e,t,h,d,f,p),g=Math.sign((f-h)*(t-d)-(p-d)*(e-h));if(m<=(g<0?a:n))return!0}return!1}getBounds(e){e||(e=new Q);let t=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=t.length;a<l;a+=2){let c=t[a],u=t[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,t)=>`${e}, ${t}`,"")}]`}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 Ah,Ph,mw=y(()=>{ct();Ah=(r,e,t,i,s,o,n)=>{let a=r-t,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ph=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new Q),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new r(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,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(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=t-(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,t,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,g=o+a,_=n+l;return(e>=o-u&&e<=o+h||e>=g-h&&e<=g+u)&&t>=f&&t<=f+m||(t>=n-u&&t<=n+h||t>=_-h&&t<=_+u)&&e>=d&&e<=d+p?!0:e<d&&t<f&&Ah(e,t,d,f,c,h,u)||e>g-c&&t<f&&Ah(e,t,g-c,f,c,h,u)||e>g-c&&t>_-c&&Ah(e,t,g-c,_-c,c,h,u)||e<d&&t>_-c&&Ah(e,t,d,_-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 Mh(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??No.defaultOptions.bezierSmoothness)),d=(IO-h)/1;return d*=d,BO(e,t,i,s,o,n,a,l,r,d),r}function BO(r,e,t,i,s,o,n,a,l,c){kg(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function kg(r,e,t,i,s,o,n,a,l,c,u){if(u>RO)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,p=(t+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,v=(d+p)/2,x=(f+m)/2,T=(p+g)/2,b=(m+_)/2,w=(v+T)/2,E=(x+b)/2;if(u>0){let I=n-r,B=a-e,C=Math.abs((t-n)*B-(i-a)*I),A=Math.abs((s-n)*B-(o-a)*I),P,R;if(C>Ch&&A>Ch){if((C+A)*(C+A)<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}let M=Math.atan2(o-i,s-t);if(P=Math.abs(M-Math.atan2(i-e,t-r)),R=Math.abs(Math.atan2(a-o,n-s)-M),P>=h&&(P=2*h-P),R>=h&&(R=2*h-R),P+R<$o){l.push(w,E);return}if(Rs!==0){if(P>Rs){l.push(t,i);return}if(R>Rs){l.push(s,o);return}}}}else if(C>Ch){if(C*C<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}if(P=Math.abs(Math.atan2(o-i,s-t)-Math.atan2(i-e,t-r)),P>=h&&(P=2*h-P),P<$o){l.push(t,i),l.push(s,o);return}if(Rs!==0&&P>Rs){l.push(t,i);return}}}else if(A>Ch){if(A*A<=c*(I*I+B*B)){if($o<Bg){l.push(w,E);return}if(P=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-t)),P>=h&&(P=2*h-P),P<$o){l.push(t,i),l.push(s,o);return}if(Rs!==0&&P>Rs){l.push(s,o);return}}}else if(I=w-(r+n)/2,B=E-(e+a)/2,I*I+B*B<=c){l.push(w,E);return}}kg(r,e,d,f,v,x,w,E,l,c,u+1),kg(w,E,T,b,g,_,n,a,l,c,u+1)}var RO,Ch,IO,Bg,$o,Rs,Fg=y(()=>{xh();RO=8,Ch=11920929e-14,IO=1,Bg=.01,$o=0,Rs=0});function xw(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??No.defaultOptions.bezierSmoothness)),u=(OO-c)/1;return u*=u,GO(e,t,i,s,o,n,r,u),r}function GO(r,e,t,i,s,o,n,a){Og(n,r,e,t,i,s,o,a,0),n.push(s,o)}function Og(r,e,t,i,s,o,n,a,l){if(l>kO)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,g=o-e,_=n-t,v=Math.abs((i-o)*_-(s-n)*g);if(v>FO){if(v*v<=a*(g*g+_*_)){if(gw<UO){r.push(p,m);return}let x=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-t,i-e));if(x>=c&&(x=2*c-x),x<gw){r.push(p,m);return}}}else if(g=p-(e+o)/2,_=m-(t+n)/2,g*g+_*_<=a){r.push(p,m);return}Og(r,e,t,u,h,p,m,a,l+1),Og(r,p,m,d,f,o,n,a,l+1)}var kO,FO,OO,UO,gw,yw=y(()=>{xh();kO=8,FO=11920929e-14,OO=1,UO=.01,gw=0});function Rh(r,e,t,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=t+f*i;r.push(p,m),u+=c}}var Ug=y(()=>{"use strict"});function _w(r,e,t,i,s,o){let n=r[r.length-2],l=r[r.length-1]-t,c=n-e,u=s-t,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(r[r.length-2]!==e||r[r.length-1]!==t)&&r.push(e,t);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,v=g*m/f,x=_*m/p,T=g*h+_*c,b=g*u+_*l,w=c*(_+v),E=l*(_+v),I=h*(g+x),B=u*(g+x),C=Math.atan2(E-b,w-T),A=Math.atan2(B-b,I-T);Rh(r,T+e,b+t,o,C,A,c*u>h*l)}var bw=y(()=>{Ug()});function LO(r,e){let t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:t,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+e),a=Math.sin(r+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Tw(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*qa/360),h=Math.cos(a*qa/360),d=h*(e-i)/2+u*(t-s)/2,f=-u*(e-i)/2+h*(t-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)),DO(e,t,i,s,o,n,l,c,u,h,d,f,Gg);let{ang1:m,ang2:g}=Gg,{centerX:_,centerY:v}=Gg,x=Math.abs(g)/(qa/4);Math.abs(1-x)<1e-7&&(x=1);let T=Math.max(Math.ceil(x),1);g/=T;let b=r[r.length-2],w=r[r.length-1],E={x:0,y:0};for(let I=0;I<T;I++){let B=LO(m,g),{x:C,y:A}=Lg(B[0],o,n,h,u,_,v,E),{x:P,y:R}=Lg(B[1],o,n,h,u,_,v,E),{x:M,y:F}=Lg(B[2],o,n,h,u,_,v,E);Mh(r,b,w,C,A,P,R,M,F),b=M,w=F,m+=g}}var qa,Gg,Lg,vw,DO,Sw=y(()=>{Fg();qa=Math.PI*2,Gg={centerX:0,centerY:0,ang1:0,ang2:0},Lg=({x:r,y:e},t,i,s,o,n,a,l)=>{r*=t,e*=i;let c=s*r-o*e,u=o*r+s*e;return l.x=c+n,l.y=u+a,l};vw=(r,e,t,i)=>{let s=r*i-e*t<0?-1:1,o=r*t+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},DO=(r,e,t,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),g=Math.pow(h,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let v=_*s/o*h,x=_*-o/s*u,T=c*v-l*x+(r+t)/2,b=l*v+c*x+(e+i)/2,w=(u-v)/s,E=(h-x)/o,I=(-u-v)/s,B=(-h-x)/o,C=vw(1,0,w,E),A=vw(w,E,I,B);a===0&&A>0&&(A-=qa),a===1&&A<0&&(A+=qa),d.centerX=T,d.centerY=b,d.ang1=C,d.ang2=A}});function ww(r,e,t){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?r.moveTo(a.x,a.y):r.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??t;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,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(u.len/2,h.len/2)?(_=Math.min(u.len/2,h.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let v=a.x+h.nx*_+-h.ny*g*f,x=a.y+h.ny*_+h.nx*g*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,b=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(v+Math.cos(T)*g,x+Math.sin(T)*g),r.arc(v,x,g,T,b,p),o=a}}function Ew(r,e,t,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??t;if(c<=0){a===0?r.moveTo(l.x,l.y):r.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 g=Math.min(d/2,c);f=o(l,u,g/d)}let p=s(h,l),m;if(p<1e-4)m=l;else{let g=Math.min(p/2,c);m=o(l,h,g/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var Aw=y(()=>{"use strict"});var NO,Ih,Pw=y(()=>{uw();hw();pw();ct();mw();zt();Fg();yw();Ug();bw();Sw();Aw();NO=new Q,Ih=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ee,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==t)&&i.push(e,t),this}arc(e,t,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Rh(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return _w(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return Tw(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,t,i,s,o),this}bezierCurveTo(e,t,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Mh(this._currentPoly.points,l.lastX,l.lastY,e,t,i,s,o,n,a),this}quadraticCurveTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly;return xw(this._currentPoly.points,n.lastX,n.lastY,e,t,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));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,t,i,s,o){return this.drawShape(new Q(e,t,i,s),o),this}circle(e,t,i,s){return this.drawShape(new wh(e,t,i),s),this}poly(e,t,i){let s=new zo(e);return s.closePath=t,this.drawShape(s,i),this}regularPoly(e,t,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),t+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,t,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,t,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=t+i*Math.sin(f),g=f+Math.PI+h,_=f-Math.PI-h,v=p+o*Math.cos(g),x=m+o*Math.sin(g),T=p+o*Math.cos(_),b=m+o*Math.sin(_);d===0?this.moveTo(v,x):this.lineTo(v,x),this.quadraticCurveTo(p,m,T,b,a)}return this.closePath()}roundShape(e,t,i=!1,s){return e.length<3?this:(i?Ew(this,e,t,s):ww(this,e,t),this.closePath())}filletRect(e,t,i,s,o){if(o===0)return this.rect(e,t,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=t+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,t+h).arcTo(e+u,t+u,e+h,t,h).lineTo(l-h,t).arcTo(l-u,t+u,l,t+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,t,i,s,o,n){if(o<=0)return this.rect(e,t,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=t+s,u=[e+a,t,l-a,t,l,t+a,l,c-a,l-a,c,e+a,c,e,c-a,e,t+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,t,i,s,o){return this.drawShape(new Eh(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new Ph(e,t,i,s,o),n),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new zo,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new zo,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,s=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let o=t.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 t=0;t<e.instructions.length;t++){let i=e.instructions[t];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let i=0;i<t.length;i++){let s=t[i],o=s.shape.getBounds(NO);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Ka(r,e){return r?r.prepend(e):e.clone()}var ji,Dg=y(()=>{dr();St();Ae();cw();Pw();ji=class r{constructor(e,t=!1){this.instructions=[],this.uid=he("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?lw(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ih(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),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,t,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(de.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,t,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,t,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(de.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,t,i]}),this._dirty=!0,this}rect(e,t,i,s,o){return this.instructions.push({action:"rect",data:[e,t,i,s,o]}),this._dirty=!0,this}circle(e,t,i,s){return this.instructions.push({action:"circle",data:[e,t,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,t,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),t+f*Math.sin(p))}return this.poly(h,!0,a),this}clone(e=!1){let t=new r;if(t.checkForHoles=this.checkForHoles,!e)t.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];t.instructions.push({action:s.action,data:s.data.slice()})}return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=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 g=0;g<this.instructions.length;g++){let _=this.instructions[g],v=_.data;switch(_.action){case"moveTo":case"lineTo":l=v[0],c=v[1],v[0]=t*l+s*c+n,v[1]=i*l+o*c+a;break;case"bezierCurveTo":u=v[0],h=v[1],d=v[2],f=v[3],l=v[4],c=v[5],v[0]=t*u+s*h+n,v[1]=i*u+o*h+a,v[2]=t*d+s*f+n,v[3]=i*d+o*f+a,v[4]=t*l+s*c+n,v[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=v[0],h=v[1],l=v[2],c=v[3],v[0]=t*u+s*h+n,v[1]=i*u+o*h+a,v[2]=t*l+s*c+n,v[3]=i*l+o*c+a;break;case"arcToSvg":l=v[5],c=v[6],p=v[0],m=v[1],v[0]=t*p+s*m,v[1]=i*p+o*m,v[5]=t*l+s*c+n,v[6]=i*l+o*c+a;break;case"circle":v[4]=Ka(v[3],e);break;case"rect":v[4]=Ka(v[4],e);break;case"ellipse":v[8]=Ka(v[8],e);break;case"roundRect":v[5]=Ka(v[5],e);break;case"addPath":v[0].transform(e);break;case"poly":v[2]=Ka(v[2],e);break;default:W("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,i=this.instructions[t];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(t--,t<0)return e.x=0,e.y=0,e;i=this.instructions[t]}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 Ve(r,e,t){let i=r.getAttribute(e);return i?Number(i):t}var Ng=y(()=>{"use strict"});function Cw(r,e){let t=r.querySelectorAll("defs");for(let i=0;i<t.length;i++){let s=t[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]=HO(n);break;case"radialgradient":e.defs[n.id]=VO(n);break;default:break}}}}function HO(r){let e=Ve(r,"x1",0),t=Ve(r,"y1",0),i=Ve(r,"x2",1),s=Ve(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Yt(e,t,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=Ve(l,"offset",0),u=oe.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function VO(r){return W("[SVG Parser] Radial gradients are not yet supported"),new Yt(0,0,1,0)}var Mw=y(()=>{vt();Ae();Do();Ng()});function Hg(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var Rw=y(()=>{"use strict"});function Vg(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Iw){let a=r.getAttribute(n);a&&Bw(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");Iw[c]&&Bw(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Bw(r,e,t,i){switch(t){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Hg(i);e.strokeStyle.fill=r.defs[s]}else e.strokeStyle.color=oe.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=Hg(i);e.fillStyle.fill=r.defs[s]}else e.fillStyle.color=oe.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 Iw,kw=y(()=>{vt();Rw();Iw={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Fw(r,e){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let t={context:e,defs:{},path:new ji};Cw(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Vg(r,t);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&Ow(a,t,s,o)}return e}function Ow(r,e,t,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Vg(r,e);o&&t?t={...t,...o}:o&&(t=o),n&&i?i={...i,...n}:n&&(i=n);let a=!t&&!i;a&&(t={color:0});let l,c,u,h,d,f,p,m,g,_,v,x,T,b,w,E,I;switch(r.nodeName.toLowerCase()){case"path":b=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&W("SVG Evenodd fill rule not supported, your svg may render incorrectly"),w=new ji(b,!0),e.context.path(w),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"circle":p=Ve(r,"cx",0),m=Ve(r,"cy",0),g=Ve(r,"r",0),e.context.ellipse(p,m,g,g),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"rect":l=Ve(r,"x",0),c=Ve(r,"y",0),E=Ve(r,"width",0),I=Ve(r,"height",0),_=Ve(r,"rx",0),v=Ve(r,"ry",0),_||v?e.context.roundRect(l,c,E,I,_||v):e.context.rect(l,c,E,I),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"ellipse":p=Ve(r,"cx",0),m=Ve(r,"cy",0),_=Ve(r,"rx",0),v=Ve(r,"ry",0),e.context.beginPath(),e.context.ellipse(p,m,_,v),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"line":u=Ve(r,"x1",0),h=Ve(r,"y1",0),d=Ve(r,"x2",0),f=Ve(r,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{W(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let B=0;B<s.length;B++)Ow(s[B],e,t,i)}var Uw=y(()=>{Ae();Dg();Mw();Ng();kw()});function WO(r){return oe.isColorLike(r)}function Gw(r){return r instanceof xi}function Lw(r){return r instanceof Yt}function zO(r){return r instanceof k}function $O(r,e,t){let i=oe.shared.setValue(e??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?t.alpha:i.alpha,r.texture=k.WHITE,{...t,...r}}function XO(r,e,t){return r.texture=e,{...t,...r}}function Dw(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function Nw(r,e,t){return e.buildGradient(),r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,r.textureSpace=e.textureSpace,{...t,...r}}function jO(r,e){let t={...e,...r},i=oe.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function yi(r,e){if(r==null)return null;let t={},i=r;return WO(r)?$O(t,r,e):zO(r)?XO(t,r,e):Gw(r)?Dw(t,r,e):Lw(r)?Nw(t,r,e):i.fill&&Gw(i.fill)?Dw(i,i.fill,e):i.fill&&Lw(i.fill)?Nw(i,i.fill,e):jO(i,e)}function Xo(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=yi(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Wg=y(()=>{vt();ve();Do();Sh()});var YO,Hw,zg,Nt,Bh=y(()=>{Ct();vt();ge();dr();ve();St();$e();zt();Dg();Uw();Wg();YO=new de,Hw=new G,zg=class qr extends Ce{constructor(){super(...arguments),this.uid=he("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ji,this._transform=new G,this._fillStyle={...qr.defaultFillStyle},this._strokeStyle={...qr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ee,this._boundsDirty=!0}clone(){let e=new qr;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=yi(e,qr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Xo(e,qr.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=yi(e,qr.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=yi(e,qr.defaultStrokeStyle),this}texture(e,t,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:t?oe.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ji,this}fill(e,t){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&&(t!==void 0&&typeof e=="number"&&(X(ie,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=yi(e,qr.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:t}=this._activePath.getLastPoint(de.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?t=i.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=Xo(e,qr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(i);else{t.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,t,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,i,s,o,n),this}arcTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,t,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+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,t,i,s){return this._tick++,this._activePath.ellipse(e,t,i,s,this._transform.clone()),this}circle(e,t,i){return this._tick++,this._activePath.circle(e,t,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty),this}moveTo(e,t){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*t+i.tx,n=i.b*e+i.d*t+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,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,t,i,s){return this._tick++,this._activePath.rect(e,t,i,s,this._transform.clone()),this}roundRect(e,t,i,s,o){return this._tick++,this._activePath.roundRect(e,t,i,s,o,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,t,i,s,o,n),this}roundPoly(e,t,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,t,i,s,o,n),this}roundShape(e,t,i,s){return this._tick++,this._activePath.roundShape(e,t,i,s),this}filletRect(e,t,i,s,o){return this._tick++,this._activePath.filletRect(e,t,i,s,o),this}chamferRect(e,t,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,t,i,s,o,n),this}star(e,t,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,t,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,Fw(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,t=e){return this._transform.scale(e,t),this}setTransform(e,t,i,s,o,n){return e instanceof G?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,i,s,o,n),this)}transform(e,t,i,s,o,n){return e instanceof G?(this._transform.append(e),this):(Hw.set(e,t,i,s,o,n),this._transform.append(Hw),this)}translate(e,t=e){return this._transform.translate(e,t),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 t=0;t<this.instructions.length;t++){let i=this.instructions[t],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 t=this.instructions,i=!1;for(let s=0;s<t.length;s++){let o=t[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,YO):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 g=0;g<m.length;g++)m[g].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}};zg.defaultFillStyle={color:16777215,alpha:1,texture:k.WHITE,matrix:null,fill:null,textureSpace:"local"};zg.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:k.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Nt=zg});function kh(r){let e=[],t=0;for(let i=0;i<Vw.length;i++){let s=`_${Vw[i]}`;e[t++]=r[s]}return t=Ww(r._fill,e,t),t=qO(r._stroke,e,t),t=KO(r.dropShadow,e,t),e.join("-")}function Ww(r,e,t){return r&&(e[t++]=r.color,e[t++]=r.alpha,e[t++]=r.fill?.styleKey),t}function qO(r,e,t){return r&&(t=Ww(r,e,t),e[t++]=r.width,e[t++]=r.alignment,e[t++]=r.cap,e[t++]=r.join,e[t++]=r.miterLimit),t}function KO(r,e,t){return r&&(e[t++]=r.alpha,e[t++]=r.angle,e[t++]=r.blur,e[t++]=r.distance,e[t++]=oe.shared.setValue(r.color).toNumber()),t}var Vw,$g=y(()=>{vt();Vw=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function ZO(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Oe.defaultDropShadow;r.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){X(ie,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(oe.isColorLike(t))i.color=t;else if(t instanceof Yt||t instanceof xi)i.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))i=t;else throw new Error("Invalid stroke value.");r.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){X(ie,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Oe.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new Yt({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>oe.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Xg,Oe,Is=y(()=>{Ct();vt();$e();Do();Sh();Bh();Wg();$g();Xg=class jo extends Ce{constructor(e={}){super(),ZO(e);let t={...jo.defaultTextStyle,...e};for(let i in t){let s=i;this[s]=t[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({...jo.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...jo.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({...Nt.defaultFillStyle,...e},()=>{this._fill=yi({...this._originalFill},Nt.defaultFillStyle)})),this._fill=yi(e===0?"black":e,Nt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Nt.defaultStrokeStyle,...e},()=>{this._stroke=Xo({...this._originalStroke},Nt.defaultStrokeStyle)})),this._stroke=Xo(e,Nt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=kh(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=jo.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new jo({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,t){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,t?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(oe.isColorLike(e)||e instanceof Yt||e instanceof xi)}};Xg.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Xg.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};Oe=Xg});function Fh(r,e,t,i){let s=QO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Xe.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=t/i,o.source.emit("update",o.source),o.updateUvs(),o}var QO,jg=y(()=>{Fi();zt();QO=new Ee});function Bs(r){let e=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,t=r.fontFamily;Array.isArray(r.fontFamily)||(t=r.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!JO.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var JO,Oh=y(()=>{"use strict";JO=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Yg,Rr,De,Za=y(()=>{Re();Oh();Yg={willReadFrequently:!0},Rr=class q{static get experimentalLetterSpacingSupported(){let e=q._experimentalLetterSpacingSupported;if(e!==void 0){let t=j.get().getCanvasRenderingContext2D().prototype;e=q._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,o,n,a,l,c){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",t,i=q._canvas,s=t.wordWrap){let o=`${e}:${t.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=Bs(t),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);let l=q.__context;l.font=n;let u=(s?q._wordWrap(e,t,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let v=0;v<u.length;v++){let x=q._measureText(u[v],t.letterSpacing,l);h[v]=x,d=Math.max(d,x)}let f=t._stroke?.width||0,p=d+f;t.dropShadow&&(p+=t.dropShadow.distance);let m=t.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(u.length-1)*(m+t.leading);return t.dropShadow&&(g+=t.dropShadow.distance),new q(e,t,p,g,u,h,m+t.leading,d,a)}static _measureText(e,t,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}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-=t,c-=t;else{let u=(q.graphemeSegmenter(e).length-1)*t;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,t,i=q._canvas){let s=i.getContext("2d",Yg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=q._collapseSpaces(u),d=q._collapseNewlines(u),f=!h,p=t.wordWrapWidth+c,m=q._tokenize(e);for(let g=0;g<m.length;g++){let _=m[g];if(q._isNewline(_)){if(!d){a+=q._addLine(n),f=!h,n="",o=0;continue}_=" "}if(h){let x=q.isBreakingSpace(_),T=q.isBreakingSpace(n[n.length-1]);if(x&&T)continue}let v=q._getFromCache(_,c,l,s);if(v>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,t.breakWords)){let x=q.wordWrapSplit(_);for(let T=0;T<x.length;T++){let b=x[T],w=b,E=1;for(;x[T+E];){let B=x[T+E];if(!q.canBreakChars(w,B,_,T,t.breakWords))b+=B;else break;w=B,E++}T+=E-1;let I=q._getFromCache(b,c,l,s);I+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=b,o+=I}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let x=g===m.length-1;a+=q._addLine(_,!x),f=!1,n="",o=0}else v+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=v)}return a+=q._addLine(n,!1),a}static _addLine(e,t=!0){return e=q._trimRight(e),e=t?`${e}
|
|
368
|
+
`:e,e}static _getFromCache(e,t,i,s){let o=i[e];return typeof o!="number"&&(o=q._measureText(e,t,s)+t,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 t=e.length-1;t>=0;t--){let i=e[t];if(!q.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:q._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:q._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let t=[],i="";if(typeof e!="string")return t;for(let s=0;s<e.length;s++){let o=e[s],n=e[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){i!==""&&(t.push(i),i=""),t.push(o);continue}i+=o}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,o){return!0}static wordWrapSplit(e){return q.graphemeSegmenter(e)}static measureFont(e){if(q._fonts[e])return q._fonts[e];let t=q._context;t.font=e;let i=t.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return q._fonts[e]=s,s}static clearMetrics(e=""){e?delete q._fonts[e]:q._fonts={}}static get _canvas(){if(!q.__canvas){let e;try{let t=new OffscreenCanvas(0,0);if(t.getContext("2d",Yg)?.measureText)return q.__canvas=t,t;e=j.get().createCanvas()}catch{e=j.get().createCanvas()}e.width=e.height=10,q.__canvas=e}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Yg)),q.__context}};Rr.METRICS_STRING="|\xC9q\xC5";Rr.BASELINE_SYMBOL="M";Rr.BASELINE_MULTIPLIER=1.4;Rr.HEIGHT_MULTIPLIER=2;Rr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Rr.experimentalLetterSpacing=!1;Rr._fonts={};Rr._newlines=[10,13];Rr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Rr._measurementCache={};De=Rr});function Yo(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return oe.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof xi){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Yt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&t&&(a=t.width+i,l=t.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&&t){let h=t.lineHeight/l;for(let d=0;d<t.lines.length;d++){let f=(d*t.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*h;c.addColorStop(Math.floor(m*zw)/zw,oe.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,oe.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return W("FillStyle not recognised",r),"red"}var zw,qg=y(()=>{vt();ge();ve();Ae();Do();Sh();zw=1e5});var Qa,$w=y(()=>{vt();U();xa();Wo();Fi();iw();$e();Is();jg();Za();Oh();qg();Qa=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=De.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*t),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*t);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=hi(o),n=hi(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Oe||(e.style=new Oe(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),qt.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=De.measureText(t||" ",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=qt.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=Fh(c,n,a,s);if(i.trim){let h=rw(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 t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",Xe.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(qt.returnCanvasAndContext(t.canvasAndContext),this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,s){let{canvas:o,context:n}=s,a=Bs(t),l=De.measureText(e||" ",t),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=t.textBaseline,t._stroke?.width){let v=t._stroke;n.lineWidth=v.width,n.miterLimit=v.miterLimit,n.lineJoin=v.join,n.lineCap=v.cap}n.font=a;let m,g,_=t.dropShadow?2:1;for(let v=0;v<_;++v){let x=t.dropShadow&&v===0,T=x?Math.ceil(Math.max(1,p)+t.padding*2):0,b=T*i;if(x){n.fillStyle="black",n.strokeStyle="black";let I=t.dropShadow,B=I.color,C=I.alpha;n.shadowColor=oe.shared.setValue(B).setAlpha(C).toRgbaString();let A=I.blur*i,P=I.distance*i;n.shadowBlur=A,n.shadowOffsetX=Math.cos(I.angle)*P,n.shadowOffsetY=Math.sin(I.angle)*P+b}else{if(n.fillStyle=t._fill?Yo(t._fill,n,l):null,t._stroke?.width){let I=t._stroke.width*t._stroke.alignment;n.strokeStyle=Yo(t._stroke,n,l,I)}n.shadowColor="black"}let w=(u-f.fontSize)/2;u-f.fontSize<0&&(w=0);let E=t._stroke?.width??0;for(let I=0;I<c.length;I++)m=E/2,g=E/2+I*u+f.ascent+w,t.align==="right"?m+=d-h[I]:t.align==="center"&&(m+=(d-h[I])/2),t._stroke?.width&&this._drawLetterSpacing(c[I],t,s,m+t.padding,g+t.padding-T,!0),t._fill!==void 0&&this._drawLetterSpacing(c[I],t,s,m+t.padding,g+t.padding-T)}}_drawLetterSpacing(e,t,i,s,o,n=!1){let{context:a}=i,l=t.letterSpacing,c=!1;if(De.experimentalLetterSpacingSupported&&(De.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=De.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 g="";for(let _=p+1;_<h.length;++_)g+=h[_];f=a.measureText(g).width,u+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Qa.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"canvasText"}});var Kg=y(()=>{U();JS();$w();V.add(Qa);V.add(Ya)});var Ue,Zg=y(()=>{$e();$u();Bh();Ue=class r extends Gi{constructor(e){e instanceof Nt&&(e={context:e});let{context:t,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",t?this._context=t:this._context=this._ownedContext=new Nt,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,t){return this.context[e](...t),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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(e,t,i){X(ie,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),t&&(s.color=t),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,t){X(ie,"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),t!==void 0&&(i.alpha=t),this.context.fillStyle=i,this}endFill(){X(ie,"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!==Nt.defaultStrokeStyle.width||e.color!==Nt.defaultStrokeStyle.color||e.alpha!==Nt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return X(ie,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return X(ie,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return X(ie,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return X(ie,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return X(ie,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return X(ie,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var Xw,jw,Yw=y(()=>{"use strict";Xw={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
371
371
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -462,7 +462,7 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}}});var Qg,Jg,Uh,Qw=y(()=>{ge();Ss();zi();Ua();Ga();$i();lh();Cr();Rt();Yw();Zw();Uh=class extends Ke{constructor(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new
|
|
465
|
+
`}}});var Qg,Jg,Uh,Qw=y(()=>{ge();Ss();zi();Ua();Ga();$i();lh();Cr();Rt();Yw();Zw();Uh=class extends Ke{constructor(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=fr();Qg??(Qg=Vr({name:"sdf-shader",bits:[Bo,Fo(t),Xw,qw,zr]})),Jg??(Jg=Wr({name:"sdf-shader",bits:[ko,Oo(t),jw,Kw,$r]})),super({glProgram:Jg,gpuProgram:Qg,resources:{localUniforms:e,batchSamplers:Uo(t)}})}}});var qo,ex=y(()=>{Ct();$e();qo=class extends Ce{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return X(ie,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(ie,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(ie,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(ie,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function Gh(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let e=[];for(let t=0,i=r.length;t<i;t++){let s=r[t];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 tx=y(()=>{"use strict"});var Jw,rx,tE=y(()=>{vt();ct();Wo();Eo();ve();$e();Za();Oh();qg();Is();ex();tx();Jw=class eE extends qo{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 t={...eE.defaultOptions,...e};this._textureSize=t.textureSize,this._mipmap=t.mipmap;let i=t.style.clone();t.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=k.WHITE,i._fill.fill=null),this.applyFillAsTint=t.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=Bs(i);t.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=t.skipKerning??!1,this.resolution=t.resolution??1,this._padding=t.padding??4,this.fontMetrics=De.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let t=Gh(e).filter(g=>!this._currentChars.includes(g)).filter((g,_,v)=>v.indexOf(g)===_);if(!t.length)return;this._currentChars=[...this._currentChars,...t];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 g=0;g<t.length;g++){let _=t[g],v=De.measureText(_,a,s,!1);v.lineHeight=v.height;let x=v.width*u,T=Math.ceil((a.fontStyle==="italic"?2:1)*x),b=v.height*u,w=T+h*2,E=b+h*2;if(f=!1,_!==`
|
|
466
466
|
`&&_!=="\r"&&_!==" "&&_!==" "&&(f=!0,d=Math.ceil(Math.max(E,d))),l+w>p&&(c+=d,d=E,l=0,c+d>m)){n.update();let B=this._nextPage();s=B.canvasAndContext.canvas,o=B.canvasAndContext.context,n=B.texture.source,c=0}let I=x/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:I,kerning:{}},f){this._drawGlyph(o,v,l+h,c+h,u,a);let B=n.width*u,C=n.height*u,A=new Q(l/B*n.width,c/C*n.height,w/B*n.width,E/C*n.height);this.chars[_].texture=new k({source:n,frame:A}),l+=Math.ceil(w)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){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]=t.measureText(o).width);let c=i[a];c||(c=i[a]=t.measureText(a).width);let u=t.measureText(o+a).width,h=u-(l+c);h&&(this.chars[o].kerning[a]=h),u=t.measureText(o+a).width,h=u-(l+c),h&&(this.chars[a].kerning[o]=h)}}}_nextPage(){this._currentPageIndex++;let e=this.resolution,t=qt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);let i=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new k({source:new Xt({resource:t.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:t,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(e,t,i){t.fontSize=this.baseRenderedFontSize,e.scale(i,i),e.font=Bs(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;let s=t._stroke,o=s?.width??0;if(s&&(e.lineWidth=o,e.lineJoin=s.join,e.miterLimit=s.miterLimit,e.strokeStyle=Yo(s,e)),t._fill&&(e.fillStyle=Yo(t._fill,e)),t.dropShadow){let n=t.dropShadow,a=oe.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,t,i,s,o,n){let a=t.text,l=t.fontProperties,u=(n._stroke?.width??0)*o,h=i+u/2,d=s-u/2,f=l.descent*o,p=t.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:t,texture:i}=this.pages[e];qt.returnCanvasAndContext(t),i.destroy(!0)}this.pages=null}};Jw.defaultOptions={textureSize:512,style:new Oe,mipmap:!0};rx=Jw});function Lh(r,e,t,i){let s={width:0,height:0,offsetY:0,scale:e.fontSize/t.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=t.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 g=0;g<l.index;g++){let _=p.positions[g];o.chars.push(p.chars[g]),o.charPositions.push(_+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-=t.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+=t.lineHeight},h=t.baseMeasurementFontSize/e.fontSize,d=e.letterSpacing*h,f=e.wordWrapWidth*h;for(let p=0;p<r.length+1;p++){let m,g=p===r.length;g||(m=r[p]);let _=t.chars[m]||t.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
|
|
467
467
|
`||g){if(!a&&e.wordWrap&&o.width+l.width-d>f?(u(),c(l),g||o.charPositions.push(0)):(l.start=o.width,c(l),g||o.charPositions.push(0)),m==="\r"||m===`
|
|
468
468
|
`)o.width!==0&&u();else if(!g){let b=_.xAdvance+(_.kerning[n]||0)+d;o.width+=b,o.spaceWidth=b,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=_.kerning[n]||0,b=_.xAdvance+T+d;l.positions[l.index++]=l.width+T,l.chars.push(m),l.width+=b}n=m}return u(),e.align==="center"?eU(s):e.align==="right"?tU(s):e.align==="justify"&&rU(s),s}function eU(r){for(let e=0;e<r.lines.length;e++){let t=r.lines[e],i=r.width/2-t.width/2;for(let s=0;s<t.charPositions.length;s++)t.charPositions[s]+=i}}function tU(r){for(let e=0;e<r.lines.length;e++){let t=r.lines[e],i=r.width-t.width;for(let s=0;s<t.charPositions.length;s++)t.charPositions[s]+=i}}function rU(r){let e=r.width;for(let t=0;t<r.lines.length;t++){let i=r.lines[t],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 ix=y(()=>{"use strict"});var Dh,sx,Ja,ox=y(()=>{Ni();$e();Ae();Is();tE();ix();tx();Dh=0,sx=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,t){let i=`${t.fontFamily}-bitmap`,s=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,s=!1;else if(t._stroke||t.dropShadow){let n=t.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!Se.has(i)){let n=new rx({style:t,overrideFill:s,overrideSize:!0,...this.defaultOptions});Dh++,Dh>50&&W("BitmapText",`You have dynamically created ${Dh} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Dh--,Se.remove(i)}),Se.set(i,n)}let o=Se.get(i);return o.ensureCharacters?.(e),o}getLayout(e,t,i=!0){let s=this.getFont(e,t);return Lh([...e],t,s,i)}measureText(e,t,i=!0){return this.getLayout(e,t,i)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},X(ie,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=t?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let s=t.style,o=s instanceof Oe?s:new Oe(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new rx({style:o,overrideFill:n,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),l=Gh(t.chars);return a.ensureCharacters(l.join("")),Se.set(`${i}-bitmap`,a),a.once("destroy",()=>Se.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Se.get(t);i&&i.destroy()}},Ja=new sx});function rE(r,e){e.groupTransform=r.groupTransform,e.groupColorAlpha=r.groupColorAlpha,e.groupColor=r.groupColor,e.groupBlendMode=r.groupBlendMode,e.globalDisplayStatus=r.globalDisplayStatus,e.groupTransform=r.groupTransform,e.localDisplayStatus=r.localDisplayStatus,e.groupAlpha=r.groupAlpha,e._roundPixels=r._roundPixels}var el,iE=y(()=>{Ni();U();Ut();Zg();Qw();ox();ix();el=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let i=this._getGpuBitmapText(e);rE(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,t),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(se.return(t.customShader),t.customShader=null),se.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);rE(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,s=Ja.getFont(e.text,e._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=se.get(Uh)));let o=Array.from(e.text),n=e._style,a=s.baseLineOffset,l=Lh(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 g=l.lines[m];for(let _=0;_<g.charPositions.length;_++){let v=o[c++],x=s.chars[v];x?.texture&&i.texture(x.texture,p||"black",Math.round(g.charPositions[_]+x.xOffset),Math.round(a+x.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(e){return this._gpuBitmapText[e.uid]||this.initGpuText(e)}initGpuText(e){let t=se.get(Ue);return this._gpuBitmapText[e.uid]=t,this._updateContext(e,t),e.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[e.uid]}_updateDistanceField(e){let t=this._getGpuBitmapText(e).context,i=e._style.fontFamily,s=Se.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);t.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let e in this._gpuBitmapText)this._destroyRenderableByUid(e);this._gpuBitmapText=null,this._renderer=null}};el.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"bitmapText"}});var nx=y(()=>{U();iE();V.add(el)});var tl,sE=y(()=>{U();ve();Ut();Xa();Mg();tl=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 t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}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 t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(o=>{console.error(o)}),e._didTextUpdate=!1,ja(s,e)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=i;let s=e.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(e.text,s,e._style,e._getKey()),n=t.batchableSprite;n.texture=t.texture=o,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate(),ja(n,e)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:k.EMPTY,currentKey:"--",batchableSprite:se.get(Yr),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.transform=e.groupTransform,i.texture=k.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]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};tl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"}});function oE(){let{userAgent:r}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var nE=y(()=>{Re()});var aE,lE,Ko,ax=y(()=>{"use strict";aE="http://www.w3.org/2000/svg",lE="http://www.w3.org/1999/xhtml",Ko=class{constructor(){this.svgRoot=document.createElementNS(aE,"svg"),this.foreignObject=document.createElementNS(aE,"foreignObject"),this.domElement=document.createElementNS(lE,"div"),this.styleElement=document.createElementNS(lE,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(s)}}});function hE(r){let e=r._stroke,t=r._fill,s=[`div { ${[`color: ${oe.shared.setValue(t.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...e?[fE(e)]:[],...r.dropShadow?[dE(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return iU(r.tagStyles,s),s.join(" ")}function dE(r){let e=oe.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),t=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${t}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${e}`:`text-shadow: ${s} ${e}`}function fE(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function iU(r,e){for(let t in r){let i=r[t],s=[];for(let o in i)uE[o]?s.push(uE[o](i[o])):cE[o]&&s.push(cE[o].replace("{{VALUE}}",i[o]));e.push(`${t} { ${s.join(";")} }`)}}var cE,uE,pE=y(()=>{vt();cE={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"},uE={fill:r=>`color: ${oe.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:fE,dropShadow:dE}});var Nh,mE=y(()=>{Ae();Is();$g();pE();Nh=class r extends Oe{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=kh(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=hE(this)),this._cssStyle}addOverride(...e){let t=e.filter(i=>!this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){let t=e.filter(i=>this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!t.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function gE(r,e){let t=e.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(t))for(let l=0;l<t.length;l++)a(t[l]);else a(t);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 xE=y(()=>{"use strict"});async function yE(r){let t=await(await j.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(t)})}var _E=y(()=>{Re()});async function lx(r,e){let t=await yE(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 ux,hx,Wh,DE=y(()=>{ge();zi();en();$i();Cr();Rt();ve();LE();Wh=class extends Ke{constructor(){ux??(ux=Vr({name:"tiling-sprite-shader",bits:[ks,UE,zr]})),hx??(hx=Wr({name:"tiling-sprite-shader",bits:[Jo,GE,$r]}));let e=new be({uMapCoord:{value:new L,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 L,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:hx,gpuProgram:ux,resources:{localUniforms:new be({uTransformMatrix:{value:new L,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}})}updateUniforms(e,t,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/t,i.c*c/e,i.d*c/t,i.tx/e,i.ty/t),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]=t,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var zh,NE=y(()=>{Vh();zh=class extends Qo{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 HE(r,e){let t=r.anchor.x,i=r.anchor.y;e[0]=-t*r.width,e[1]=-i*r.height,e[2]=(1-t)*r.width,e[3]=-i*r.height,e[4]=(1-t)*r.width,e[5]=(1-i)*r.height,e[6]=-t*r.width,e[7]=(1-i)*r.height}var VE=y(()=>{"use strict"});function WE(r,e,t,i){let s=0,o=r.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(t*=e;s<o;){let d=r[t],f=r[t+1];r[t]=n*d+l*f+u,r[t+1]=a*d+c*f+h,t+=e,s++}}var zE=y(()=>{"use strict"});function $E(r,e){let t=r.texture,i=t.frame.width,s=t.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=L.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),WE(e,2,0,a)}var XE=y(()=>{ge();zE()});var $h,rl,jE=y(()=>{U();ka();Mr();Xr();Ho();yh();Vh();DE();NE();VE();XE();$h=new zh,rl=class{constructor(e){this._state=Qe.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let s=t.canBatch;if(s&&s===i){let{batchableMesh:o}=t;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,t){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 Xi);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,t)}else i.break(t),s.shader||(s.shader=new Wh),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,jr(e.groupColorAlpha,i.uColor,0),this._state.blendMode=pi(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:$h,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:s}=t;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=t;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.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 t=new Qo({indices:$h.indices,positions:$h.positions.slice(),uvs:$h.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),$E(e,i.uvs),HE(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 t=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===st.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),t.canBatch}};rl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"}});var dx=y(()=>{U();jE();V.add(rl)});var YE,KE,ZE=y(()=>{$e();Vh();YE=class qE extends Qo{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(X(ie,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...qE.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 t=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<t;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,g=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,_,g)}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()}};YE.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};KE=YE});var QE,eA,tA=y(()=>{ZE();QE=class JE extends KE{constructor(e={}){e={...JE.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:t,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=t>u?1:t/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*t,g=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]=t-o*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=n*p-g,e[17]=e[19]=e[21]=e[23]=i-a*p-g,e[25]=e[27]=e[29]=e[31]=i-g,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 t=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};QE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};eA=QE});var il,rA=y(()=>{U();Ut();yh();tA();il=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,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t.geometry),se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(Xi);return t.geometry=se.get(eA),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};il.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"}});var fx=y(()=>{U();rA();V.add(il)});var sl,iA=y(()=>{U();sl=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,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}};sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"}});function sA(r,e){e.clear();let t=e.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(e.matrix=s.worldTransform,e.addBounds(s.bounds))}return e.matrix=t,e}var oA=y(()=>{"use strict"});var sU,ol,nA=y(()=>{U();ge();dr();Hi();Mo();Rt();ve();Fi();Xr();zt();oA();Ae();sU=new pr({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])}),ol=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new be({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 mt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=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?sA(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=t.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&t.type)){h=!1;break}if(p.blendRequired&&!(t.backBuffer?.useBackBuffer??!0)){W("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=t.renderTarget.rootViewPort,p=t.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=t.renderTarget.renderSurface,s.inputTexture=Xe.getOptimalTexture(o.width,o.height,a,c),t.renderTarget.bind(s.inputTexture,!0),t.globalUniforms.push({offset:o})}pop(){let e=this.renderer;this._filterStackIndex--;let t=this._filterStack[this._filterStackIndex];if(t.skip)return;this._activeFilterData=t;let i=t.inputTexture,s=t.bounds,o=k.EMPTY;if(e.renderTarget.finishRenderPass(),t.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(t.previousRenderSurface);o=this.getBackTexture(l,s,a)}t.backTexture=o;let n=t.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,t.previousRenderSurface,!1),Xe.returnTexture(i);else{let a=t.inputTexture,l=Xe.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,t.previousRenderSurface,!1),Xe.returnTexture(a),Xe.returnTexture(l)}t.blendRequired&&Xe.returnTexture(o)}getBackTexture(e,t,i){let s=e.colorTexture.source._resolution,o=Xe.getOptimalTexture(t.width,t.height,s,!1),n=t.minX,a=t.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(t.width*s),c=Math.ceil(t.height*s);return this.renderer.renderTarget.copyToTexture(e,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(e,t,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=de.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,g=p.uInputSize,_=p.uInputPixel,v=p.uInputClamp,x=p.uGlobalFrame,T=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;let I=this._filterStack[this._filterStackIndex-1];if(!I.skip){l.x=I.bounds.minX,l.y=I.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=t.frame.width,m[3]=t.frame.height,g[0]=t.source.width,g[1]=t.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=t.source.pixelWidth,_[1]=t.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],v[0]=.5*_[2],v[1]=.5*_[3],v[2]=t.frame.width*g[2]-.5*_[2],v[3]=t.frame.height*g[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=l.x*h,x[1]=l.y*h,x[2]=b.source.width*h,x[3]=b.source.height*h;let w=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof k?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=w.width,T[1]=w.height),T[2]=w.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(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:sU,shader:e,state:e._state,topology:"triangle-list"}),o.type===st.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Ee,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=t.worldTransform.copyTo(L.shared),n=t.renderGroup||t.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}};ol.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"}});var px=y(()=>{U();iA();nA();V.add(ol);V.add(sl)});var oU={};var aA=y(()=>{c0();xm();x0();_0();ju();Ju();Sg();wg();Cg();Kg();nx();cx();dx();fx();px()});var nU={};var cA=y(()=>{xm();ju();Ju();Sg();wg();Cg();Kg();nx();cx();dx();fx();px()});var hA,tn,gx=y(()=>{Es();Io();Cr();Mr();hA=class mx extends Ke{constructor(e){e={...mx.defaultOptions,...e},super(e),this.enabled=!0,this._state=Qe.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,t,i,s){e.applyFilter(this,t,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=gr.from(t)),i&&(n=mr.from(i)),new mx({gpuProgram:o,glProgram:n,...s})}};hA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};tn=hA});async function dA(r){if(!r)for(let e=0;e<xx.length;e++){let t=xx[e];if(t.value.test()){await t.value.load();return}}}var xx,fA=y(()=>{U();xx=[];V.handleByNamedList(S.Environment,xx)});function Xh(){if(typeof nl=="boolean")return nl;try{nl=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{nl=!1}return nl}var nl,yx=y(()=>{"use strict"});var gt,rn=y(()=>{"use strict";gt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(gt||{})});var sn,_x=y(()=>{"use strict";sn=class{constructor(e){this.items=[],this._name=e}emit(e,t,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,t,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 t=this.items.indexOf(e);return t!==-1&&this.items.splice(t,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 aU,pA,Yi,al=y(()=>{vt();fA();Ar();yx();$e();rn();_x();Ct();aU=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],pA=class mA extends Ce{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 t=[...aU,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){let t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await dA(t),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={...mA.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,t){let i=e;if(i instanceof te&&(i={container:i},t&&(X(ie,"passing a second argument is deprecated, please use render options instead"),i.target=t.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:oe.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,t,i){let s=this.view.resolution;this.view.resize(e,t,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 t=this;e.target||(e.target=t.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=gt.ALL);let{clear:i,clearColor:s,target:o}=e;oe.shared.setValue(s??this.background.colorRgba),t.renderTarget.clear(o,i,oe.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(t=>{this.runners[t]=new sn(t)})}_addSystems(e){let t;for(t in e){let i=e[t];this._addSystem(i.value,i.name)}}_addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,t){let i=t.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(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Xh())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()}};pA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Yi=pA});var ll,yA=y(()=>{U();ge();Ss();rh();zi();Ua();Ga();en();$i();Cr();Rt();ll=class{init(){let e=new be({uTransformMatrix:{value:new L,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),t=Vr({name:"graphics",bits:[Bo,Fo(fr()),OE,zr]});this.shader=new Ke({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.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 g=m.textures;m.bindGroup=Co(g.textures,g.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}};ll.extension={type:[S.WebGPUPipesAdaptor],name:"graphics"}});var _A,bA,bx=y(()=>{"use strict";_A={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var ux,hx,Wh,DE=y(()=>{ge();zi();en();$i();Cr();Rt();ve();LE();Wh=class extends Ke{constructor(){ux??(ux=Vr({name:"tiling-sprite-shader",bits:[ks,UE,zr]})),hx??(hx=Wr({name:"tiling-sprite-shader",bits:[Jo,GE,$r]}));let e=new be({uMapCoord:{value:new G,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:hx,gpuProgram:ux,resources:{localUniforms:new be({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}})}updateUniforms(e,t,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/t,i.c*c/e,i.d*c/t,i.tx/e,i.ty/t),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]=t,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var zh,NE=y(()=>{Vh();zh=class extends Qo{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 HE(r,e){let t=r.anchor.x,i=r.anchor.y;e[0]=-t*r.width,e[1]=-i*r.height,e[2]=(1-t)*r.width,e[3]=-i*r.height,e[4]=(1-t)*r.width,e[5]=(1-i)*r.height,e[6]=-t*r.width,e[7]=(1-i)*r.height}var VE=y(()=>{"use strict"});function WE(r,e,t,i){let s=0,o=r.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(t*=e;s<o;){let d=r[t],f=r[t+1];r[t]=n*d+l*f+u,r[t+1]=a*d+c*f+h,t+=e,s++}}var zE=y(()=>{"use strict"});function $E(r,e){let t=r.texture,i=t.frame.width,s=t.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),WE(e,2,0,a)}var XE=y(()=>{ge();zE()});var $h,rl,jE=y(()=>{U();ka();Mr();Xr();Ho();yh();Vh();DE();NE();VE();XE();$h=new zh,rl=class{constructor(e){this._state=Qe.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let s=t.canBatch;if(s&&s===i){let{batchableMesh:o}=t;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,t){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 Xi);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,t)}else i.break(t),s.shader||(s.shader=new Wh),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,jr(e.groupColorAlpha,i.uColor,0),this._state.blendMode=pi(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:$h,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:s}=t;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=t;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.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 t=new Qo({indices:$h.indices,positions:$h.positions.slice(),uvs:$h.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),$E(e,i.uvs),HE(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 t=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===st.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),t.canBatch}};rl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"}});var dx=y(()=>{U();jE();V.add(rl)});var YE,KE,ZE=y(()=>{$e();Vh();YE=class qE extends Qo{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(X(ie,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...qE.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 t=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<t;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,g=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,_,g)}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()}};YE.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};KE=YE});var QE,eA,tA=y(()=>{ZE();QE=class JE extends KE{constructor(e={}){e={...JE.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:t,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=t>u?1:t/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*t,g=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]=t-o*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=n*p-g,e[17]=e[19]=e[21]=e[23]=i-a*p-g,e[25]=e[27]=e[29]=e[31]=i-g,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 t=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};QE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};eA=QE});var il,rA=y(()=>{U();Ut();yh();tA();il=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,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t.geometry),se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(Xi);return t.geometry=se.get(eA),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};il.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"}});var fx=y(()=>{U();rA();V.add(il)});var sl,iA=y(()=>{U();sl=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,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}};sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"}});function sA(r,e){e.clear();let t=e.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(e.matrix=s.worldTransform,e.addBounds(s.bounds))}return e.matrix=t,e}var oA=y(()=>{"use strict"});var sU,ol,nA=y(()=>{U();ge();dr();Hi();Mo();Rt();ve();Fi();Xr();zt();oA();Ae();sU=new pr({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])}),ol=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new be({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 mt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=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?sA(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=t.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&t.type)){h=!1;break}if(p.blendRequired&&!(t.backBuffer?.useBackBuffer??!0)){W("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=t.renderTarget.rootViewPort,p=t.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=t.renderTarget.renderSurface,s.inputTexture=Xe.getOptimalTexture(o.width,o.height,a,c),t.renderTarget.bind(s.inputTexture,!0),t.globalUniforms.push({offset:o})}pop(){let e=this.renderer;this._filterStackIndex--;let t=this._filterStack[this._filterStackIndex];if(t.skip)return;this._activeFilterData=t;let i=t.inputTexture,s=t.bounds,o=k.EMPTY;if(e.renderTarget.finishRenderPass(),t.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(t.previousRenderSurface);o=this.getBackTexture(l,s,a)}t.backTexture=o;let n=t.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,t.previousRenderSurface,!1),Xe.returnTexture(i);else{let a=t.inputTexture,l=Xe.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,t.previousRenderSurface,!1),Xe.returnTexture(a),Xe.returnTexture(l)}t.blendRequired&&Xe.returnTexture(o)}getBackTexture(e,t,i){let s=e.colorTexture.source._resolution,o=Xe.getOptimalTexture(t.width,t.height,s,!1),n=t.minX,a=t.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(t.width*s),c=Math.ceil(t.height*s);return this.renderer.renderTarget.copyToTexture(e,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(e,t,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=de.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,g=p.uInputSize,_=p.uInputPixel,v=p.uInputClamp,x=p.uGlobalFrame,T=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;let I=this._filterStack[this._filterStackIndex-1];if(!I.skip){l.x=I.bounds.minX,l.y=I.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=t.frame.width,m[3]=t.frame.height,g[0]=t.source.width,g[1]=t.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=t.source.pixelWidth,_[1]=t.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],v[0]=.5*_[2],v[1]=.5*_[3],v[2]=t.frame.width*g[2]-.5*_[2],v[3]=t.frame.height*g[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=l.x*h,x[1]=l.y*h,x[2]=b.source.width*h,x[3]=b.source.height*h;let w=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof k?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=w.width,T[1]=w.height),T[2]=w.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(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:sU,shader:e,state:e._state,topology:"triangle-list"}),o.type===st.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Ee,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=t.worldTransform.copyTo(G.shared),n=t.renderGroup||t.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}};ol.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"}});var px=y(()=>{U();iA();nA();V.add(ol);V.add(sl)});var oU={};var aA=y(()=>{c0();xm();x0();_0();ju();Ju();Sg();wg();Cg();Kg();nx();cx();dx();fx();px()});var nU={};var cA=y(()=>{xm();ju();Ju();Sg();wg();Cg();Kg();nx();cx();dx();fx();px()});var hA,tn,gx=y(()=>{Es();Io();Cr();Mr();hA=class mx extends Ke{constructor(e){e={...mx.defaultOptions,...e},super(e),this.enabled=!0,this._state=Qe.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,t,i,s){e.applyFilter(this,t,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=gr.from(t)),i&&(n=mr.from(i)),new mx({gpuProgram:o,glProgram:n,...s})}};hA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};tn=hA});async function dA(r){if(!r)for(let e=0;e<xx.length;e++){let t=xx[e];if(t.value.test()){await t.value.load();return}}}var xx,fA=y(()=>{U();xx=[];V.handleByNamedList(S.Environment,xx)});function Xh(){if(typeof nl=="boolean")return nl;try{nl=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{nl=!1}return nl}var nl,yx=y(()=>{"use strict"});var gt,rn=y(()=>{"use strict";gt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(gt||{})});var sn,_x=y(()=>{"use strict";sn=class{constructor(e){this.items=[],this._name=e}emit(e,t,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,t,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 t=this.items.indexOf(e);return t!==-1&&this.items.splice(t,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 aU,pA,Yi,al=y(()=>{vt();fA();Ar();yx();$e();rn();_x();Ct();aU=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],pA=class mA extends Ce{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 t=[...aU,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){let t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await dA(t),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={...mA.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,t){let i=e;if(i instanceof te&&(i={container:i},t&&(X(ie,"passing a second argument is deprecated, please use render options instead"),i.target=t.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:oe.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,t,i){let s=this.view.resolution;this.view.resize(e,t,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 t=this;e.target||(e.target=t.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=gt.ALL);let{clear:i,clearColor:s,target:o}=e;oe.shared.setValue(s??this.background.colorRgba),t.renderTarget.clear(o,i,oe.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(t=>{this.runners[t]=new sn(t)})}_addSystems(e){let t;for(t in e){let i=e[t];this._addSystem(i.value,i.name)}}_addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,t){let i=t.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(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Xh())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()}};pA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Yi=pA});var ll,yA=y(()=>{U();ge();Ss();rh();zi();Ua();Ga();en();$i();Cr();Rt();ll=class{init(){let e=new be({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),t=Vr({name:"graphics",bits:[Bo,Fo(fr()),OE,zr]});this.shader=new Ke({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.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 g=m.textures;m.bindGroup=Co(g.textures,g.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}};ll.extension={type:[S.WebGPUPipesAdaptor],name:"graphics"}});var _A,bA,bx=y(()=>{"use strict";_A={name:"texture-bit",vertex:{header:`
|
|
570
570
|
|
|
571
571
|
struct TextureUniforms {
|
|
572
572
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -592,7 +592,7 @@ fn mainFragment(
|
|
|
592
592
|
|
|
593
593
|
`,main:`
|
|
594
594
|
outColor = texture(uTexture, vUV);
|
|
595
|
-
`}}});var cl,vA=y(()=>{U();ge();zi();en();$i();bx();Cr();ve();Ae();cl=class{init(){let e=Vr({name:"mesh",bits:[ks,_A,zr]});this._shader=new Ke({gpuProgram:e,resources:{uTexture:k.EMPTY._source,uSampler:k.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new L}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){W("Mesh shader has no gpuProgram",t.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=e.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};cl.extension={type:[S.WebGPUPipesAdaptor],name:"mesh"}});var qh,ul,TA=y(()=>{U();Mr();rh();qh=Qe.for2d(),ul=class{start(e,t,i){let s=e.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=t,o.setGeometry(t,n),qh.blendMode="normal",s.pipeline.getPipeline(t,n,qh);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(e,t){let i=this._shader.gpuProgram,s=e.renderer,o=s.encoder;if(!t.bindGroup){let l=t.textures;t.bindGroup=Co(l.textures,l.count)}qh.blendMode=t.blendMode;let n=s.bindGroup.getBindGroup(t.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,qh,t.topology);t.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(t.size,1,t.start)}};ul.extension={type:[S.WebGPUPipesAdaptor],name:"batch"}});var hl,SA=y(()=>{U();hl=class{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}};hl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"customRender"}});function dl(r,e){let t=r.instructionSet,i=t.instructions;for(let s=0;s<t.instructionSize;s++){let o=i[s];e[o.renderPipeId].execute(o)}}var vx=y(()=>{"use strict"});var lU,fl,wA=y(()=>{U();ge();Ut();Xa();vx();lU=new L,fl=class{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(se.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){let i=e._batchableRenderGroup??(e._batchableRenderGroup=se.get(Yr));i.renderable=e.root,i.transform=e.root.relativeGroupTransform,i.texture=e.texture,i.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.batch.addToBatch(i,t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;let t=lU.identity().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295}),dl(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),dl(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};fl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"renderGroup"}});function pl(r,e){e||(e=0);for(let t=e;t<r.length&&r[t];t++)r[t]=null}var Tx=y(()=>{"use strict"});function Sx(r,e=!1){uU(r);let t=r.childrenToUpdate,i=r.updateTick++;for(let s in t){let o=Number(s),n=t[s],a=n.list,l=n.index;for(let c=0;c<l;c++){let u=a[c];u.parentRenderGroup===r&&u.relativeRenderGroupDepth===o&&PA(u,i,0)}pl(a,l),n.index=0}if(e)for(let s=0;s<r.renderGroupChildren.length;s++)Sx(r.renderGroupChildren[s],e)}function uU(r){let e=r.root,t;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(e.relativeGroupTransform,i.worldTransform),r.worldColor=mo(e.groupColor,i.worldColor),t=e.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(e.localTransform),r.worldColor=e.localColor,t=e.localAlpha;t=t<0?0:t>1?1:t,r.worldAlpha=t,r.worldColorAlpha=r.worldColor+((t*255|0)<<24)}function PA(r,e,t){if(e===r.updateTick)return;r.updateTick=e,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(t|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),t&EA&&AA(r,s,t)):(t=r._updateFlags,r.relativeGroupTransform.copyFrom(i),t&EA&&AA(r,cU,t)),!r.renderGroup){let o=r.children,n=o.length;for(let c=0;c<n;c++)PA(o[c],e,t);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function AA(r,e,t){if(t&_o){r.groupColor=mo(r.localColor,e.groupColor);let i=r.localAlpha*e.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}t&ya&&(r.groupBlendMode=r.localBlendMode==="inherit"?e.groupBlendMode:r.localBlendMode),t&bs&&(r.globalDisplayStatus=r.localDisplayStatus&e.globalDisplayStatus),r._updateFlags=0}var cU,EA,CA=y(()=>{Ar();Tx();Zp();cU=new te,EA=bs|_o|ya});function MA(r,e){let{list:t,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=t[o];if(s=e[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var RA=y(()=>{"use strict"});var hU,ml,IA=y(()=>{U();ge();Fi();zt();Tx();vx();CA();RA();hU=new L,ml=class{constructor(e){this._renderer=e}render({container:e,transform:t}){let i=e.parent,s=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let o=this._renderer,n=hU;t&&(n=n.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let a=o.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),o.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),dl(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(n),e.parent=i,e.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e.isCachedAsTexture){if(!e.updateCacheTexture)return;t=e}e._parentCacheAsTextureRenderGroup=t;for(let i=e.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(e.renderGroupChildren[i],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){let i=e.root.getLocalBounds();i.ceil();let s=e.texture;e.texture&&Xe.returnTexture(e.texture);let o=this._renderer,n=e.textureOptions.resolution||o.view.resolution,a=e.textureOptions.antialias??o.view.antialias;e.texture=Xe.getOptimalTexture(i.width,i.height,n,a),e._textureBounds||(e._textureBounds=new Ee),e._textureBounds.copyFrom(i),s!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(Xe.returnTexture(e.texture),e.texture=null)}_updateRenderGroups(e){let t=this._renderer,i=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=i,e.structureDidChange?pl(e.childrenRenderablesToUpdate.list,0):MA(e,i),Sx(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let s=0;s<e.renderGroupChildren.length;s++)this._updateRenderGroups(e.renderGroupChildren[s])}_updateRenderables(e){let{list:t,index:i}=e.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=t[s];o.didViewUpdate&&e.updateRenderable(o)}pl(t,i)}_buildInstructions(e,t){let i=e.root,s=e.instructionSet;s.reset();let o=t.renderPipes?t:t.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};ml.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"renderGroup"}});var gl,BA=y(()=>{U();Ut();Xa();gl=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,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(Yr);return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)se.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}};gl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"sprite"}});var on,wx=y(()=>{Ct();on="8.9.2"});var xl,yl,Ex=y(()=>{U();wx();xl=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,on)}static destroy(){}};xl.extension=S.Application;yl=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,on)}destroy(){this._renderer=null}};yl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"initHook",priority:-10}});var Ax,Px,FA=y(()=>{U();Mr();rg();Ax=class kA{constructor(e,t){this.state=Qe.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new La)),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=kA.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let t=this._activeBatches;for(let i in t){let s=t[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(e){let t=this._batchersByInstructionSet[e.uid];for(let i in t){let s=t[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let t=e.batcher,i=t.geometry,s=t.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};Ax.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"batch"};Ax._availableBatchers=Object.create(null);Px=Ax;V.handleByMap(S.Batcher,Px._availableBatchers);V.add(La)});var OA,UA=y(()=>{OA=`in vec2 vMaskCoord;
|
|
595
|
+
`}}});var cl,vA=y(()=>{U();ge();zi();en();$i();bx();Cr();ve();Ae();cl=class{init(){let e=Vr({name:"mesh",bits:[ks,_A,zr]});this._shader=new Ke({gpuProgram:e,resources:{uTexture:k.EMPTY._source,uSampler:k.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){W("Mesh shader has no gpuProgram",t.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=e.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};cl.extension={type:[S.WebGPUPipesAdaptor],name:"mesh"}});var qh,ul,TA=y(()=>{U();Mr();rh();qh=Qe.for2d(),ul=class{start(e,t,i){let s=e.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=t,o.setGeometry(t,n),qh.blendMode="normal",s.pipeline.getPipeline(t,n,qh);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(e,t){let i=this._shader.gpuProgram,s=e.renderer,o=s.encoder;if(!t.bindGroup){let l=t.textures;t.bindGroup=Co(l.textures,l.count)}qh.blendMode=t.blendMode;let n=s.bindGroup.getBindGroup(t.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,qh,t.topology);t.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(t.size,1,t.start)}};ul.extension={type:[S.WebGPUPipesAdaptor],name:"batch"}});var hl,SA=y(()=>{U();hl=class{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}};hl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"customRender"}});function dl(r,e){let t=r.instructionSet,i=t.instructions;for(let s=0;s<t.instructionSize;s++){let o=i[s];e[o.renderPipeId].execute(o)}}var vx=y(()=>{"use strict"});var lU,fl,wA=y(()=>{U();ge();Ut();Xa();vx();lU=new G,fl=class{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(se.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){let i=e._batchableRenderGroup??(e._batchableRenderGroup=se.get(Yr));i.renderable=e.root,i.transform=e.root.relativeGroupTransform,i.texture=e.texture,i.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.batch.addToBatch(i,t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;let t=lU.identity().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295}),dl(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),dl(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};fl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"renderGroup"}});function pl(r,e){e||(e=0);for(let t=e;t<r.length&&r[t];t++)r[t]=null}var Tx=y(()=>{"use strict"});function Sx(r,e=!1){uU(r);let t=r.childrenToUpdate,i=r.updateTick++;for(let s in t){let o=Number(s),n=t[s],a=n.list,l=n.index;for(let c=0;c<l;c++){let u=a[c];u.parentRenderGroup===r&&u.relativeRenderGroupDepth===o&&PA(u,i,0)}pl(a,l),n.index=0}if(e)for(let s=0;s<r.renderGroupChildren.length;s++)Sx(r.renderGroupChildren[s],e)}function uU(r){let e=r.root,t;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(e.relativeGroupTransform,i.worldTransform),r.worldColor=mo(e.groupColor,i.worldColor),t=e.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(e.localTransform),r.worldColor=e.localColor,t=e.localAlpha;t=t<0?0:t>1?1:t,r.worldAlpha=t,r.worldColorAlpha=r.worldColor+((t*255|0)<<24)}function PA(r,e,t){if(e===r.updateTick)return;r.updateTick=e,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(t|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),t&EA&&AA(r,s,t)):(t=r._updateFlags,r.relativeGroupTransform.copyFrom(i),t&EA&&AA(r,cU,t)),!r.renderGroup){let o=r.children,n=o.length;for(let c=0;c<n;c++)PA(o[c],e,t);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function AA(r,e,t){if(t&_o){r.groupColor=mo(r.localColor,e.groupColor);let i=r.localAlpha*e.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}t&ya&&(r.groupBlendMode=r.localBlendMode==="inherit"?e.groupBlendMode:r.localBlendMode),t&bs&&(r.globalDisplayStatus=r.localDisplayStatus&e.globalDisplayStatus),r._updateFlags=0}var cU,EA,CA=y(()=>{Ar();Tx();Zp();cU=new te,EA=bs|_o|ya});function MA(r,e){let{list:t,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=t[o];if(s=e[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var RA=y(()=>{"use strict"});var hU,ml,IA=y(()=>{U();ge();Fi();zt();Tx();vx();CA();RA();hU=new G,ml=class{constructor(e){this._renderer=e}render({container:e,transform:t}){let i=e.parent,s=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let o=this._renderer,n=hU;t&&(n=n.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let a=o.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),o.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),dl(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(n),e.parent=i,e.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e.isCachedAsTexture){if(!e.updateCacheTexture)return;t=e}e._parentCacheAsTextureRenderGroup=t;for(let i=e.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(e.renderGroupChildren[i],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){let i=e.root.getLocalBounds();i.ceil();let s=e.texture;e.texture&&Xe.returnTexture(e.texture);let o=this._renderer,n=e.textureOptions.resolution||o.view.resolution,a=e.textureOptions.antialias??o.view.antialias;e.texture=Xe.getOptimalTexture(i.width,i.height,n,a),e._textureBounds||(e._textureBounds=new Ee),e._textureBounds.copyFrom(i),s!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(Xe.returnTexture(e.texture),e.texture=null)}_updateRenderGroups(e){let t=this._renderer,i=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=i,e.structureDidChange?pl(e.childrenRenderablesToUpdate.list,0):MA(e,i),Sx(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let s=0;s<e.renderGroupChildren.length;s++)this._updateRenderGroups(e.renderGroupChildren[s])}_updateRenderables(e){let{list:t,index:i}=e.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=t[s];o.didViewUpdate&&e.updateRenderable(o)}pl(t,i)}_buildInstructions(e,t){let i=e.root,s=e.instructionSet;s.reset();let o=t.renderPipes?t:t.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};ml.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"renderGroup"}});var gl,BA=y(()=>{U();Ut();Xa();gl=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,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(Yr);return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)se.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}};gl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"sprite"}});var on,wx=y(()=>{Ct();on="8.9.2"});var xl,yl,Ex=y(()=>{U();wx();xl=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,on)}static destroy(){}};xl.extension=S.Application;yl=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,on)}destroy(){this._renderer=null}};yl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"initHook",priority:-10}});var Ax,Px,FA=y(()=>{U();Mr();rg();Ax=class kA{constructor(e,t){this.state=Qe.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new La)),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=kA.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let t=this._activeBatches;for(let i in t){let s=t[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(e){let t=this._batchersByInstructionSet[e.uid];for(let i in t){let s=t[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let t=e.batcher,i=t.geometry,s=t.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};Ax.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"batch"};Ax._availableBatchers=Object.create(null);Px=Ax;V.handleByMap(S.Batcher,Px._availableBatchers);V.add(La)});var OA,UA=y(()=>{OA=`in vec2 vMaskCoord;
|
|
596
596
|
in vec2 vTextureCoord;
|
|
597
597
|
|
|
598
598
|
uniform sampler2D uTexture;
|
|
@@ -761,7 +761,7 @@ fn mainFragment(
|
|
|
761
761
|
|
|
762
762
|
return source * a;
|
|
763
763
|
}
|
|
764
|
-
`});var Kh,NA=y(()=>{ge();Es();Io();Rt();am();gx();UA();LA();DA();Kh=class extends tn{constructor(e){let{sprite:t,...i}=e,s=new yo(t.texture),o=new be({uFilterMatrix:{value:new L,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}}),n=gr.from({vertex:{source:Cx,entryPoint:"mainVertex"},fragment:{source:Cx,entryPoint:"mainFragment"}}),a=mr.from({vertex:GA,fragment:OA,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=s}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(e,t,i,s){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,i,s)}}});var dU,Mx,_l,HA=y(()=>{U();Mu();NA();zt();ma();Ca();Ut();ve();Fi();Xr();dU=new Ee,Mx=class extends ui{constructor(){super(),this.filters=[new Kh({sprite:new Te(k.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}},_l=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){let o=e.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){let t=this._renderer,i=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let s=se.get(Mx);if(s.inverse=e.inverse,i){e.mask.mask.measurable=!0;let o=po(e.mask.mask,!0,dU);e.mask.mask.measurable=!1,o.ceil();let n=t.renderTarget.renderTarget.colorTexture.source,a=Xe.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer,filterTexture:a})}else s.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(t.type===st.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let s=this._activeMaskStage.pop();i&&Xe.returnTexture(s.filterTexture),se.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};_l.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"alphaMask"}});var bl,VA=y(()=>{U();bl=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}};bl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"colorMask"}});var vl,WA=y(()=>{U();rn();ws();vl=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,i){var s;let o=e,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let c=i.instructionSize-l.instructionsStart-1;l.instructionsLength=c;let u=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[u]??(s[u]=0)}pop(e,t,i){let s=e,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(e);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(t=this._maskStackHash)[s]??(t[s]=0);e.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Fe.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):e.action==="pushMaskEnd"?(e.inverse?i.stencil.setStencilMode(Fe.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Fe.MASK_ACTIVE,o),i.colorMask.setMask(15)):e.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Fe.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,gt.STENCIL),i.stencil.setStencilMode(Fe.DISABLED,o)),o--):e.action==="popMaskEnd"&&(e.inverse?i.stencil.setStencilMode(Fe.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Fe.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};vl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"stencilMask"}});var Rx,$A,XA=y(()=>{vt();U();Rx=class zA{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new oe(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...zA.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Rx.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"background",priority:0};Rx.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};$A=Rx});var Tl,Sl,jA=y(()=>{U();Mu();Ae();Tl={};V.handle(S.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Tl[r.name]=r.ref},r=>{delete Tl[r.name]});Sl=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(e,t,i){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Tl[t],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!Tl[t]){W(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[t];i||(i=this._filterHash[t]=new ui,i.filters=[new Tl[t]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,e.add(s)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}};Sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"blendMode"}});var Ix,Bx,qA,KA=y(()=>{U();Ar();ve();Ix={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Bx=class YA{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof te||e instanceof k?{target:e,...t}:{...t,...e}}async image(e){let t=new Image;return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,YA.defaultImageOptions);let{format:t,quality:i}=e,s=this.canvas(e);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},Ix[t],i)});if(s.toDataURL!==void 0)return s.toDataURL(Ix[t],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Ix[t],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer;if(t instanceof k)return i.texture.generateCanvas(t);let s=i.textureGenerator.generateTexture(e),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer,s=t instanceof k?t:i.textureGenerator.generateTexture(e),o=i.texture.getPixels(s);return t instanceof te&&s.destroy(!0),o}texture(e){return e=this._normalizeOptions(e),e.target instanceof k?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let t=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=t.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let t=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Bx.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"extract"};Bx.defaultImageOptions={format:"png",quality:1};qA=Bx});var qi,kx=y(()=>{$t();ve();qi=class r extends k{static create(e){return new r({source:new we(e)})}resize(e,t,i){return this.source.resize(e,t,i),this}}});var fU,pU,mU,wl,ZA=y(()=>{vt();U();ge();ct();zt();Fu();Ar();kx();fU=new Q,pU=new Ee,mU=[0,0,0,0],wl=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof te&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,i=e.antialias||this._renderer.view.antialias,s=e.target,o=e.clearColor;o?o=Array.isArray(o)&&o.length===4?o:oe.shared.setValue(o).toArray():o=mU;let n=e.frame?.copyTo(fU)||go(s,pU).rectangle;n.width=Math.max(n.width,1/t)|0,n.height=Math.max(n.height,1/t)|0;let a=qi.create({...e.textureSourceOptions,width:n.width,height:n.height,resolution:t,antialias:i}),l=L.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};wl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGenerator"}});var El,QA=y(()=>{U();ge();dr();Ho();Hi();Xr();Rt();El=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new L,worldColor:4294967295,offset:new de},l={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},c=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(c);let u=c.uniforms;u.uProjectionMatrix=l.projectionMatrix,u.uResolution=l.resolution,u.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),u.uWorldTransformMatrix.tx-=l.offset.x,u.uWorldTransformMatrix.ty-=l.offset.y,jr(l.worldColor,u.uWorldColorAlpha,0),c.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(c,!1):(h=this._bindGroupPool.pop()||new mt,this._activeBindGroups.push(h),h.setResource(c,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===st.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new be({uProjectionMatrix:{value:new L,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new L,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};El.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"globalUniforms"}});var gU,Al,JA=y(()=>{U();To();gU=1,Al=class{constructor(){this._tasks=[],this._offset=0}init(){ut.system.add(this._update,this)}repeat(e,t,i=!0){let s=gU++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e){this._tasks.splice(t,1);return}}_update(){let e=performance.now();for(let t=0;t<this._tasks.length;t++){let i=this._tasks[t];if(e-i.offset-i.last>=i.duration){let s=e-i.start;i.func(s),i.last=e}}}destroy(){ut.system.remove(this._update,this),this._tasks.length=0}};Al.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"scheduler",priority:0}});function t1(r){if(!e1){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${on} (${r}) http://www.pixijs.com/
|
|
764
|
+
`});var Kh,NA=y(()=>{ge();Es();Io();Rt();am();gx();UA();LA();DA();Kh=class extends tn{constructor(e){let{sprite:t,...i}=e,s=new yo(t.texture),o=new be({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}}),n=gr.from({vertex:{source:Cx,entryPoint:"mainVertex"},fragment:{source:Cx,entryPoint:"mainFragment"}}),a=mr.from({vertex:GA,fragment:OA,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=s}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(e,t,i,s){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,i,s)}}});var dU,Mx,_l,HA=y(()=>{U();Mu();NA();zt();ma();Ca();Ut();ve();Fi();Xr();dU=new Ee,Mx=class extends ui{constructor(){super(),this.filters=[new Kh({sprite:new Te(k.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}},_l=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){let o=e.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){let t=this._renderer,i=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let s=se.get(Mx);if(s.inverse=e.inverse,i){e.mask.mask.measurable=!0;let o=po(e.mask.mask,!0,dU);e.mask.mask.measurable=!1,o.ceil();let n=t.renderTarget.renderTarget.colorTexture.source,a=Xe.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer,filterTexture:a})}else s.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(t.type===st.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let s=this._activeMaskStage.pop();i&&Xe.returnTexture(s.filterTexture),se.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};_l.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"alphaMask"}});var bl,VA=y(()=>{U();bl=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}};bl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"colorMask"}});var vl,WA=y(()=>{U();rn();ws();vl=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,i){var s;let o=e,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let c=i.instructionSize-l.instructionsStart-1;l.instructionsLength=c;let u=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[u]??(s[u]=0)}pop(e,t,i){let s=e,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(e);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(t=this._maskStackHash)[s]??(t[s]=0);e.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Fe.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):e.action==="pushMaskEnd"?(e.inverse?i.stencil.setStencilMode(Fe.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Fe.MASK_ACTIVE,o),i.colorMask.setMask(15)):e.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Fe.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,gt.STENCIL),i.stencil.setStencilMode(Fe.DISABLED,o)),o--):e.action==="popMaskEnd"&&(e.inverse?i.stencil.setStencilMode(Fe.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Fe.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};vl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"stencilMask"}});var Rx,$A,XA=y(()=>{vt();U();Rx=class zA{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new oe(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...zA.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Rx.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"background",priority:0};Rx.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};$A=Rx});var Tl,Sl,jA=y(()=>{U();Mu();Ae();Tl={};V.handle(S.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Tl[r.name]=r.ref},r=>{delete Tl[r.name]});Sl=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(e,t,i){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Tl[t],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!Tl[t]){W(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[t];i||(i=this._filterHash[t]=new ui,i.filters=[new Tl[t]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,e.add(s)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}};Sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"blendMode"}});var Ix,Bx,qA,KA=y(()=>{U();Ar();ve();Ix={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Bx=class YA{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof te||e instanceof k?{target:e,...t}:{...t,...e}}async image(e){let t=new Image;return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,YA.defaultImageOptions);let{format:t,quality:i}=e,s=this.canvas(e);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},Ix[t],i)});if(s.toDataURL!==void 0)return s.toDataURL(Ix[t],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Ix[t],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer;if(t instanceof k)return i.texture.generateCanvas(t);let s=i.textureGenerator.generateTexture(e),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer,s=t instanceof k?t:i.textureGenerator.generateTexture(e),o=i.texture.getPixels(s);return t instanceof te&&s.destroy(!0),o}texture(e){return e=this._normalizeOptions(e),e.target instanceof k?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let t=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=t.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let t=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Bx.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"extract"};Bx.defaultImageOptions={format:"png",quality:1};qA=Bx});var qi,kx=y(()=>{$t();ve();qi=class r extends k{static create(e){return new r({source:new we(e)})}resize(e,t,i){return this.source.resize(e,t,i),this}}});var fU,pU,mU,wl,ZA=y(()=>{vt();U();ge();ct();zt();Fu();Ar();kx();fU=new Q,pU=new Ee,mU=[0,0,0,0],wl=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof te&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,i=e.antialias||this._renderer.view.antialias,s=e.target,o=e.clearColor;o?o=Array.isArray(o)&&o.length===4?o:oe.shared.setValue(o).toArray():o=mU;let n=e.frame?.copyTo(fU)||go(s,pU).rectangle;n.width=Math.max(n.width,1/t)|0,n.height=Math.max(n.height,1/t)|0;let a=qi.create({...e.textureSourceOptions,width:n.width,height:n.height,resolution:t,antialias:i}),l=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};wl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGenerator"}});var El,QA=y(()=>{U();ge();dr();Ho();Hi();Xr();Rt();El=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new de},l={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},c=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(c);let u=c.uniforms;u.uProjectionMatrix=l.projectionMatrix,u.uResolution=l.resolution,u.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),u.uWorldTransformMatrix.tx-=l.offset.x,u.uWorldTransformMatrix.ty-=l.offset.y,jr(l.worldColor,u.uWorldColorAlpha,0),c.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(c,!1):(h=this._bindGroupPool.pop()||new mt,this._activeBindGroups.push(h),h.setResource(c,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===st.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new be({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};El.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"globalUniforms"}});var gU,Al,JA=y(()=>{U();To();gU=1,Al=class{constructor(){this._tasks=[],this._offset=0}init(){ut.system.add(this._update,this)}repeat(e,t,i=!0){let s=gU++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e){this._tasks.splice(t,1);return}}_update(){let e=performance.now();for(let t=0;t<this._tasks.length;t++){let i=this._tasks[t];if(e-i.offset-i.last>=i.duration){let s=e-i.start;i.func(s),i.last=e}}}destroy(){ut.system.remove(this._update,this),this._tasks.length=0}};Al.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"scheduler",priority:0}});function t1(r){if(!e1){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${on} (${r}) http://www.pixijs.com/
|
|
765
765
|
|
|
766
766
|
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${on} - ${r} - http://www.pixijs.com/`);e1=!0}}var e1,r1=y(()=>{Re();wx();e1=!1});var nn,i1=y(()=>{U();r1();Xr();nn=class{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===st.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),t1(t)}}};nn.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"hello",priority:-2};nn.defaultOptions={hello:!1}});function s1(r){let e=!1;for(let i in r)if(r[i]==null){e=!0;break}if(!e)return r;let t=Object.create(null);for(let i in r){let s=r[i];s&&(t[i]=s)}return t}function o1(r){let e=0;for(let t=0;t<r.length;t++)r[t]==null?e++:r[t-e]=r[t];return r.length-=e,r}var n1=y(()=>{"use strict"});var xU,Fx,l1,c1=y(()=>{U();n1();xU=0,Fx=class a1{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(e){e={...a1.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let t of this._managedHashes)t.context[t.hash]=s1(t.context[t.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let t of this._managedArrays)o1(t.context[t.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,t){this._managedHashes.push({context:e,hash:t})}addManagedArray(e,t){this._managedArrays.push({context:e,hash:t})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=xU++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,t=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=e),e-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let c=i;a&&(a.structureDidChange=!0),c[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else t[o-s]=n}t.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let t=this._managedRenderables.indexOf(e);t>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[t]=null)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,t)}};Fx.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"renderableGC",priority:0};Fx.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};l1=Fx});var Ox,h1,d1=y(()=>{U();Ox=class u1{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(e){e={...u1.defaultOptions,...e},this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=e.textureGCAMaxIdle??e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let t=0;t<e.length;t++){let i=e[t];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Ox.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGC"};Ox.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};h1=Ox});var f1,Pl,Ux=y(()=>{St();$t();ve();f1=class p1{constructor(e={}){if(this.uid=he("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...p1.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let t=0;t<e.colorTextures;t++)this.colorTextures.push(new we({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}))}else{this.colorTextures=[...e.colorTextures.map(i=>i.source)];let t=this.colorTexture.source;this.resize(t.width,t.height,t._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof k||e.depthStencilTexture instanceof we?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new we({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(e,t,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};f1.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Pl=f1});function Fs(r,e){if(!Cl.has(r)){let t=new k({source:new Mt({resource:r,...e})}),i=()=>{Cl.get(r)===t&&Cl.delete(r)};t.once("destroy",i),t.source.once("destroy",i),Cl.set(r,t)}return Cl.get(r)}var Cl,Zh=y(()=>{wo();ve();Cl=new Map});var Gx,g1,x1=y(()=>{Re();U();ct();$e();Ux();Zh();Gx=class m1{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...m1.defaultOptions,...e},e.view&&(X(ie,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new Q(0,0,e.width,e.height),this.canvas=e.canvas||j.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Fs(this.canvas,e),this.renderTarget=new Pl({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,t,i){this.texture.source.resize(e,t,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Gx.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"view",priority:0};Gx.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};g1=Gx});var Qh,Jh,Lx=y(()=>{SA();wA();IA();BA();Ex();FA();HA();VA();WA();XA();jA();KA();ZA();QA();JA();i1();c1();d1();x1();Qh=[$A,El,nn,g1,ml,h1,wl,qA,yl,l1,Al],Jh=[Sl,Px,gl,fl,_l,vl,bl,hl]});var Ml,y1=y(()=>{U();Ml=class{constructor(e){this._hash=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(e){this._gpu=e}getBindGroup(e,t,i){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,i)}_createBindGroup(e,t,i){let s=this._gpu.device,o=t.layout[i],n=[],a=this._renderer;for(let u in o){let h=e.resources[u]??e.resources[o[u]],d;if(h._resourceType==="uniformGroup"){let f=h;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(h._resourceType==="buffer"){let f=h;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(h._resourceType==="bufferResource"){let f=h;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(h._resourceType==="textureSampler"){let f=h;d=a.texture.getGpuSampler(f)}else if(h._resourceType==="textureSource"){let f=h;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[u],resource:d})}let l=a.shader.getProgramData(t).bindGroups[i],c=s.createBindGroup({layout:l,entries:n});return this._hash[e._key]=c,c}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}};Ml.extension={type:[S.WebGPUSystem],name:"bindGroup"}});var Rl,_1=y(()=>{U();Dm();Rl=class{constructor(e){this._gpuBuffers=Object.create(null),this._managedBuffers=[],e.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),i=e.data;return e._updateID&&i&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,i.buffer,0,(e._updateSize||i.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(Ba(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}};Rl.extension={type:[S.WebGPUSystem],name:"buffer"}});var Il,b1=y(()=>{U();Il=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}};Il.extension={type:[S.WebGPUSystem],name:"colorMask"}});var an,v1=y(()=>{Re();U();an=class{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(e).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await j.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>t.features.has(o)),s=await t.requestDevice({requiredFeatures:i});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}};an.extension={type:[S.WebGPUSystem],name:"device"};an.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Bl,T1=y(()=>{U();Bl=class{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,i,s){let o=this._renderer.pipeline.getPipeline(e,t,i,s);this.setPipeline(o)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,i){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(t,i,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){let i=this._renderer.pipeline.getBufferNamesToBind(e,t);for(let s in i)this._setVertexBuffer(s,e.attributes[i[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let i in e.groups){let s=e.groups[i];t||this._syncBindGroup(s),this.setBindGroup(i,s,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let i=e.resources[t];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(e){let{geometry:t,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,i.gpuProgram,s,o),this.setGeometry(t,i.gpuProgram),this._setShaderBindGroups(i,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,l??t.instanceCount,a||0):this.renderPassEncoder.draw(n||t.getSize(),l??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,i={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}};Bl.extension={type:[S.WebGPUSystem],name:"encoder",priority:1}});var kl,S1=y(()=>{U();ws();kl=class{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Fe.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=e,i.stencilReference=t;let s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};kl.extension={type:[S.WebGPUSystem],name:"stencil"}});var ln,Dx=y(()=>{yx();Vi();mi();ln=class{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!Xh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new qe({data:new Float32Array(t.layout.size/4),usage:le.UNIFORM|le.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,i=this._syncFunctionHash[t];if(!i){let s=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[t]={layout:o,syncFunction:n}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,i){let s=this.getUniformGroupData(e);e.buffer||(e.buffer=new qe({data:new Float32Array(s.layout.size/4),usage:le.UNIFORM|le.COPY_DST}));let o=null;return t||(t=e.buffer.data,o=e.buffer.dataInt32),i||(i=0),s.syncFunction(e.uniforms,t,o,i),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}});function w1(r){let e=r.map(i=>({data:i,offset:0,size:0})),t=0;for(let i=0;i<e.length;i++){let s=e[i],o=Fl[s.data.type].size,n=Fl[s.data.type].align;if(!Fl[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=o,s.offset=t,t+=o}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}var Fl,Nx=y(()=>{"use strict";Fl={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var _i,Hx=y(()=>{"use strict";_i=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
|
|
767
767
|
var matrix = uv[name].toArray(true);
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var P1=y(()=>{Nx()});function C1(r){return ed(r,"uboWgsl",A1,E1)}var M1=y(()=>{Vx();zx();P1()});var Ol,R1=y(()=>{U();Dx();Nx();M1();Ol=class extends ln{constructor(){super({createUboElements:w1,generateUboSync:C1})}};Ol.extension={type:[S.WebGPUSystem],name:"ubo"}});var Ki,td=y(()=>{Ct();St();Ki=class extends Ce{constructor({buffer:e,offset:t,size:i}){super(),this.uid=he("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=he("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=he("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var rd,I1=y(()=>{"use strict";rd=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 t=this.byteIndex,i=t+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,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let i=0;i<e.length;i++)this.data[t/4+i]=e[i];return t}destroy(){this.data=null}}});var Zi,Ul,B1=y(()=>{U();Vi();td();mi();I1();Hi();Zi=128,Ul=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 rd({minUniformOffsetAlignment:Zi});let t=256/Zi;for(let i=0;i<t;i++){let s=le.UNIFORM|le.COPY_DST;i===0&&(s|=le.COPY_SRC),this._buffers.push(new qe({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,t){if(!t&&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/Zi),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let t=e.buffer.data,i=this._batchBuffer.addGroup(t);return this._getBufferResource(i/Zi)}getArrayBindGroup(e){let t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/Zi)}getArrayBufferResource(e){let i=this._batchBuffer.addGroup(e)/Zi;return this._getBufferResource(i)}_getBufferResource(e){if(!this._bufferResources[e]){let t=this._buffers[e%2];this._bufferResources[e]=new Ki({buffer:t,offset:(e/2|0)*256,size:Zi})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let t=new mt({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);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(t),Zi,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}};Ul.extension={type:[S.WebGPUPipes],name:"uniformBatch"}});function id(r,e){for(let t in r.attributes){let i=r.attributes[t],s=e[t];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):W(`Attribute ${t} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}yU(r)}function yU(r){let{buffers:e,attributes:t}=r,i={},s={};for(let o in e){let n=e[o];i[n.uid]=0,s[n.uid]=0}for(let o in t){let n=t[o];i[n.buffer.uid]+=jt(n.format).stride}for(let o in t){let n=t[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=jt(n.format).stride}}var $x=y(()=>{Ae();As()});var Kr,Xx=y(()=>{ws();Kr=[];Kr[Fe.NONE]=void 0;Kr[Fe.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Kr[Fe.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Kr[Fe.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Kr[Fe.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Kr[Fe.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function bU(r,e,t,i,s){return r<<24|e<<16|t<<10|i<<5|s}function vU(r,e,t,i){return t<<6|r<<3|i<<1|e}var _U,Gl,k1=y(()=>{U();Ae();$x();ws();Oa();Xx();_U={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Gl=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(Fe.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=Kr[e],this._updatePipeHash())}setPipeline(e,t,i,s){let o=this.getPipeline(e,t,i);s.setPipeline(o)}getPipeline(e,t,i,s){e._layoutKey||(id(e,t.attributeData),this._generateBufferKey(e)),s||(s=e.topology);let o=bU(e._layoutKey,t._layoutKey,i.data,i._blendModeId,_U[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(e,t,i,s),this._pipeCache[o])}_createPipeline(e,t,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Fe.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(t).pipeline,c={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.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 t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],i=0,s=Object.keys(e.attributes).sort();for(let n=0;n<s.length;n++){let a=e.attributes[s[n]];t[i++]=a.offset,t[i++]=a.format,t[i++]=a.stride,t[i++]=a.instance}let o=t.join("|");return e._layoutKey=gi(o,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let t=[],i=0,s=Object.keys(e.attributeData).sort();for(let n=0;n<s.length;n++){let a=e.attributeData[s[n]];t[i++]=a.location}let o=t.join("|");return e._attributeLocationsKey=gi(o,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){let i=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(e,t),o=Object.create(null),n=t.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,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);let i=e._layoutKey<<16|t._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 t.attributeData){let c=e.attributes[l];(c.divisor??1)!==1&&W(`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:t.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let e=vU(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}};Gl.extension={type:[S.WebGPUSystem],name:"pipeline"}});function F1(r,e,t,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-e*r.a,r.ty=-n-t*r.d,r}var O1=y(()=>{"use strict"});function U1(r){let e=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var G1=y(()=>{"use strict"});var un,jx=y(()=>{ge();ct();rn();O1();_x();wo();$t();ve();Zh();G1();Ux();un=class{constructor(e){this.rootViewPort=new Q,this.viewport=new Q,this.onRenderTargetChange=new sn("onRenderTargetChange"),this.projectionMatrix=new L,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:t,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(e,t,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=U1(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!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 k&&(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 F1(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,t,i,c),n&&this.onRenderTargetChange.emit(o),o}clear(e,t=gt.ALL,i){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=gt.ALL,i,s){let o=this.bind(e,t,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,t,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,t,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,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return Mt.test(e)&&(e=Fs(e).source),e instanceof Pl?t=e:e instanceof we&&(t=new Pl({colorTextures:[e]}),Mt.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[t.uid];i&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var sd,L1=y(()=>{"use strict";sd=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var od,D1=y(()=>{rn();wo();$t();L1();od=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(e),l=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),t}startRenderPass(e,t=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,t,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 t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,i){typeof t=="boolean"&&(t=t?gt.ALL:gt.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=t>.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=t>.STENCIL?"clear":"load",u=t>.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,t=!0,i,s){if(!t)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(e,t,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,t,i,s)}initGpuRenderTarget(e){e.isRoot=!0;let t=new sd;return e.colorTextures.forEach((i,s)=>{if(Mt.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)}t.contexts[s]=o}if(t.msaa=i.source.antialias,i.source.antialias){let o=new we({width:0,height:0,sampleCount:4});t.msaaTextures[s]=o}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((i,s)=>{t.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Ll,N1=y(()=>{U();jx();D1();Ll=class extends un{constructor(e){super(e),this.adaptor=new od,this.adaptor.init(e,this)}};Ll.extension={type:[S.WebGPUSystem],name:"renderTarget"}});var Dl,H1=y(()=>{U();Dl=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 t=this._gpu.device,i=e.gpuLayout.map(o=>t.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Dl.extension={type:[S.WebGPUSystem],name:"shader"}});var Ht,V1=y(()=>{"use strict";Ht={};Ht.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ht.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ht.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ht.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ht["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ht["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ht.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ht.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ht.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Nl,W1=y(()=>{U();Mr();V1();Nl=class{constructor(){this.defaultState=new Qe,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:Ht[e.blendMode]||Ht.normal}]}destroy(){this.gpu=null}};Nl.extension={type:[S.WebGPUSystem],name:"state"}});var z1,$1=y(()=>{"use strict";z1={type:"image",upload(r,e,t){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;t.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var Yx,TU,X1,j1=y(()=>{"use strict";Yx={"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}},TU={blockBytes:4,blockWidth:1,blockHeight:1},X1={type:"compressed",upload(r,e,t){let i=r.pixelWidth,s=r.pixelHeight,o=Yx[r.format]||TU;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;t.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 nd,qx=y(()=>{"use strict";nd={type:"image",upload(r,e,t){let i=r.resource;if(!i)return;let s=Math.min(e.width,r.resourceWidth||r.pixelWidth),o=Math.min(e.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:n},{width:s,height:o})}}});var Y1,q1=y(()=>{qx();Y1={type:"video",upload(r,e,t){nd.upload(r,e,t)}}});var ad,K1=y(()=>{"use strict";ad=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
910
|
+
`}var P1=y(()=>{Nx()});function C1(r){return ed(r,"uboWgsl",A1,E1)}var M1=y(()=>{Vx();zx();P1()});var Ol,R1=y(()=>{U();Dx();Nx();M1();Ol=class extends ln{constructor(){super({createUboElements:w1,generateUboSync:C1})}};Ol.extension={type:[S.WebGPUSystem],name:"ubo"}});var Ki,td=y(()=>{Ct();St();Ki=class extends Ce{constructor({buffer:e,offset:t,size:i}){super(),this.uid=he("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=he("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=he("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var rd,I1=y(()=>{"use strict";rd=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 t=this.byteIndex,i=t+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,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let i=0;i<e.length;i++)this.data[t/4+i]=e[i];return t}destroy(){this.data=null}}});var Zi,Ul,B1=y(()=>{U();Vi();td();mi();I1();Hi();Zi=128,Ul=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 rd({minUniformOffsetAlignment:Zi});let t=256/Zi;for(let i=0;i<t;i++){let s=le.UNIFORM|le.COPY_DST;i===0&&(s|=le.COPY_SRC),this._buffers.push(new qe({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,t){if(!t&&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/Zi),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let t=e.buffer.data,i=this._batchBuffer.addGroup(t);return this._getBufferResource(i/Zi)}getArrayBindGroup(e){let t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/Zi)}getArrayBufferResource(e){let i=this._batchBuffer.addGroup(e)/Zi;return this._getBufferResource(i)}_getBufferResource(e){if(!this._bufferResources[e]){let t=this._buffers[e%2];this._bufferResources[e]=new Ki({buffer:t,offset:(e/2|0)*256,size:Zi})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let t=new mt({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);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(t),Zi,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}};Ul.extension={type:[S.WebGPUPipes],name:"uniformBatch"}});function id(r,e){for(let t in r.attributes){let i=r.attributes[t],s=e[t];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):W(`Attribute ${t} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}yU(r)}function yU(r){let{buffers:e,attributes:t}=r,i={},s={};for(let o in e){let n=e[o];i[n.uid]=0,s[n.uid]=0}for(let o in t){let n=t[o];i[n.buffer.uid]+=jt(n.format).stride}for(let o in t){let n=t[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=jt(n.format).stride}}var $x=y(()=>{Ae();As()});var Kr,Xx=y(()=>{ws();Kr=[];Kr[Fe.NONE]=void 0;Kr[Fe.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Kr[Fe.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Kr[Fe.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Kr[Fe.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Kr[Fe.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function bU(r,e,t,i,s){return r<<24|e<<16|t<<10|i<<5|s}function vU(r,e,t,i){return t<<6|r<<3|i<<1|e}var _U,Gl,k1=y(()=>{U();Ae();$x();ws();Oa();Xx();_U={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Gl=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(Fe.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=Kr[e],this._updatePipeHash())}setPipeline(e,t,i,s){let o=this.getPipeline(e,t,i);s.setPipeline(o)}getPipeline(e,t,i,s){e._layoutKey||(id(e,t.attributeData),this._generateBufferKey(e)),s||(s=e.topology);let o=bU(e._layoutKey,t._layoutKey,i.data,i._blendModeId,_U[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(e,t,i,s),this._pipeCache[o])}_createPipeline(e,t,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Fe.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(t).pipeline,c={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.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 t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],i=0,s=Object.keys(e.attributes).sort();for(let n=0;n<s.length;n++){let a=e.attributes[s[n]];t[i++]=a.offset,t[i++]=a.format,t[i++]=a.stride,t[i++]=a.instance}let o=t.join("|");return e._layoutKey=gi(o,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let t=[],i=0,s=Object.keys(e.attributeData).sort();for(let n=0;n<s.length;n++){let a=e.attributeData[s[n]];t[i++]=a.location}let o=t.join("|");return e._attributeLocationsKey=gi(o,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){let i=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(e,t),o=Object.create(null),n=t.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,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);let i=e._layoutKey<<16|t._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 t.attributeData){let c=e.attributes[l];(c.divisor??1)!==1&&W(`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:t.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let e=vU(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}};Gl.extension={type:[S.WebGPUSystem],name:"pipeline"}});function F1(r,e,t,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-e*r.a,r.ty=-n-t*r.d,r}var O1=y(()=>{"use strict"});function U1(r){let e=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var G1=y(()=>{"use strict"});var un,jx=y(()=>{ge();ct();rn();O1();_x();wo();$t();ve();Zh();G1();Ux();un=class{constructor(e){this.rootViewPort=new Q,this.viewport=new Q,this.onRenderTargetChange=new sn("onRenderTargetChange"),this.projectionMatrix=new G,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:t,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(e,t,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=U1(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!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 k&&(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 F1(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,t,i,c),n&&this.onRenderTargetChange.emit(o),o}clear(e,t=gt.ALL,i){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=gt.ALL,i,s){let o=this.bind(e,t,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,t,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,t,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,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return Mt.test(e)&&(e=Fs(e).source),e instanceof Pl?t=e:e instanceof we&&(t=new Pl({colorTextures:[e]}),Mt.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[t.uid];i&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var sd,L1=y(()=>{"use strict";sd=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var od,D1=y(()=>{rn();wo();$t();L1();od=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(e),l=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),t}startRenderPass(e,t=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,t,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 t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,i){typeof t=="boolean"&&(t=t?gt.ALL:gt.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=t>.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=t>.STENCIL?"clear":"load",u=t>.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,t=!0,i,s){if(!t)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(e,t,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,t,i,s)}initGpuRenderTarget(e){e.isRoot=!0;let t=new sd;return e.colorTextures.forEach((i,s)=>{if(Mt.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)}t.contexts[s]=o}if(t.msaa=i.source.antialias,i.source.antialias){let o=new we({width:0,height:0,sampleCount:4});t.msaaTextures[s]=o}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((i,s)=>{t.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Ll,N1=y(()=>{U();jx();D1();Ll=class extends un{constructor(e){super(e),this.adaptor=new od,this.adaptor.init(e,this)}};Ll.extension={type:[S.WebGPUSystem],name:"renderTarget"}});var Dl,H1=y(()=>{U();Dl=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 t=this._gpu.device,i=e.gpuLayout.map(o=>t.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Dl.extension={type:[S.WebGPUSystem],name:"shader"}});var Ht,V1=y(()=>{"use strict";Ht={};Ht.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ht.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ht.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ht.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ht["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ht["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ht["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ht.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ht.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ht.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Nl,W1=y(()=>{U();Mr();V1();Nl=class{constructor(){this.defaultState=new Qe,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:Ht[e.blendMode]||Ht.normal}]}destroy(){this.gpu=null}};Nl.extension={type:[S.WebGPUSystem],name:"state"}});var z1,$1=y(()=>{"use strict";z1={type:"image",upload(r,e,t){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;t.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var Yx,TU,X1,j1=y(()=>{"use strict";Yx={"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}},TU={blockBytes:4,blockWidth:1,blockHeight:1},X1={type:"compressed",upload(r,e,t){let i=r.pixelWidth,s=r.pixelHeight,o=Yx[r.format]||TU;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;t.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 nd,qx=y(()=>{"use strict";nd={type:"image",upload(r,e,t){let i=r.resource;if(!i)return;let s=Math.min(e.width,r.resourceWidth||r.pixelWidth),o=Math.min(e.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:n},{width:s,height:o})}}});var Y1,q1=y(()=>{qx();Y1={type:"video",upload(r,e,t){nd.upload(r,e,t)}}});var ad,K1=y(()=>{"use strict";ad=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -931,7 +931,7 @@ fn mainFragment(
|
|
|
931
931
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
932
932
|
return textureSample(img, imgSampler, texCoord);
|
|
933
933
|
}
|
|
934
|
-
`})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=e,s=e.depthOrArrayLayers||1,o=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let l=0;l<s;++l){let c=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),u=o?1:0;for(let h=1;h<e.mipLevelCount;++h){let d=i.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});f.setPipeline(t),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),c=d}}if(!o){let l={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let c=1;c<e.mipLevelCount;++c)n.copyTextureToTexture({texture:i,mipLevel:c-1},{texture:e,mipLevel:c},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([n.finish()]),o||i.destroy(),e}}});var Hl,Z1=y(()=>{Re();U();Rt();Wo();Hi();$1();j1();qx();q1();K1();Hl=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:nd,buffer:z1,video:Y1,compressed:X1},this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuSources"),e.renderableGC.addManagedHash(this,"_gpuSamplers"),e.renderableGC.addManagedHash(this,"_bindGroupHash"),e.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let l=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(l))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let i=Yx[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(e.pixelHeight/i.blockHeight)*i.blockHeight,n={label:e.label,size:{width:s,height:o},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(n);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,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),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ad(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new mt({0:t,1:t.style,2:new be({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,i=t.gpu.device.createCommandEncoder(),s=j.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:j.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([i.finish()]),s}getPixels(e){let t=this.generateCanvas(e),i=qt.getOptimalCanvasAndContext(t.width,t.height),s=i.context;s.drawImage(t,0,0);let{width:o,height:n}=t,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return qt.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Hl.extension={type:[S.WebGPUSystem],name:"texture"}});var tP={};Ob(tP,{WebGPURenderer:()=>Kx});var SU,wU,EU,Q1,J1,eP,Kx,rP=y(()=>{U();yA();vA();TA();al();Lx();Xr();y1();_1();b1();v1();T1();S1();R1();B1();k1();N1();H1();W1();Z1();SU=[...Qh,Ol,Bl,an,Rl,Hl,Ll,Dl,Nl,Gl,Il,kl,Ml],wU=[...Jh,Ul],EU=[ul,cl,ll],Q1=[],J1=[],eP=[];V.handleByNamedList(S.WebGPUSystem,Q1);V.handleByNamedList(S.WebGPUPipes,J1);V.handleByNamedList(S.WebGPUPipesAdaptor,eP);V.add(...SU,...wU,...EU);Kx=class extends Yi{constructor(){let e={name:"webgpu",type:st.WEBGPU,systems:Q1,renderPipes:J1,renderPipeAdaptors:eP};super(e)}}});var Vl,iP=y(()=>{U();ge();Ss();zi();Ua();Ga();en();$i();lh();Cr();Rt();Vl=class{init(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new L,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),t=fr(),i=Wr({name:"graphics",bits:[ko,Oo(t),Jo,$r]});this.shader=new Ke({glProgram:i,resources:{localUniforms:e,batchSamplers:Uo(t)}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(e.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let c=l.instructions;for(let u=0;u<l.instructionSize;u++){let h=c[u];if(h.size){for(let d=0;d<h.textures.count;d++)o.texture.bind(h.textures.textures[d],d);o.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Vl.extension={type:[S.WebGLPipesAdaptor],name:"graphics"}});var Wl,sP=y(()=>{U();ge();zi();en();$i();bx();Cr();ve();Ae();Wl=class{init(){let e=Wr({name:"mesh",bits:[Jo,bA,$r]});this._shader=new Ke({glProgram:e,resources:{uTexture:k.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new L}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(s){if(!s.glProgram){W("Mesh shader has no glProgram",t.shader);return}}else{s=this._shader;let o=t.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Wl.extension={type:[S.WebGLPipesAdaptor],name:"mesh"}});var zl,oP=y(()=>{U();Mr();zl=class{constructor(){this._tempState=Qe.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,i){let s=e.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(t,i.glProgram)}execute(e,t){let i=e.renderer;this._tempState.blendMode=t.blendMode,i.state.set(this._tempState);let s=t.textures.textures;for(let o=0;o<t.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(t.topology,t.size,t.start)}};zl.extension={type:[S.WebGLPipesAdaptor],name:"batch"}});var $l,nP=y(()=>{"use strict";$l=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))($l||{})});var ld,aP=y(()=>{"use strict";ld=class{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}});var Xl,lP=y(()=>{U();mi();nP();aP();Xl=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let e=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,i=this.getGlBuffer(e);t.bindBuffer(i.type,i.buffer)}bindBufferBase(e,t){let{_gl:i}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,i.bindBufferBase(i.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return t=s,this._nextBindBaseIndex=s+1,i>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){let t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,i,s){let{_gl:o}=this;i||(i=0),t||(t=0),this._boundBufferBases[t]=null,o.bindBufferRange(o.UNIFORM_BUFFER,t||0,e.buffer,i*256,s||256)}updateBuffer(e){let{_gl:t}=this,i=this.getGlBuffer(e);if(e._updateID===i.updateID)return i;i.updateID=e._updateID,t.bindBuffer(i.type,i.buffer);let s=e.data,o=e.descriptor.usage&le.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?t.bufferSubData(i.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,t.bufferData(i.type,s,o)):(i.byteLength=e.descriptor.size,t.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let i=this._gpuBuffers[e.uid],s=this._gl;t||s.deleteBuffer(i.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,i=$l.ARRAY_BUFFER;e.descriptor.usage&le.INDEX?i=$l.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&le.UNIFORM&&(i=$l.UNIFORM_BUFFER);let s=new ld(t.createBuffer(),i);return this._gpuBuffers[e.uid]=s,e.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Xl.extension={type:[S.WebGLSystem],name:"buffer"}});var Zx,uP,hP=y(()=>{Re();U();Ae();Zx=class cP{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...cP.defaultOptions,...e};let t=this.multiView=e.multiView;if(e.context&&t&&(W("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),t=!1),t?this.canvas=j.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,o=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&W("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:t}=this;(t.width<e.width||t.height<e.height)&&(t.width=Math.max(e.width,e.width),t.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof j.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);let t=this._renderer.view.canvas;t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,t){let i,s=this.canvas;if(e===2&&(i=s.getContext("webgl2",t)),!i&&(i=s.getContext("webgl",t),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){let{gl:e}=this,t={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"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...t,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"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...t,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};let i=e.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let t=e.getContextAttributes();t&&!t.stencil&&W("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||W("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Zx.extension={type:[S.WebGLSystem],name:"context"};Zx.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};uP=Zx});var cd,Qx,ye,Jx=y(()=>{"use strict";cd=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(cd||{}),Qx=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Qx||{}),ye=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ye||{})});function fP(r){return dP[r]??dP.float32}var dP,pP=y(()=>{Jx();dP={uint8x2:ye.UNSIGNED_BYTE,uint8x4:ye.UNSIGNED_BYTE,sint8x2:ye.BYTE,sint8x4:ye.BYTE,unorm8x2:ye.UNSIGNED_BYTE,unorm8x4:ye.UNSIGNED_BYTE,snorm8x2:ye.BYTE,snorm8x4:ye.BYTE,uint16x2:ye.UNSIGNED_SHORT,uint16x4:ye.UNSIGNED_SHORT,sint16x2:ye.SHORT,sint16x4:ye.SHORT,unorm16x2:ye.UNSIGNED_SHORT,unorm16x4:ye.UNSIGNED_SHORT,snorm16x2:ye.SHORT,snorm16x4:ye.SHORT,float16x2:ye.HALF_FLOAT,float16x4:ye.HALF_FLOAT,float32:ye.FLOAT,float32x2:ye.FLOAT,float32x3:ye.FLOAT,float32x4:ye.FLOAT,uint32:ye.UNSIGNED_INT,uint32x2:ye.UNSIGNED_INT,uint32x3:ye.UNSIGNED_INT,uint32x4:ye.UNSIGNED_INT,sint32:ye.INT,sint32x2:ye.INT,sint32x3:ye.INT,sint32x4:ye.INT}});var AU,jl,mP=y(()=>{U();As();$x();pP();AU={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},jl=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=s=>t.bindVertexArrayOES(s),e.deleteVertexArray=s=>t.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(e.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},e.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let i=this.gl;this._activeGeometry=e;let s=this.getVao(e,t);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];t.updateBuffer(s)}}checkCompatibility(e,t){let i=e.attributes,s=t._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,t){let i=e.attributes,s=t._attributeData,o=["g",e.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(e,t){return this._geometryVaoHash[e.uid]?.[t._key]||this.initGeometryVao(e,t)}initGeometryVao(e,t,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);let n=this.getSignature(e,t);this._geometryVaoHash[e.uid]||(this._geometryVaoHash[e.uid]=Object.create(null),e.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[e.uid],l=a[n];if(l)return a[t._key]=l,l;id(e,t._attributeData);let c=e.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let u=0;u<c.length;u++){let h=c[u];o.bind(h)}return this.activateVao(e,t),a[t._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(e,t){let i=this._geometryVaoHash[e.uid],s=this.gl;if(i){if(t)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[e.uid]=null}}destroyAll(e=!1){let t=this.gl;for(let i in this._geometryVaoHash){if(e)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),t.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(e,t){let i=this._renderer.gl,s=this._renderer.buffer,o=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let n=null;for(let a in o){let l=o[a],c=l.buffer,u=s.getGlBuffer(c),h=t._attributeData[a];if(h){n!==u&&(s.bind(c),n=u);let d=h.location;i.enableVertexAttribArray(d);let f=jt(l.format),p=fP(l.format);if(h.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,l.stride,l.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let m=l.divisor??1;i.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=AU[e||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,c=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,t||n.indexBuffer.data.length,c,(i||0)*l,s):o.drawElements(a,t||n.indexBuffer.data.length,c,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,t||n.getSize(),s):o.drawArrays(a,i||0,t||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};jl.extension={type:[S.WebGLSystem],name:"geometry"}});var PU,ey,xP,yP=y(()=>{U();Ae();Mo();Cr();Mr();$t();ve();Es();PU=new pr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ey=class gP{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:t,antialias:i}={...gP.defaultOptions,...e};this.useBackBuffer=t,this._antialias=i,this._renderer.context.supports.msaa||(W("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Qe.for2d();let s=new mr({vertex:`
|
|
934
|
+
`})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=e,s=e.depthOrArrayLayers||1,o=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let l=0;l<s;++l){let c=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),u=o?1:0;for(let h=1;h<e.mipLevelCount;++h){let d=i.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});f.setPipeline(t),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),c=d}}if(!o){let l={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let c=1;c<e.mipLevelCount;++c)n.copyTextureToTexture({texture:i,mipLevel:c-1},{texture:e,mipLevel:c},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([n.finish()]),o||i.destroy(),e}}});var Hl,Z1=y(()=>{Re();U();Rt();Wo();Hi();$1();j1();qx();q1();K1();Hl=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:nd,buffer:z1,video:Y1,compressed:X1},this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuSources"),e.renderableGC.addManagedHash(this,"_gpuSamplers"),e.renderableGC.addManagedHash(this,"_bindGroupHash"),e.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let l=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(l))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let i=Yx[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(e.pixelHeight/i.blockHeight)*i.blockHeight,n={label:e.label,size:{width:s,height:o},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(n);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,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),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ad(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new mt({0:t,1:t.style,2:new be({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,i=t.gpu.device.createCommandEncoder(),s=j.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:j.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([i.finish()]),s}getPixels(e){let t=this.generateCanvas(e),i=qt.getOptimalCanvasAndContext(t.width,t.height),s=i.context;s.drawImage(t,0,0);let{width:o,height:n}=t,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return qt.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Hl.extension={type:[S.WebGPUSystem],name:"texture"}});var tP={};Ob(tP,{WebGPURenderer:()=>Kx});var SU,wU,EU,Q1,J1,eP,Kx,rP=y(()=>{U();yA();vA();TA();al();Lx();Xr();y1();_1();b1();v1();T1();S1();R1();B1();k1();N1();H1();W1();Z1();SU=[...Qh,Ol,Bl,an,Rl,Hl,Ll,Dl,Nl,Gl,Il,kl,Ml],wU=[...Jh,Ul],EU=[ul,cl,ll],Q1=[],J1=[],eP=[];V.handleByNamedList(S.WebGPUSystem,Q1);V.handleByNamedList(S.WebGPUPipes,J1);V.handleByNamedList(S.WebGPUPipesAdaptor,eP);V.add(...SU,...wU,...EU);Kx=class extends Yi{constructor(){let e={name:"webgpu",type:st.WEBGPU,systems:Q1,renderPipes:J1,renderPipeAdaptors:eP};super(e)}}});var Vl,iP=y(()=>{U();ge();Ss();zi();Ua();Ga();en();$i();lh();Cr();Rt();Vl=class{init(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),t=fr(),i=Wr({name:"graphics",bits:[ko,Oo(t),Jo,$r]});this.shader=new Ke({glProgram:i,resources:{localUniforms:e,batchSamplers:Uo(t)}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(e.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let c=l.instructions;for(let u=0;u<l.instructionSize;u++){let h=c[u];if(h.size){for(let d=0;d<h.textures.count;d++)o.texture.bind(h.textures.textures[d],d);o.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Vl.extension={type:[S.WebGLPipesAdaptor],name:"graphics"}});var Wl,sP=y(()=>{U();ge();zi();en();$i();bx();Cr();ve();Ae();Wl=class{init(){let e=Wr({name:"mesh",bits:[Jo,bA,$r]});this._shader=new Ke({glProgram:e,resources:{uTexture:k.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(s){if(!s.glProgram){W("Mesh shader has no glProgram",t.shader);return}}else{s=this._shader;let o=t.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Wl.extension={type:[S.WebGLPipesAdaptor],name:"mesh"}});var zl,oP=y(()=>{U();Mr();zl=class{constructor(){this._tempState=Qe.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,i){let s=e.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(t,i.glProgram)}execute(e,t){let i=e.renderer;this._tempState.blendMode=t.blendMode,i.state.set(this._tempState);let s=t.textures.textures;for(let o=0;o<t.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(t.topology,t.size,t.start)}};zl.extension={type:[S.WebGLPipesAdaptor],name:"batch"}});var $l,nP=y(()=>{"use strict";$l=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))($l||{})});var ld,aP=y(()=>{"use strict";ld=class{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}});var Xl,lP=y(()=>{U();mi();nP();aP();Xl=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let e=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,i=this.getGlBuffer(e);t.bindBuffer(i.type,i.buffer)}bindBufferBase(e,t){let{_gl:i}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,i.bindBufferBase(i.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return t=s,this._nextBindBaseIndex=s+1,i>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){let t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,i,s){let{_gl:o}=this;i||(i=0),t||(t=0),this._boundBufferBases[t]=null,o.bindBufferRange(o.UNIFORM_BUFFER,t||0,e.buffer,i*256,s||256)}updateBuffer(e){let{_gl:t}=this,i=this.getGlBuffer(e);if(e._updateID===i.updateID)return i;i.updateID=e._updateID,t.bindBuffer(i.type,i.buffer);let s=e.data,o=e.descriptor.usage&le.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?t.bufferSubData(i.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,t.bufferData(i.type,s,o)):(i.byteLength=e.descriptor.size,t.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let i=this._gpuBuffers[e.uid],s=this._gl;t||s.deleteBuffer(i.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,i=$l.ARRAY_BUFFER;e.descriptor.usage&le.INDEX?i=$l.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&le.UNIFORM&&(i=$l.UNIFORM_BUFFER);let s=new ld(t.createBuffer(),i);return this._gpuBuffers[e.uid]=s,e.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Xl.extension={type:[S.WebGLSystem],name:"buffer"}});var Zx,uP,hP=y(()=>{Re();U();Ae();Zx=class cP{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...cP.defaultOptions,...e};let t=this.multiView=e.multiView;if(e.context&&t&&(W("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),t=!1),t?this.canvas=j.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,o=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&W("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:t}=this;(t.width<e.width||t.height<e.height)&&(t.width=Math.max(e.width,e.width),t.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof j.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);let t=this._renderer.view.canvas;t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,t){let i,s=this.canvas;if(e===2&&(i=s.getContext("webgl2",t)),!i&&(i=s.getContext("webgl",t),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){let{gl:e}=this,t={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"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...t,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"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...t,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};let i=e.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let t=e.getContextAttributes();t&&!t.stencil&&W("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||W("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Zx.extension={type:[S.WebGLSystem],name:"context"};Zx.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};uP=Zx});var cd,Qx,ye,Jx=y(()=>{"use strict";cd=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(cd||{}),Qx=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Qx||{}),ye=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ye||{})});function fP(r){return dP[r]??dP.float32}var dP,pP=y(()=>{Jx();dP={uint8x2:ye.UNSIGNED_BYTE,uint8x4:ye.UNSIGNED_BYTE,sint8x2:ye.BYTE,sint8x4:ye.BYTE,unorm8x2:ye.UNSIGNED_BYTE,unorm8x4:ye.UNSIGNED_BYTE,snorm8x2:ye.BYTE,snorm8x4:ye.BYTE,uint16x2:ye.UNSIGNED_SHORT,uint16x4:ye.UNSIGNED_SHORT,sint16x2:ye.SHORT,sint16x4:ye.SHORT,unorm16x2:ye.UNSIGNED_SHORT,unorm16x4:ye.UNSIGNED_SHORT,snorm16x2:ye.SHORT,snorm16x4:ye.SHORT,float16x2:ye.HALF_FLOAT,float16x4:ye.HALF_FLOAT,float32:ye.FLOAT,float32x2:ye.FLOAT,float32x3:ye.FLOAT,float32x4:ye.FLOAT,uint32:ye.UNSIGNED_INT,uint32x2:ye.UNSIGNED_INT,uint32x3:ye.UNSIGNED_INT,uint32x4:ye.UNSIGNED_INT,sint32:ye.INT,sint32x2:ye.INT,sint32x3:ye.INT,sint32x4:ye.INT}});var AU,jl,mP=y(()=>{U();As();$x();pP();AU={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},jl=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=s=>t.bindVertexArrayOES(s),e.deleteVertexArray=s=>t.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(e.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},e.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let i=this.gl;this._activeGeometry=e;let s=this.getVao(e,t);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];t.updateBuffer(s)}}checkCompatibility(e,t){let i=e.attributes,s=t._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,t){let i=e.attributes,s=t._attributeData,o=["g",e.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(e,t){return this._geometryVaoHash[e.uid]?.[t._key]||this.initGeometryVao(e,t)}initGeometryVao(e,t,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);let n=this.getSignature(e,t);this._geometryVaoHash[e.uid]||(this._geometryVaoHash[e.uid]=Object.create(null),e.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[e.uid],l=a[n];if(l)return a[t._key]=l,l;id(e,t._attributeData);let c=e.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let u=0;u<c.length;u++){let h=c[u];o.bind(h)}return this.activateVao(e,t),a[t._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(e,t){let i=this._geometryVaoHash[e.uid],s=this.gl;if(i){if(t)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[e.uid]=null}}destroyAll(e=!1){let t=this.gl;for(let i in this._geometryVaoHash){if(e)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),t.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(e,t){let i=this._renderer.gl,s=this._renderer.buffer,o=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let n=null;for(let a in o){let l=o[a],c=l.buffer,u=s.getGlBuffer(c),h=t._attributeData[a];if(h){n!==u&&(s.bind(c),n=u);let d=h.location;i.enableVertexAttribArray(d);let f=jt(l.format),p=fP(l.format);if(h.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,l.stride,l.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let m=l.divisor??1;i.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=AU[e||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,c=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,t||n.indexBuffer.data.length,c,(i||0)*l,s):o.drawElements(a,t||n.indexBuffer.data.length,c,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,t||n.getSize(),s):o.drawArrays(a,i||0,t||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};jl.extension={type:[S.WebGLSystem],name:"geometry"}});var PU,ey,xP,yP=y(()=>{U();Ae();Mo();Cr();Mr();$t();ve();Es();PU=new pr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ey=class gP{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:t,antialias:i}={...gP.defaultOptions,...e};this.useBackBuffer=t,this._antialias=i,this._renderer.context.supports.msaa||(W("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Qe.for2d();let s=new mr({vertex:`
|
|
935
935
|
attribute vec2 aPosition;
|
|
936
936
|
out vec2 vUv;
|
|
937
937
|
|
|
@@ -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",t.join(`
|
|
1089
|
-
`))}var JP=y(()=>{td();Rt();Hx();ZP()});var ec,eC=y(()=>{U();JP();ec=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let s=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[s],i[t._key]}_generateUniformsSync(e,t){return QP(e,t)}_getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};ec.extension={type:[S.WebGLSystem],name:"uniformGroup"}});function tC(r){let e={};if(e.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e.add=[r.ONE,r.ONE],e.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))e.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(e.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var rC=y(()=>{Re()});var MU,RU,IU,BU,kU,FU,iC,sC,oC=y(()=>{U();Mr();rC();MU=0,RU=1,IU=2,BU=3,kU=4,FU=5,iC=class ly{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[MU]=this.setBlend,this.map[RU]=this.setOffset,this.map[IU]=this.setCullFace,this.map[BU]=this.setDepthTest,this.map[kU]=this.setFrontFace,this.map[FU]=this.setDepthMask,this.checks=[],this.defaultState=Qe.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=tC(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t>>=1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(ly._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(ly._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 t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let t=this.blendModesMap[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}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,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};iC.extension={type:[S.WebGLSystem],name:"state"};sC=iC});var gd,nC=y(()=>{Jx();gd=class{constructor(e){this.target=Qx.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=cd.RGBA,this.format=cd.RGBA,this.samplerType=0}}});var aC,lC=y(()=>{"use strict";aC={id:"buffer",upload(r,e,t){e.width===r.width||e.height===r.height?t.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,r.width,r.height,0,e.format,e.type,r.resource),e.width=r.width,e.height=r.height}}});var OU,cC,uC=y(()=>{"use strict";OU={"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},cC={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!OU[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?t.compressedTexImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,a):t.texImage2D(t.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 xd,cy=y(()=>{"use strict";xd={id:"image",upload(r,e,t,i){let s=e.width,o=e.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<n||c<a?((s!==n||o!==a)&&t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?t.texSubImage2D(t.TEXTURE_2D,0,0,0,l,c,e.format,e.type,r.resource):t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource)):s===n&&o===a?t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource):i===2?t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,e.format,e.type,r.resource),e.width=n,e.height=a}}});var hC,dC=y(()=>{cy();hC={id:"video",upload(r,e,t,i){if(!r.isValid){t.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}xd.upload(r,e,t,i)}}});var uy,fC,yd,pC,mC=y(()=>{"use strict";uy={linear:9729,nearest:9728},fC={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},yd={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},pC={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function hy(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=yd[n?"clamp-to-edge":r.addressModeU],u=yd[n?"clamp-to-edge":r.addressModeV],h=yd[n?"clamp-to-edge":r.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||r.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,uy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=fC[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,uy[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,pC[r.compare])}var gC=y(()=>{mC()});function xC(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var yC=y(()=>{"use strict"});function _C(r,e){let t={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...t,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...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 bC=y(()=>{Re()});function vC(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var TC=y(()=>{"use strict"});var UU,tc,SC=y(()=>{Re();U();ve();nC();lC();uC();cy();dC();gC();yC();bC();TC();UU=4,tc=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:xd,buffer:aC,video:hC,compressed:cC},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=_C(e,this._renderer.context.extensions),this._mapFormatToType=vC(e),this._mapFormatToFormat=xC(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(k.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=k.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,i.bindSampler(t,s))}unbind(e){let t=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===t){this._activateLocation(o);let n=this.getGlSource(t);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 t=this._gl,i=new gd(t.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,t){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,hy(e.style,i,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&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 t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,hy(e,t,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:t,width:i,height:s}=this.getPixels(e),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(t),n.putImageData(a,0,0)}return o}getPixels(e){let t=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*t),1),o=Math.max(Math.round(i.height*t),1),n=new Uint8Array(UU*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*t),Math.round(i.y*t),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(k.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};tc.extension={type:[S.WebGLSystem],name:"texture"}});var PC={};Ob(PC,{WebGLRenderer:()=>dy});var GU,LU,DU,wC,EC,AC,dy,CC=y(()=>{U();iP();sP();oP();al();Lx();Xr();lP();hP();mP();yP();_P();bP();vP();PP();RP();YP();eC();oC();SC();GU=[...Qh,Zl,xP,uP,Xl,tc,Ql,jl,ec,Jl,ql,sC,Kl,Yl],LU=[...Jh],DU=[zl,Wl,Vl],wC=[],EC=[],AC=[];V.handleByNamedList(S.WebGLSystem,wC);V.handleByNamedList(S.WebGLPipes,EC);V.handleByNamedList(S.WebGLPipesAdaptor,AC);V.add(...GU,...LU,...DU);dy=class extends Yi{constructor(){let e={name:"webgl",type:st.WEBGL,systems:wC,renderPipes:EC,renderPipeAdaptors:AC};super(e)}}});var gI=ee((s_e,c_)=>{"use strict";var QD=Object.prototype.hasOwnProperty,Wt="~";function wc(){}Object.create&&(wc.prototype=Object.create(null),new wc().__proto__||(Wt=!1));function JD(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function mI(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new JD(t,i||r,s),n=Wt?Wt+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Df(r,e){--r._eventsCount===0?r._events=new wc:delete r._events[e]}function Bt(){this._events=new wc,this._eventsCount=0}Bt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)QD.call(t,i)&&e.push(Wt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Bt.prototype.listeners=function(e){var t=Wt?Wt+e:e,i=this._events[t];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};Bt.prototype.listenerCount=function(e){var t=Wt?Wt+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Bt.prototype.emit=function(e,t,i,s,o,n){var a=Wt?Wt+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,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,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,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,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};Bt.prototype.on=function(e,t,i){return mI(this,e,t,i,!1)};Bt.prototype.once=function(e,t,i){return mI(this,e,t,i,!0)};Bt.prototype.removeListener=function(e,t,i,s){var o=Wt?Wt+e:e;if(!this._events[o])return this;if(!t)return Df(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&Df(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Df(this,o)}return this};Bt.prototype.removeAllListeners=function(e){var t;return e?(t=Wt?Wt+e:e,this._events[t]&&Df(this,t)):(this._events=new wc,this._eventsCount=0),this};Bt.prototype.off=Bt.prototype.removeListener;Bt.prototype.addListener=Bt.prototype.on;Bt.prefixed=Wt;Bt.EventEmitter=Bt;typeof c_<"u"&&(c_.exports=Bt)});var xI=ee((Bn,kn)=>{(function(r){var e=typeof Bn=="object"&&Bn&&!Bn.nodeType&&Bn,t=typeof kn=="object"&&kn&&!kn.nodeType&&kn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=n-a,x=Math.floor,T=String.fromCharCode,b;function w(N){throw new RangeError(_[N])}function E(N,G){for(var Y=N.length,ue=[];Y--;)ue[Y]=G(N[Y]);return ue}function I(N,G){var Y=N.split("@"),ue="";Y.length>1&&(ue=Y[0]+"@",N=Y[1]),N=N.replace(g,".");var J=N.split("."),Be=E(J,G).join(".");return ue+Be}function B(N){for(var G=[],Y=0,ue=N.length,J,Be;Y<ue;)J=N.charCodeAt(Y++),J>=55296&&J<=56319&&Y<ue?(Be=N.charCodeAt(Y++),(Be&64512)==56320?G.push(((J&1023)<<10)+(Be&1023)+65536):(G.push(J),Y--)):G.push(J);return G}function C(N){return E(N,function(G){var Y="";return G>65535&&(G-=65536,Y+=T(G>>>10&1023|55296),G=56320|G&1023),Y+=T(G),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function P(N,G){return N+22+75*(N<26)-((G!=0)<<5)}function R(N,G,Y){var ue=0;for(N=Y?x(N/u):N>>1,N+=x(N/G);N>v*l>>1;ue+=n)N=x(N/v);return x(ue+(v+1)*N/(N+c))}function M(N){var G=[],Y=N.length,ue,J=0,Be=d,ke=h,Me,ze,rt,_t,Le,bt,kt,At,Ft;for(Me=N.lastIndexOf(f),Me<0&&(Me=0),ze=0;ze<Me;++ze)N.charCodeAt(ze)>=128&&w("not-basic"),G.push(N.charCodeAt(ze));for(rt=Me>0?Me+1:0;rt<Y;){for(_t=J,Le=1,bt=n;rt>=Y&&w("invalid-input"),kt=A(N.charCodeAt(rt++)),(kt>=n||kt>x((o-J)/Le))&&w("overflow"),J+=kt*Le,At=bt<=ke?a:bt>=ke+l?l:bt-ke,!(kt<At);bt+=n)Ft=n-At,Le>x(o/Ft)&&w("overflow"),Le*=Ft;ue=G.length+1,ke=R(J-_t,ue,_t==0),x(J/ue)>o-Be&&w("overflow"),Be+=x(J/ue),J%=ue,G.splice(J++,0,Be)}return C(G)}function F(N){var G,Y,ue,J,Be,ke,Me,ze,rt,_t,Le,bt=[],kt,At,Ft,Er;for(N=B(N),kt=N.length,G=d,Y=0,Be=h,ke=0;ke<kt;++ke)Le=N[ke],Le<128&&bt.push(T(Le));for(ue=J=bt.length,J&&bt.push(f);ue<kt;){for(Me=o,ke=0;ke<kt;++ke)Le=N[ke],Le>=G&&Le<Me&&(Me=Le);for(At=ue+1,Me-G>x((o-Y)/At)&&w("overflow"),Y+=(Me-G)*At,G=Me,ke=0;ke<kt;++ke)if(Le=N[ke],Le<G&&++Y>o&&w("overflow"),Le==G){for(ze=Y,rt=n;_t=rt<=Be?a:rt>=Be+l?l:rt-Be,!(ze<_t);rt+=n)Er=ze-_t,Ft=n-_t,bt.push(T(P(_t+Er%Ft,0))),ze=x(Er/Ft);bt.push(T(P(ze,0))),Be=R(Y,At,ue==J),Y=0,++ue}++Y,++G}return bt.join("")}function O(N){return I(N,function(G){return p.test(G)?M(G.slice(4).toLowerCase()):G})}function D(N){return I(N,function(G){return m.test(G)?"xn--"+F(G):G})}if(s={version:"1.4.1",ucs2:{decode:B,encode:C},decode:M,encode:F,toASCII:D,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&t)if(kn.exports==e)t.exports=s;else for(b in s)s.hasOwnProperty(b)&&(e[b]=s[b]);else r.punycode=s})(Bn)});var zs=ee((o_e,yI)=>{"use strict";yI.exports=TypeError});var _I=ee(()=>{});var Mc=ee((l_e,DI)=>{var __=typeof Map=="function"&&Map.prototype,u_=Object.getOwnPropertyDescriptor&&__?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Hf=__&&u_&&typeof u_.get=="function"?u_.get:null,bI=__&&Map.prototype.forEach,b_=typeof Set=="function"&&Set.prototype,h_=Object.getOwnPropertyDescriptor&&b_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vf=b_&&h_&&typeof h_.get=="function"?h_.get:null,vI=b_&&Set.prototype.forEach,eN=typeof WeakMap=="function"&&WeakMap.prototype,Ac=eN?WeakMap.prototype.has:null,tN=typeof WeakSet=="function"&&WeakSet.prototype,Pc=tN?WeakSet.prototype.has:null,rN=typeof WeakRef=="function"&&WeakRef.prototype,TI=rN?WeakRef.prototype.deref:null,iN=Boolean.prototype.valueOf,sN=Object.prototype.toString,oN=Function.prototype.toString,nN=String.prototype.match,v_=String.prototype.slice,ns=String.prototype.replace,aN=String.prototype.toUpperCase,SI=String.prototype.toLowerCase,BI=RegExp.prototype.test,wI=Array.prototype.concat,ei=Array.prototype.join,lN=Array.prototype.slice,EI=Math.floor,p_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,d_=Object.getOwnPropertySymbols,m_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Cc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fn||!0)?Symbol.toStringTag:null,kI=Object.prototype.propertyIsEnumerable,AI=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function PI(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||BI.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-EI(-r):EI(r);if(i!==r){var s=String(i),o=v_.call(e,s.length+1);return ns.call(s,t,"$&_")+"."+ns.call(ns.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ns.call(e,t,"$&_")}var g_=_I(),CI=g_.custom,MI=UI(CI)?CI:null,FI={__proto__:null,double:'"',single:"'"},cN={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};DI.exports=function r(e,t,i,s){var o=t||{};if(wi(o,"quoteStyle")&&!wi(FI,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(wi(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=wi(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(wi(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(wi(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 LI(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?PI(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?PI(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 x_(e)?"[Array]":"[Object]";var h=PN(o,i);if(typeof s>"u")s=[];else if(GI(s,e)>=0)return"[Circular]";function d(R,M,F){if(M&&(s=lN.call(s),s.push(M)),F){var O={depth:o.depth};return wi(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(R,O,i+1,s)}return r(R,o,i+1,s)}if(typeof e=="function"&&!RI(e)){var f=yN(e),p=Nf(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ei.call(p,", ")+" }":"")}if(UI(e)){var m=Fn?ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):m_.call(e);return typeof e=="object"&&!Fn?Ec(m):m}if(wN(e)){for(var g="<"+SI.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+OI(uN(_[v].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+SI.call(String(e.nodeName))+">",g}if(x_(e)){if(e.length===0)return"[]";var x=Nf(e,d);return h&&!AN(x)?"["+y_(x,h)+"]":"[ "+ei.call(x,", ")+" ]"}if(dN(e)){var T=Nf(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!kI.call(e,"cause")?"{ ["+String(e)+"] "+ei.call(wI.call("[cause]: "+d(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ei.call(T,", ")+" }"}if(typeof e=="object"&&n){if(MI&&typeof e[MI]=="function"&&g_)return g_(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(_N(e)){var b=[];return bI&&bI.call(e,function(R,M){b.push(d(M,e,!0)+" => "+d(R,e))}),II("Map",Hf.call(e),b,h)}if(TN(e)){var w=[];return vI&&vI.call(e,function(R){w.push(d(R,e))}),II("Set",Vf.call(e),w,h)}if(bN(e))return f_("WeakMap");if(SN(e))return f_("WeakSet");if(vN(e))return f_("WeakRef");if(pN(e))return Ec(d(Number(e)));if(gN(e))return Ec(d(p_.call(e)));if(mN(e))return Ec(iN.call(e));if(fN(e))return Ec(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(!hN(e)&&!RI(e)){var E=Nf(e,d),I=AI?AI(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",C=!I&&Cc&&Object(e)===e&&Cc in e?v_.call(as(e),8,-1):B?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=A+(C||B?"["+ei.call(wI.call([],C||[],B||[]),": ")+"] ":"");return E.length===0?P+"{}":h?P+"{"+y_(E,h)+"}":P+"{ "+ei.call(E,", ")+" }"}return String(e)};function OI(r,e,t){var i=t.quoteStyle||e,s=FI[i];return s+r+s}function uN(r){return ns.call(String(r),/"/g,""")}function $s(r){return!Cc||!(typeof r=="object"&&(Cc in r||typeof r[Cc]<"u"))}function x_(r){return as(r)==="[object Array]"&&$s(r)}function hN(r){return as(r)==="[object Date]"&&$s(r)}function RI(r){return as(r)==="[object RegExp]"&&$s(r)}function dN(r){return as(r)==="[object Error]"&&$s(r)}function fN(r){return as(r)==="[object String]"&&$s(r)}function pN(r){return as(r)==="[object Number]"&&$s(r)}function mN(r){return as(r)==="[object Boolean]"&&$s(r)}function UI(r){if(Fn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!m_)return!1;try{return m_.call(r),!0}catch{}return!1}function gN(r){if(!r||typeof r!="object"||!p_)return!1;try{return p_.call(r),!0}catch{}return!1}var xN=Object.prototype.hasOwnProperty||function(r){return r in this};function wi(r,e){return xN.call(r,e)}function as(r){return sN.call(r)}function yN(r){if(r.name)return r.name;var e=nN.call(oN.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function GI(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function _N(r){if(!Hf||!r||typeof r!="object")return!1;try{Hf.call(r);try{Vf.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function bN(r){if(!Ac||!r||typeof r!="object")return!1;try{Ac.call(r,Ac);try{Pc.call(r,Pc)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function vN(r){if(!TI||!r||typeof r!="object")return!1;try{return TI.call(r),!0}catch{}return!1}function TN(r){if(!Vf||!r||typeof r!="object")return!1;try{Vf.call(r);try{Hf.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function SN(r){if(!Pc||!r||typeof r!="object")return!1;try{Pc.call(r,Pc);try{Ac.call(r,Ac)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function wN(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function LI(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return LI(v_.call(r,0,e.maxStringLength),e)+i}var s=cN[e.quoteStyle||"single"];s.lastIndex=0;var o=ns.call(ns.call(r,s,"\\$1"),/[\x00-\x1f]/g,EN);return OI(o,"single",e)}function EN(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+aN.call(e.toString(16))}function Ec(r){return"Object("+r+")"}function f_(r){return r+" { ? }"}function II(r,e,t,i){var s=i?y_(t,i):ei.call(t,", ");return r+" ("+e+") {"+s+"}"}function AN(r){for(var e=0;e<r.length;e++)if(GI(r[e],`
|
|
1090
|
-
`)>=0)return!1;return!0}function
|
|
1089
|
+
`))}var JP=y(()=>{td();Rt();Hx();ZP()});var ec,eC=y(()=>{U();JP();ec=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let s=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[s],i[t._key]}_generateUniformsSync(e,t){return QP(e,t)}_getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};ec.extension={type:[S.WebGLSystem],name:"uniformGroup"}});function tC(r){let e={};if(e.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e.add=[r.ONE,r.ONE],e.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))e.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(e.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var rC=y(()=>{Re()});var MU,RU,IU,BU,kU,FU,iC,sC,oC=y(()=>{U();Mr();rC();MU=0,RU=1,IU=2,BU=3,kU=4,FU=5,iC=class ly{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[MU]=this.setBlend,this.map[RU]=this.setOffset,this.map[IU]=this.setCullFace,this.map[BU]=this.setDepthTest,this.map[kU]=this.setFrontFace,this.map[FU]=this.setDepthMask,this.checks=[],this.defaultState=Qe.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=tC(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t>>=1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(ly._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(ly._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 t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let t=this.blendModesMap[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}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,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};iC.extension={type:[S.WebGLSystem],name:"state"};sC=iC});var gd,nC=y(()=>{Jx();gd=class{constructor(e){this.target=Qx.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=cd.RGBA,this.format=cd.RGBA,this.samplerType=0}}});var aC,lC=y(()=>{"use strict";aC={id:"buffer",upload(r,e,t){e.width===r.width||e.height===r.height?t.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,r.width,r.height,0,e.format,e.type,r.resource),e.width=r.width,e.height=r.height}}});var OU,cC,uC=y(()=>{"use strict";OU={"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},cC={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!OU[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?t.compressedTexImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,a):t.texImage2D(t.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 xd,cy=y(()=>{"use strict";xd={id:"image",upload(r,e,t,i){let s=e.width,o=e.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<n||c<a?((s!==n||o!==a)&&t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?t.texSubImage2D(t.TEXTURE_2D,0,0,0,l,c,e.format,e.type,r.resource):t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource)):s===n&&o===a?t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource):i===2?t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,e.format,e.type,r.resource),e.width=n,e.height=a}}});var hC,dC=y(()=>{cy();hC={id:"video",upload(r,e,t,i){if(!r.isValid){t.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}xd.upload(r,e,t,i)}}});var uy,fC,yd,pC,mC=y(()=>{"use strict";uy={linear:9729,nearest:9728},fC={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},yd={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},pC={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function hy(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=yd[n?"clamp-to-edge":r.addressModeU],u=yd[n?"clamp-to-edge":r.addressModeV],h=yd[n?"clamp-to-edge":r.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||r.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,uy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=fC[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,uy[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,pC[r.compare])}var gC=y(()=>{mC()});function xC(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var yC=y(()=>{"use strict"});function _C(r,e){let t={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...t,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...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 bC=y(()=>{Re()});function vC(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var TC=y(()=>{"use strict"});var UU,tc,SC=y(()=>{Re();U();ve();nC();lC();uC();cy();dC();gC();yC();bC();TC();UU=4,tc=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:xd,buffer:aC,video:hC,compressed:cC},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=_C(e,this._renderer.context.extensions),this._mapFormatToType=vC(e),this._mapFormatToFormat=xC(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(k.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=k.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,i.bindSampler(t,s))}unbind(e){let t=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===t){this._activateLocation(o);let n=this.getGlSource(t);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 t=this._gl,i=new gd(t.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,t){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,hy(e.style,i,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&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 t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,hy(e,t,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:t,width:i,height:s}=this.getPixels(e),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(t),n.putImageData(a,0,0)}return o}getPixels(e){let t=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*t),1),o=Math.max(Math.round(i.height*t),1),n=new Uint8Array(UU*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*t),Math.round(i.y*t),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(k.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};tc.extension={type:[S.WebGLSystem],name:"texture"}});var PC={};Ob(PC,{WebGLRenderer:()=>dy});var GU,LU,DU,wC,EC,AC,dy,CC=y(()=>{U();iP();sP();oP();al();Lx();Xr();lP();hP();mP();yP();_P();bP();vP();PP();RP();YP();eC();oC();SC();GU=[...Qh,Zl,xP,uP,Xl,tc,Ql,jl,ec,Jl,ql,sC,Kl,Yl],LU=[...Jh],DU=[zl,Wl,Vl],wC=[],EC=[],AC=[];V.handleByNamedList(S.WebGLSystem,wC);V.handleByNamedList(S.WebGLPipes,EC);V.handleByNamedList(S.WebGLPipesAdaptor,AC);V.add(...GU,...LU,...DU);dy=class extends Yi{constructor(){let e={name:"webgl",type:st.WEBGL,systems:wC,renderPipes:EC,renderPipeAdaptors:AC};super(e)}}});var gI=ee((o_e,c_)=>{"use strict";var JD=Object.prototype.hasOwnProperty,Wt="~";function wc(){}Object.create&&(wc.prototype=Object.create(null),new wc().__proto__||(Wt=!1));function eN(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function mI(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new eN(t,i||r,s),n=Wt?Wt+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Df(r,e){--r._eventsCount===0?r._events=new wc:delete r._events[e]}function Bt(){this._events=new wc,this._eventsCount=0}Bt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)JD.call(t,i)&&e.push(Wt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Bt.prototype.listeners=function(e){var t=Wt?Wt+e:e,i=this._events[t];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};Bt.prototype.listenerCount=function(e){var t=Wt?Wt+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Bt.prototype.emit=function(e,t,i,s,o,n){var a=Wt?Wt+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,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,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,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,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};Bt.prototype.on=function(e,t,i){return mI(this,e,t,i,!1)};Bt.prototype.once=function(e,t,i){return mI(this,e,t,i,!0)};Bt.prototype.removeListener=function(e,t,i,s){var o=Wt?Wt+e:e;if(!this._events[o])return this;if(!t)return Df(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&Df(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Df(this,o)}return this};Bt.prototype.removeAllListeners=function(e){var t;return e?(t=Wt?Wt+e:e,this._events[t]&&Df(this,t)):(this._events=new wc,this._eventsCount=0),this};Bt.prototype.off=Bt.prototype.removeListener;Bt.prototype.addListener=Bt.prototype.on;Bt.prefixed=Wt;Bt.EventEmitter=Bt;typeof c_<"u"&&(c_.exports=Bt)});var xI=ee((Bn,kn)=>{(function(r){var e=typeof Bn=="object"&&Bn&&!Bn.nodeType&&Bn,t=typeof kn=="object"&&kn&&!kn.nodeType&&kn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=n-a,x=Math.floor,T=String.fromCharCode,b;function w(N){throw new RangeError(_[N])}function E(N,L){for(var Y=N.length,ue=[];Y--;)ue[Y]=L(N[Y]);return ue}function I(N,L){var Y=N.split("@"),ue="";Y.length>1&&(ue=Y[0]+"@",N=Y[1]),N=N.replace(g,".");var J=N.split("."),Be=E(J,L).join(".");return ue+Be}function B(N){for(var L=[],Y=0,ue=N.length,J,Be;Y<ue;)J=N.charCodeAt(Y++),J>=55296&&J<=56319&&Y<ue?(Be=N.charCodeAt(Y++),(Be&64512)==56320?L.push(((J&1023)<<10)+(Be&1023)+65536):(L.push(J),Y--)):L.push(J);return L}function C(N){return E(N,function(L){var Y="";return L>65535&&(L-=65536,Y+=T(L>>>10&1023|55296),L=56320|L&1023),Y+=T(L),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function P(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function R(N,L,Y){var ue=0;for(N=Y?x(N/u):N>>1,N+=x(N/L);N>v*l>>1;ue+=n)N=x(N/v);return x(ue+(v+1)*N/(N+c))}function M(N){var L=[],Y=N.length,ue,J=0,Be=d,ke=h,Me,ze,rt,_t,Le,bt,kt,At,Ft;for(Me=N.lastIndexOf(f),Me<0&&(Me=0),ze=0;ze<Me;++ze)N.charCodeAt(ze)>=128&&w("not-basic"),L.push(N.charCodeAt(ze));for(rt=Me>0?Me+1:0;rt<Y;){for(_t=J,Le=1,bt=n;rt>=Y&&w("invalid-input"),kt=A(N.charCodeAt(rt++)),(kt>=n||kt>x((o-J)/Le))&&w("overflow"),J+=kt*Le,At=bt<=ke?a:bt>=ke+l?l:bt-ke,!(kt<At);bt+=n)Ft=n-At,Le>x(o/Ft)&&w("overflow"),Le*=Ft;ue=L.length+1,ke=R(J-_t,ue,_t==0),x(J/ue)>o-Be&&w("overflow"),Be+=x(J/ue),J%=ue,L.splice(J++,0,Be)}return C(L)}function F(N){var L,Y,ue,J,Be,ke,Me,ze,rt,_t,Le,bt=[],kt,At,Ft,Er;for(N=B(N),kt=N.length,L=d,Y=0,Be=h,ke=0;ke<kt;++ke)Le=N[ke],Le<128&&bt.push(T(Le));for(ue=J=bt.length,J&&bt.push(f);ue<kt;){for(Me=o,ke=0;ke<kt;++ke)Le=N[ke],Le>=L&&Le<Me&&(Me=Le);for(At=ue+1,Me-L>x((o-Y)/At)&&w("overflow"),Y+=(Me-L)*At,L=Me,ke=0;ke<kt;++ke)if(Le=N[ke],Le<L&&++Y>o&&w("overflow"),Le==L){for(ze=Y,rt=n;_t=rt<=Be?a:rt>=Be+l?l:rt-Be,!(ze<_t);rt+=n)Er=ze-_t,Ft=n-_t,bt.push(T(P(_t+Er%Ft,0))),ze=x(Er/Ft);bt.push(T(P(ze,0))),Be=R(Y,At,ue==J),Y=0,++ue}++Y,++L}return bt.join("")}function O(N){return I(N,function(L){return p.test(L)?M(L.slice(4).toLowerCase()):L})}function D(N){return I(N,function(L){return m.test(L)?"xn--"+F(L):L})}if(s={version:"1.4.1",ucs2:{decode:B,encode:C},decode:M,encode:F,toASCII:D,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&t)if(kn.exports==e)t.exports=s;else for(b in s)s.hasOwnProperty(b)&&(e[b]=s[b]);else r.punycode=s})(Bn)});var zs=ee((n_e,yI)=>{"use strict";yI.exports=TypeError});var _I=ee(()=>{});var Mc=ee((c_e,DI)=>{var __=typeof Map=="function"&&Map.prototype,u_=Object.getOwnPropertyDescriptor&&__?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Hf=__&&u_&&typeof u_.get=="function"?u_.get:null,bI=__&&Map.prototype.forEach,b_=typeof Set=="function"&&Set.prototype,h_=Object.getOwnPropertyDescriptor&&b_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vf=b_&&h_&&typeof h_.get=="function"?h_.get:null,vI=b_&&Set.prototype.forEach,tN=typeof WeakMap=="function"&&WeakMap.prototype,Ac=tN?WeakMap.prototype.has:null,rN=typeof WeakSet=="function"&&WeakSet.prototype,Pc=rN?WeakSet.prototype.has:null,iN=typeof WeakRef=="function"&&WeakRef.prototype,TI=iN?WeakRef.prototype.deref:null,sN=Boolean.prototype.valueOf,oN=Object.prototype.toString,nN=Function.prototype.toString,aN=String.prototype.match,v_=String.prototype.slice,ns=String.prototype.replace,lN=String.prototype.toUpperCase,SI=String.prototype.toLowerCase,BI=RegExp.prototype.test,wI=Array.prototype.concat,ei=Array.prototype.join,cN=Array.prototype.slice,EI=Math.floor,p_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,d_=Object.getOwnPropertySymbols,m_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Cc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fn||!0)?Symbol.toStringTag:null,kI=Object.prototype.propertyIsEnumerable,AI=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function PI(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||BI.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-EI(-r):EI(r);if(i!==r){var s=String(i),o=v_.call(e,s.length+1);return ns.call(s,t,"$&_")+"."+ns.call(ns.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ns.call(e,t,"$&_")}var g_=_I(),CI=g_.custom,MI=UI(CI)?CI:null,FI={__proto__:null,double:'"',single:"'"},uN={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};DI.exports=function r(e,t,i,s){var o=t||{};if(wi(o,"quoteStyle")&&!wi(FI,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(wi(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=wi(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(wi(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(wi(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 LI(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?PI(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?PI(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 x_(e)?"[Array]":"[Object]";var h=CN(o,i);if(typeof s>"u")s=[];else if(GI(s,e)>=0)return"[Circular]";function d(R,M,F){if(M&&(s=cN.call(s),s.push(M)),F){var O={depth:o.depth};return wi(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(R,O,i+1,s)}return r(R,o,i+1,s)}if(typeof e=="function"&&!RI(e)){var f=_N(e),p=Nf(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ei.call(p,", ")+" }":"")}if(UI(e)){var m=Fn?ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):m_.call(e);return typeof e=="object"&&!Fn?Ec(m):m}if(EN(e)){for(var g="<"+SI.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+OI(hN(_[v].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+SI.call(String(e.nodeName))+">",g}if(x_(e)){if(e.length===0)return"[]";var x=Nf(e,d);return h&&!PN(x)?"["+y_(x,h)+"]":"[ "+ei.call(x,", ")+" ]"}if(fN(e)){var T=Nf(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!kI.call(e,"cause")?"{ ["+String(e)+"] "+ei.call(wI.call("[cause]: "+d(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ei.call(T,", ")+" }"}if(typeof e=="object"&&n){if(MI&&typeof e[MI]=="function"&&g_)return g_(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(bN(e)){var b=[];return bI&&bI.call(e,function(R,M){b.push(d(M,e,!0)+" => "+d(R,e))}),II("Map",Hf.call(e),b,h)}if(SN(e)){var w=[];return vI&&vI.call(e,function(R){w.push(d(R,e))}),II("Set",Vf.call(e),w,h)}if(vN(e))return f_("WeakMap");if(wN(e))return f_("WeakSet");if(TN(e))return f_("WeakRef");if(mN(e))return Ec(d(Number(e)));if(xN(e))return Ec(d(p_.call(e)));if(gN(e))return Ec(sN.call(e));if(pN(e))return Ec(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(!dN(e)&&!RI(e)){var E=Nf(e,d),I=AI?AI(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",C=!I&&Cc&&Object(e)===e&&Cc in e?v_.call(as(e),8,-1):B?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=A+(C||B?"["+ei.call(wI.call([],C||[],B||[]),": ")+"] ":"");return E.length===0?P+"{}":h?P+"{"+y_(E,h)+"}":P+"{ "+ei.call(E,", ")+" }"}return String(e)};function OI(r,e,t){var i=t.quoteStyle||e,s=FI[i];return s+r+s}function hN(r){return ns.call(String(r),/"/g,""")}function $s(r){return!Cc||!(typeof r=="object"&&(Cc in r||typeof r[Cc]<"u"))}function x_(r){return as(r)==="[object Array]"&&$s(r)}function dN(r){return as(r)==="[object Date]"&&$s(r)}function RI(r){return as(r)==="[object RegExp]"&&$s(r)}function fN(r){return as(r)==="[object Error]"&&$s(r)}function pN(r){return as(r)==="[object String]"&&$s(r)}function mN(r){return as(r)==="[object Number]"&&$s(r)}function gN(r){return as(r)==="[object Boolean]"&&$s(r)}function UI(r){if(Fn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!m_)return!1;try{return m_.call(r),!0}catch{}return!1}function xN(r){if(!r||typeof r!="object"||!p_)return!1;try{return p_.call(r),!0}catch{}return!1}var yN=Object.prototype.hasOwnProperty||function(r){return r in this};function wi(r,e){return yN.call(r,e)}function as(r){return oN.call(r)}function _N(r){if(r.name)return r.name;var e=aN.call(nN.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function GI(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function bN(r){if(!Hf||!r||typeof r!="object")return!1;try{Hf.call(r);try{Vf.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function vN(r){if(!Ac||!r||typeof r!="object")return!1;try{Ac.call(r,Ac);try{Pc.call(r,Pc)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function TN(r){if(!TI||!r||typeof r!="object")return!1;try{return TI.call(r),!0}catch{}return!1}function SN(r){if(!Vf||!r||typeof r!="object")return!1;try{Vf.call(r);try{Hf.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function wN(r){if(!Pc||!r||typeof r!="object")return!1;try{Pc.call(r,Pc);try{Ac.call(r,Ac)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function EN(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function LI(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return LI(v_.call(r,0,e.maxStringLength),e)+i}var s=uN[e.quoteStyle||"single"];s.lastIndex=0;var o=ns.call(ns.call(r,s,"\\$1"),/[\x00-\x1f]/g,AN);return OI(o,"single",e)}function AN(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+lN.call(e.toString(16))}function Ec(r){return"Object("+r+")"}function f_(r){return r+" { ? }"}function II(r,e,t,i){var s=i?y_(t,i):ei.call(t,", ");return r+" ("+e+") {"+s+"}"}function PN(r){for(var e=0;e<r.length;e++)if(GI(r[e],`
|
|
1090
|
+
`)>=0)return!1;return!0}function CN(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ei.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ei.call(Array(e+1),t)}}function y_(r,e){if(r.length===0)return"";var t=`
|
|
1091
1091
|
`+e.prev+e.base;return t+ei.call(r,","+t)+`
|
|
1092
|
-
`+e.prev}function Nf(r,e){var t=x_(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=wi(r,s)?e(r[s],r):""}var o=typeof d_=="function"?d_(r):[],n;if(Fn){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)wi(r,l)&&(t&&String(Number(l))===l&&l<r.length||Fn&&n["$"+l]instanceof Symbol||(BI.call(/[^\w$]/,l)?i.push(e(l,r)+": "+e(r[l],r)):i.push(l+": "+e(r[l],r))));if(typeof d_=="function")for(var c=0;c<o.length;c++)kI.call(r,o[c])&&i.push("["+e(o[c])+"]: "+e(r[o[c]],r));return i}});var HI=ee((c_e,NI)=>{"use strict";var CN=Mc(),MN=zs(),Wf=function(r,e,t){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,t||(s.next=r.next,r.next=s),s},RN=function(r,e){if(r){var t=Wf(r,e);return t&&t.value}},IN=function(r,e,t){var i=Wf(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},BN=function(r,e){return r?!!Wf(r,e):!1},kN=function(r,e){if(r)return Wf(r,e,!0)};NI.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new MN("Side channel does not contain "+CN(i))},delete:function(i){var s=e&&e.next,o=kN(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return RN(e,i)},has:function(i){return BN(e,i)},set:function(i,s){e||(e={next:void 0}),IN(e,i,s)}};return t}});var T_=ee((u_e,VI)=>{"use strict";VI.exports=Object});var zI=ee((h_e,WI)=>{"use strict";WI.exports=Error});var XI=ee((d_e,$I)=>{"use strict";$I.exports=EvalError});var YI=ee((f_e,jI)=>{"use strict";jI.exports=RangeError});var KI=ee((p_e,qI)=>{"use strict";qI.exports=ReferenceError});var QI=ee((m_e,ZI)=>{"use strict";ZI.exports=SyntaxError});var eB=ee((g_e,JI)=>{"use strict";JI.exports=URIError});var rB=ee((x_e,tB)=>{"use strict";tB.exports=Math.abs});var sB=ee((y_e,iB)=>{"use strict";iB.exports=Math.floor});var nB=ee((__e,oB)=>{"use strict";oB.exports=Math.max});var lB=ee((b_e,aB)=>{"use strict";aB.exports=Math.min});var uB=ee((v_e,cB)=>{"use strict";cB.exports=Math.pow});var dB=ee((T_e,hB)=>{"use strict";hB.exports=Math.round});var pB=ee((S_e,fB)=>{"use strict";fB.exports=Number.isNaN||function(e){return e!==e}});var gB=ee((w_e,mB)=>{"use strict";var FN=pB();mB.exports=function(e){return FN(e)||e===0?e:e<0?-1:1}});var yB=ee((E_e,xB)=>{"use strict";xB.exports=Object.getOwnPropertyDescriptor});var S_=ee((A_e,_B)=>{"use strict";var zf=yB();if(zf)try{zf([],"length")}catch{zf=null}_B.exports=zf});var vB=ee((P_e,bB)=>{"use strict";var $f=Object.defineProperty||!1;if($f)try{$f({},"a",{value:1})}catch{$f=!1}bB.exports=$f});var SB=ee((C_e,TB)=>{"use strict";TB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var AB=ee((M_e,EB)=>{"use strict";var wB=typeof Symbol<"u"&&Symbol,ON=SB();EB.exports=function(){return typeof wB!="function"||typeof Symbol!="function"||typeof wB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ON()}});var w_=ee((R_e,PB)=>{"use strict";PB.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var E_=ee((I_e,CB)=>{"use strict";var UN=T_();CB.exports=UN.getPrototypeOf||null});var IB=ee((B_e,RB)=>{"use strict";var GN="Function.prototype.bind called on incompatible ",LN=Object.prototype.toString,DN=Math.max,NN="[object Function]",MB=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<t.length;o+=1)i[o+e.length]=t[o];return i},HN=function(e,t){for(var i=[],s=t||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},VN=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t};RB.exports=function(e){var t=this;if(typeof t!="function"||LN.apply(t)!==NN)throw new TypeError(GN+t);for(var i=HN(arguments,1),s,o=function(){if(this instanceof s){var u=t.apply(this,MB(i,arguments));return Object(u)===u?u:this}return t.apply(e,MB(i,arguments))},n=DN(0,t.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+VN(a,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,s.prototype=new c,c.prototype=null}return s}});var Rc=ee((k_e,BB)=>{"use strict";var WN=IB();BB.exports=Function.prototype.bind||WN});var Xf=ee((F_e,kB)=>{"use strict";kB.exports=Function.prototype.call});var A_=ee((O_e,FB)=>{"use strict";FB.exports=Function.prototype.apply});var UB=ee((U_e,OB)=>{"use strict";OB.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var LB=ee((G_e,GB)=>{"use strict";var zN=Rc(),$N=A_(),XN=Xf(),jN=UB();GB.exports=jN||zN.call(XN,$N)});var P_=ee((L_e,DB)=>{"use strict";var YN=Rc(),qN=zs(),KN=Xf(),ZN=LB();DB.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new qN("a function is required");return ZN(YN,KN,e)}});var $B=ee((D_e,zB)=>{"use strict";var QN=P_(),NB=S_(),VB;try{VB=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var C_=!!VB&&NB&&NB(Object.prototype,"__proto__"),WB=Object,HB=WB.getPrototypeOf;zB.exports=C_&&typeof C_.get=="function"?QN([C_.get]):typeof HB=="function"?function(e){return HB(e==null?e:WB(e))}:!1});var KB=ee((N_e,qB)=>{"use strict";var XB=w_(),jB=E_(),YB=$B();qB.exports=XB?function(e){return XB(e)}:jB?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return jB(e)}:YB?function(e){return YB(e)}:null});var QB=ee((H_e,ZB)=>{"use strict";var JN=Function.prototype.call,e3=Object.prototype.hasOwnProperty,t3=Rc();ZB.exports=t3.call(JN,e3)});var qf=ee((V_e,sk)=>{"use strict";var me,r3=T_(),i3=zI(),s3=XI(),o3=YI(),n3=KI(),Ln=QI(),Gn=zs(),a3=eB(),l3=rB(),c3=sB(),u3=nB(),h3=lB(),d3=uB(),f3=dB(),p3=gB(),rk=Function,M_=function(r){try{return rk('"use strict"; return ('+r+").constructor;")()}catch{}},Ic=S_(),m3=vB(),R_=function(){throw new Gn},g3=Ic?function(){try{return arguments.callee,R_}catch{try{return Ic(arguments,"callee").get}catch{return R_}}}():R_,On=AB()(),yt=KB(),x3=E_(),y3=w_(),ik=A_(),Bc=Xf(),Un={},_3=typeof Uint8Array>"u"||!yt?me:yt(Uint8Array),Xs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?me:ArrayBuffer,"%ArrayIteratorPrototype%":On&&yt?yt([][Symbol.iterator]()):me,"%AsyncFromSyncIteratorPrototype%":me,"%AsyncFunction%":Un,"%AsyncGenerator%":Un,"%AsyncGeneratorFunction%":Un,"%AsyncIteratorPrototype%":Un,"%Atomics%":typeof Atomics>"u"?me:Atomics,"%BigInt%":typeof BigInt>"u"?me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i3,"%eval%":eval,"%EvalError%":s3,"%Float16Array%":typeof Float16Array>"u"?me:Float16Array,"%Float32Array%":typeof Float32Array>"u"?me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?me:FinalizationRegistry,"%Function%":rk,"%GeneratorFunction%":Un,"%Int8Array%":typeof Int8Array>"u"?me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":On&&yt?yt(yt([][Symbol.iterator]())):me,"%JSON%":typeof JSON=="object"?JSON:me,"%Map%":typeof Map>"u"?me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!On||!yt?me:yt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r3,"%Object.getOwnPropertyDescriptor%":Ic,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?me:Promise,"%Proxy%":typeof Proxy>"u"?me:Proxy,"%RangeError%":o3,"%ReferenceError%":n3,"%Reflect%":typeof Reflect>"u"?me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!On||!yt?me:yt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":On&&yt?yt(""[Symbol.iterator]()):me,"%Symbol%":On?Symbol:me,"%SyntaxError%":Ln,"%ThrowTypeError%":g3,"%TypedArray%":_3,"%TypeError%":Gn,"%Uint8Array%":typeof Uint8Array>"u"?me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?me:Uint32Array,"%URIError%":a3,"%WeakMap%":typeof WeakMap>"u"?me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?me:WeakSet,"%Function.prototype.call%":Bc,"%Function.prototype.apply%":ik,"%Object.defineProperty%":m3,"%Object.getPrototypeOf%":x3,"%Math.abs%":l3,"%Math.floor%":c3,"%Math.max%":u3,"%Math.min%":h3,"%Math.pow%":d3,"%Math.round%":f3,"%Math.sign%":p3,"%Reflect.getPrototypeOf%":y3};if(yt)try{null.error}catch(r){JB=yt(yt(r)),Xs["%Error.prototype%"]=JB}var JB,b3=function r(e){var t;if(e==="%AsyncFunction%")t=M_("async function () {}");else if(e==="%GeneratorFunction%")t=M_("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=M_("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&yt&&(t=yt(s.prototype))}return Xs[e]=t,t},ek={__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"]},kc=Rc(),jf=QB(),v3=kc.call(Bc,Array.prototype.concat),T3=kc.call(ik,Array.prototype.splice),tk=kc.call(Bc,String.prototype.replace),Yf=kc.call(Bc,String.prototype.slice),S3=kc.call(Bc,RegExp.prototype.exec),w3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E3=/\\(\\)?/g,A3=function(e){var t=Yf(e,0,1),i=Yf(e,-1);if(t==="%"&&i!=="%")throw new Ln("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Ln("invalid intrinsic syntax, expected opening `%`");var s=[];return tk(e,w3,function(o,n,a,l){s[s.length]=a?tk(l,E3,"$1"):n||o}),s},P3=function(e,t){var i=e,s;if(jf(ek,i)&&(s=ek[i],i="%"+s[0]+"%"),jf(Xs,i)){var o=Xs[i];if(o===Un&&(o=b3(i)),typeof o>"u"&&!t)throw new Gn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Ln("intrinsic "+e+" does not exist!")};sk.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Gn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Gn('"allowMissing" argument must be a boolean');if(S3(/^%?[^%]*%?$/,e)===null)throw new Ln("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=A3(e),s=i.length>0?i[0]:"",o=P3("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],T3(i,v3([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=Yf(d,0,1),p=Yf(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ln("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",jf(Xs,n))a=Xs[n];else if(a!=null){if(!(d in a)){if(!t)throw new Gn("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ic&&u+1>=i.length){var m=Ic(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=jf(a,d),a=a[d];h&&!l&&(Xs[n]=a)}}return a}});var I_=ee((W_e,ak)=>{"use strict";var ok=qf(),nk=P_(),C3=nk([ok("%String.prototype.indexOf%")]);ak.exports=function(e,t){var i=ok(e,!!t);return typeof i=="function"&&C3(e,".prototype.")>-1?nk([i]):i}});var B_=ee((z_e,ck)=>{"use strict";var M3=qf(),Fc=I_(),R3=Mc(),I3=zs(),lk=M3("%Map%",!0),B3=Fc("Map.prototype.get",!0),k3=Fc("Map.prototype.set",!0),F3=Fc("Map.prototype.has",!0),O3=Fc("Map.prototype.delete",!0),U3=Fc("Map.prototype.size",!0);ck.exports=!!lk&&function(){var e,t={assert:function(i){if(!t.has(i))throw new I3("Side channel does not contain "+R3(i))},delete:function(i){if(e){var s=O3(e,i);return U3(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return B3(e,i)},has:function(i){return e?F3(e,i):!1},set:function(i,s){e||(e=new lk),k3(e,i,s)}};return t}});var hk=ee(($_e,uk)=>{"use strict";var G3=qf(),Zf=I_(),L3=Mc(),Kf=B_(),D3=zs(),Dn=G3("%WeakMap%",!0),N3=Zf("WeakMap.prototype.get",!0),H3=Zf("WeakMap.prototype.set",!0),V3=Zf("WeakMap.prototype.has",!0),W3=Zf("WeakMap.prototype.delete",!0);uk.exports=Dn?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new D3("Side channel does not contain "+L3(s))},delete:function(s){if(Dn&&s&&(typeof s=="object"||typeof s=="function")){if(e)return W3(e,s)}else if(Kf&&t)return t.delete(s);return!1},get:function(s){return Dn&&s&&(typeof s=="object"||typeof s=="function")&&e?N3(e,s):t&&t.get(s)},has:function(s){return Dn&&s&&(typeof s=="object"||typeof s=="function")&&e?V3(e,s):!!t&&t.has(s)},set:function(s,o){Dn&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Dn),H3(e,s,o)):Kf&&(t||(t=Kf()),t.set(s,o))}};return i}:Kf});var fk=ee((X_e,dk)=>{"use strict";var z3=zs(),$3=Mc(),X3=HI(),j3=B_(),Y3=hk(),q3=Y3||j3||X3;dk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new z3("Side channel does not contain "+$3(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=q3()),e.set(i,s)}};return t}});var Qf=ee((j_e,pk)=>{"use strict";var K3=String.prototype.replace,Z3=/%20/g,k_={RFC1738:"RFC1738",RFC3986:"RFC3986"};pk.exports={default:k_.RFC3986,formatters:{RFC1738:function(r){return K3.call(r,Z3,"+")},RFC3986:function(r){return String(r)}},RFC1738:k_.RFC1738,RFC3986:k_.RFC3986}});var U_=ee((Y_e,gk)=>{"use strict";var Q3=Qf(),F_=Object.prototype.hasOwnProperty,js=Array.isArray,ti=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),J3=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(js(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);t.obj[t.prop]=s}}},mk=function(e,t){for(var i=t&&t.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},eH=function r(e,t,i){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(js(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!F_.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return js(e)&&!js(t)&&(s=mk(e,i)),js(e)&&js(t)?(t.forEach(function(o,n){if(F_.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=r(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(t).reduce(function(o,n){var a=t[n];return F_.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},tH=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},rH=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},O_=1024,iH=function(e,t,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+=O_){for(var c=n.length>=O_?n.slice(l,l+O_):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===Q3.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=ti[d];continue}if(d<2048){u[u.length]=ti[192|d>>6]+ti[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ti[224|d>>12]+ti[128|d>>6&63]+ti[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=ti[240|d>>18]+ti[128|d>>12&63]+ti[128|d>>6&63]+ti[128|d&63]}a+=u.join("")}return a},sH=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var o=t[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&&(t.push({obj:n,prop:c}),i.push(u))}return J3(t),e},oH=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},nH=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},aH=function(e,t){return[].concat(e,t)},lH=function(e,t){if(js(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)};gk.exports={arrayToObject:mk,assign:tH,combine:aH,compact:sH,decode:rH,encode:iH,isBuffer:nH,isRegExp:oH,maybeMap:lH,merge:eH}});var Tk=ee((q_e,vk)=>{"use strict";var yk=fk(),Jf=U_(),Oc=Qf(),cH=Object.prototype.hasOwnProperty,_k={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ri=Array.isArray,uH=Array.prototype.push,bk=function(r,e){uH.apply(r,ri(e)?e:[e])},hH=Date.prototype.toISOString,xk=Oc.default,dt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Jf.encode,encodeValuesOnly:!1,filter:void 0,format:xk,formatter:Oc.formatters[xk],indices:!1,serializeDate:function(e){return hH.call(e)},skipNulls:!1,strictNullHandling:!1},dH=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},G_={},fH=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m,g,_,v){for(var x=e,T=v,b=0,w=!1;(T=T.get(G_))!==void 0&&!w;){var E=T.get(e);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof T.get(G_)>"u"&&(b=0)}if(typeof u=="function"?x=u(t,x):x instanceof Date?x=f(x):i==="comma"&&ri(x)&&(x=Jf.maybeMap(x,function(Y){return Y instanceof Date?f(Y):Y})),x===null){if(n)return c&&!g?c(t,dt.encoder,_,"key",p):t;x=""}if(dH(x)||Jf.isBuffer(x)){if(c){var I=g?t:c(t,dt.encoder,_,"key",p);return[m(I)+"="+m(c(x,dt.encoder,_,"value",p))]}return[m(t)+"="+m(String(x))]}var B=[];if(typeof x>"u")return B;var C;if(i==="comma"&&ri(x))g&&c&&(x=Jf.maybeMap(x,c)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(ri(u))C=u;else{var A=Object.keys(x);C=h?A.sort(h):A}var P=l?String(t).replace(/\./g,"%2E"):String(t),R=s&&ri(x)&&x.length===1?P+"[]":P;if(o&&ri(x)&&x.length===0)return R+"[]";for(var M=0;M<C.length;++M){var F=C[M],O=typeof F=="object"&&F&&typeof F.value<"u"?F.value:x[F];if(!(a&&O===null)){var D=d&&l?String(F).replace(/\./g,"%2E"):String(F),N=ri(x)?typeof i=="function"?i(R,D):R:R+(d?"."+D:"["+D+"]");v.set(e,b);var G=yk();G.set(G_,v),bk(B,r(O,N,i,s,o,n,a,l,i==="comma"&&g&&ri(x)?null:c,u,h,d,f,p,m,g,_,G))}}return B},pH=function(e){if(!e)return dt;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 t=e.charset||dt.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=Oc.default;if(typeof e.format<"u"){if(!cH.call(Oc.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=Oc.formatters[i],o=dt.filter;(typeof e.filter=="function"||ri(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in _k?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=dt.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:dt.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:dt.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:dt.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:dt.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?dt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:dt.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:dt.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:dt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:dt.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:dt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:dt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:dt.strictNullHandling}};vk.exports=function(r,e){var t=r,i=pH(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):ri(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=_k[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=yk(),u=0;u<s.length;++u){var h=s[u],d=t[h];i.skipNulls&&d===null||bk(n,fH(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 Ak=ee((K_e,Ek)=>{"use strict";var Ys=U_(),L_=Object.prototype.hasOwnProperty,Sk=Array.isArray,Ze={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ys.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},mH=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},wk=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},gH="utf8=%26%2310003%3B",xH="utf8=%E2%9C%93",yH=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?o+1:o);if(t.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===xH?c="utf-8":n[l]===gH&&(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=t.decoder(u,Ze.decoder,c,"key"),p=t.strictNullHandling?null:""):(f=t.decoder(u.slice(0,d),Ze.decoder,c,"key"),p=Ys.maybeMap(wk(u.slice(d+1),t,Sk(i[f])?i[f].length:0),function(g){return t.decoder(g,Ze.decoder,c,"value")})),p&&t.interpretNumericEntities&&c==="iso-8859-1"&&(p=mH(String(p))),u.indexOf("[]=")>-1&&(p=Sk(p)?[p]:p);var m=L_.call(i,f);m&&t.duplicates==="combine"?i[f]=Ys.combine(i[f],p):(!m||t.duplicates==="last")&&(i[f]=p)}return i},_H=function(r,e,t,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:wk(e,t,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&t.parseArrays)l=t.allowEmptyArrays&&(n===""||t.strictNullHandling&&n===null)?[]:Ys.combine([],n);else{l=t.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=t.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!t.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},bH=function(e,t,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&&L_.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&&L_.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 _H(u,t,i,s)}},vH=function(e){if(!e)return Ze;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 t=typeof e.charset>"u"?Ze.charset:e.charset,i=typeof e.duplicates>"u"?Ze.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:Ze.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ze.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ze.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ze.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ze.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ze.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ze.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Ze.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Ze.decoder,delimiter:typeof e.delimiter=="string"||Ys.isRegExp(e.delimiter)?e.delimiter:Ze.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ze.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ze.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ze.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ze.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Ze.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ze.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Ek.exports=function(r,e){var t=vH(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?yH(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=bH(a,i[a],t,typeof r=="string");s=Ys.merge(s,l,t)}return t.allowSparse===!0?s:Ys.compact(s)}});var Ck=ee((Z_e,Pk)=>{"use strict";var TH=Tk(),SH=Ak(),wH=Qf();Pk.exports={formats:wH,parse:SH,stringify:TH}});var Bk=ee(Hn=>{"use strict";var EH=xI();function vr(){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 AH=/^([a-z0-9.+-]+:)/i,PH=/:[0-9]*$/,CH=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,MH=["<",">",'"',"`"," ","\r",`
|
|
1093
|
-
`," "],RH=["{","}","|","\\","^","`"].concat(MH),D_=["'"].concat(RH),Mk=["%","/","?",";","#"].concat(D_),Rk=["/","?","#"],IH=255,Ik=/^[+a-z0-9A-Z_-]{0,63}$/,BH=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kH={javascript:!0,"javascript:":!0},N_={javascript:!0,"javascript:":!0},Nn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},H_=Ck();function Uc(r,e,t){if(r&&typeof r=="object"&&r instanceof vr)return r;var i=new vr;return i.parse(r,e,t),i}vr.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var l=CH.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=H_.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=AH.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(t||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&N_[c])&&(a=a.substr(2),this.slashes=!0)}if(!N_[c]&&(h||c&&!Nn[c])){for(var d=-1,f=0;f<Rk.length;f++){var p=a.indexOf(Rk[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Mk.length;f++){var p=a.indexOf(Mk[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var v=this.hostname.split(/\./),f=0,x=v.length;f<x;f++){var T=v[f];if(T&&!T.match(Ik)){for(var b="",w=0,E=T.length;w<E;w++)T.charCodeAt(w)>127?b+="x":b+=T[w];if(!b.match(Ik)){var I=v.slice(0,f),B=v.slice(f+1),C=T.match(BH);C&&(I.push(C[1]),B.unshift(C[2])),B.length&&(a="/"+B.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>IH?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=EH.toASCII(this.hostname));var A=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+A,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!kH[u])for(var f=0,x=D_.length;f<x;f++){var R=D_[f];if(a.indexOf(R)!==-1){var M=encodeURIComponent(R);M===R&&(M=escape(R)),a=a.split(R).join(M)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),e&&(this.query=H_.parse(this.query)),a=a.slice(0,O)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Nn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var A=this.pathname||"",D=this.search||"";this.path=A+D}return this.href=this.format(),this};function FH(r){return typeof r=="string"&&(r=Uc(r)),r instanceof vr?r.format():vr.prototype.format.call(r)}vr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=H_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Nn[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+t+n+i};function OH(r,e){return Uc(r,!1,!0).resolve(e)}vr.prototype.resolve=function(r){return this.resolveObject(Uc(r,!1,!0)).format()};function UH(r,e){return r?Uc(r,!1,!0).resolveObject(e):e}vr.prototype.resolveObject=function(r){if(typeof r=="string"){var e=new vr;e.parse(r,!1,!0),r=e}for(var t=new vr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];t[o]=this[o]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(t[l]=r[l])}return Nn[t.protocol]&&t.hostname&&!t.pathname&&(t.pathname="/",t.path=t.pathname),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Nn[r.protocol]){for(var c=Object.keys(r),u=0;u<c.length;u++){var h=c[u];t[h]=r[h]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!N_[r.protocol]){for(var x=(r.pathname||"").split("/");x.length&&!(r.host=x.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),x[0]!==""&&x.unshift(""),x.length<2&&x.unshift(""),t.pathname=x.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var d=t.pathname||"",f=t.search||"";t.path=d+f}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||t.host&&r.pathname,_=g,v=t.pathname&&t.pathname.split("/")||[],x=r.pathname&&r.pathname.split("/")||[],T=t.protocol&&!Nn[t.protocol];if(T&&(t.hostname="",t.port=null,t.host&&(v[0]===""?v[0]=t.host:v.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(x[0]===""?x[0]=r.host:x.unshift(r.host)),r.host=null),g=g&&(x[0]===""||v[0]==="")),m)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,v=x;else if(x.length)v||(v=[]),v.pop(),v=v.concat(x),t.search=r.search,t.query=r.query;else if(r.search!=null){if(T){t.host=v.shift(),t.hostname=t.host;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var w=v.slice(-1)[0],E=(t.host||r.host||v.length>1)&&(w==="."||w==="..")||w==="",I=0,B=v.length;B>=0;B--)w=v[B],w==="."?v.splice(B,1):w===".."?(v.splice(B,1),I++):I&&(v.splice(B,1),I--);if(!g&&!_)for(;I--;I)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),E&&v.join("/").substr(-1)!=="/"&&v.push("");var C=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(T){t.hostname=C?"":v.length?v.shift():"",t.host=t.hostname;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return g=g||t.host&&v.length,g&&!C&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};vr.prototype.parseHost=function(){var r=this.host,e=PH.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};Hn.parse=Uc;Hn.resolve=OH;Hn.resolveObject=UH;Hn.format=FH;Hn.Url=vr});var ZF=()=>{let r=new Map,e=l=>typeof l=="string"&&l.startsWith("blob:"),t=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!e(l.url);return{load:async l=>{let c=[];for(let[u,h]of Object.entries(l))r.has(u)||c.push([u,h]);c.length>0&&await Promise.all(c.map(async([u,h])=>{if(t(h)){r.set(u,{url:h.url,type:h.type,source:"url"});return}let p={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,p)}))},getBufferMap:()=>{let l={};for(let[c,u]of r.entries())l[c]=u;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};U();var lA={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(aA(),oU))}};U();var uA={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(cA(),nU))}};U();Ju();ju();U();Re();al();var jh;function gA(r){return jh!==void 0||(jh=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??Yi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.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}})()),jh}Re();var Yh;async function xA(r={}){return Yh!==void 0||(Yh=await(async()=>{let e=j.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Yh}al();var MC=["webgl","webgpu","canvas"];async function RC(r){let e=[];r.preference?(e.push(r.preference),MC.forEach(o=>{o!==r.preference&&e.push(o)})):e=MC.slice();let t,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await xA()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(rP(),tP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&gA(r.failIfMajorPerformanceCaveat??Yi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(CC(),PC));t=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!t)throw new Error("No available renderer for the current environment");let s=new t;return await s.init(i),s}Ar();Ex();$e();var IC=class fy{constructor(...e){this.stage=new te,e[0]!==void 0&&X(ie,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await RC(e),fy._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(ie,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,t=!1){let i=fy._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};IC._plugins=[];var rc=IC;V.handleByList(S.Application,rc._plugins);V.add(xl);U();Li();Em();Re();U();vs();ct();ve();ex();ox();var ic=class extends qo{constructor(e,t){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 Q(n.x+a.x,n.y+a.y,n.width,n.height),u=new k({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=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){Ja.install(e)}static uninstall(e){Ja.uninstall(e)}};var _d={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let e=r.match(/^[a-z]+\s+.+$/gm),t={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 g=f[m].split("="),_=g[0],v=g[1].replace(/"/gm,""),x=parseFloat(v),T=isNaN(x)?v:x;p[_]=T}t[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=t.info,[o]=t.common,[n]=t.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=t.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=t.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=t.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}};Re();var py={test(r){let e=r;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},t=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");e.fontSize=parseInt(t.getAttribute("size"),10),e.fontFamily=t.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 my={test(r){return typeof r=="string"&&r.includes("<font>")?py.test(j.get().parseXML(r)):!1},parse(r){return py.parse(j.get().parseXML(r))}};var NU=[".xml",".fnt"],BC={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ic,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},kC={extension:{type:S.LoadParser,priority:Lt.Normal},name:"loadBitmapFont",test(r){return NU.includes(ht.extname(r).toLowerCase())},async testParse(r){return _d.test(r)||my.test(r)},async parse(r,e,t){let i=_d.test(r)?_d.parse(r):my.parse(r),{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=ht.join(ht.dirname(s),d);f=Aa(f,s),n.push({src:f,data:a})}let l=await t.load(n),c=n.map(h=>l[h.src]);return new ic({data:i,textures:c},s)},async load(r,e){return await(await j.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};Ae();var bd=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),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=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<t;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())}};Ni();U();ve();var FC={extension:{type:S.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(e=>e instanceof k),getCacheableAssets:(r,e)=>{let t={};return r.forEach(i=>{e.forEach((s,o)=>{t[i+(o===0?"":o+1)]=s})}),t}};U();async function vd(r){if("Image"in globalThis)return new Promise(e=>{let t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var OC={extension:{type:S.DetectionParser,priority:1},test:async()=>vd("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};U();var UC=["png","jpg","jpeg"],GC={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...UC],remove:async r=>r.filter(e=>!UC.includes(e))};U();var HU="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function hn(r){return HU?!1:document.createElement("video").canPlayType(r)!==""}var LC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};U();var DC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};U();var NC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};U();var HC={extension:{type:S.DetectionParser,priority:0},test:async()=>vd("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};Ae();vs();Ea();Xu();var Td=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(t.loadParser&&(o=this._parserHash[t.loadParser],o||W(`[Assets] specified load parser "${t.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,t,this)){o=a;break}}if(!o)return W(`[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,t,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,t,this)&&(s=await a.parse(s,t,this)||s,i.parser=a)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0,s={},o=Ts(e),n=Dt(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=ht.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,t&&t(++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 Nf(r,e){var t=x_(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=wi(r,s)?e(r[s],r):""}var o=typeof d_=="function"?d_(r):[],n;if(Fn){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)wi(r,l)&&(t&&String(Number(l))===l&&l<r.length||Fn&&n["$"+l]instanceof Symbol||(BI.call(/[^\w$]/,l)?i.push(e(l,r)+": "+e(r[l],r)):i.push(l+": "+e(r[l],r))));if(typeof d_=="function")for(var c=0;c<o.length;c++)kI.call(r,o[c])&&i.push("["+e(o[c])+"]: "+e(r[o[c]],r));return i}});var HI=ee((u_e,NI)=>{"use strict";var MN=Mc(),RN=zs(),Wf=function(r,e,t){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,t||(s.next=r.next,r.next=s),s},IN=function(r,e){if(r){var t=Wf(r,e);return t&&t.value}},BN=function(r,e,t){var i=Wf(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},kN=function(r,e){return r?!!Wf(r,e):!1},FN=function(r,e){if(r)return Wf(r,e,!0)};NI.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new RN("Side channel does not contain "+MN(i))},delete:function(i){var s=e&&e.next,o=FN(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return IN(e,i)},has:function(i){return kN(e,i)},set:function(i,s){e||(e={next:void 0}),BN(e,i,s)}};return t}});var T_=ee((h_e,VI)=>{"use strict";VI.exports=Object});var zI=ee((d_e,WI)=>{"use strict";WI.exports=Error});var XI=ee((f_e,$I)=>{"use strict";$I.exports=EvalError});var YI=ee((p_e,jI)=>{"use strict";jI.exports=RangeError});var KI=ee((m_e,qI)=>{"use strict";qI.exports=ReferenceError});var QI=ee((g_e,ZI)=>{"use strict";ZI.exports=SyntaxError});var eB=ee((x_e,JI)=>{"use strict";JI.exports=URIError});var rB=ee((y_e,tB)=>{"use strict";tB.exports=Math.abs});var sB=ee((__e,iB)=>{"use strict";iB.exports=Math.floor});var nB=ee((b_e,oB)=>{"use strict";oB.exports=Math.max});var lB=ee((v_e,aB)=>{"use strict";aB.exports=Math.min});var uB=ee((T_e,cB)=>{"use strict";cB.exports=Math.pow});var dB=ee((S_e,hB)=>{"use strict";hB.exports=Math.round});var pB=ee((w_e,fB)=>{"use strict";fB.exports=Number.isNaN||function(e){return e!==e}});var gB=ee((E_e,mB)=>{"use strict";var ON=pB();mB.exports=function(e){return ON(e)||e===0?e:e<0?-1:1}});var yB=ee((A_e,xB)=>{"use strict";xB.exports=Object.getOwnPropertyDescriptor});var S_=ee((P_e,_B)=>{"use strict";var zf=yB();if(zf)try{zf([],"length")}catch{zf=null}_B.exports=zf});var vB=ee((C_e,bB)=>{"use strict";var $f=Object.defineProperty||!1;if($f)try{$f({},"a",{value:1})}catch{$f=!1}bB.exports=$f});var SB=ee((M_e,TB)=>{"use strict";TB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var AB=ee((R_e,EB)=>{"use strict";var wB=typeof Symbol<"u"&&Symbol,UN=SB();EB.exports=function(){return typeof wB!="function"||typeof Symbol!="function"||typeof wB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:UN()}});var w_=ee((I_e,PB)=>{"use strict";PB.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var E_=ee((B_e,CB)=>{"use strict";var GN=T_();CB.exports=GN.getPrototypeOf||null});var IB=ee((k_e,RB)=>{"use strict";var LN="Function.prototype.bind called on incompatible ",DN=Object.prototype.toString,NN=Math.max,HN="[object Function]",MB=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<t.length;o+=1)i[o+e.length]=t[o];return i},VN=function(e,t){for(var i=[],s=t||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},WN=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t};RB.exports=function(e){var t=this;if(typeof t!="function"||DN.apply(t)!==HN)throw new TypeError(LN+t);for(var i=VN(arguments,1),s,o=function(){if(this instanceof s){var u=t.apply(this,MB(i,arguments));return Object(u)===u?u:this}return t.apply(e,MB(i,arguments))},n=NN(0,t.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+WN(a,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,s.prototype=new c,c.prototype=null}return s}});var Rc=ee((F_e,BB)=>{"use strict";var zN=IB();BB.exports=Function.prototype.bind||zN});var Xf=ee((O_e,kB)=>{"use strict";kB.exports=Function.prototype.call});var A_=ee((U_e,FB)=>{"use strict";FB.exports=Function.prototype.apply});var UB=ee((G_e,OB)=>{"use strict";OB.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var LB=ee((L_e,GB)=>{"use strict";var $N=Rc(),XN=A_(),jN=Xf(),YN=UB();GB.exports=YN||$N.call(jN,XN)});var P_=ee((D_e,DB)=>{"use strict";var qN=Rc(),KN=zs(),ZN=Xf(),QN=LB();DB.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new KN("a function is required");return QN(qN,ZN,e)}});var $B=ee((N_e,zB)=>{"use strict";var JN=P_(),NB=S_(),VB;try{VB=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var C_=!!VB&&NB&&NB(Object.prototype,"__proto__"),WB=Object,HB=WB.getPrototypeOf;zB.exports=C_&&typeof C_.get=="function"?JN([C_.get]):typeof HB=="function"?function(e){return HB(e==null?e:WB(e))}:!1});var KB=ee((H_e,qB)=>{"use strict";var XB=w_(),jB=E_(),YB=$B();qB.exports=XB?function(e){return XB(e)}:jB?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return jB(e)}:YB?function(e){return YB(e)}:null});var QB=ee((V_e,ZB)=>{"use strict";var e3=Function.prototype.call,t3=Object.prototype.hasOwnProperty,r3=Rc();ZB.exports=r3.call(e3,t3)});var qf=ee((W_e,sk)=>{"use strict";var me,i3=T_(),s3=zI(),o3=XI(),n3=YI(),a3=KI(),Ln=QI(),Gn=zs(),l3=eB(),c3=rB(),u3=sB(),h3=nB(),d3=lB(),f3=uB(),p3=dB(),m3=gB(),rk=Function,M_=function(r){try{return rk('"use strict"; return ('+r+").constructor;")()}catch{}},Ic=S_(),g3=vB(),R_=function(){throw new Gn},x3=Ic?function(){try{return arguments.callee,R_}catch{try{return Ic(arguments,"callee").get}catch{return R_}}}():R_,On=AB()(),yt=KB(),y3=E_(),_3=w_(),ik=A_(),Bc=Xf(),Un={},b3=typeof Uint8Array>"u"||!yt?me:yt(Uint8Array),Xs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?me:ArrayBuffer,"%ArrayIteratorPrototype%":On&&yt?yt([][Symbol.iterator]()):me,"%AsyncFromSyncIteratorPrototype%":me,"%AsyncFunction%":Un,"%AsyncGenerator%":Un,"%AsyncGeneratorFunction%":Un,"%AsyncIteratorPrototype%":Un,"%Atomics%":typeof Atomics>"u"?me:Atomics,"%BigInt%":typeof BigInt>"u"?me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":s3,"%eval%":eval,"%EvalError%":o3,"%Float16Array%":typeof Float16Array>"u"?me:Float16Array,"%Float32Array%":typeof Float32Array>"u"?me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?me:FinalizationRegistry,"%Function%":rk,"%GeneratorFunction%":Un,"%Int8Array%":typeof Int8Array>"u"?me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":On&&yt?yt(yt([][Symbol.iterator]())):me,"%JSON%":typeof JSON=="object"?JSON:me,"%Map%":typeof Map>"u"?me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!On||!yt?me:yt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":i3,"%Object.getOwnPropertyDescriptor%":Ic,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?me:Promise,"%Proxy%":typeof Proxy>"u"?me:Proxy,"%RangeError%":n3,"%ReferenceError%":a3,"%Reflect%":typeof Reflect>"u"?me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!On||!yt?me:yt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":On&&yt?yt(""[Symbol.iterator]()):me,"%Symbol%":On?Symbol:me,"%SyntaxError%":Ln,"%ThrowTypeError%":x3,"%TypedArray%":b3,"%TypeError%":Gn,"%Uint8Array%":typeof Uint8Array>"u"?me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?me:Uint32Array,"%URIError%":l3,"%WeakMap%":typeof WeakMap>"u"?me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?me:WeakSet,"%Function.prototype.call%":Bc,"%Function.prototype.apply%":ik,"%Object.defineProperty%":g3,"%Object.getPrototypeOf%":y3,"%Math.abs%":c3,"%Math.floor%":u3,"%Math.max%":h3,"%Math.min%":d3,"%Math.pow%":f3,"%Math.round%":p3,"%Math.sign%":m3,"%Reflect.getPrototypeOf%":_3};if(yt)try{null.error}catch(r){JB=yt(yt(r)),Xs["%Error.prototype%"]=JB}var JB,v3=function r(e){var t;if(e==="%AsyncFunction%")t=M_("async function () {}");else if(e==="%GeneratorFunction%")t=M_("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=M_("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&yt&&(t=yt(s.prototype))}return Xs[e]=t,t},ek={__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"]},kc=Rc(),jf=QB(),T3=kc.call(Bc,Array.prototype.concat),S3=kc.call(ik,Array.prototype.splice),tk=kc.call(Bc,String.prototype.replace),Yf=kc.call(Bc,String.prototype.slice),w3=kc.call(Bc,RegExp.prototype.exec),E3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A3=/\\(\\)?/g,P3=function(e){var t=Yf(e,0,1),i=Yf(e,-1);if(t==="%"&&i!=="%")throw new Ln("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Ln("invalid intrinsic syntax, expected opening `%`");var s=[];return tk(e,E3,function(o,n,a,l){s[s.length]=a?tk(l,A3,"$1"):n||o}),s},C3=function(e,t){var i=e,s;if(jf(ek,i)&&(s=ek[i],i="%"+s[0]+"%"),jf(Xs,i)){var o=Xs[i];if(o===Un&&(o=v3(i)),typeof o>"u"&&!t)throw new Gn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Ln("intrinsic "+e+" does not exist!")};sk.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Gn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Gn('"allowMissing" argument must be a boolean');if(w3(/^%?[^%]*%?$/,e)===null)throw new Ln("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=P3(e),s=i.length>0?i[0]:"",o=C3("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],S3(i,T3([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=Yf(d,0,1),p=Yf(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ln("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",jf(Xs,n))a=Xs[n];else if(a!=null){if(!(d in a)){if(!t)throw new Gn("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ic&&u+1>=i.length){var m=Ic(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=jf(a,d),a=a[d];h&&!l&&(Xs[n]=a)}}return a}});var I_=ee((z_e,ak)=>{"use strict";var ok=qf(),nk=P_(),M3=nk([ok("%String.prototype.indexOf%")]);ak.exports=function(e,t){var i=ok(e,!!t);return typeof i=="function"&&M3(e,".prototype.")>-1?nk([i]):i}});var B_=ee(($_e,ck)=>{"use strict";var R3=qf(),Fc=I_(),I3=Mc(),B3=zs(),lk=R3("%Map%",!0),k3=Fc("Map.prototype.get",!0),F3=Fc("Map.prototype.set",!0),O3=Fc("Map.prototype.has",!0),U3=Fc("Map.prototype.delete",!0),G3=Fc("Map.prototype.size",!0);ck.exports=!!lk&&function(){var e,t={assert:function(i){if(!t.has(i))throw new B3("Side channel does not contain "+I3(i))},delete:function(i){if(e){var s=U3(e,i);return G3(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return k3(e,i)},has:function(i){return e?O3(e,i):!1},set:function(i,s){e||(e=new lk),F3(e,i,s)}};return t}});var hk=ee((X_e,uk)=>{"use strict";var L3=qf(),Zf=I_(),D3=Mc(),Kf=B_(),N3=zs(),Dn=L3("%WeakMap%",!0),H3=Zf("WeakMap.prototype.get",!0),V3=Zf("WeakMap.prototype.set",!0),W3=Zf("WeakMap.prototype.has",!0),z3=Zf("WeakMap.prototype.delete",!0);uk.exports=Dn?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new N3("Side channel does not contain "+D3(s))},delete:function(s){if(Dn&&s&&(typeof s=="object"||typeof s=="function")){if(e)return z3(e,s)}else if(Kf&&t)return t.delete(s);return!1},get:function(s){return Dn&&s&&(typeof s=="object"||typeof s=="function")&&e?H3(e,s):t&&t.get(s)},has:function(s){return Dn&&s&&(typeof s=="object"||typeof s=="function")&&e?W3(e,s):!!t&&t.has(s)},set:function(s,o){Dn&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Dn),V3(e,s,o)):Kf&&(t||(t=Kf()),t.set(s,o))}};return i}:Kf});var fk=ee((j_e,dk)=>{"use strict";var $3=zs(),X3=Mc(),j3=HI(),Y3=B_(),q3=hk(),K3=q3||Y3||j3;dk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new $3("Side channel does not contain "+X3(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=K3()),e.set(i,s)}};return t}});var Qf=ee((Y_e,pk)=>{"use strict";var Z3=String.prototype.replace,Q3=/%20/g,k_={RFC1738:"RFC1738",RFC3986:"RFC3986"};pk.exports={default:k_.RFC3986,formatters:{RFC1738:function(r){return Z3.call(r,Q3,"+")},RFC3986:function(r){return String(r)}},RFC1738:k_.RFC1738,RFC3986:k_.RFC3986}});var U_=ee((q_e,gk)=>{"use strict";var J3=Qf(),F_=Object.prototype.hasOwnProperty,js=Array.isArray,ti=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),eH=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(js(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);t.obj[t.prop]=s}}},mk=function(e,t){for(var i=t&&t.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},tH=function r(e,t,i){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(js(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!F_.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return js(e)&&!js(t)&&(s=mk(e,i)),js(e)&&js(t)?(t.forEach(function(o,n){if(F_.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=r(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(t).reduce(function(o,n){var a=t[n];return F_.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},rH=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},iH=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},O_=1024,sH=function(e,t,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+=O_){for(var c=n.length>=O_?n.slice(l,l+O_):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===J3.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=ti[d];continue}if(d<2048){u[u.length]=ti[192|d>>6]+ti[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ti[224|d>>12]+ti[128|d>>6&63]+ti[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=ti[240|d>>18]+ti[128|d>>12&63]+ti[128|d>>6&63]+ti[128|d&63]}a+=u.join("")}return a},oH=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var o=t[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&&(t.push({obj:n,prop:c}),i.push(u))}return eH(t),e},nH=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},aH=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},lH=function(e,t){return[].concat(e,t)},cH=function(e,t){if(js(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)};gk.exports={arrayToObject:mk,assign:rH,combine:lH,compact:oH,decode:iH,encode:sH,isBuffer:aH,isRegExp:nH,maybeMap:cH,merge:tH}});var Tk=ee((K_e,vk)=>{"use strict";var yk=fk(),Jf=U_(),Oc=Qf(),uH=Object.prototype.hasOwnProperty,_k={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ri=Array.isArray,hH=Array.prototype.push,bk=function(r,e){hH.apply(r,ri(e)?e:[e])},dH=Date.prototype.toISOString,xk=Oc.default,dt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Jf.encode,encodeValuesOnly:!1,filter:void 0,format:xk,formatter:Oc.formatters[xk],indices:!1,serializeDate:function(e){return dH.call(e)},skipNulls:!1,strictNullHandling:!1},fH=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},G_={},pH=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m,g,_,v){for(var x=e,T=v,b=0,w=!1;(T=T.get(G_))!==void 0&&!w;){var E=T.get(e);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof T.get(G_)>"u"&&(b=0)}if(typeof u=="function"?x=u(t,x):x instanceof Date?x=f(x):i==="comma"&&ri(x)&&(x=Jf.maybeMap(x,function(Y){return Y instanceof Date?f(Y):Y})),x===null){if(n)return c&&!g?c(t,dt.encoder,_,"key",p):t;x=""}if(fH(x)||Jf.isBuffer(x)){if(c){var I=g?t:c(t,dt.encoder,_,"key",p);return[m(I)+"="+m(c(x,dt.encoder,_,"value",p))]}return[m(t)+"="+m(String(x))]}var B=[];if(typeof x>"u")return B;var C;if(i==="comma"&&ri(x))g&&c&&(x=Jf.maybeMap(x,c)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(ri(u))C=u;else{var A=Object.keys(x);C=h?A.sort(h):A}var P=l?String(t).replace(/\./g,"%2E"):String(t),R=s&&ri(x)&&x.length===1?P+"[]":P;if(o&&ri(x)&&x.length===0)return R+"[]";for(var M=0;M<C.length;++M){var F=C[M],O=typeof F=="object"&&F&&typeof F.value<"u"?F.value:x[F];if(!(a&&O===null)){var D=d&&l?String(F).replace(/\./g,"%2E"):String(F),N=ri(x)?typeof i=="function"?i(R,D):R:R+(d?"."+D:"["+D+"]");v.set(e,b);var L=yk();L.set(G_,v),bk(B,r(O,N,i,s,o,n,a,l,i==="comma"&&g&&ri(x)?null:c,u,h,d,f,p,m,g,_,L))}}return B},mH=function(e){if(!e)return dt;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 t=e.charset||dt.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=Oc.default;if(typeof e.format<"u"){if(!uH.call(Oc.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=Oc.formatters[i],o=dt.filter;(typeof e.filter=="function"||ri(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in _k?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=dt.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:dt.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:dt.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:dt.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:dt.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?dt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:dt.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:dt.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:dt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:dt.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:dt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:dt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:dt.strictNullHandling}};vk.exports=function(r,e){var t=r,i=mH(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):ri(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=_k[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=yk(),u=0;u<s.length;++u){var h=s[u],d=t[h];i.skipNulls&&d===null||bk(n,pH(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 Ak=ee((Z_e,Ek)=>{"use strict";var Ys=U_(),L_=Object.prototype.hasOwnProperty,Sk=Array.isArray,Ze={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ys.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},gH=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},wk=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},xH="utf8=%26%2310003%3B",yH="utf8=%E2%9C%93",_H=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?o+1:o);if(t.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===yH?c="utf-8":n[l]===xH&&(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=t.decoder(u,Ze.decoder,c,"key"),p=t.strictNullHandling?null:""):(f=t.decoder(u.slice(0,d),Ze.decoder,c,"key"),p=Ys.maybeMap(wk(u.slice(d+1),t,Sk(i[f])?i[f].length:0),function(g){return t.decoder(g,Ze.decoder,c,"value")})),p&&t.interpretNumericEntities&&c==="iso-8859-1"&&(p=gH(String(p))),u.indexOf("[]=")>-1&&(p=Sk(p)?[p]:p);var m=L_.call(i,f);m&&t.duplicates==="combine"?i[f]=Ys.combine(i[f],p):(!m||t.duplicates==="last")&&(i[f]=p)}return i},bH=function(r,e,t,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:wk(e,t,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&t.parseArrays)l=t.allowEmptyArrays&&(n===""||t.strictNullHandling&&n===null)?[]:Ys.combine([],n);else{l=t.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=t.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!t.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},vH=function(e,t,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&&L_.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&&L_.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 bH(u,t,i,s)}},TH=function(e){if(!e)return Ze;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 t=typeof e.charset>"u"?Ze.charset:e.charset,i=typeof e.duplicates>"u"?Ze.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:Ze.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ze.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ze.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ze.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ze.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ze.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ze.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Ze.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Ze.decoder,delimiter:typeof e.delimiter=="string"||Ys.isRegExp(e.delimiter)?e.delimiter:Ze.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ze.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ze.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ze.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ze.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Ze.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ze.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Ek.exports=function(r,e){var t=TH(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?_H(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=vH(a,i[a],t,typeof r=="string");s=Ys.merge(s,l,t)}return t.allowSparse===!0?s:Ys.compact(s)}});var Ck=ee((Q_e,Pk)=>{"use strict";var SH=Tk(),wH=Ak(),EH=Qf();Pk.exports={formats:EH,parse:wH,stringify:SH}});var Bk=ee(Hn=>{"use strict";var AH=xI();function vr(){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 PH=/^([a-z0-9.+-]+:)/i,CH=/:[0-9]*$/,MH=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,RH=["<",">",'"',"`"," ","\r",`
|
|
1093
|
+
`," "],IH=["{","}","|","\\","^","`"].concat(RH),D_=["'"].concat(IH),Mk=["%","/","?",";","#"].concat(D_),Rk=["/","?","#"],BH=255,Ik=/^[+a-z0-9A-Z_-]{0,63}$/,kH=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,FH={javascript:!0,"javascript:":!0},N_={javascript:!0,"javascript:":!0},Nn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},H_=Ck();function Uc(r,e,t){if(r&&typeof r=="object"&&r instanceof vr)return r;var i=new vr;return i.parse(r,e,t),i}vr.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var l=MH.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=H_.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=PH.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(t||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&N_[c])&&(a=a.substr(2),this.slashes=!0)}if(!N_[c]&&(h||c&&!Nn[c])){for(var d=-1,f=0;f<Rk.length;f++){var p=a.indexOf(Rk[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Mk.length;f++){var p=a.indexOf(Mk[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var v=this.hostname.split(/\./),f=0,x=v.length;f<x;f++){var T=v[f];if(T&&!T.match(Ik)){for(var b="",w=0,E=T.length;w<E;w++)T.charCodeAt(w)>127?b+="x":b+=T[w];if(!b.match(Ik)){var I=v.slice(0,f),B=v.slice(f+1),C=T.match(kH);C&&(I.push(C[1]),B.unshift(C[2])),B.length&&(a="/"+B.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>BH?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=AH.toASCII(this.hostname));var A=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+A,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!FH[u])for(var f=0,x=D_.length;f<x;f++){var R=D_[f];if(a.indexOf(R)!==-1){var M=encodeURIComponent(R);M===R&&(M=escape(R)),a=a.split(R).join(M)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),e&&(this.query=H_.parse(this.query)),a=a.slice(0,O)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Nn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var A=this.pathname||"",D=this.search||"";this.path=A+D}return this.href=this.format(),this};function OH(r){return typeof r=="string"&&(r=Uc(r)),r instanceof vr?r.format():vr.prototype.format.call(r)}vr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=H_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Nn[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+t+n+i};function UH(r,e){return Uc(r,!1,!0).resolve(e)}vr.prototype.resolve=function(r){return this.resolveObject(Uc(r,!1,!0)).format()};function GH(r,e){return r?Uc(r,!1,!0).resolveObject(e):e}vr.prototype.resolveObject=function(r){if(typeof r=="string"){var e=new vr;e.parse(r,!1,!0),r=e}for(var t=new vr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];t[o]=this[o]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(t[l]=r[l])}return Nn[t.protocol]&&t.hostname&&!t.pathname&&(t.pathname="/",t.path=t.pathname),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Nn[r.protocol]){for(var c=Object.keys(r),u=0;u<c.length;u++){var h=c[u];t[h]=r[h]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!N_[r.protocol]){for(var x=(r.pathname||"").split("/");x.length&&!(r.host=x.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),x[0]!==""&&x.unshift(""),x.length<2&&x.unshift(""),t.pathname=x.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var d=t.pathname||"",f=t.search||"";t.path=d+f}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||t.host&&r.pathname,_=g,v=t.pathname&&t.pathname.split("/")||[],x=r.pathname&&r.pathname.split("/")||[],T=t.protocol&&!Nn[t.protocol];if(T&&(t.hostname="",t.port=null,t.host&&(v[0]===""?v[0]=t.host:v.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(x[0]===""?x[0]=r.host:x.unshift(r.host)),r.host=null),g=g&&(x[0]===""||v[0]==="")),m)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,v=x;else if(x.length)v||(v=[]),v.pop(),v=v.concat(x),t.search=r.search,t.query=r.query;else if(r.search!=null){if(T){t.host=v.shift(),t.hostname=t.host;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var w=v.slice(-1)[0],E=(t.host||r.host||v.length>1)&&(w==="."||w==="..")||w==="",I=0,B=v.length;B>=0;B--)w=v[B],w==="."?v.splice(B,1):w===".."?(v.splice(B,1),I++):I&&(v.splice(B,1),I--);if(!g&&!_)for(;I--;I)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),E&&v.join("/").substr(-1)!=="/"&&v.push("");var C=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(T){t.hostname=C?"":v.length?v.shift():"",t.host=t.hostname;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return g=g||t.host&&v.length,g&&!C&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};vr.prototype.parseHost=function(){var r=this.host,e=CH.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};Hn.parse=Uc;Hn.resolve=UH;Hn.resolveObject=GH;Hn.format=OH;Hn.Url=vr});var ZF=()=>{let r=new Map,e=l=>typeof l=="string"&&l.startsWith("blob:"),t=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!e(l.url);return{load:async l=>{let c=[];for(let[u,h]of Object.entries(l))r.has(u)||c.push([u,h]);c.length>0&&await Promise.all(c.map(async([u,h])=>{if(t(h)){r.set(u,{url:h.url,type:h.type,source:"url"});return}let p={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,p)}))},getBufferMap:()=>{let l={};for(let[c,u]of r.entries())l[c]=u;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};U();var lA={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(aA(),oU))}};U();var uA={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(cA(),nU))}};U();Ju();ju();U();Re();al();var jh;function gA(r){return jh!==void 0||(jh=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??Yi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.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}})()),jh}Re();var Yh;async function xA(r={}){return Yh!==void 0||(Yh=await(async()=>{let e=j.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Yh}al();var MC=["webgl","webgpu","canvas"];async function RC(r){let e=[];r.preference?(e.push(r.preference),MC.forEach(o=>{o!==r.preference&&e.push(o)})):e=MC.slice();let t,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await xA()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(rP(),tP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&gA(r.failIfMajorPerformanceCaveat??Yi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(CC(),PC));t=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!t)throw new Error("No available renderer for the current environment");let s=new t;return await s.init(i),s}Ar();Ex();$e();var IC=class fy{constructor(...e){this.stage=new te,e[0]!==void 0&&X(ie,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await RC(e),fy._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(ie,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,t=!1){let i=fy._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};IC._plugins=[];var rc=IC;V.handleByList(S.Application,rc._plugins);V.add(xl);U();Li();Em();Re();U();vs();ct();ve();ex();ox();var ic=class extends qo{constructor(e,t){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 Q(n.x+a.x,n.y+a.y,n.width,n.height),u=new k({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=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){Ja.install(e)}static uninstall(e){Ja.uninstall(e)}};var _d={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let e=r.match(/^[a-z]+\s+.+$/gm),t={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 g=f[m].split("="),_=g[0],v=g[1].replace(/"/gm,""),x=parseFloat(v),T=isNaN(x)?v:x;p[_]=T}t[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=t.info,[o]=t.common,[n]=t.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=t.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=t.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=t.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}};Re();var py={test(r){let e=r;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},t=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");e.fontSize=parseInt(t.getAttribute("size"),10),e.fontFamily=t.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 my={test(r){return typeof r=="string"&&r.includes("<font>")?py.test(j.get().parseXML(r)):!1},parse(r){return py.parse(j.get().parseXML(r))}};var NU=[".xml",".fnt"],BC={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ic,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},kC={extension:{type:S.LoadParser,priority:Lt.Normal},name:"loadBitmapFont",test(r){return NU.includes(ht.extname(r).toLowerCase())},async testParse(r){return _d.test(r)||my.test(r)},async parse(r,e,t){let i=_d.test(r)?_d.parse(r):my.parse(r),{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=ht.join(ht.dirname(s),d);f=Aa(f,s),n.push({src:f,data:a})}let l=await t.load(n),c=n.map(h=>l[h.src]);return new ic({data:i,textures:c},s)},async load(r,e){return await(await j.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};Ae();var bd=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),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=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<t;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())}};Ni();U();ve();var FC={extension:{type:S.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(e=>e instanceof k),getCacheableAssets:(r,e)=>{let t={};return r.forEach(i=>{e.forEach((s,o)=>{t[i+(o===0?"":o+1)]=s})}),t}};U();async function vd(r){if("Image"in globalThis)return new Promise(e=>{let t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var OC={extension:{type:S.DetectionParser,priority:1},test:async()=>vd("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};U();var UC=["png","jpg","jpeg"],GC={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...UC],remove:async r=>r.filter(e=>!UC.includes(e))};U();var HU="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function hn(r){return HU?!1:document.createElement("video").canPlayType(r)!==""}var LC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};U();var DC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};U();var NC={extension:{type:S.DetectionParser,priority:0},test:async()=>hn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};U();var HC={extension:{type:S.DetectionParser,priority:0},test:async()=>vd("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};Ae();vs();Ea();Xu();var Td=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(t.loadParser&&(o=this._parserHash[t.loadParser],o||W(`[Assets] specified load parser "${t.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,t,this)){o=a;break}}if(!o)return W(`[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,t,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,t,this)&&(s=await a.parse(s,t,this)||s,i.parser=a)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0,s={},o=Ts(e),n=Dt(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=ht.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,t&&t(++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=Dt(e,s=>({alias:[s],src:s})).map(async s=>{let o=ht.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,t)=>(t.name?e[t.name]&&W(`[Assets] loadParser name conflict "${t.name}"`):W("[Assets] loadParser should have a name"),{...e,[t.name]:t}),{})}};Re();U();function xr(r,e){if(Array.isArray(e)){for(let t of e)if(r.startsWith(`data:${t}`))return!0;return!1}return r.startsWith(`data:${e}`)}vs();function yr(r,e){let t=r.split("?")[0],i=ht.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}Li();var VU=".json",WU="application/json",VC={extension:{type:S.LoadParser,priority:Lt.Low},name:"loadJson",test(r){return xr(r,WU)||yr(r,VU)},async load(r){return await(await j.get().fetch(r)).json()}};Re();U();Li();var zU=".txt",$U="text/plain",WC={name:"loadTxt",extension:{type:S.LoadParser,priority:Lt.Low,name:"loadTxt"},test(r){return xr(r,$U)||yr(r,zU)},async load(r){return await(await j.get().fetch(r)).text()}};Re();U();Ae();vs();Ni();Li();var XU=["normal","bold","100","200","300","400","500","600","700","800","900"],jU=[".ttf",".otf",".woff",".woff2"],YU=["font/ttf","font/otf","font/woff","font/woff2"],qU=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function KU(r){let e=ht.extname(r),s=ht.basename(r,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(qU)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var ZU=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function QU(r){return ZU.test(r)?r:encodeURI(r)}var zC={extension:{type:S.LoadParser,priority:Lt.Low},name:"loadWebFont",test(r){return xr(r,YU)||yr(r,jU)},async load(r,e){let t=j.get().getFontFaceSet();if(t){let i=[],s=e.data?.family??KU(r),o=e.data?.weights?.filter(a=>XU.includes(a))??["normal"],n=e.data??{};for(let a=0;a<o.length;a++){let l=o[a],c=new FontFace(s,`url(${QU(r)})`,{...n,weight:l});await c.load(),t.add(c),i.push(c)}return Se.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return W("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(e=>{Se.remove(`${e.family}-and-url`),j.get().getFontFaceSet().delete(e)})}};Re();U();Eo();Bh();So();function dn(r,e=1){let t=tr.RETINA_PREFIX?.exec(r);return t?parseFloat(t[1]):e}Li();ve();Ae();Ni();function fn(r,e,t){r.label=t,r._sourceOrigin=t;let i=new k({source:r,label:t}),s=()=>{delete e.promiseCache[t],Se.has(t)&&Se.remove(t)};return i.source.once("destroy",()=>{e.promiseCache[t]&&(W("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(W("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var JU=".svg",eG="image/svg+xml",$C={extension:{type:S.LoadParser,priority:Lt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return xr(r,eG)||yr(r,JU)},async load(r,e,t){return e.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?rG(r):tG(r,e,t,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function tG(r,e,t,i){let o=await(await j.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),c=l.getContext("2d"),u=e.data?.resolution||dn(r),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 Xt({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:u,...p});return fn(m,t,r)}async function rG(r){let t=await(await j.get().fetch(r)).text(),i=new Nt;return i.svg(t),i}Re();U();Eo();var iG=`(function () {
|
|
1095
1095
|
'use strict';
|
|
1096
1096
|
|
|
@@ -1141,17 +1141,19 @@ ${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=Dt(e
|
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
1143
|
})();
|
|
1144
|
-
`,gn=null,sc=class{constructor(){gn||(gn=URL.createObjectURL(new Blob([sG],{type:"application/javascript"}))),this.worker=new Worker(gn)}};sc.revokeObjectURL=function(){gn&&(URL.revokeObjectURL(gn),gn=null)};var XC=0,gy,xy=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{let{worker:t}=new mn;t.addEventListener("message",i=>{t.terminate(),mn.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){gy===void 0&&(gy=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers<gy&&(this._createdWorkers++,e=new sc().worker,e.addEventListener("message",t=>{this._complete(t.data),this._returnWorker(t.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){e.error!==void 0?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),this._resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:e,arguments:t,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let e=this._getWorker();if(!e)return;let t=this._queue.pop(),i=t.id;this._resolveHash[XC]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:XC++,id:i})}},yy=new xy;Li();var oG=[".jpeg",".jpg",".png",".webp",".avif"],nG=["image/jpeg","image/png","image/webp","image/avif"];async function aG(r,e){let t=await j.get().fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);let i=await t.blob();return e?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Sd={name:"loadTextures",extension:{type:S.LoadParser,priority:Lt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return xr(r,nG)||yr(r,oG)},async load(r,e,t){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await yy.isImageBitmapSupported()?i=await yy.loadImageBitmap(r,e):i=await aG(r,e):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Xt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:e.data?.resolution||dn(r),...e.data});return fn(s,t,r)},unload(r){r.destroy(!0)}};U();Bm();Im();var jC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],lG=jC.map(r=>`video/${r.substring(1)}`);function cG(r,e,t){t===void 0&&!e.startsWith("data:")?r.crossOrigin=hG(e):t!==!1&&(r.crossOrigin=typeof t=="string"?t:"anonymous")}function uG(r){return new Promise((e,t)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),e()}function s(n){o(),t(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function hG(r,e=globalThis.location){if(r.startsWith("data:"))return"";e||(e=globalThis.location);let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}var YC={name:"loadVideo",extension:{type:S.LoadParser,name:"loadVideo"},test(r){let e=xr(r,lG),t=yr(r,jC);return e||t},async load(r,e,t){let i={...Ao.defaultOptions,resolution:e.data?.resolution||dn(r),alphaMode:e.data?.alphaMode||await Zu(),...e.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),cG(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ao.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new Ao({...i,resource:s});s.removeEventListener("canplay",c),e.data.preload&&await uG(s),l(fn(u,t,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};U();So();U();So();var wd={extension:{type:S.ResolveParser,name:"resolveTexture"},test:Sd.test,parse:r=>({resolution:parseFloat(tr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var qC={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>tr.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:wd.parse};So();Ea();Xu();var Ed=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tr,this.loader=new Td,this.cache=Se,this._backgroundLoader=new bd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){W("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let t=e.texturePreference?.resolution??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();let i=Ts(e),s=Dt(e).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,t);return i?n[s[0]]:n}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);let s=this.resolver.resolveBundle(e),o={},n=Object.keys(s),a=0,l=0,c=()=>{t?.(++a/l)},u=n.map(h=>{let d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[h]=f})});return await Promise.all(u),i?o[e[0]]:o}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Se.get(e);let t={};for(let i=0;i<e.length;i++)t[i]=Se.get(e[i]);return t}async _mapLoadToResolve(e,t){let i=[...new Set(Object.values(e))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,t);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),Se.set(l,a)}),o}async unload(e){this._initialized||await this.init();let t=Dt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=Dt(e);let t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(i=>{Se.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}},_r=new Ed;V.handleByList(S.LoadParser,_r.loader.parsers).handleByList(S.ResolveParser,_r.resolver.parsers).handleByList(S.CacheParser,_r.cache.parsers).handleByList(S.DetectionParser,_r.detections);V.add(FC,GC,OC,HC,LC,DC,NC,VC,WC,zC,$C,Sd,YC,kC,BC,wd,qC);var KC={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};V.handle(S.Asset,r=>{let e=r.ref;Object.entries(KC).filter(([t])=>!!e[t]).forEach(([t,i])=>V.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{let e=r.ref;Object.keys(KC).filter(t=>!!e[t]).forEach(t=>V.remove(e[t]))});ve();ba();To();Ca();var oc=class r extends Te{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={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}=t,[f]=u;super({...d,texture:f instanceof k?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&&(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ut.shared.add(this.update,this,Lr.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 t=e.deltaTime,i=this.animationSpeed*t,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*t);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 t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}static fromImages(e){let t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof k)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].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 t=this.currentFrame;this._currentTime=e,t!==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?(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ut.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Pu();$e();$u();var Ad=class extends Gi{constructor(e,t){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=t,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Tt({_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,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,s=-t*this.anchor.x,o=0;return e.x>=s&&e.x<=s+t&&(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 ZC(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(X(ie,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Za();Is();var Ir=class extends Ad{constructor(...e){let t=ZC(e,"Text");super(t,Oe),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=De.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*o,e.maxY=e.minY+o}};gx();ge();ct();Rt();kx();ve();Zh();Om();Ar();Zg();Ca();Za();Is();Am();Ct();var dG=ds(ph(),1);V.add(lA,uA);var fG=new(window.AudioContext||window.webkitAudioContext),_y={},pG=async(r,e)=>{if(!_y[r]&&e.byteLength!==0)try{let t=await fG.decodeAudioData(e);_y[r]=t}catch(t){console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}},mG=r=>_y[r],xn={load:pG,getAsset:mG};var Je=({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o});var by=({type:r})=>({type:r});var vy=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var Pd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Cd={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Os={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 Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var gG=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Ge.strokeColor,width:r.strokeWidth??e.width??Ge.strokeWidth}},rr=(r={})=>{let{strokeColor:e,strokeWidth:t,stroke:i,...s}=r;return{...s,stroke:gG({strokeColor:e,strokeWidth:t,stroke:i})}};var Zr=(r,e)=>{let t={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth};r.style=rr(t)};var xG=(r,e)=>typeof e!="string"?e:r[e]??e,yG=(r,e,t,i)=>{let s=xG(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},QC=(r,e,t=Cd)=>{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!Pd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&yG(r,s,t,o.initialValue)}},Md=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=t.getVersion();t.track(a),e.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{t.complete(a),o?.(n)}}})}};function Rd(r,e){let t=r.text.substring(0,e),s=De.measureText(t,r.style).width;return r.x+s}var _G=async(r,e)=>new Promise((t,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),t()},r);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Ty=_G;var bi=Symbol("textRevealRuntime"),Bd=Symbol("textRevealSnapshot"),bG=18,vG=64,TG=1.25,wy=50,SG=0,Ey=100,Sy=Ey-1,JC=10,wG=120,EG=.9,tM=(r=wy)=>typeof r!="number"||!Number.isFinite(r)?wy:Math.max(SG,Math.min(Ey,r)),AG=r=>tM(r)>=Ey,rM=r=>{let e=Math.min(tM(r),Sy),i=(Sy>0?e/Sy:0)**EG;return JC*(wG/JC)**i},PG=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",yn=r=>r?.revealEffect==="none"||AG(r?.speed??wy),CG=r=>{let e=new Te(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Te(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},ac=(r,e)=>{if(!e?.indicator?.complete?.src)return;let t=k.from(e.indicator.complete.src);r.texture=t,r.width=e.indicator.complete.width??t.width,r.height=e.indicator.complete.height??t.height},lc=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Id=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=Rd(e,e.text.length-1)+t},MG=(r,e)=>{if(r[bi]){let t=r[bi];delete r[bi],t()}r[bi]=e},RG=r=>r?.[Bd]??null,nc=(r,e)=>r?e?(r[Bd]=e,e):(delete r[Bd],null):null,iM=r=>{let e=RG(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},sM=r=>!!iM(r),Ay=r=>{if(r[bi]){let t=r[bi];delete r[bi],t()}delete r[Bd],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},oM=(r,e="",t="")=>{let i=new Oe(rr(r.textStyle)),s=new Ir({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Oe(rr(r.furigana.textStyle));o=new Ir({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},nM=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new te({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:m,furiganaText:g}=oM(p,p.text,p.furigana?.text||"");g&&(c.addChild(g),u.push(g)),c.addChild(m),u.push(m),t=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:t,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},eM=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=nM(r,t);lc(e,o,i),Id(e,s,i),ac(e,t)},IG=({indicatorSprite:r,element:e})=>{let t=e?.indicator?.offset??12,i=e.content[0]??null;lc(r,i,t)},BG=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=rM(t.speed??50),a=t?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),u=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=u,o.completed=!1);for(let h=0;h<t.content.length;h++){if(i?.aborted||r.destroyed)return!1;let d=t.content[h],f=!1;lc(e,d,a);for(let p=0;p<d.lineParts.length;p++){if(i?.aborted||r.destroyed)return!1;let m=d.lineParts[p],{text:g,furiganaText:_}=oM(m);_&&r.addChild(_),r.addChild(g);let v=m.text,x=m.furigana?.text||"",T=x.length,b=Math.min(v.length,u),w=v.length>0?Math.round(b/v.length*T):0;g.text=v.substring(0,b),_&&(_.text=x.substring(0,w)),u-=b,b>0&&(e.x=Rd(g,b-1)+a);for(let E=b;E<v.length;E++){if(i?.aborted||r.destroyed)return!1;if(g.text=v.substring(0,E+1),e.x=Rd(g,E)+a,f=!0,o&&(o.revealedCharacters+=1),_){let I=Math.round((E+1)/v.length*T);_.text=x.substring(0,I)}E<v.length-1&&await Ty(l,i)}}h<t.content.length-1&&f&&await Ty(c,i)}return ac(e,t),o&&(o.completed=!0),!0},kG=({container:r,contentContainer:e,indicatorSprite:t,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=rM(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d,bounds:f}=nM(e,i);if(lc(t,u,n),l.length===0||h===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return Id(t,c,n),ac(t,i),!1;let p=Math.max(bG,Math.min(vG,Math.round(d*TG))),m=Math.max(1,Math.round(h/a*1e3)),g=l.map(C=>{let A=Math.max(1,C.totalCharacters),P=1+p/Math.max(1,C.bounds.width);return A*P}),_=g.reduce((C,A)=>C+A,0),v=[],x=0;for(let C=0;C<l.length;C++){let A=g[C],P=_>0?x/_:0;x+=A,v.push({...l[C],startProgress:P,endProgress:_>0?x/_:1})}let T=o.getVersion(),b=`${i.id}-soft-wipe`,w=v.map(C=>{let A=document.createElement("canvas");A.width=Math.max(1,Math.ceil(C.bounds.width+p)),A.height=Math.max(1,Math.ceil(C.bounds.height));let P=A.getContext("2d");if(!P)return null;let R=Fs(A),M=new Te(R);return M.x=Math.floor(C.bounds.x-p),M.y=Math.floor(C.bounds.y),C.container.mask=M,e.addChild(M),{canvas:A,context:P,texture:R,sprite:M,line:C}});if(w.some(C=>C===null))return w.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),Id(t,c,n),ac(t,i),!1;let E=!1,I=C=>{E||(E=!0,r[bi]===B&&delete r[bi],w.forEach(A=>{A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0)}),C&&(Id(t,c,n),ac(t,i)))},B=()=>{s.dispatch({type:"CANCEL",id:b}),I(!1)};return MG(r,B),o.track(T),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let A=m>0?Math.min(C/m,1):1,P=v[0],R=0;for(let M=0;M<v.length;M++){let F=v[M],O=w[M],D=Math.max(1e-6,F.endProgress-F.startProgress),N=Math.max(0,Math.min((A-F.startProgress)/D,1)),{context:G,canvas:Y,texture:ue}=O;if(G.clearRect(0,0,Y.width,Y.height),N<=0){ue.source.update();continue}let J=p,Be=0,ke=F.bounds.width+p,Me=J+N*ke,ze=Math.max(J,Me-p);ze>J&&(G.fillStyle="#ffffff",G.fillRect(J,Be,Math.min(ze-J,F.bounds.width),F.bounds.height));let rt=Math.max(J,Me-p),_t=Math.min(J+F.bounds.width,Me);if(_t>rt){let Le=G.createLinearGradient(rt,0,_t,0);Le.addColorStop(0,"rgba(255, 255, 255, 1)"),Le.addColorStop(1,"rgba(255, 255, 255, 0)"),G.fillStyle=Le,G.fillRect(rt,Be,_t-rt,F.bounds.height)}ue.source.update(),(N<1||M===v.length-1)&&(P=F,R=Math.min(1,(Me-J)/Math.max(1,F.bounds.width)))}lc(t,P.chunk,n),t.x=P.bounds.x+Math.min(P.bounds.width,P.bounds.width*R)+n},applyTargetState:()=>{I(!1)},onComplete:()=>{o.complete(T),I(!0)},onCancel:()=>{o.complete(T),I(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},vi=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=yn(e),l=n==="resume"?iM(r):null;if(n==="resume"&&!l)return;Ay(r),r.zIndex=s;let c=new te({label:`${e.id}-content`}),u=CG(e);r.addChild(c),r.addChild(u);try{if(n==="paused-initial"){a||nc(r,{mode:PG(e),revealedCharacters:0,completed:!1}),a?(nc(r,{mode:"none",completed:!0}),eM({contentContainer:c,indicatorSprite:u,element:e})):IG({indicatorSprite:u,element:e});return}let h=t.getVersion(),d=!1;if(a)t.track(h),nc(r,{mode:"none",completed:!0}),eM({contentContainer:c,indicatorSprite:u,element:e}),d=!0;else if(e.revealEffect==="softWipe")if(nc(r,{mode:"softWipe",completed:!1}),!kG({container:r,contentContainer:c,indicatorSprite:u,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(h),d=!0;else return;else{t.track(h);let f=nc(r,{mode:"typewriter",revealedCharacters:l?.revealedCharacters??0,completed:!1});d=await BG({contentContainer:c,indicatorSprite:u,element:e,signal:o,startAtCharacter:l?.revealedCharacters??0,snapshot:f})}d&&!o?.aborted&&!r.destroyed&&t.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var kd=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),aM=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let e=t=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}t?.detail?.deltaMS&&(r.emitter.update(Number(t.detail.deltaMS)/1e3),typeof r.app?.render=="function"&&r.app.render())};window.addEventListener("snapShotKeyFrame",e),r.container.customTickerHandler=e;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":vi({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;Md({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},cc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){aM(e);return}r.deferredMountOperations.push(e)}},Fd=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},lM=(r,e)=>cc(r,{type:"play-animated-sprite",animatedSprite:e}),cM=(r,e)=>cc(r,{type:"play-video",video:e}),uM=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>cc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),Od=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>cc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),hM=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>cc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),dM=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)aM(t)};var fM=(r=[])=>{if(r instanceof Map)return r;let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,[]),e.get(t.targetId).push(t);return e},Ud=(r,e)=>r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e),FG=(r,e)=>Ud(r,e).filter(t=>t.type==="update"),Gd=(r,e)=>Ud(r,e).find(t=>t.type==="transition")??null,OG=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=FG(r,e);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return QC(s,l),hM(a,{animations:l,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return Md({animations:l,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ne=OG;var gM=Symbol("routeGraphicsTextAnchorRatios"),xM=Symbol("routeGraphicsTextLayoutState"),pM=(r,e)=>typeof r!="number"||r===0?0:e/r,Py=r=>r?.align??Ge.align,mM=r=>{let e=r[xM];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:r.width},Cy=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},uc=r=>{let e=r.measuredWidth??r.width,t=Cy(r.width,e,Py(r.textStyle));return{x:r.x+t,y:r.y}},Ld=(r,e)=>{let t=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width||e.width,i=r.height||e.height,s=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:pM(t,e.originX),o=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:pM(i,e.originY);r[gM]={x:s,y:o},r[xM]={fixedWidth:!!e.__fixedWidth,layoutWidth:e.width}},UG=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Ge.lineHeight:r.lineHeight/r.fontSize,GG=(r,e)=>{if(!e)return r;let t={...r,...e};if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??UG(r);t.lineHeight=Math.round(t.fontSize*i)}return t},Qr=(r,e,t)=>{let i=r[gM],s=mM(r),o=GG(e,t);if(!i){Zr(r,o);return}let n=Cy(s,r.width,Py(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Zr(r,o);let u=mM(r),h=Cy(u,r.width,Py(r.style));r.x=l-u*i.x+h,r.y=c-r.height*i.y},Dd=(r,e)=>{let t=uc({...e,measuredWidth:r.width,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r.width});r.x=t.x,r.y=t.y};var yM=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},ot=r=>{let e=yM(r);return e===void 0||e===0},_M=r=>yM(r)===2;var My=Symbol.for("routeGraphics.setInheritedHover"),bM=Symbol.for("routeGraphics.treeInheritedHoverActive"),Ry=Symbol.for("routeGraphics.setInheritedPress"),vM=Symbol.for("routeGraphics.treeInheritedPressActive"),Iy=Symbol.for("routeGraphics.setInheritedRightPress"),TM=Symbol.for("routeGraphics.treeInheritedRightPressActive"),_n=r=>Array.isArray(r?.children)?r.children:[],By=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Nd=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},ky=({displayObject:r,symbol:e,onStateChange:t})=>{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&&t(c),c};return r[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:()=>{Nd({displayObject:r,symbol:e})}}},bn=r=>Nd({displayObject:r,symbol:My}),Hd=r=>Nd({displayObject:r,symbol:Ry}),Vd=r=>Nd({displayObject:r,symbol:Iy}),Jr=({displayObject:r,onHoverChange:e})=>{let t=ky({displayObject:r,symbol:My,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Qi=({displayObject:r,onPressChange:e})=>{let t=ky({displayObject:r,symbol:Ry,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Ji=({displayObject:r,onPressChange:e})=>{let t=ky({displayObject:r,symbol:Iy,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Fy=r=>r?.[bM]===!0,Oy=r=>r?.[vM]===!0,Uy=r=>r?.[TM]===!0,vn=({root:r,isHovered:e})=>{if(!r)return;r[bM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:My,source:r,isActive:e}),t.push(..._n(i))}},Us=({root:r,isPressed:e})=>{if(!r)return;r[vM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:Ry,source:r,isActive:e}),t.push(..._n(i))}},Ti=({root:r,isPressed:e})=>{if(!r)return;r[TM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:Iy,source:r,isActive:e}),t.push(..._n(i))}};var SM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Ir({label:t.id});c.zIndex=l,c.text=t.content,Zr(c,t.textStyle),Ld(c,t),c.alpha=t.alpha,Dd(c,t);let u=t?.hover,h=t?.click,d=t?.rightClick,f=null,p=null,m=null,g=()=>{let _=f?.isHovering()??!1,v=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?Qr(c,t.textStyle,d.textStyle):v&&h?.textStyle?Qr(c,t.textStyle,h.textStyle):_&&u?.textStyle?Qr(c,t.textStyle,u.textStyle):Qr(c,t.textStyle)};if(u){let{cursor:_,soundSrc:v,payload:x}=u;c.eventMode="static",f=Jr({displayObject:c,onHoverChange:g});let T=()=>{f.setDirectHover(!0),x&&s&&s("hover",{_event:{id:c.label},...x}),_&&(c.cursor=_),v&&r.audioStage.add({id:`hover-${Date.now()}`,url:v,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",T),c.on("pointerout",b)}if(h){let{soundSrc:_,soundVolume:v,payload:x}=h;c.eventMode="static",p=Qi({displayObject:c,onPressChange:g});let T=E=>{ot(E)&&p.setDirectPress(!0)},b=E=>{ot(E)&&(p.setDirectPress(!1),x&&s&&s("click",{_event:{id:c.label},...x}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:(v??1e3)/1e3}))},w=()=>{p.setDirectPress(!1)};c.on("pointerdown",T),c.on("pointerup",b),c.on("pointerupoutside",w)}if(d){let{soundSrc:_,payload:v}=d;c.eventMode="static",m=Ji({displayObject:c,onPressChange:g});let x=()=>{m.setDirectPress(!0)},T=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),v&&s&&s("rightClick",{_event:{id:c.label},...v}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},w=()=>{m.setDirectPress(!1)};c.on("rightdown",x),c.on("rightup",T),c.on("rightclick",b),c.on("rightupoutside",w)}e.addChild(c),ne({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{...uc(t),alpha:t.alpha},renderContext:a})};var LG=Object.prototype.hasOwnProperty,pe=(r,e)=>{if(Object.is(r,e))return!0;if(r===null||e===null||typeof r!="object"||typeof e!="object")return!1;let t=Array.isArray(r),i=Array.isArray(e);if(t!==i)return!1;if(t&&i){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!pe(r[n],e[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!LG.call(e,n)||!pe(r[n],e[n]))return!1;return!0};var wM=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===t.id);if(!c)return;c.zIndex=l;let{alpha:u}=i,h=()=>{if(!pe(t,i)){c.text=i.content,Zr(c,i.textStyle),Ld(c,i),Dd(c,i),c.alpha=u,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"),bn(c),Hd(c),Vd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,g=null,_=null,v=null,x=()=>{let T=g?.isHovering()??!1,b=_?.isPressed()??!1;(v?.isPressed()??!1)&&m?.textStyle?Qr(c,i.textStyle,m.textStyle):b&&p?.textStyle?Qr(c,i.textStyle,p.textStyle):T&&f?.textStyle?Qr(c,i.textStyle,f.textStyle):Qr(c,i.textStyle)};if(f){let{cursor:T,soundSrc:b,payload:w}=f;c.eventMode="static",g=Jr({displayObject:c,onHoverChange:x});let E=()=>{g.setDirectHover(!0),w&&s&&s("hover",{_event:{id:c.label},...w}),T&&(c.cursor=T),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},I=()=>{g.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",E),c.on("pointerout",I)}if(p){let{soundSrc:T,soundVolume:b,payload:w}=p;c.eventMode="static",_=Qi({displayObject:c,onPressChange:x});let E=C=>{ot(C)&&_.setDirectPress(!0)},I=C=>{ot(C)&&(_.setDirectPress(!1),w&&s&&s("click",{_event:{id:c.label},...w}),T&&r.audioStage.add({id:`click-${Date.now()}`,url:T,loop:!1,volume:(b??1e3)/1e3}))},B=()=>{_.setDirectPress(!1)};c.on("pointerdown",E),c.on("pointerup",I),c.on("pointerupoutside",B)}if(m){let{soundSrc:T,payload:b}=m;c.eventMode="static",v=Ji({displayObject:c,onPressChange:x});let w=()=>{v.setDirectPress(!0)},E=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),T&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:T,loop:!1})},B=()=>{v.setDirectPress(!1)};c.on("rightdown",w),c.on("rightup",E),c.on("rightclick",I),c.on("rightupoutside",B)}}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:{...uc(i),alpha:u},onComplete:()=>{h()}})||h()};var EM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var AM=({positionX:r=0,positionY:e=0,width:t,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof t!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:t*s,y:i*o},a=r-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var xt=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Os).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Os).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let e=r.scaleX?r.scaleX*r.width:r.width,t=r.scaleY?r.scaleY*r.height:r.height;r.type===Os.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=AM({positionX:r.x,positionY:r.y,width:e,height:t,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(e),height:Math.round(t),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var PM=({state:r})=>{let e={...Ge,...r.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),typeof r.width=="number"&&(e.wordWrapWidth=r.width,e.wordWrap=!0);let t=String(r.content??""),{width:i,height:s}=De.measureText(t,new Oe(rr(e))),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...xt({...r,width:a,height:n}),content:t,measuredWidth:o,textStyle:{...e},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var DG=Je({type:"text",add:SM,update:wM,delete:EM,parse:PM});var CM="__rtglRectScrollHandled",Wd=({canvas:r,rect:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;e.eventMode="static",e.hitArea=new Q(0,0,Math.round(t),Math.round(i));let l=(f,p)=>{p?.[CM]||(p&&(p[CM]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:e.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:e.label},...o.payload}))},c=()=>{a=!0},u=()=>{a=!1},h=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};e.on("pointerover",c),e.on("pointerout",u),e.on("wheel",h),r?.addEventListener("wheel",d,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",c),e.off("pointerout",u),e.off("wheel",h),r?.removeEventListener("wheel",d),e.hitArea=null,delete e._cleanupScrollInteraction}};var NG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,MM=({app:r,parent:e,element:t,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=t,x=new Ue;x.label=c,x.zIndex=n;let T={x:u,y:h,alpha:g};_!==void 0&&(T.scaleX=_),v!==void 0&&(T.scaleY=v),(()=>{x.clear(),x.rect(0,0,Math.round(d),Math.round(f)).fill(NG(p)),x.x=Math.round(u),x.y=Math.round(h),x.alpha=g,x.scale.x=1,x.scale.y=1,m&&x.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let w=t?.hover,E=t?.click,I=t?.rightClick,B=t?.scrollUp,C=t?.scrollDown,A=t?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;x.eventMode="static";let F=()=>{M&&o&&o("hover",{_event:{id:x.label},...M}),P&&(x.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{x.cursor="auto"};x.on("pointerover",F),x.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;x.eventMode="static";let F=O=>{ot(O)&&(M&&o&&o("click",{_event:{id:x.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(R??1e3)/1e3}))};x.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;x.eventMode="static";let M=()=>{R&&o&&o("rightClick",{_event:{id:x.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};x.on("rightclick",M)}if((B||C)&&Wd({canvas:r.canvas,rect:x,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:o}),A){let{start:P,end:R,move:M}=A;x.eventMode="static";let F=()=>{x._isDragging=!0,P&&o&&o("dragStart",{_event:{id:x.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{x._isDragging=!1,R&&o&&o("dragEnd",{_event:{id:x.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&o&&x._isDragging&&o("dragMove",{_event:{id:x.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};x.on("pointerdown",F),x.on("pointerup",O),x.on("globalpointermove",D),x.on("pointerupoutside",O)}e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:a,element:x,targetState:T,renderContext:l})};var HG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,RM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(w=>w.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=i,x={x:u,y:h,alpha:g};_!==void 0&&(x.scaleX=_),v!==void 0&&(x.scaleY=v);let T=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(HG(p)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=g,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let w=i?.hover,E=i?.click,I=i?.rightClick,B=i?.scrollUp,C=i?.scrollDown,A=i?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;c.eventMode="static";let F=()=>{M&&n&&n("hover",{_event:{id:c.label},...M}),P&&(c.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;c.eventMode="static";let F=O=>{ot(O)&&(M&&n&&n("click",{_event:{id:c.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(R??1e3)/1e3}))};c.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;c.eventMode="static";let M=()=>{R&&n&&n("rightClick",{_event:{id:c.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};c.on("rightclick",M)}if((B||C)&&Wd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:n}),A){let{start:P,end:R,move:M}=A;c.eventMode="static";let F=()=>{c._isDragging=!0,P&&n&&n("dragStart",{_event:{id:c.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{c._isDragging=!1,R&&n&&n("dragEnd",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};c.on("pointerdown",F),c.on("pointerup",O),c.on("globalpointermove",D),c.on("pointerupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:x,onComplete:()=>{T()}})||T()};var IM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var BM=({state:r})=>{let e=xt(r),t=r.border?.width,i=e;return typeof t=="number"&&t>0&&(i={...e,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:t}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var VG=Je({type:"rect",add:MM,update:RM,delete:IM,parse:BM});var kM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,src:p,alpha:m}=t,g=p?k.from(p):k.EMPTY,_=new Te(g);_.label=c,_.zIndex=l,_.x=Math.round(u),_.y=Math.round(h),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let v=t?.hover,x=t?.click,T=t?.rightClick,b=null,w=null,E=null,I=()=>{let B=b?.isHovering()??!1,C=w?.isPressed()??!1;if((E?.isPressed()??!1)&&T?.src){let P=k.from(T.src);_.texture=P}else if(C&&x?.src){let P=k.from(x.src);_.texture=P}else if(B&&v?.src){let P=k.from(v.src);_.texture=P}else _.texture=g};if(v){let{cursor:B,soundSrc:C,payload:A}=v;_.eventMode="static",b=Jr({displayObject:_,onHoverChange:I});let P=()=>{b.setDirectHover(!0),A&&s&&s("hover",{_event:{id:_.label},...A}),B&&(_.cursor=B),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},R=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",P),_.on("pointerout",R)}if(x){let{soundSrc:B,soundVolume:C,payload:A}=x;_.eventMode="static",w=Qi({displayObject:_,onPressChange:I});let P=F=>{ot(F)&&w.setDirectPress(!0)},R=F=>{ot(F)&&(w.setDirectPress(!1),A&&s&&s("click",{_event:{id:_.label},...A}),B&&r.audioStage.add({id:`click-${Date.now()}`,url:B,loop:!1,volume:(C??1e3)/1e3}))},M=()=>{w.setDirectPress(!1)};_.on("pointerdown",P),_.on("pointerup",R),_.on("pointerupoutside",M)}if(T){let{soundSrc:B,payload:C}=T;_.eventMode="static",E=Ji({displayObject:_,onPressChange:I});let A=()=>{E.setDirectPress(!0)},P=()=>{E.setDirectPress(!1)},R=()=>{E.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),B&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:B,loop:!1})},M=()=>{E.setDirectPress(!1)};_.on("rightdown",A),_.on("rightup",P),_.on("rightclick",R),_.on("rightupoutside",M)}e.addChild(_),ne({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:u,y:h,width:d,height:f,alpha:m},renderContext:a})};var FM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(x=>x.label===t.id);if(!c)return;c.zIndex=l;let{id:u,x:h,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!pe(t,i)){let x=m?k.from(m):k.EMPTY;c.texture=x,c.x=Math.round(h),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=g,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"),bn(c),Hd(c),Vd(c);let T=i?.hover,b=i?.click,w=i?.rightClick,E=null,I=null,B=null,C=()=>{let A=E?.isHovering()??!1,P=I?.isPressed()??!1;if((B?.isPressed()??!1)&&w?.src){let M=k.from(w.src);c.texture=M}else if(P&&b?.src){let M=k.from(b.src);c.texture=M}else if(A&&T?.src){let M=k.from(T.src);c.texture=M}else c.texture=x};if(T){let{cursor:A,soundSrc:P,payload:R}=T;c.eventMode="static",E=Jr({displayObject:c,onHoverChange:C});let M=()=>{E.setDirectHover(!0),R&&a&&a("hover",{_event:{id:c.label},...R}),A&&(c.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{E.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",F)}if(b){let{soundSrc:A,soundVolume:P,payload:R}=b;c.eventMode="static",I=Qi({displayObject:c,onPressChange:C});let M=D=>{ot(D)&&I.setDirectPress(!0)},F=D=>{ot(D)&&(I.setDirectPress(!1),R&&a&&a("click",{_event:{id:c.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(P??1e3)/1e3}))},O=()=>{I.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",F),c.on("pointerupoutside",O)}if(w){let{soundSrc:A,payload:P}=w;c.eventMode="static",B=Ji({displayObject:c,onPressChange:C});let R=()=>{B.setDirectPress(!0)},M=()=>{B.setDirectPress(!1)},F=()=>{B.setDirectPress(!1),P&&a&&a("rightClick",{_event:{id:c.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},O=()=>{B.setDirectPress(!1)};c.on("rightdown",R),c.on("rightup",M),c.on("rightclick",F),c.on("rightupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var OM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var UM=({state:r})=>({...xt(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var WG=Je({type:"sprite",add:kM,update:FM,delete:OM,parse:UM});var zG=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Gy=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},zd=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(Gy({videoElement:r,video:e}),(t??!1)||zG(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var GM=({parent:r,element:e,renderContext:t,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:u,volume:h,loop:d,alpha:f}=e,p=k.from(u),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=h/1e3,m.muted=!1;let g=new Te(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(c),g.alpha=f??1,zd({videoElement:g,video:m,loop:d,completionTracker:i}),cM(t,m),r.addChild(g)};var LM=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,p=()=>{if(!pe(e,t)){l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(e.src!==t.src){let _=g;Gy({videoElement:l,video:_}),_&&_.pause();let v=k.from(t.src);l.texture=v,g=v.source.resource,g.muted=!1,g.pause(),g.currentTime=0}zd({videoElement:l,video:g,loop:t.loop,completionTracker:n}),g.volume=t.volume/1e3,g.loop=t.loop??!1,e.src!==t.src&&g.play()}};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1},onComplete:p})||p()};var DM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.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()),r.removeChild(o),o.destroy()}};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var NM=({state:r})=>({...xt(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var $G=Je({type:"video",add:GM,update:LM,delete:DM,parse:NM});var HM=0,VM=16,XG=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),Dy=r=>Math.max(0,Math.min(1,r)),Gs=r=>r?k.from(r):k.EMPTY,Tn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),zM=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=Tn(e),s=Tn(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},Sn=({sliderContainer:r,id:e})=>{let t=Tn(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},Ly=({baseValue:r,override:e,key:t})=>XG(e,t)?e[t]??"":r??"",jG=(r,e=null)=>({thumbSrc:Ly({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Ly({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Ly({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),YG=r=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},qG=r=>{let e=new Ue;return e.label=r,e.zIndex=0,e},KG=({sliderContainer:r,id:e,bar:t})=>{let i=Tn(e),{inactiveBar:s,barMask:o}=Sn({sliderContainer:r,id:e});return s||(s=YG(i.inactiveBar),r.addChild(s)),o||(o=qG(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},ZG=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=Sn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},$M=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:Dy((r-e)/i)},QG=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=$M({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?t*a:t),c=Math.round(e==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},JG=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=$M({currentValue:t,min:i,max:s});if(e==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},$d=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-HM*2:i-HM*2,n=Gs(e),a=n.width||VM,l=n.height||VM,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},hc=({sliderContainer:r,sliderComputedNode:e,thumb:t,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}=jG(e,s),{bar:p}=Sn({sliderContainer:r,id:o});if(p){if(p.texture=Gs(h),p.width=n,p.height=a,t.texture=Gs(f),d){let{inactiveBar:m,barMask:g}=KG({sliderContainer:r,id:o,bar:p});m.texture=Gs(d),m.width=n,m.height=a,QG({barMask:g,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else ZG({sliderContainer:r,id:o,bar:p});JG({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},eL=({position:r,thumb:e,direction:t,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(t==="horizontal"){let h=r.x-e.width/2,d=Math.max(n-e.width,1);c=Dy(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=Dy(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},WM=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=Sn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},Xd=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{bn(e);let{id:o,hover:n,change:a,min:l,max:c,step:u,direction:h,initialValue:d,width:f,height:p}=t,m=d??l,g=!1,_=null,v=()=>{hc({sliderContainer:e,sliderComputedNode:t,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},x=B=>{let C=e.toLocal(B.global),A=eL({position:C,thumb:i,direction:h,min:l,max:c,step:u,trackWidth:f,trackHeight:p});A!==m&&(m=A,v(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},T=B=>{g=!0,x(B)},b=B=>{g&&x(B)},w=()=>{g&&(g=!1)};if(e.on("pointerdown",T),e.on("globalpointermove",b),e.on("pointerup",w),e.on("pointerupoutside",w),!n)return;_=Jr({displayObject:e,onHoverChange:v});let E=()=>{_.setDirectHover(!0),v(),WM({sliderContainer:e,sliderComputedNode:t,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},I=()=>{g||(_.setDirectHover(!1),v(),WM({sliderContainer:e,sliderComputedNode:t,cursor:null}))};e.on("pointerover",E),e.on("pointerout",I),e.on("pointerupoutside",I)};var XM=({app:r,parent:e,element:t,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:g,initialValue:_,min:v}=t,x=new te;x.label=c,x.zIndex=l,x.x=u,x.y=h,x.alpha=p,x.sortableChildren=!0,x.eventMode="static";let T=Tn(c),b=new Te(Gs(g));b.label=T.bar,b.eventMode="static",b.zIndex=1;let w=new Te(Gs(m));w.label=T.thumb,w.eventMode="static",w.zIndex=2;let E=_??v;$d({thumb:w,thumbSrc:m,direction:t.direction,trackWidth:d,trackHeight:f}),x.addChild(b),x.addChild(w),hc({sliderContainer:x,sliderComputedNode:t,thumb:w,currentValue:E}),Xd({app:r,sliderContainer:x,sliderComputedNode:t,thumb:w,eventHandler:n}),e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:o,element:x,targetState:{x:u,y:h,alpha:p},renderContext:a})};var jM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),zM({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:m,thumb:g}=Sn({sliderContainer:c,id:i.id}),_=!pe(t.hover,i.hover)||!pe(t.change,i.change)||t.min!==i.min||t.max!==i.max||t.step!==i.step||t.direction!==i.direction||t.initialValue!==i.initialValue||t.thumbSrc!==i.thumbSrc||t.barSrc!==i.barSrc||t.inactiveBarSrc!==i.inactiveBarSrc||t.width!==i.width||t.height!==i.height||t.id!==i.id;if(m&&g&&($d({thumb:g,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),hc({sliderContainer:c,sliderComputedNode:i,thumb:g,currentValue:i.initialValue})),!m||!g)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&Xd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:g,eventHandler:a})}},{x:h,y:d,alpha:f}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var YM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var qM=({state:r})=>{let e=xt(r),t=r.min??0,i=r.max??100;if(i<=t)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<t||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...e,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:t,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var tL=Je({type:"slider",add:XM,update:jM,delete:YM,parse:qM});var An=Symbol("routeGraphicsInputRuntime"),jd={top:10,right:12,bottom:10,left:12},wn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},Yd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},KM={fill:"#4A89FF",alpha:.3},Ny={fill:"#111111",width:2},rL=(r={})=>{let e=r.fontSize??Ge.fontSize,t=r.lineHeight??Ge.lineHeight;return typeof t!="number"?Math.round(e*Ge.lineHeight):t>8?Math.round(t):Math.round(e*t)},Qd=(r={},e={})=>({...Ge,...r,align:r.align??"left",lineHeight:rL(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Hy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??jd.top,right:r?.right??jd.right,bottom:r?.bottom??jd.bottom,left:r?.left??jd.left},En=r=>String(r??"").replace(/\r\n/g,`
|
|
1144
|
+
`,gn=null,sc=class{constructor(){gn||(gn=URL.createObjectURL(new Blob([sG],{type:"application/javascript"}))),this.worker=new Worker(gn)}};sc.revokeObjectURL=function(){gn&&(URL.revokeObjectURL(gn),gn=null)};var XC=0,gy,xy=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{let{worker:t}=new mn;t.addEventListener("message",i=>{t.terminate(),mn.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){gy===void 0&&(gy=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers<gy&&(this._createdWorkers++,e=new sc().worker,e.addEventListener("message",t=>{this._complete(t.data),this._returnWorker(t.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){e.error!==void 0?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),this._resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:e,arguments:t,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let e=this._getWorker();if(!e)return;let t=this._queue.pop(),i=t.id;this._resolveHash[XC]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:XC++,id:i})}},yy=new xy;Li();var oG=[".jpeg",".jpg",".png",".webp",".avif"],nG=["image/jpeg","image/png","image/webp","image/avif"];async function aG(r,e){let t=await j.get().fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);let i=await t.blob();return e?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Sd={name:"loadTextures",extension:{type:S.LoadParser,priority:Lt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return xr(r,nG)||yr(r,oG)},async load(r,e,t){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await yy.isImageBitmapSupported()?i=await yy.loadImageBitmap(r,e):i=await aG(r,e):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Xt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:e.data?.resolution||dn(r),...e.data});return fn(s,t,r)},unload(r){r.destroy(!0)}};U();Bm();Im();var jC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],lG=jC.map(r=>`video/${r.substring(1)}`);function cG(r,e,t){t===void 0&&!e.startsWith("data:")?r.crossOrigin=hG(e):t!==!1&&(r.crossOrigin=typeof t=="string"?t:"anonymous")}function uG(r){return new Promise((e,t)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),e()}function s(n){o(),t(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function hG(r,e=globalThis.location){if(r.startsWith("data:"))return"";e||(e=globalThis.location);let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}var YC={name:"loadVideo",extension:{type:S.LoadParser,name:"loadVideo"},test(r){let e=xr(r,lG),t=yr(r,jC);return e||t},async load(r,e,t){let i={...Ao.defaultOptions,resolution:e.data?.resolution||dn(r),alphaMode:e.data?.alphaMode||await Zu(),...e.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),cG(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ao.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new Ao({...i,resource:s});s.removeEventListener("canplay",c),e.data.preload&&await uG(s),l(fn(u,t,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};U();So();U();So();var wd={extension:{type:S.ResolveParser,name:"resolveTexture"},test:Sd.test,parse:r=>({resolution:parseFloat(tr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var qC={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>tr.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:wd.parse};So();Ea();Xu();var Ed=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tr,this.loader=new Td,this.cache=Se,this._backgroundLoader=new bd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){W("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let t=e.texturePreference?.resolution??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();let i=Ts(e),s=Dt(e).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,t);return i?n[s[0]]:n}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);let s=this.resolver.resolveBundle(e),o={},n=Object.keys(s),a=0,l=0,c=()=>{t?.(++a/l)},u=n.map(h=>{let d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[h]=f})});return await Promise.all(u),i?o[e[0]]:o}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Se.get(e);let t={};for(let i=0;i<e.length;i++)t[i]=Se.get(e[i]);return t}async _mapLoadToResolve(e,t){let i=[...new Set(Object.values(e))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,t);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),Se.set(l,a)}),o}async unload(e){this._initialized||await this.init();let t=Dt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=Dt(e);let t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(i=>{Se.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}},_r=new Ed;V.handleByList(S.LoadParser,_r.loader.parsers).handleByList(S.ResolveParser,_r.resolver.parsers).handleByList(S.CacheParser,_r.cache.parsers).handleByList(S.DetectionParser,_r.detections);V.add(FC,GC,OC,HC,LC,DC,NC,VC,WC,zC,$C,Sd,YC,kC,BC,wd,qC);var KC={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};V.handle(S.Asset,r=>{let e=r.ref;Object.entries(KC).filter(([t])=>!!e[t]).forEach(([t,i])=>V.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{let e=r.ref;Object.keys(KC).filter(t=>!!e[t]).forEach(t=>V.remove(e[t]))});ve();ba();To();Ca();var oc=class r extends Te{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={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}=t,[f]=u;super({...d,texture:f instanceof k?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&&(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ut.shared.add(this.update,this,Lr.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 t=e.deltaTime,i=this.animationSpeed*t,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*t);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 t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}static fromImages(e){let t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof k)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].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 t=this.currentFrame;this._currentTime=e,t!==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?(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ut.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Pu();$e();$u();var Ad=class extends Gi{constructor(e,t){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=t,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Tt({_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,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,s=-t*this.anchor.x,o=0;return e.x>=s&&e.x<=s+t&&(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 ZC(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(X(ie,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Za();Is();var Ir=class extends Ad{constructor(...e){let t=ZC(e,"Text");super(t,Oe),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=De.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*o,e.maxY=e.minY+o}};gx();ge();ct();Rt();kx();ve();Zh();Om();Ar();Zg();Ca();Za();Is();Am();Ct();var dG=ds(ph(),1);V.add(lA,uA);var fG=new(window.AudioContext||window.webkitAudioContext),_y={},pG=async(r,e)=>{if(!_y[r]&&e.byteLength!==0)try{let t=await fG.decodeAudioData(e);_y[r]=t}catch(t){console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}},mG=r=>_y[r],xn={load:pG,getAsset:mG};var Je=({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o});var by=({type:r})=>({type:r});var vy=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var Pd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Cd={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Os={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 Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var gG=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Ge.strokeColor,width:r.strokeWidth??e.width??Ge.strokeWidth}},rr=(r={})=>{let{strokeColor:e,strokeWidth:t,stroke:i,...s}=r;return{...s,stroke:gG({strokeColor:e,strokeWidth:t,stroke:i})}};var Zr=(r,e)=>{let t={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth};r.style=rr(t)};var xG=(r,e)=>typeof e!="string"?e:r[e]??e,yG=(r,e,t,i)=>{let s=xG(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},QC=(r,e,t=Cd)=>{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!Pd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&yG(r,s,t,o.initialValue)}},Md=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=t.getVersion();t.track(a),e.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{t.complete(a),o?.(n)}}})}};function Rd(r,e){let t=r.text.substring(0,e),s=De.measureText(t,r.style).width;return r.x+s}var _G=async(r,e)=>new Promise((t,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),t()},r);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Ty=_G;var bi=Symbol("textRevealRuntime"),Bd=Symbol("textRevealSnapshot"),bG=18,vG=64,TG=1.25,wy=50,SG=0,Ey=100,Sy=Ey-1,JC=10,wG=120,EG=.9,tM=(r=wy)=>typeof r!="number"||!Number.isFinite(r)?wy:Math.max(SG,Math.min(Ey,r)),AG=r=>tM(r)>=Ey,rM=r=>{let e=Math.min(tM(r),Sy),i=(Sy>0?e/Sy:0)**EG;return JC*(wG/JC)**i},PG=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",yn=r=>r?.revealEffect==="none"||AG(r?.speed??wy),CG=r=>{let e=new Te(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Te(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},ac=(r,e)=>{if(!e?.indicator?.complete?.src)return;let t=k.from(e.indicator.complete.src);r.texture=t,r.width=e.indicator.complete.width??t.width,r.height=e.indicator.complete.height??t.height},lc=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Id=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=Rd(e,e.text.length-1)+t},MG=(r,e)=>{if(r[bi]){let t=r[bi];delete r[bi],t()}r[bi]=e},RG=r=>r?.[Bd]??null,nc=(r,e)=>r?e?(r[Bd]=e,e):(delete r[Bd],null):null,iM=r=>{let e=RG(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},sM=r=>!!iM(r),Ay=r=>{if(r[bi]){let t=r[bi];delete r[bi],t()}delete r[Bd],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},oM=(r,e="",t="")=>{let i=new Oe(rr(r.textStyle)),s=new Ir({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Oe(rr(r.furigana.textStyle));o=new Ir({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},nM=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new te({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:m,furiganaText:g}=oM(p,p.text,p.furigana?.text||"");g&&(c.addChild(g),u.push(g)),c.addChild(m),u.push(m),t=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:t,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},eM=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=nM(r,t);lc(e,o,i),Id(e,s,i),ac(e,t)},IG=({indicatorSprite:r,element:e})=>{let t=e?.indicator?.offset??12,i=e.content[0]??null;lc(r,i,t)},BG=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=rM(t.speed??50),a=t?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),u=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=u,o.completed=!1);for(let h=0;h<t.content.length;h++){if(i?.aborted||r.destroyed)return!1;let d=t.content[h],f=!1;lc(e,d,a);for(let p=0;p<d.lineParts.length;p++){if(i?.aborted||r.destroyed)return!1;let m=d.lineParts[p],{text:g,furiganaText:_}=oM(m);_&&r.addChild(_),r.addChild(g);let v=m.text,x=m.furigana?.text||"",T=x.length,b=Math.min(v.length,u),w=v.length>0?Math.round(b/v.length*T):0;g.text=v.substring(0,b),_&&(_.text=x.substring(0,w)),u-=b,b>0&&(e.x=Rd(g,b-1)+a);for(let E=b;E<v.length;E++){if(i?.aborted||r.destroyed)return!1;if(g.text=v.substring(0,E+1),e.x=Rd(g,E)+a,f=!0,o&&(o.revealedCharacters+=1),_){let I=Math.round((E+1)/v.length*T);_.text=x.substring(0,I)}E<v.length-1&&await Ty(l,i)}}h<t.content.length-1&&f&&await Ty(c,i)}return ac(e,t),o&&(o.completed=!0),!0},kG=({container:r,contentContainer:e,indicatorSprite:t,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=rM(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d,bounds:f}=nM(e,i);if(lc(t,u,n),l.length===0||h===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return Id(t,c,n),ac(t,i),!1;let p=Math.max(bG,Math.min(vG,Math.round(d*TG))),m=Math.max(1,Math.round(h/a*1e3)),g=l.map(C=>{let A=Math.max(1,C.totalCharacters),P=1+p/Math.max(1,C.bounds.width);return A*P}),_=g.reduce((C,A)=>C+A,0),v=[],x=0;for(let C=0;C<l.length;C++){let A=g[C],P=_>0?x/_:0;x+=A,v.push({...l[C],startProgress:P,endProgress:_>0?x/_:1})}let T=o.getVersion(),b=`${i.id}-soft-wipe`,w=v.map(C=>{let A=document.createElement("canvas");A.width=Math.max(1,Math.ceil(C.bounds.width+p)),A.height=Math.max(1,Math.ceil(C.bounds.height));let P=A.getContext("2d");if(!P)return null;let R=Fs(A),M=new Te(R);return M.x=Math.floor(C.bounds.x-p),M.y=Math.floor(C.bounds.y),C.container.mask=M,e.addChild(M),{canvas:A,context:P,texture:R,sprite:M,line:C}});if(w.some(C=>C===null))return w.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),Id(t,c,n),ac(t,i),!1;let E=!1,I=C=>{E||(E=!0,r[bi]===B&&delete r[bi],w.forEach(A=>{A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0)}),C&&(Id(t,c,n),ac(t,i)))},B=()=>{s.dispatch({type:"CANCEL",id:b}),I(!1)};return MG(r,B),o.track(T),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let A=m>0?Math.min(C/m,1):1,P=v[0],R=0;for(let M=0;M<v.length;M++){let F=v[M],O=w[M],D=Math.max(1e-6,F.endProgress-F.startProgress),N=Math.max(0,Math.min((A-F.startProgress)/D,1)),{context:L,canvas:Y,texture:ue}=O;if(L.clearRect(0,0,Y.width,Y.height),N<=0){ue.source.update();continue}let J=p,Be=0,ke=F.bounds.width+p,Me=J+N*ke,ze=Math.max(J,Me-p);ze>J&&(L.fillStyle="#ffffff",L.fillRect(J,Be,Math.min(ze-J,F.bounds.width),F.bounds.height));let rt=Math.max(J,Me-p),_t=Math.min(J+F.bounds.width,Me);if(_t>rt){let Le=L.createLinearGradient(rt,0,_t,0);Le.addColorStop(0,"rgba(255, 255, 255, 1)"),Le.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=Le,L.fillRect(rt,Be,_t-rt,F.bounds.height)}ue.source.update(),(N<1||M===v.length-1)&&(P=F,R=Math.min(1,(Me-J)/Math.max(1,F.bounds.width)))}lc(t,P.chunk,n),t.x=P.bounds.x+Math.min(P.bounds.width,P.bounds.width*R)+n},applyTargetState:()=>{I(!1)},onComplete:()=>{o.complete(T),I(!0)},onCancel:()=>{o.complete(T),I(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},vi=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=yn(e),l=n==="resume"?iM(r):null;if(n==="resume"&&!l)return;Ay(r),r.zIndex=s;let c=new te({label:`${e.id}-content`}),u=CG(e);r.addChild(c),r.addChild(u);try{if(n==="paused-initial"){a||nc(r,{mode:PG(e),revealedCharacters:0,completed:!1}),a?(nc(r,{mode:"none",completed:!0}),eM({contentContainer:c,indicatorSprite:u,element:e})):IG({indicatorSprite:u,element:e});return}let h=t.getVersion(),d=!1;if(a)t.track(h),nc(r,{mode:"none",completed:!0}),eM({contentContainer:c,indicatorSprite:u,element:e}),d=!0;else if(e.revealEffect==="softWipe")if(nc(r,{mode:"softWipe",completed:!1}),!kG({container:r,contentContainer:c,indicatorSprite:u,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(h),d=!0;else return;else{t.track(h);let f=nc(r,{mode:"typewriter",revealedCharacters:l?.revealedCharacters??0,completed:!1});d=await BG({contentContainer:c,indicatorSprite:u,element:e,signal:o,startAtCharacter:l?.revealedCharacters??0,snapshot:f})}d&&!o?.aborted&&!r.destroyed&&t.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var kd=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),aM=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let e=t=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}t?.detail?.deltaMS&&(r.emitter.update(Number(t.detail.deltaMS)/1e3),typeof r.app?.render=="function"&&r.app.render())};window.addEventListener("snapShotKeyFrame",e),r.container.customTickerHandler=e;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":vi({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;Md({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},cc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){aM(e);return}r.deferredMountOperations.push(e)}},Fd=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},lM=(r,e)=>cc(r,{type:"play-animated-sprite",animatedSprite:e}),cM=(r,e)=>cc(r,{type:"play-video",video:e}),uM=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>cc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),Od=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>cc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),hM=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>cc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),dM=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)aM(t)};var fM=(r=[])=>{if(r instanceof Map)return r;let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,[]),e.get(t.targetId).push(t);return e},Ud=(r,e)=>r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e),FG=(r,e)=>Ud(r,e).filter(t=>t.type==="update"),Gd=(r,e)=>Ud(r,e).find(t=>t.type==="transition")??null,OG=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=FG(r,e);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return QC(s,l),hM(a,{animations:l,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return Md({animations:l,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ne=OG;var gM=Symbol("routeGraphicsTextAnchorRatios"),xM=Symbol("routeGraphicsTextLayoutState"),pM=(r,e)=>typeof r!="number"||r===0?0:e/r,Py=r=>r?.align??Ge.align,mM=r=>{let e=r[xM];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:r.width},Cy=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},uc=r=>{let e=r.measuredWidth??r.width,t=Cy(r.width,e,Py(r.textStyle));return{x:r.x+t,y:r.y}},Ld=(r,e)=>{let t=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width||e.width,i=r.height||e.height,s=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:pM(t,e.originX),o=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:pM(i,e.originY);r[gM]={x:s,y:o},r[xM]={fixedWidth:!!e.__fixedWidth,layoutWidth:e.width}},UG=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Ge.lineHeight:r.lineHeight/r.fontSize,GG=(r,e)=>{if(!e)return r;let t={...r,...e};if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??UG(r);t.lineHeight=Math.round(t.fontSize*i)}return t},Qr=(r,e,t)=>{let i=r[gM],s=mM(r),o=GG(e,t);if(!i){Zr(r,o);return}let n=Cy(s,r.width,Py(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Zr(r,o);let u=mM(r),h=Cy(u,r.width,Py(r.style));r.x=l-u*i.x+h,r.y=c-r.height*i.y},Dd=(r,e)=>{let t=uc({...e,measuredWidth:r.width,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r.width});r.x=t.x,r.y=t.y};var yM=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},ot=r=>{let e=yM(r);return e===void 0||e===0},_M=r=>yM(r)===2;var My=Symbol.for("routeGraphics.setInheritedHover"),bM=Symbol.for("routeGraphics.treeInheritedHoverActive"),Ry=Symbol.for("routeGraphics.setInheritedPress"),vM=Symbol.for("routeGraphics.treeInheritedPressActive"),Iy=Symbol.for("routeGraphics.setInheritedRightPress"),TM=Symbol.for("routeGraphics.treeInheritedRightPressActive"),_n=r=>Array.isArray(r?.children)?r.children:[],By=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Nd=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},ky=({displayObject:r,symbol:e,onStateChange:t})=>{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&&t(c),c};return r[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:()=>{Nd({displayObject:r,symbol:e})}}},bn=r=>Nd({displayObject:r,symbol:My}),Hd=r=>Nd({displayObject:r,symbol:Ry}),Vd=r=>Nd({displayObject:r,symbol:Iy}),Jr=({displayObject:r,onHoverChange:e})=>{let t=ky({displayObject:r,symbol:My,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Qi=({displayObject:r,onPressChange:e})=>{let t=ky({displayObject:r,symbol:Ry,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Ji=({displayObject:r,onPressChange:e})=>{let t=ky({displayObject:r,symbol:Iy,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Fy=r=>r?.[bM]===!0,Oy=r=>r?.[vM]===!0,Uy=r=>r?.[TM]===!0,vn=({root:r,isHovered:e})=>{if(!r)return;r[bM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:My,source:r,isActive:e}),t.push(..._n(i))}},Us=({root:r,isPressed:e})=>{if(!r)return;r[vM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:Ry,source:r,isActive:e}),t.push(..._n(i))}},Ti=({root:r,isPressed:e})=>{if(!r)return;r[TM]=e;let t=[..._n(r)];for(;t.length>0;){let i=t.pop();By({displayObject:i,symbol:Iy,source:r,isActive:e}),t.push(..._n(i))}};var SM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Ir({label:t.id});c.zIndex=l,c.text=t.content,Zr(c,t.textStyle),Ld(c,t),c.alpha=t.alpha,Dd(c,t);let u=t?.hover,h=t?.click,d=t?.rightClick,f=null,p=null,m=null,g=()=>{let _=f?.isHovering()??!1,v=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?Qr(c,t.textStyle,d.textStyle):v&&h?.textStyle?Qr(c,t.textStyle,h.textStyle):_&&u?.textStyle?Qr(c,t.textStyle,u.textStyle):Qr(c,t.textStyle)};if(u){let{cursor:_,soundSrc:v,payload:x}=u;c.eventMode="static",f=Jr({displayObject:c,onHoverChange:g});let T=()=>{f.setDirectHover(!0),x&&s&&s("hover",{_event:{id:c.label},...x}),_&&(c.cursor=_),v&&r.audioStage.add({id:`hover-${Date.now()}`,url:v,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",T),c.on("pointerout",b)}if(h){let{soundSrc:_,soundVolume:v,payload:x}=h;c.eventMode="static",p=Qi({displayObject:c,onPressChange:g});let T=E=>{ot(E)&&p.setDirectPress(!0)},b=E=>{ot(E)&&(p.setDirectPress(!1),x&&s&&s("click",{_event:{id:c.label},...x}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:(v??1e3)/1e3}))},w=()=>{p.setDirectPress(!1)};c.on("pointerdown",T),c.on("pointerup",b),c.on("pointerupoutside",w)}if(d){let{soundSrc:_,payload:v}=d;c.eventMode="static",m=Ji({displayObject:c,onPressChange:g});let x=()=>{m.setDirectPress(!0)},T=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),v&&s&&s("rightClick",{_event:{id:c.label},...v}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},w=()=>{m.setDirectPress(!1)};c.on("rightdown",x),c.on("rightup",T),c.on("rightclick",b),c.on("rightupoutside",w)}e.addChild(c),ne({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{...uc(t),alpha:t.alpha},renderContext:a})};var LG=Object.prototype.hasOwnProperty,pe=(r,e)=>{if(Object.is(r,e))return!0;if(r===null||e===null||typeof r!="object"||typeof e!="object")return!1;let t=Array.isArray(r),i=Array.isArray(e);if(t!==i)return!1;if(t&&i){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!pe(r[n],e[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!LG.call(e,n)||!pe(r[n],e[n]))return!1;return!0};var wM=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===t.id);if(!c)return;c.zIndex=l;let{alpha:u}=i,h=()=>{if(!pe(t,i)){c.text=i.content,Zr(c,i.textStyle),Ld(c,i),Dd(c,i),c.alpha=u,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"),bn(c),Hd(c),Vd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,g=null,_=null,v=null,x=()=>{let T=g?.isHovering()??!1,b=_?.isPressed()??!1;(v?.isPressed()??!1)&&m?.textStyle?Qr(c,i.textStyle,m.textStyle):b&&p?.textStyle?Qr(c,i.textStyle,p.textStyle):T&&f?.textStyle?Qr(c,i.textStyle,f.textStyle):Qr(c,i.textStyle)};if(f){let{cursor:T,soundSrc:b,payload:w}=f;c.eventMode="static",g=Jr({displayObject:c,onHoverChange:x});let E=()=>{g.setDirectHover(!0),w&&s&&s("hover",{_event:{id:c.label},...w}),T&&(c.cursor=T),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},I=()=>{g.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",E),c.on("pointerout",I)}if(p){let{soundSrc:T,soundVolume:b,payload:w}=p;c.eventMode="static",_=Qi({displayObject:c,onPressChange:x});let E=C=>{ot(C)&&_.setDirectPress(!0)},I=C=>{ot(C)&&(_.setDirectPress(!1),w&&s&&s("click",{_event:{id:c.label},...w}),T&&r.audioStage.add({id:`click-${Date.now()}`,url:T,loop:!1,volume:(b??1e3)/1e3}))},B=()=>{_.setDirectPress(!1)};c.on("pointerdown",E),c.on("pointerup",I),c.on("pointerupoutside",B)}if(m){let{soundSrc:T,payload:b}=m;c.eventMode="static",v=Ji({displayObject:c,onPressChange:x});let w=()=>{v.setDirectPress(!0)},E=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),T&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:T,loop:!1})},B=()=>{v.setDirectPress(!1)};c.on("rightdown",w),c.on("rightup",E),c.on("rightclick",I),c.on("rightupoutside",B)}}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:{...uc(i),alpha:u},onComplete:()=>{h()}})||h()};var EM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var AM=({positionX:r=0,positionY:e=0,width:t,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof t!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:t*s,y:i*o},a=r-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var xt=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Os).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Os).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let e=r.scaleX?r.scaleX*r.width:r.width,t=r.scaleY?r.scaleY*r.height:r.height;r.type===Os.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=AM({positionX:r.x,positionY:r.y,width:e,height:t,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(e),height:Math.round(t),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var PM=({state:r})=>{let e={...Ge,...r.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),typeof r.width=="number"&&(e.wordWrapWidth=r.width,e.wordWrap=!0);let t=String(r.content??""),{width:i,height:s}=De.measureText(t,new Oe(rr(e))),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...xt({...r,width:a,height:n}),content:t,measuredWidth:o,textStyle:{...e},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var DG=Je({type:"text",add:SM,update:wM,delete:EM,parse:PM});var CM="__rtglRectScrollHandled",Wd=({canvas:r,rect:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;e.eventMode="static",e.hitArea=new Q(0,0,Math.round(t),Math.round(i));let l=(f,p)=>{p?.[CM]||(p&&(p[CM]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:e.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:e.label},...o.payload}))},c=()=>{a=!0},u=()=>{a=!1},h=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};e.on("pointerover",c),e.on("pointerout",u),e.on("wheel",h),r?.addEventListener("wheel",d,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",c),e.off("pointerout",u),e.off("wheel",h),r?.removeEventListener("wheel",d),e.hitArea=null,delete e._cleanupScrollInteraction}};var NG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,MM=({app:r,parent:e,element:t,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=t,x=new Ue;x.label=c,x.zIndex=n;let T={x:u,y:h,alpha:g};_!==void 0&&(T.scaleX=_),v!==void 0&&(T.scaleY=v),(()=>{x.clear(),x.rect(0,0,Math.round(d),Math.round(f)).fill(NG(p)),x.x=Math.round(u),x.y=Math.round(h),x.alpha=g,x.scale.x=1,x.scale.y=1,m&&x.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let w=t?.hover,E=t?.click,I=t?.rightClick,B=t?.scrollUp,C=t?.scrollDown,A=t?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;x.eventMode="static";let F=()=>{M&&o&&o("hover",{_event:{id:x.label},...M}),P&&(x.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{x.cursor="auto"};x.on("pointerover",F),x.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;x.eventMode="static";let F=O=>{ot(O)&&(M&&o&&o("click",{_event:{id:x.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(R??1e3)/1e3}))};x.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;x.eventMode="static";let M=()=>{R&&o&&o("rightClick",{_event:{id:x.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};x.on("rightclick",M)}if((B||C)&&Wd({canvas:r.canvas,rect:x,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:o}),A){let{start:P,end:R,move:M}=A;x.eventMode="static";let F=()=>{x._isDragging=!0,P&&o&&o("dragStart",{_event:{id:x.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{x._isDragging=!1,R&&o&&o("dragEnd",{_event:{id:x.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&o&&x._isDragging&&o("dragMove",{_event:{id:x.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};x.on("pointerdown",F),x.on("pointerup",O),x.on("globalpointermove",D),x.on("pointerupoutside",O)}e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:a,element:x,targetState:T,renderContext:l})};var HG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,RM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(w=>w.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=i,x={x:u,y:h,alpha:g};_!==void 0&&(x.scaleX=_),v!==void 0&&(x.scaleY=v);let T=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(HG(p)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=g,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let w=i?.hover,E=i?.click,I=i?.rightClick,B=i?.scrollUp,C=i?.scrollDown,A=i?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;c.eventMode="static";let F=()=>{M&&n&&n("hover",{_event:{id:c.label},...M}),P&&(c.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;c.eventMode="static";let F=O=>{ot(O)&&(M&&n&&n("click",{_event:{id:c.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(R??1e3)/1e3}))};c.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;c.eventMode="static";let M=()=>{R&&n&&n("rightClick",{_event:{id:c.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};c.on("rightclick",M)}if((B||C)&&Wd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:n}),A){let{start:P,end:R,move:M}=A;c.eventMode="static";let F=()=>{c._isDragging=!0,P&&n&&n("dragStart",{_event:{id:c.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{c._isDragging=!1,R&&n&&n("dragEnd",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};c.on("pointerdown",F),c.on("pointerup",O),c.on("globalpointermove",D),c.on("pointerupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:x,onComplete:()=>{T()}})||T()};var IM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var BM=({state:r})=>{let e=xt(r),t=r.border?.width,i=e;return typeof t=="number"&&t>0&&(i={...e,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:t}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var VG=Je({type:"rect",add:MM,update:RM,delete:IM,parse:BM});var kM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,src:p,alpha:m}=t,g=p?k.from(p):k.EMPTY,_=new Te(g);_.label=c,_.zIndex=l,_.x=Math.round(u),_.y=Math.round(h),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let v=t?.hover,x=t?.click,T=t?.rightClick,b=null,w=null,E=null,I=()=>{let B=b?.isHovering()??!1,C=w?.isPressed()??!1;if((E?.isPressed()??!1)&&T?.src){let P=k.from(T.src);_.texture=P}else if(C&&x?.src){let P=k.from(x.src);_.texture=P}else if(B&&v?.src){let P=k.from(v.src);_.texture=P}else _.texture=g};if(v){let{cursor:B,soundSrc:C,payload:A}=v;_.eventMode="static",b=Jr({displayObject:_,onHoverChange:I});let P=()=>{b.setDirectHover(!0),A&&s&&s("hover",{_event:{id:_.label},...A}),B&&(_.cursor=B),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},R=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",P),_.on("pointerout",R)}if(x){let{soundSrc:B,soundVolume:C,payload:A}=x;_.eventMode="static",w=Qi({displayObject:_,onPressChange:I});let P=F=>{ot(F)&&w.setDirectPress(!0)},R=F=>{ot(F)&&(w.setDirectPress(!1),A&&s&&s("click",{_event:{id:_.label},...A}),B&&r.audioStage.add({id:`click-${Date.now()}`,url:B,loop:!1,volume:(C??1e3)/1e3}))},M=()=>{w.setDirectPress(!1)};_.on("pointerdown",P),_.on("pointerup",R),_.on("pointerupoutside",M)}if(T){let{soundSrc:B,payload:C}=T;_.eventMode="static",E=Ji({displayObject:_,onPressChange:I});let A=()=>{E.setDirectPress(!0)},P=()=>{E.setDirectPress(!1)},R=()=>{E.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),B&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:B,loop:!1})},M=()=>{E.setDirectPress(!1)};_.on("rightdown",A),_.on("rightup",P),_.on("rightclick",R),_.on("rightupoutside",M)}e.addChild(_),ne({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:u,y:h,width:d,height:f,alpha:m},renderContext:a})};var FM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(x=>x.label===t.id);if(!c)return;c.zIndex=l;let{id:u,x:h,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!pe(t,i)){let x=m?k.from(m):k.EMPTY;c.texture=x,c.x=Math.round(h),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=g,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"),bn(c),Hd(c),Vd(c);let T=i?.hover,b=i?.click,w=i?.rightClick,E=null,I=null,B=null,C=()=>{let A=E?.isHovering()??!1,P=I?.isPressed()??!1;if((B?.isPressed()??!1)&&w?.src){let M=k.from(w.src);c.texture=M}else if(P&&b?.src){let M=k.from(b.src);c.texture=M}else if(A&&T?.src){let M=k.from(T.src);c.texture=M}else c.texture=x};if(T){let{cursor:A,soundSrc:P,payload:R}=T;c.eventMode="static",E=Jr({displayObject:c,onHoverChange:C});let M=()=>{E.setDirectHover(!0),R&&a&&a("hover",{_event:{id:c.label},...R}),A&&(c.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{E.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",F)}if(b){let{soundSrc:A,soundVolume:P,payload:R}=b;c.eventMode="static",I=Qi({displayObject:c,onPressChange:C});let M=D=>{ot(D)&&I.setDirectPress(!0)},F=D=>{ot(D)&&(I.setDirectPress(!1),R&&a&&a("click",{_event:{id:c.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(P??1e3)/1e3}))},O=()=>{I.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",F),c.on("pointerupoutside",O)}if(w){let{soundSrc:A,payload:P}=w;c.eventMode="static",B=Ji({displayObject:c,onPressChange:C});let R=()=>{B.setDirectPress(!0)},M=()=>{B.setDirectPress(!1)},F=()=>{B.setDirectPress(!1),P&&a&&a("rightClick",{_event:{id:c.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},O=()=>{B.setDirectPress(!1)};c.on("rightdown",R),c.on("rightup",M),c.on("rightclick",F),c.on("rightupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var OM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var UM=({state:r})=>({...xt(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var WG=Je({type:"sprite",add:kM,update:FM,delete:OM,parse:UM});var zG=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Gy=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},zd=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(Gy({videoElement:r,video:e}),(t??!1)||zG(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var GM=({parent:r,element:e,renderContext:t,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:u,volume:h,loop:d,alpha:f}=e,p=k.from(u),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=h/1e3,m.muted=!1;let g=new Te(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(c),g.alpha=f??1,zd({videoElement:g,video:m,loop:d,completionTracker:i}),cM(t,m),r.addChild(g)};var LM=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,p=()=>{if(!pe(e,t)){l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(e.src!==t.src){let _=g;Gy({videoElement:l,video:_}),_&&_.pause();let v=k.from(t.src);l.texture=v,g=v.source.resource,g.muted=!1,g.pause(),g.currentTime=0}zd({videoElement:l,video:g,loop:t.loop,completionTracker:n}),g.volume=t.volume/1e3,g.loop=t.loop??!1,e.src!==t.src&&g.play()}};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1},onComplete:p})||p()};var DM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.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()),r.removeChild(o),o.destroy()}};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var NM=({state:r})=>({...xt(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var $G=Je({type:"video",add:GM,update:LM,delete:DM,parse:NM});var HM=0,VM=16,XG=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),Dy=r=>Math.max(0,Math.min(1,r)),Gs=r=>r?k.from(r):k.EMPTY,Tn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),zM=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=Tn(e),s=Tn(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},Sn=({sliderContainer:r,id:e})=>{let t=Tn(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},Ly=({baseValue:r,override:e,key:t})=>XG(e,t)?e[t]??"":r??"",jG=(r,e=null)=>({thumbSrc:Ly({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Ly({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Ly({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),YG=r=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},qG=r=>{let e=new Ue;return e.label=r,e.zIndex=0,e},KG=({sliderContainer:r,id:e,bar:t})=>{let i=Tn(e),{inactiveBar:s,barMask:o}=Sn({sliderContainer:r,id:e});return s||(s=YG(i.inactiveBar),r.addChild(s)),o||(o=qG(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},ZG=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=Sn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},$M=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:Dy((r-e)/i)},QG=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=$M({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?t*a:t),c=Math.round(e==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},JG=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=$M({currentValue:t,min:i,max:s});if(e==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},$d=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-HM*2:i-HM*2,n=Gs(e),a=n.width||VM,l=n.height||VM,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},hc=({sliderContainer:r,sliderComputedNode:e,thumb:t,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}=jG(e,s),{bar:p}=Sn({sliderContainer:r,id:o});if(p){if(p.texture=Gs(h),p.width=n,p.height=a,t.texture=Gs(f),d){let{inactiveBar:m,barMask:g}=KG({sliderContainer:r,id:o,bar:p});m.texture=Gs(d),m.width=n,m.height=a,QG({barMask:g,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else ZG({sliderContainer:r,id:o,bar:p});JG({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},eL=({position:r,thumb:e,direction:t,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(t==="horizontal"){let h=r.x-e.width/2,d=Math.max(n-e.width,1);c=Dy(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=Dy(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},WM=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=Sn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},Xd=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{bn(e);let{id:o,hover:n,change:a,min:l,max:c,step:u,direction:h,initialValue:d,width:f,height:p}=t,m=d??l,g=!1,_=null,v=()=>{hc({sliderContainer:e,sliderComputedNode:t,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},x=B=>{let C=e.toLocal(B.global),A=eL({position:C,thumb:i,direction:h,min:l,max:c,step:u,trackWidth:f,trackHeight:p});A!==m&&(m=A,v(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},T=B=>{g=!0,x(B)},b=B=>{g&&x(B)},w=()=>{g&&(g=!1)};if(e.on("pointerdown",T),e.on("globalpointermove",b),e.on("pointerup",w),e.on("pointerupoutside",w),!n)return;_=Jr({displayObject:e,onHoverChange:v});let E=()=>{_.setDirectHover(!0),v(),WM({sliderContainer:e,sliderComputedNode:t,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},I=()=>{g||(_.setDirectHover(!1),v(),WM({sliderContainer:e,sliderComputedNode:t,cursor:null}))};e.on("pointerover",E),e.on("pointerout",I),e.on("pointerupoutside",I)};var XM=({app:r,parent:e,element:t,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:g,initialValue:_,min:v}=t,x=new te;x.label=c,x.zIndex=l,x.x=u,x.y=h,x.alpha=p,x.sortableChildren=!0,x.eventMode="static";let T=Tn(c),b=new Te(Gs(g));b.label=T.bar,b.eventMode="static",b.zIndex=1;let w=new Te(Gs(m));w.label=T.thumb,w.eventMode="static",w.zIndex=2;let E=_??v;$d({thumb:w,thumbSrc:m,direction:t.direction,trackWidth:d,trackHeight:f}),x.addChild(b),x.addChild(w),hc({sliderContainer:x,sliderComputedNode:t,thumb:w,currentValue:E}),Xd({app:r,sliderContainer:x,sliderComputedNode:t,thumb:w,eventHandler:n}),e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:o,element:x,targetState:{x:u,y:h,alpha:p},renderContext:a})};var jM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),zM({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:m,thumb:g}=Sn({sliderContainer:c,id:i.id}),_=!pe(t.hover,i.hover)||!pe(t.change,i.change)||t.min!==i.min||t.max!==i.max||t.step!==i.step||t.direction!==i.direction||t.initialValue!==i.initialValue||t.thumbSrc!==i.thumbSrc||t.barSrc!==i.barSrc||t.inactiveBarSrc!==i.inactiveBarSrc||t.width!==i.width||t.height!==i.height||t.id!==i.id;if(m&&g&&($d({thumb:g,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),hc({sliderContainer:c,sliderComputedNode:i,thumb:g,currentValue:i.initialValue})),!m||!g)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&Xd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:g,eventHandler:a})}},{x:h,y:d,alpha:f}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var YM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var qM=({state:r})=>{let e=xt(r),t=r.min??0,i=r.max??100;if(i<=t)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<t||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...e,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:t,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var tL=Je({type:"slider",add:XM,update:jM,delete:YM,parse:qM});var An=Symbol("routeGraphicsInputRuntime"),jd={top:10,right:12,bottom:10,left:12},wn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},Yd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},KM={fill:"#4A89FF",alpha:.3},Ny={fill:"#111111",width:2},rL=(r={})=>{let e=r.fontSize??Ge.fontSize,t=r.lineHeight??Ge.lineHeight;return typeof t!="number"?Math.round(e*Ge.lineHeight):t>8?Math.round(t):Math.round(e*t)},Qd=(r={},e={})=>({...Ge,...r,align:r.align??"left",lineHeight:rL(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Hy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??jd.top,right:r?.right??jd.right,bottom:r?.bottom??jd.bottom,left:r?.left??jd.left},En=r=>String(r??"").replace(/\r\n/g,`
|
|
1145
1145
|
`).replace(/\r/g,`
|
|
1146
1146
|
`),iL=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},JM=r=>new Oe(rr(r)),Kt=(r,e)=>De.measureText(r,JM(e)).width,es=(r,e,t)=>Math.max(e,Math.min(t,r)),ZM=({text:r,style:e,targetX:t})=>{let i=Number.isFinite(t)?t:0;if(i<=0||r.length===0)return 0;let s=Kt(r,e);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Kt(r.slice(0,o-1),e),a=Kt(r.slice(0,o),e),l=n+(a-n)/2;if(i<l)return o-1}return r.length},QM=(r,e)=>{let t=Math.max(r.x,e.x),i=Math.max(r.y,e.y),s=Math.min(r.x+r.width,e.x+e.width),o=Math.min(r.y+r.height,e.y+e.height),n=s-t,a=o-i;return n<=0||a<=0?null:{x:t,y:i,width:n,height:a}},sL=r=>{let e=r?.mask;if(!e?.getBounds)return null;let t=e.getBounds();return!t||t.width<=0||t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}},oL=({app:r,container:e,fallbackElement:t})=>{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??t.x,y:e.y??t.y,width:t.width,height:t.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=sL(n);if(l&&(o=QM(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=QM(o,a)),{fullBounds:s,visibleBounds:o}},nL=(r,e)=>e?{top:Math.max(0,e.y-r.y),right:Math.max(0,r.x+r.width-(e.x+e.width)),bottom:Math.max(0,r.y+r.height-(e.y+e.height)),left:Math.max(0,e.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},aL=({displayedValue:r,textStyle:e})=>{let t=Kt(r,e);return{lines:[{text:r,width:t,startIndex:0}],lineHeight:e.lineHeight,totalHeight:e.lineHeight,maxLineWidth:t,textValue:r}},lL=({displayedValue:r,textStyle:e})=>{let t=En(r),i=t.split(`
|
|
1147
1147
|
`),s=i.map((a,l)=>({text:a,width:Kt(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:t}},cL=({element:r,displayedValue:e,textStyle:t})=>r.multiline?lL({displayedValue:e,textStyle:t}):aL({displayedValue:e,textStyle:t}),qd=({value:r,index:e})=>{let t=En(r),i=es(e,0,t.length),s=0,o=0;for(let n=0;n<i;n+=1){if(t[n]===`
|
|
1148
1148
|
`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},Vy=({contentWidth:r,lineWidth:e,align:t})=>iL(r,e,t),uL=r=>new Ir({label:r,text:""}),hL=(r,e)=>{for(;r.textNodes.length<e;){let t=uL(`${r.element.id}-text-line-${r.textNodes.length}`);r.text.addChild(t),r.textNodes.push(t)}for(;r.textNodes.length>e;){let t=r.textNodes.pop();t?.removeFromParent(),t?.destroy()}},Kd=({contentWidth:r,lineWidth:e,align:t,scrollOffsetX:i})=>e>r?-i:Vy({contentWidth:r,lineWidth:e,align:t}),eR=({contentWidth:r,lineWidth:e,align:t})=>Vy({contentWidth:r,lineWidth:e,align:t}),Zd=({padding:r,contentWidth:e,lineWidth:t,align:i,scrollOffsetX:s})=>r.left+eR({contentWidth:e,lineWidth:t,align:i})-s,tR=r=>{let e=new Ue;e.label=`${r.id}-background`;let t=new Ue;t.label=`${r.id}-selection`;let i=new te;i.label=`${r.id}-text`;let s=new Ir({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Ue;o.label=`${r.id}-caret`;let n=new Ue;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,t.mask=n,o.mask=n,{background:e,selection:t,text:i,placeholder:s,caret:o,clip:n}},rR=({app:r,container:e,display:t,element:i})=>({app:r,container:e,...t,value:En(i.value??""),selectionStart:En(i.value??"").length,selectionEnd:En(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:En(i.value??""),tickerListener:null,element:i}),Jd=(r,e,t)=>{let i=oL({app:r,container:e,fallbackElement:t});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=nL(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}},et=(r,e)=>{let t=Hy(e.padding),i=Math.max(0,e.width-t.left-t.right),s=Math.max(0,e.height-t.top-t.bottom),o=Qd(e.textStyle,{wordWrapWidth:i}),n=Qd({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=cL({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=es(Math.min(r.selectionStart,r.selectionEnd),0,a.length),h=es(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=es(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:t,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},hL(r,l.lines.length),r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{text:"",width:0};Zr(p,o),p.text=g.text}),Zr(r.placeholder,n),r.placeholder.text=e.placeholder??"",e.multiline){let p=qd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=m?.width??0,_=Kt((m?.text??"").slice(0,p.column),o),v=l.totalHeight,x=p.line*l.lineHeight,T=x+l.lineHeight;if(g<=i)r.scrollOffsetX=0;else if(r.focused){let w=Math.max(0,g-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=es(r.scrollOffsetX,0,w)}else r.scrollOffsetX=0;if(v<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,v-s);T-r.scrollOffsetY>s?r.scrollOffsetY=T-s:x-r.scrollOffsetY<0&&(r.scrollOffsetY=x),r.scrollOffsetY=es(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Kt(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=es(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(e.multiline)r.text.x=t.left-r.scrollOffsetX,r.text.y=t.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{width:0};p.x=eR({contentWidth:i,lineWidth:g.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],g=Kd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=t.left+g,r.text.y=t.top+Math.max(0,(s-m.height)/2)}let f=De.measureText(r.placeholder.text,JM(n));if(r.placeholder.x=t.left,r.placeholder.y=e.multiline?t.top:t.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Vy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,e.width,e.height),r.background.fill({color:wn.fill,alpha:wn.fillAlpha}),wn.strokeWidth>0&&r.background.stroke({color:wn.strokeColor,alpha:wn.strokeAlpha,width:wn.strokeWidth}),r.focused&&Yd.strokeWidth>0&&e.disabled!==!0&&r.background.stroke({color:Yd.strokeColor,alpha:Yd.strokeAlpha,width:Yd.strokeWidth}),r.clip.clear(),r.clip.rect(t.left,t.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let p=qd({value:a,index:u}),m=qd({value:a,index:h});for(let g=p.line;g<=m.line;g+=1){let _=l.lines[g];if(!_)continue;let v=g===p.line?p.column:0,x=g===m.line?m.column:_.text.length,T=Zd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Kt(_.text.slice(0,v),o),b=Zd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Kt(_.text.slice(0,x),o),w=t.top+g*l.lineHeight-r.scrollOffsetY;r.selection.rect(T,w,Math.max(b-T,1),l.lineHeight)}}else{let p=l.lines[0],m=Kd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Kt(p.text.slice(0,u),o),_=t.left+m+Kt(p.text.slice(0,h),o),v=t.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(g,v,Math.max(_-g,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:KM.fill,alpha:KM.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let p=qd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=Zd({padding:t,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Kt((m?.text??"").slice(0,p.column),o),_=t.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(g,_,Ny.width,l.lineHeight)}else{let p=l.lines[0],m=Kd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Kt(p.text.slice(0,d),o),_=t.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(g,_,Ny.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:Ny.fill,alpha:1})}},Wy=(r,e)=>{let t=r.layoutState;if(!t)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=t,c=e?.x??0,u=e?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Kt(n,o)},g=Kd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+g;return ZM({text:m.text,style:o,targetX:c-_})}let h=a.lineHeight||o.lineHeight||1,d=es(Math.floor((u-i.top+r.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=ZM({text:f.text,style:o,targetX:c-Zd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var ts=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},dL=({app:r,container:e,element:t,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,et(i,t),ts({eventHandler:s,eventName:"change",element:t,eventConfig:t.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,et(i,t),!n&&ts({eventHandler:s,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,et(i,t),ts({eventHandler:s,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),et(i,t),ts({eventHandler:s,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:o})},onSubmit:o=>{ts({eventHandler:s,eventName:"submit",element:t,eventConfig:t.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,et(i,t),ts({eventHandler:s,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,et(i,t),ts({eventHandler:s,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,et(i,t),ts({eventHandler:s,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:o})}}),iR=({app:r,parent:e,element:t,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new te({label:t.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=t.disabled?"default":"text",o.x=Math.round(t.x),o.y=Math.round(t.y),o.alpha=t.alpha;let n=tR(t),a=rR({app:r,container:o,display:n,element:t});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,et(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,et(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(t.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(t.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:g=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=g,a.blinkVisible=!0,a.blinkTick=0,et(a,a.element),l({start:f,end:p,shouldFocus:m})},u=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=Wy(a,p),g=!!f.shiftKey&&a.focused,_=g?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,v=g?Math.min(_,m):m,x=g?Math.max(_,m):m;a.draggingSelection=!0,c({start:v,end:x,shouldFocus:!0,anchor:_})},h=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=Wy(a,p),g=a.selectionAnchor??m,_=Math.min(g,m),v=Math.max(g,m);c({start:_,end:v,anchor:g})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",u),o.on("globalpointermove",h),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(t.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[An]=a,et(a,t),r.inputDomBridge.mount(t.id,{...t,value:a.value,callbacks:dL({app:r,container:o,element:t,runtime:a,eventHandler:i}),getGeometry:()=>Jd(r,o,t)}),e.addChild(o)};var rs=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},fL=({element:r,runtime:e,eventHandler:t})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,et(e,r),rs({eventHandler:t,eventName:"change",element:r,eventConfig:r.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,et(e,r),!s&&rs({eventHandler:t,eventName:"focus",element:r,eventConfig:r.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,et(e,r),rs({eventHandler:t,eventName:"blur",element:r,eventConfig:r.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),et(e,r),rs({eventHandler:t,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{rs({eventHandler:t,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{e.composing=!0,et(e,r),rs({eventHandler:t,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,et(e,r),rs({eventHandler:t,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,et(e,r),rs({eventHandler:t,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),sR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===t.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[An];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==t.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),(!pe(t,i)||c)&&et(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:fL({element:l,runtime:a,eventHandler:s}),getGeometry:()=>Jd(r,n,l)})};var oR=({app:r,parent:e,element:t})=>{let i=e.getChildByLabel(t.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[An];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(t.id),i.destroy({children:!0})};var nR=({state:r})=>{let e=xt(r),t=String(r.value??""),i=String(r.placeholder??"");return delete e.originX,delete e.originY,{...e,value:t,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Qd(r.textStyle),padding:Hy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var pL=Je({type:"input",add:iR,update:sR,delete:oR,parse:nR});var mL=24,gL=24,Ls=(r,e,t)=>Math.min(t,Math.max(e,r)),cR=r=>Ls(r,0,1),Pn=r=>{r?.stopPropagation?.()},xL=r=>r?k.from(r):k.EMPTY,ef=({label:r})=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.cursor="pointer",e},yL=({config:r,state:e})=>r?e?.pressed&&r.pressSrc?r.pressSrc:e?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",tf=({sprite:r,config:e,state:t,width:i,height:s})=>{r&&(r.texture=xL(yL({config:e,state:t})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},_L=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),aR=(r,e)=>Math.abs(r-e)<.5,lR=({hasOverflow:r,minScroll:e,previousOffset:t,wasAtEnd:i,anchorToEnd:s})=>r?s&&(t===void 0||i)?e:typeof t=="number"?Ls(t,e,0):0:0,bL=({controller:r})=>{let e=_L(r.container.label),t=r.element.scrollbar?.vertical;if(!t)return null;let i=new te({label:e.root});i.eventMode="static",i.cursor="pointer";let s=ef({label:e.track}),o=ef({label:e.thumb}),n={config:t,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),t.startButton&&(n.startButton=ef({label:e.startButton}),i.addChild(n.startButton)),t.endButton&&(n.endButton=ef({label:e.endButton}),i.addChild(n.endButton));let a=()=>{uR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Pn(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=r.viewportHeight;d.y<f.y?r.setScrollOffsets({y:r.scrollYOffset+p,source:"track"}):d.y>f.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=h=>{Pn(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=>{Pn(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(Pn(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||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=Ls(d.y-n.dragOffsetY,f,f+p),g=cR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*g,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",g=>{Pn(g),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??mL,0),source:"button"})});let m=g=>{Pn(g),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:t.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:t.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},uR=({controller:r})=>{let e=r.verticalScrollbar;if(!e)return;let{config:t,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(t.thickness??0,0),u=n?Math.max(t.startButton?.size??c,0):0,h=a?Math.max(t.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-u-h,0),f=Math.min(gL,d),p=t.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,g=d>0?typeof p=="number"?Ls(m,0,d):Ls(m,f,d):0,_=Math.max(d-g,0),v=r.minScrollY===0?0:cR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,tf({sprite:s,config:t.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+_*v,tf({sprite:o,config:t.thumb,state:l.thumb,width:c,height:g}),n&&(n.x=0,n.y=0,tf({sprite:n,config:t.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=r.viewportHeight-h,tf({sprite:a,config:t.endButton,state:l.endButton,width:c,height:h}))},hR=({container:r})=>{let e=r.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&aR(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&aR(e.scrollYOffset,e.minScrollY)}:null},dc=({container:r,element:e,interactive:t=!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 te({label:`${r.label}-content`});[...r.children].forEach(g=>{u.addChild(g)}),r.addChild(u);let d=new Ue({label:`${r.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});r.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:r,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:lR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:lR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x:g,y:_})=>{let v=g??m.scrollXOffset,x=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ls(v,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ls(x,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,uR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=bL({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),t&&(r.eventMode="static",r.hitArea=new Q(0,0,e.width||o,e.height||n),r.on("wheel",g=>{if(g.preventDefault(),a&&g.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-g.deltaY,source:"wheel"}),l&&(g.deltaX!==0||g.shiftKey&&g.deltaY!==0)){let _=g.deltaX!==0?g.deltaX:g.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},zy=({container:r})=>{let e=r.__routeGraphicsScrollController,t=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));t&&([...t.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(t),t.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),e&&(r.__routeGraphicsScrollController=void 0)};var $y=({container:r,element:e,enabled:t})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(t&&i>0&&s>0){r.hitArea=new Q(0,0,i,s);return}r.hitArea=null},dR=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!0;t=t.parent??null}return!1},Ds=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!1;if(typeof t.label=="string"&&t.label.startsWith(`${r.label}-scrollbar-`))return!0;t=t.parent??null}return!1},vL=(r,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let t=r.toLocal(e),i=r.hitArea;return i?.contains?i.contains(t.x,t.y):!1},rf=({app:r,container:e,element:t,eventHandler:i})=>{let s=Fy(e),o=Oy(e),n=Uy(e),a=s;vn({root:e,isHovered:!1}),Us({root:e,isPressed:!1}),Ti({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",t.scroll||(e.eventMode="auto",$y({container:e,element:t,enabled:!1}));let l=t?.hover,c=t?.click,u=t?.rightClick;if(!!(l||c||u)&&(e.eventMode="static",t.scroll?e.hitArea||$y({container:e,element:t,enabled:!0}):$y({container:e,element:t,enabled:!0})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,g=v=>{dR(e,v?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:e.label},...p}),d&&(e.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&vn({root:e,isHovered:!0}))},_=v=>{dR(e,v?.relatedTarget)||vL(e,v?.global)||a&&(a=!1,e.cursor="auto",m&&vn({root:e,isHovered:!1}))};e.on("pointerover",g),e.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,g=x=>{ot(x)&&(Ds(e,x?.target)||m&&Us({root:e,isPressed:!0}))},_=x=>{ot(x)&&(Ds(e,x?.target)||(m&&Us({root:e,isPressed:!1}),p&&i&&i("click",{_event:{id:e.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:(f??1e3)/1e3})))},v=x=>{ot(x)&&(Ds(e,x?.target)||m&&Us({root:e,isPressed:!1}))};e.on("pointerdown",g),e.on("pointerup",_),e.on("pointerupoutside",v)}if(u){let{soundSrc:d,payload:f,inheritToChildren:p}=u,m=T=>{Ds(e,T?.target)||p&&Ti({root:e,isPressed:!0})},g=T=>{Ds(e,T?.target)||p&&Ti({root:e,isPressed:!1})},_=T=>{_M(T)&&(Ds(e,T?.target)||p&&Ti({root:e,isPressed:!1}))},v=T=>{Ds(e,T?.target)||(p&&Ti({root:e,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:e.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},x=()=>{p&&Ti({root:e,isPressed:!1})};e.on("rightdown",m),e.on("rightup",g),e.on("pointerup",_),e.on("rightclick",v),e.on("pointerupoutside",_),e.on("rightupoutside",x)}l?.inheritToChildren&&s&&vn({root:e,isHovered:!0}),c?.inheritToChildren&&o&&Us({root:e,isPressed:!0}),u?.inheritToChildren&&n&&Ti({root:e,isPressed:!0})},fR=({container:r})=>{Fy(r)&&vn({root:r,isHovered:!0})},pR=({container:r})=>{Oy(r)&&Us({root:r,isPressed:!0})},mR=({container:r})=>{Uy(r)&&Ti({root:r,isPressed:!0})};var fc=r=>{let e=new Set;if(r.id&&e.add(r.id),r.children&&Array.isArray(r.children))for(let t of r.children)for(let i of fc(t))e.add(i);return e};var gR=(r,e,t=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of 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=fc(h),f=t instanceof Map?Array.from(t.keys()).some(p=>d.has(p)):t.find(p=>d.has(p.targetId));(!pe(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var sf=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,TL=r=>r,SL=r=>r*r,wL=r=>1-(1-r)*(1-r),EL=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,xR=Object.freeze({linear:TL,easeInQuad:SL,easeOutQuad:wL,easeInOutQuad:EL,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let t=2.5949095;return r<.5?Math.pow(2*r,2)*((t+1)*2*r-t)/2:(Math.pow(2*r-2,2)*((t+1)*(r*2-2)+t)+2)/2},easeInBounce:r=>1-sf(1-r),easeOutBounce:sf,easeInOutBounce:r=>r<.5?(1-sf(1-2*r))/2:(1+sf(2*r-1))/2,easeInElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*e)},easeOutElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*e)+1},easeInOutElastic:r=>{let e=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*e))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*e)/2+1}}),of=Object.freeze(Object.keys(xR)),AL=(r="linear")=>{let e=xR[r];if(!e)throw new Error(`Unsupported easing: ${r}`);return e},Cn=r=>{let e=[],t=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:t,value:s,easing:"linear"});return}o!==void 0&&(t+=o,i=a?i+s:s,e.push({time:t,value:i,easing:n}))}),e},pc=r=>{let e=0;for(let{timeline:t}of r){let i=t[t.length-1];i&&i.time>e&&(e=i.time)}return e},mc=(r,e)=>{if(r.length===0)return 0;if(e<=r[0].time)return r[0].value;if(e>=r[r.length-1].time)return r[r.length-1].value;for(let t=0;t<r.length-1;t++){let{time:i,value:s,easing:o}=r[t],{time:n,value:a}=r[t+1];if(e>=i&&e<=n){let l=(e-i)/(n-i);return s+(a-s)*AL(o)(l)}}return r[r.length-1].value};var PL={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Yy=r=>Math.min(1,Math.max(0,r));var TR=r=>r.getLocalBounds().rectangle.clone(),SR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),yR=(r,e)=>{let t=SR(TR(e)),i=r.renderer.generateTexture({target:e,frame:t}),s=new Te(i);s.x=t.x,s.y=t.y;let o=new te;return o.x=e.x??0,o.y=e.y??0,o.scale.set(e.scale?.x??1,e.scale?.y??1),o.rotation=e.rotation??0,o.alpha=e.alpha??1,o.addChild(s),{wrapper:o,texture:i}},CL=(r={})=>Object.entries(r).map(([e,t])=>({property:e,timeline:Cn([{value:t.initialValue??PL[e]??0},...t.keyframes])})),lf=(r,e,t)=>{if(!r||!e)return{duration:0,apply:()=>{}};let i=CL(e),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:pc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=mc(a,o);switch(n){case"translateX":r.x=s.x+l*t.renderer.width;break;case"translateY":r.y=s.y+l*t.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},ML=r=>Cn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),wR=`
|
|
1149
1149
|
in vec2 aPosition;
|
|
1150
1150
|
out vec2 vTextureCoord;
|
|
1151
|
+
out vec2 vSecondaryCoord;
|
|
1151
1152
|
|
|
1152
1153
|
uniform vec4 uInputSize;
|
|
1153
1154
|
uniform vec4 uOutputFrame;
|
|
1154
1155
|
uniform vec4 uOutputTexture;
|
|
1156
|
+
uniform mat3 uSecondaryMatrix;
|
|
1155
1157
|
|
|
1156
1158
|
vec4 filterVertexPosition(void)
|
|
1157
1159
|
{
|
|
@@ -1172,9 +1174,11 @@ void main(void)
|
|
|
1172
1174
|
{
|
|
1173
1175
|
gl_Position = filterVertexPosition();
|
|
1174
1176
|
vTextureCoord = filterTextureCoord();
|
|
1177
|
+
vSecondaryCoord = (uSecondaryMatrix * vec3(vTextureCoord, 1.0)).xy;
|
|
1175
1178
|
}
|
|
1176
1179
|
`,RL=`
|
|
1177
1180
|
in vec2 vTextureCoord;
|
|
1181
|
+
in vec2 vSecondaryCoord;
|
|
1178
1182
|
out vec4 finalColor;
|
|
1179
1183
|
|
|
1180
1184
|
uniform sampler2D uTexture;
|
|
@@ -1186,11 +1190,13 @@ uniform float uSoftness;
|
|
|
1186
1190
|
uniform float uMaskMix;
|
|
1187
1191
|
uniform float uMaskInvert;
|
|
1188
1192
|
uniform vec4 uMaskChannelWeights;
|
|
1193
|
+
uniform vec4 uSecondaryClamp;
|
|
1189
1194
|
|
|
1190
|
-
float sampleMaskValue(vec2
|
|
1195
|
+
float sampleMaskValue(vec2 secondaryUv)
|
|
1191
1196
|
{
|
|
1192
|
-
|
|
1193
|
-
vec4
|
|
1197
|
+
vec2 clampedUv = clamp(secondaryUv, uSecondaryClamp.xy, uSecondaryClamp.zw);
|
|
1198
|
+
vec4 rawMaskA = texture(uMaskTextureA, clampedUv);
|
|
1199
|
+
vec4 rawMaskB = texture(uMaskTextureB, clampedUv);
|
|
1194
1200
|
float maskA = dot(rawMaskA, uMaskChannelWeights);
|
|
1195
1201
|
float maskB = dot(rawMaskB, uMaskChannelWeights);
|
|
1196
1202
|
float maskValue = mix(maskA, maskB, clamp(uMaskMix, 0.0, 1.0));
|
|
@@ -1215,9 +1221,10 @@ float sampleReveal(float maskValue)
|
|
|
1215
1221
|
void main()
|
|
1216
1222
|
{
|
|
1217
1223
|
vec2 uv = clamp(vTextureCoord, vec2(0.0), vec2(1.0));
|
|
1224
|
+
vec2 secondaryUv = clamp(vSecondaryCoord, uSecondaryClamp.xy, uSecondaryClamp.zw);
|
|
1218
1225
|
vec4 prevColor = texture(uTexture, uv);
|
|
1219
|
-
vec4 nextColor = texture(uNextTexture,
|
|
1220
|
-
float reveal = sampleReveal(sampleMaskValue(
|
|
1226
|
+
vec4 nextColor = texture(uNextTexture, secondaryUv);
|
|
1227
|
+
float reveal = sampleReveal(sampleMaskValue(secondaryUv));
|
|
1221
1228
|
|
|
1222
1229
|
finalColor = mix(prevColor, nextColor, reveal);
|
|
1223
1230
|
}
|
|
@@ -1237,6 +1244,8 @@ struct ReplaceMaskUniforms {
|
|
|
1237
1244
|
uMaskMix: f32,
|
|
1238
1245
|
uMaskInvert: f32,
|
|
1239
1246
|
uMaskChannelWeights: vec4<f32>,
|
|
1247
|
+
uSecondaryMatrix: mat3x3<f32>,
|
|
1248
|
+
uSecondaryClamp: vec4<f32>,
|
|
1240
1249
|
};
|
|
1241
1250
|
|
|
1242
1251
|
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
@@ -1250,6 +1259,7 @@ struct ReplaceMaskUniforms {
|
|
|
1250
1259
|
struct VSOutput {
|
|
1251
1260
|
@builtin(position) position: vec4<f32>,
|
|
1252
1261
|
@location(0) uv: vec2<f32>,
|
|
1262
|
+
@location(1) secondaryUv: vec2<f32>,
|
|
1253
1263
|
};
|
|
1254
1264
|
|
|
1255
1265
|
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
@@ -1302,16 +1312,25 @@ fn mainVertex(@location(0) aPosition: vec2<f32>) -> VSOutput
|
|
|
1302
1312
|
return VSOutput(
|
|
1303
1313
|
filterVertexPosition(aPosition),
|
|
1304
1314
|
filterTextureCoord(aPosition),
|
|
1315
|
+
(replaceMaskUniforms.uSecondaryMatrix * vec3(filterTextureCoord(aPosition), 1.0)).xy,
|
|
1305
1316
|
);
|
|
1306
1317
|
}
|
|
1307
1318
|
|
|
1308
1319
|
@fragment
|
|
1309
|
-
fn mainFragment(
|
|
1320
|
+
fn mainFragment(
|
|
1321
|
+
@location(0) uv: vec2<f32>,
|
|
1322
|
+
@location(1) secondaryUv: vec2<f32>,
|
|
1323
|
+
) -> @location(0) vec4<f32>
|
|
1310
1324
|
{
|
|
1311
1325
|
let clampedUv = clamp(uv, vec2(0.0), vec2(1.0));
|
|
1326
|
+
let clampedSecondaryUv = clamp(
|
|
1327
|
+
secondaryUv,
|
|
1328
|
+
replaceMaskUniforms.uSecondaryClamp.xy,
|
|
1329
|
+
replaceMaskUniforms.uSecondaryClamp.zw,
|
|
1330
|
+
);
|
|
1312
1331
|
let prevColor = textureSample(uTexture, uSampler, clampedUv);
|
|
1313
|
-
let nextColor = textureSample(uNextTexture, uSampler,
|
|
1314
|
-
let reveal = sampleReveal(sampleMaskValue(
|
|
1332
|
+
let nextColor = textureSample(uNextTexture, uSampler, clampedSecondaryUv);
|
|
1333
|
+
let reveal = sampleReveal(sampleMaskValue(clampedSecondaryUv));
|
|
1315
1334
|
|
|
1316
1335
|
return mix(prevColor, nextColor, reveal);
|
|
1317
1336
|
}
|
|
@@ -1393,16 +1412,16 @@ fn mainFragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32>
|
|
|
1393
1412
|
|
|
1394
1413
|
return vec4(outputValue, outputValue, outputValue, 1.0);
|
|
1395
1414
|
}
|
|
1396
|
-
`,BL=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},kL=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},FL=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(k.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=qi.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h<n.length;h++,d+=4){let f=kL(u,d,s);o&&(f=255-f),n[h]=f}return l.destroy({children:!0}),c.destroy(!0),n},OL=(r,e,t,i)=>{let s=null;for(let o of e.items){let n=FL({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(e.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(t*i)},af=(r="red")=>{switch(r){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])}},Xy=af("red"),jy=(r,e)=>qi.create({width:r,height:e,resolution:1}),UL=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:tn.from({gpu:{vertex:{source:bR,entryPoint:"mainVertex"},fragment:{source:bR,entryPoint:"mainFragment"}},gl:{vertex:wR,fragment:IL,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},vR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=jy(t,i),{filter:u}=UL(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},GL=(r,e,t)=>{let{canvas:i,context:s}=BL(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a<t.length;a++,l+=4){let c=t[a];n[l]=c,n[l+1]=c,n[l+2]=c,n[l+3]=255}return s.putImageData(o,0,0),k.from(i)},LL=(r,e,t,i)=>{if(!e)return{textures:[k.WHITE.source],channelWeights:af("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=vR({app:r,texture:e.texture,width:t,height:i,channelWeights:af(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:Xy,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>vR({app:r,texture:n,width:t,height:i,channelWeights:af(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:Xy,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=GL(t,i,OL(r,e,t,i));return{textures:[s.source],channelWeights:Xy,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},DL=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"}});return{filter:tn.from({gpu:{vertex:{source:_R,entryPoint:"mainVertex"},fragment:{source:_R,entryPoint:"mainFragment"}},gl:{vertex:wR,fragment:RL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},NL=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=Yy(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},HL=(r,e,t,i,s)=>{let o=ML(e),n=pc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=LL(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?NL({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??k.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??k.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=Yy(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},VL=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return SR(TR(e))},nf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new L(1,0,0,1,-i.x,-i.y)})},Ns=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},WL=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},zL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=lf(t?.wrapper??null,e.prev?.tween,r),a=lf(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Ns(t),Ns(i)}}},$L=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=VL([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=jy(o.width,o.height),c=jy(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=DL();d.resources.uNextTexture=c.source,h.filters=[d];let f=HL(r,e.mask,o.width,o.height,d),p=lf(t?.wrapper??null,e.prev?.tween,r),m=lf(i?.wrapper??null,e.next?.tween,r),g=!1,_=!1;return t?.wrapper||nf({app:r,container:n,target:l,frame:o}),i?.wrapper||nf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(p.duration,m.duration,f.duration),apply:v=>{p.apply(v),m.apply(v),t?.wrapper&&(p.duration>0||!g)&&(nf({app:r,container:n,target:l,frame:o}),g=!0),i?.wrapper&&(m.duration>0||!_)&&(nf({app:r,container:a,target:c,frame:o}),_=!0);let x=Yy(mc(f.progressTimeline,v));f.apply(x)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Ns(t),Ns(i),f.destroy()}}},XL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?$L({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):zL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),jL=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,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===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},YL=async r=>r&&typeof r.then=="function"?r:r??null,cf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?yR(r,p):null,g=new te,_=kd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},w=({flushDeferredEffects:P})=>{if(!B){if(B=!0,E.value&&!E.value.destroyed&&(E.value.visible=!0),I.value?.destroy(),P){dM(_);return}Fd(_)}},E={value:null},I={value:null},B=!1;T();let C=P=>{if(f?.aborted||e.destroyed){Fd(_),g.destroy({children:!0}),Ns(m),b();return}if(i&&!P)throw Fd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);E.value=P;let R=P?yR(r,P):null,M=WL({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});M.prevSubject!==m&&Ns(m),M.nextSubject!==R&&Ns(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let F=XL({app:r,animation:s,prevSubject:M.prevSubject,nextSubject:M.nextSubject,zIndex:d});I.value=F,e.addChild(F.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:F.duration,applyFrame:F.apply,applyTargetState:()=>{w({flushDeferredEffects:!1})},onComplete:()=>{try{w({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!F.overlay&&!F.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?jL({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){YL(A).then(C);return}C(A??null)};var Hs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=kd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=fM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:g,toUpdateElement:_}=gR(t,i,s),v=new Set(_.map(({next:b})=>b.id)),x=b=>{let w=h.get(b);if(!w)throw new Error(`No plugin found for element type: ${b}`);return w},T=b=>e.children.find(w=>w.label===b)?.zIndex??-1;for(let b of i){let w=f.get(b.id);!w||v.has(b.id)||!pe(w,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:w,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(_.push({prev:w,next:b}),v.add(b.id))}for(let b of e.children){let w=p.get(b.label);w!==void 0&&(b.zIndex=w)}for(let b of g){let w=c.suppressAnimations?null:Gd(d,b.id),E=x(b.type);if(w){cf({app:r,parent:e,prevElement:b,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:T(b.id),signal:u});continue}E.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let w=c.suppressAnimations?null:Gd(d,b.id),E=x(b.type),I=p.get(b.id)??-1;if(w){cf({app:r,parent:e,prevElement:null,nextElement:b,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:w}of _){let E=x(w.type),I=p.get(w.id)??-1,B=c.suppressAnimations?null:Gd(d,w.id);if(B){cf({app:r,parent:e,prevElement:b,nextElement:w,animation:B,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.update({app:r,parent:e,prevElement:b,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var qL=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},KL=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){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:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},ER=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,_=new te;_.label=h,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,e.addChild(_),p&&p.length>0&&(qL(p)?KL({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Hs({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&dc({container:_,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),rf({app:r,container:_,element:t,eventHandler:s})};var AR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,w=i.scroll||i.anchorToBottom,E=w?hR({container:d}):null;b!==w?w?dc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E}):zy({container:d}):w&&(zy({container:d}),dc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E})),rf({app:r,container:d,element:i,eventHandler:s})}let v=!pe(t.children,i.children),x=fc({children:i.children}),T=Array.from(x).some(b=>Ud(o,b).length>0);if(v||T){let w=d.children.find(E=>E.label===`${i.id}-content`)||d;Hs({app:r,parent:w,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),fR({container:d}),pR({container:d}),mR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var PR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var CR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0;for(let x=0;x<o.length;x++){let T=x<o.length-1?s:0,b=o[x];x>0?t==="horizontal"?(b.x=c,b.y=f):t==="vertical"&&(b.x=p,b.y=u):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let w=e.find(E=>E.type===b.type);if(w){let E=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,B=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=w.parse({state:{...b,...E?{scaleX:B}:{},...I?{scaleY:C}:{}},parserPlugins:e})}t==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=h+s,h=b.height,b.x=0,b.y=f):h=Math.max(h,b.height),c+=b.width+T,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):t==="vertical"?(r.height&&b.height+g>r.height&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),u+=b.height+T,g=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(u,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let v={...xt({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:t,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(v.rightClick=r.rightClick),v};var ZL=Je({type:"container",add:ER,update:AR,delete:PR,parse:CR});var MR=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!yn(e)){await vi({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Od(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await vi({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var RR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),QL=(r,e)=>RR(r)!==RR(e),IR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!QL(e,t)){o?.suppressAnimations!==!0&&!yn(t)&&await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!yn(t)){await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Od(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var BR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Ay(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var JL=r=>r===`
|
|
1397
|
-
`||r==="\r",
|
|
1398
|
-
`&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},rD=(r,e)=>{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),_={...p.textStyle,wordWrapWidth:g},v=De.measureText(p.text,new Oe(rr(_)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",w=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let C=tD(m,x,T);b=C.remainingText,w=C.consumedExplicitNewline}if(x.length===0&&m.length>0){let C=m.match(/^\s+/)?.[0]??"";x=C.length>0?C:m[0],b=m.slice(x.length)}if(b===m){let C=m.match(/^\s+/)?.[0]??m[0]??"";if(C.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=C,b=m.slice(C.length)}let E=De.measureText(x,new Oe({...rr(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(E.width??v.lineWidths[0]??0)),B={text:x,textStyle:_,height:E.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let C=De.measureText(p.furigana.text,new Oe(rr(p.furigana.textStyle))),A=-C.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-C.width)/2),y:A};B.furigana=P}i.push(B),n=Math.max(n,E.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||w)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p<t.length;p++){let m=t[p].lineMaxHeight;t[p].lineParts=t[p].lineParts.map(g=>{let _=g.height;g.height&&delete g.height;let v=g.y+(m-_),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},kR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=rD(t,i),a=r.width||o,c=xt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var iD=Je({type:"text-revealing",add:MR,update:IR,delete:BR,parse:kR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>sM(r.children.find(t=>t.label===e.id))});var uf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},hf=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var FR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},qy=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),sD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i<t)return[];let s=r.slice(t,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},oD=(r=[],e=[])=>!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,sD(e,t)]:null}).filter(Boolean)),Mn=(r={})=>{let e=r??{},t=qy(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,FR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,FR(o)])),...Object.keys(t).length>0?{animations:t}:{},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}}:{}}}},Rn=(r={},e={},t={},i=[])=>({...oD(t?.frameTags,i),...qy(e),...qy(r)}),nD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Vs=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??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(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=nD(r,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},df=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Vs({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},ff=r=>typeof r=="number"?r/60:.5;var OR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,_=Mn(f),v=Rn(p,f?.animations,f?.meta,Object.keys(_.frames??{})),x=Vs({atlas:_,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Di(k.from(d),_);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:w}=df({spritesheet:b,atlas:_,clips:v,playback:x}),E=new oc(w);E.label=a,E.zIndex=o,E.animationSpeed=ff(x.fps),E.loop=x.loop,r.debug?uf(E,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&lM(i,E),E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(h),E.alpha=g,e.addChild(E),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var UR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(_=>_.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let _=i.src,v=Mn(i.atlas),x=Rn(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Vs({atlas:v,clips:x,playback:i.playback});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;let b=!pe(t.playback,i.playback),w=!pe(t.clips,i.clips),E=t.src!==_||!pe(t.atlas,i.atlas);if(c.animationSpeed=ff(T.fps),c.loop=T.loop,b||w||E){let I=n?.getVersion?.();n?.track?.(I);try{let B=new Di(k.from(_),v);if(await B.parse(),l?.aborted||c.destroyed)return;let{frameTextures:C}=df({spritesheet:B,atlas:v,clips:x,playback:T});c.textures=C,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(hf(c),uf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var GR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&hf(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var LR=({state:r})=>{let e=xt(r),t=r.atlas,i=Mn(t),s=Rn(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Vs({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var DR=Je({type:"spritesheet-animation",add:OR,update:UR,delete:GR,parse:LR}),aD=DR;var lD=by({type:"tween"});var Ws=new Map,cD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),NR=r=>Ws.has(r),gc=r=>{let e=Ws.get(r);e!==void 0&&(clearTimeout(e),Ws.delete(r))},Ky=({app:r,element:e})=>{let t=cD(e);if(gc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{Ws.delete(t.id),r.audioStage.add(t)},e.delay);Ws.set(t.id,i);return}r.audioStage.add(t)},Zy=()=>{for(let r of Ws.values())clearTimeout(r);Ws.clear()},HR=({app:r,element:e})=>{Ky({app:r,element:e})};var VR=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),Ky({app:r,element:t});return}if(NR(i)){gc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3});return}o.url=t.src,o.loop=t.loop??!1,o.volume=(t.volume??800)/1e3};var WR=({app:r,element:e})=>{gc(e.id),r.audioStage.remove(e.id)};var uD=vy({type:"sound",add:HR,update:VR,delete:WR});var xc=class extends Te{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(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Qy(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function Jy(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function e_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function yc(r,e,t){return r+(e-r)*t}function mf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function zR(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(yc(i,n,t)),u=Math.round(yc(s,a,t)),h=Math.round(yc(o,l,t));return c<<16|u<<8|h}var pf=class r{constructor(e,t,i=!1){this.value=i?mf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,t),o=o.next;return s}},Br=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=pf.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 t=this.first;for(;t.next&&t.next.time<e;)t=t.next;if(!t.next||e>=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?zR(t.value,t.next.value,i):yc(t.value,t.next.value,i)}};var gf=class{static type="alpha";constructor(e){this.list=new Br(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},xf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function $R(r,e,t){return Math.min(Math.max(r,e),t)}function It(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+hD(r,s)*(i-t):s.kind==="normal"?dD(r,t,i,s):t+r()*(i-t)}function hD(r,e){let t=e.toward??"min",i=$R(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function dD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return $R(s+l*o,e,t)}var yf=class{static type="scale";constructor(e){this.list=new Br(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},_f=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var fD=Math.PI/180,bf=class{static type="speed";constructor(e){this.list=new Br(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){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*t,e.y+=e.velocity.y*t}},vf=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Tf=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 t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),this.speed),s=It(t.emitter.random.bind(t.emitter),this.direction)*fD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var Hxe=Math.PI/180,Sf=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 t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,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*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},wf=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var _c=Math.PI/180,Ef=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)*_c}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.startRange)*_c,t.rotationSpeed=It(t.emitter.random.bind(t.emitter),this.speedRange)*_c,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},Af=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.range)*_c,t=t.next}updateParticle(e,t){}},Pf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*_c}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var Cf=class{static type="color";constructor(e){this.list=new Br(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Mf=class{static type="colorStatic";constructor(e){this.color=mf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var Rf=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},If=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,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.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)}},t_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},r_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},pD={rect:Rf,rectangle:Rf,torus:If,circle:If,point:t_,line:r_};var Bf=class{static type="spawnShape";constructor(e){let t=pD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},kf=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 t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var XR=Math.PI/180,Ff=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 t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=It(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;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"?It(e,this.velocity.angle??{min:0,max:360})*XR:It(e,this.velocity.direction??0)*XR:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var jR=new Map,YR=new Map;function i_(r,e){jR.set(r,e)}function wt(r){YR.set(r.type,r)}function qR(r,e){let t=jR.get(r);return t?t(e):null}function KR(r){return YR.get(r)}i_("circle",e_);i_("snowflake",Qy);i_("raindrop",Jy);wt(gf);wt(xf);wt(yf);wt(_f);wt(bf);wt(vf);wt(Tf);wt(Sf);wt(wf);wt(Ef);wt(Af);wt(Pf);wt(Cf);wt(Mf);wt(Bf);wt(kf);wt(Ff);var Of=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 mD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var bc=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,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Of(e.seed):null,e.texture&&(mD(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 t of e.behaviors){let i=KR(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.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 xc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),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=It(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){for(let t of this.recycleBehaviors)t.recycleParticle(e);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,e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e,this.particleCount--}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 t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.x<s.x||t.x>s.x+s.width||t.y<s.y||t.y>s.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=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:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function gD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function xD(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function ZR(r,e){if(typeof e=="object"&&e?.shape)return xD(r,e);let t=e??"circle",i=qR(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function yD(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=ZR(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var vc=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=gD(t.texture)?yD(r,t.texture):ZR(r,t.texture);if(!c)return;l.texture=c;let u=new bc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,uM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Uf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var QR=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){vc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,_D(t,i))Uf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),vc({app:r,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)};ne({animations:s,targetId:t.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 _D(r,e){return r.count!==e.count||!pe(r.texture,e.texture)||!pe(r.behaviors,e.behaviors)||!pe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function s_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Os).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Os).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function JR(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function eI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;e<r.behaviors.length;e++){let t=r.behaviors[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!t.type||typeof t.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function tI(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function rI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function iI(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var bD=new Set(["continuous","burst"]),vD=new Set(["point","rect","circle","line"]),TD=new Set(["single","random","cycle"]),SD=new Set(["perParticle","perWave"]),sI=new Set(["uniform","normal","bias"]),oI=new Set(["min","max","center"]),wD=new Set(["none","fixed","random","spin"]);function cI(r){if(ED(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.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");AD(e),CD(t,i),MD(i),FD(s)}function ED(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function AD(r){if(!bD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(lI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(lI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(is(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!vD.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");PD(r.source.kind,r.source.data)}function PD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(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(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(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&&(ce(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}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function CD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");is(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?is(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&is(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function MD(r){RD(r.texture),r.scale!==void 0&&nI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&nI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&BD(r.color,"modules.appearance.color"),r.rotation!==void 0&&kD(r.rotation)}function RD(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){uI(r,"modules.appearance.texture");return}if(!TD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!SD.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e<r.items.length;e++){let t=r.items[e];ID(t,`modules.appearance.texture.items[${e}]`)}}}function ID(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.src!==void 0){if(typeof r.src!="string"||r.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(r.shape)uI(r,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(r.weight!==void 0&&(ce(r.weight,`${e}.weight`),r.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function uI(r,e){if(!["circle","ellipse","rect"].includes(r.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(r.radius!==void 0&&ce(r.radius,`${e}.radius`),r.width!==void 0&&ce(r.width,`${e}.width`),r.height!==void 0&&ce(r.height,`${e}.height`),r.color!==void 0&&typeof r.color!="string"&&typeof r.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function nI(r,e,t){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!t.modes.includes(r.mode))throw new Error(`Input Error: ${e}.mode must be one of ${t.modes.join(", ")}`);if(r.mode==="single"){Tc(r.value,`${e}.value`,t);return}if(r.mode==="range"){is(r,e,t);return}if(!Array.isArray(r.keys)||r.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<r.keys.length;s++){let o=r.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(ce(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,Tc(o.value,`${e}.keys[${s}].value`,t)}}function BD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.mode==="single"){aI(r.value,`${e}.value`);return}if(r.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let t=-1/0;for(let i=0;i<r.keys.length;i++){let s=r.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(ce(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<t)throw new Error(`Input Error: ${e}.keys must be sorted by time`);t=s.time,aI(s.value,`${e}.keys[${i}].value`)}}function aI(r,e){if(typeof r!="string"&&typeof r!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function kD(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!wD.has(r.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(r.mode!=="none"){if(r.mode==="fixed"){ce(r.value,"modules.appearance.rotation.value");return}if(r.mode==="random"){is(r,"modules.appearance.rotation",{allowNegative:!0});return}is(r.start,"modules.appearance.rotation.start",{allowNegative:!0}),is(r.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function FD(r){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.bounds must be an object");if(r.mode!=="none"&&r.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(r.mode!=="none"){if(r.source!=="area"&&r.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(r.padding!==void 0&&OD(r.padding,"modules.bounds.padding"),r.source==="custom"){if(!r.custom||typeof r.custom!="object"||Array.isArray(r.custom))throw new Error("Input Error: modules.bounds.custom must be an object");ce(r.custom.x,"modules.bounds.custom.x"),ce(r.custom.y,"modules.bounds.custom.y"),ce(r.custom.width,"modules.bounds.custom.width"),ce(r.custom.height,"modules.bounds.custom.height")}}}}function OD(r,e){if(typeof r!="number"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or object`);for(let t of["top","right","bottom","left"])ce(r[t],`${e}.${t}`)}}function is(r,e,t={}){if(typeof r=="number"){Tc(r,e,t);return}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or range object`);if(ce(r.min,`${e}.min`),ce(r.max??r.min,`${e}.max`),Tc(r.min,`${e}.min`,t),Tc(r.max??r.min,`${e}.max`,t),r.min>(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&UD(r.distribution,`${e}.distribution`)}function Tc(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&r<t.min)throw new Error(`Input Error: ${e} must be at least ${t.min}`);if(t.max!==void 0&&r>t.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function UD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!sI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...sI].join(", ")}`);if(r.kind==="bias"){if(!oI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...oI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function lI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function hI(r){let e=GD(r),t=[];t.push(LD(r.modules.emission.source));let i=ND(r.modules.movement);i&&t.push(i),t.push(...HD(r.modules.appearance));let s=YD(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=VD(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function GD(r){let{emission:e}=r.modules,t={lifetime:ss(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:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function LD(r){return{type:"spawnShape",config:{type:r.kind,data:DD(r.kind,r.data)}}}function DD(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function ND(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:ss(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=ss(r.velocity.direction):e.velocity.angle=ss(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function HD(r){let e=[];if(r.scale&&e.push(zD(r.scale)),r.alpha&&e.push($D(r.alpha)),r.color&&e.push(XD(r.color)),r.rotation){let t=jD(r.rotation);t&&e.push(t)}return e}function VD(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map(WD)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??dI(t)}return e}function WD(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=dI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function dI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function zD(r){return r.mode==="curve"?{type:"scale",config:{list:o_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:ss(r)}}function $D(r){return r.mode==="curve"?{type:"alpha",config:{list:o_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function XD(r){return r.mode==="gradient"?{type:"color",config:{list:o_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function jD(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=ss(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=ss(r.start),t=ss(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function YD(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=qD(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function qD(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function o_(r){return r.map(e=>({time:e.time,value:e.value}))}function ss(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var fI=({state:r})=>{if(r.modules)return s_(r),cI(r),hI(r);s_(r),JR(r),eI(r),tI(r),rI(r),iI(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var KD=Je({type:"particles",add:vc,update:QR,delete:Uf,parse:fI});var pI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var n_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=pI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var ir=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(ir||{}),a_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(a_||{}),Gf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Gf||{}),re=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(re||{}),In=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(In||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),Si=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Si||{}),ae=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),br=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(br||{}),Sc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sc||{}),kr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(kr||{}),sr=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(sr||{}),os=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(os||{}),Lf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Lf||{}),Vt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Vt||{}),nt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(nt||{});var Pe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pe||{}),Zt=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Zt||{});var l_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:l_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};mm();var ZD=Ui.default??Ui,Fr=ZD(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ks=ds(gI(),1),VH=ds(ph(),1);var V_=ds(Bk(),1);var kk={};function fe(r,e,t=3){if(kk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1415
|
+
`,BL=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},kL=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},FL=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(k.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=qi.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h<n.length;h++,d+=4){let f=kL(u,d,s);o&&(f=255-f),n[h]=f}return l.destroy({children:!0}),c.destroy(!0),n},OL=(r,e,t,i)=>{let s=null;for(let o of e.items){let n=FL({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(e.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(t*i)},af=(r="red")=>{switch(r){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])}},Xy=af("red"),jy=(r,e)=>qi.create({width:r,height:e,resolution:1}),UL=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:tn.from({gpu:{vertex:{source:bR,entryPoint:"mainVertex"},fragment:{source:bR,entryPoint:"mainFragment"}},gl:{vertex:wR,fragment:IL,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},vR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=jy(t,i),{filter:u}=UL(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},GL=(r,e,t)=>{let{canvas:i,context:s}=BL(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a<t.length;a++,l+=4){let c=t[a];n[l]=c,n[l+1]=c,n[l+2]=c,n[l+3]=255}return s.putImageData(o,0,0),k.from(i)},LL=(r,e,t,i)=>{if(!e)return{textures:[k.WHITE.source],channelWeights:af("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=vR({app:r,texture:e.texture,width:t,height:i,channelWeights:af(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:Xy,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>vR({app:r,texture:n,width:t,height:i,channelWeights:af(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:Xy,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=GL(t,i,OL(r,e,t,i));return{textures:[s.source],channelWeights:Xy,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},DL=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new G,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:tn.from({gpu:{vertex:{source:_R,entryPoint:"mainVertex"},fragment:{source:_R,entryPoint:"mainFragment"}},gl:{vertex:wR,fragment:RL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},NL=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=Yy(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},HL=(r,e,t,i,s)=>{let o=ML(e),n=pc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=LL(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?NL({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??k.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??k.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=Yy(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},VL=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},WL=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return SR(TR(e))},nf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},Ns=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},zL=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},$L=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=lf(t?.wrapper??null,e.prev?.tween,r),a=lf(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Ns(t),Ns(i)}}},XL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=WL([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=jy(o.width,o.height),c=jy(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=DL();d.resources.uNextTexture=c.source,h.filters=[d];let f=VL(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,w,E)=>{T.applyFilter(d,b,w,E)};d.apply=(T,b,w,E)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,w,E)};let m=HL(r,e.mask,o.width,o.height,d),g=lf(t?.wrapper??null,e.prev?.tween,r),_=lf(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||nf({app:r,container:n,target:l,frame:o}),i?.wrapper||nf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,_.duration,m.duration),apply:T=>{g.apply(T),_.apply(T),t?.wrapper&&(g.duration>0||!v)&&(nf({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(_.duration>0||!x)&&(nf({app:r,container:a,target:c,frame:o}),x=!0);let b=Yy(mc(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Ns(t),Ns(i),m.destroy()}}},jL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?XL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):$L({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),YL=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,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===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},qL=async r=>r&&typeof r.then=="function"?r:r??null,cf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?yR(r,p):null,g=new te,_=kd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},w=({flushDeferredEffects:P})=>{if(!B){if(B=!0,E.value&&!E.value.destroyed&&(E.value.visible=!0),I.value?.destroy(),P){dM(_);return}Fd(_)}},E={value:null},I={value:null},B=!1;T();let C=P=>{if(f?.aborted||e.destroyed){Fd(_),g.destroy({children:!0}),Ns(m),b();return}if(i&&!P)throw Fd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);E.value=P;let R=P?yR(r,P):null,M=zL({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});M.prevSubject!==m&&Ns(m),M.nextSubject!==R&&Ns(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let F=jL({app:r,animation:s,prevSubject:M.prevSubject,nextSubject:M.nextSubject,zIndex:d});I.value=F,e.addChild(F.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:F.duration,applyFrame:F.apply,applyTargetState:()=>{w({flushDeferredEffects:!1})},onComplete:()=>{try{w({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!F.overlay&&!F.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?YL({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){qL(A).then(C);return}C(A??null)};var Hs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=kd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=fM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:g,toUpdateElement:_}=gR(t,i,s),v=new Set(_.map(({next:b})=>b.id)),x=b=>{let w=h.get(b);if(!w)throw new Error(`No plugin found for element type: ${b}`);return w},T=b=>e.children.find(w=>w.label===b)?.zIndex??-1;for(let b of i){let w=f.get(b.id);!w||v.has(b.id)||!pe(w,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:w,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(_.push({prev:w,next:b}),v.add(b.id))}for(let b of e.children){let w=p.get(b.label);w!==void 0&&(b.zIndex=w)}for(let b of g){let w=c.suppressAnimations?null:Gd(d,b.id),E=x(b.type);if(w){cf({app:r,parent:e,prevElement:b,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:T(b.id),signal:u});continue}E.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let w=c.suppressAnimations?null:Gd(d,b.id),E=x(b.type),I=p.get(b.id)??-1;if(w){cf({app:r,parent:e,prevElement:null,nextElement:b,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:w}of _){let E=x(w.type),I=p.get(w.id)??-1,B=c.suppressAnimations?null:Gd(d,w.id);if(B){cf({app:r,parent:e,prevElement:b,nextElement:w,animation:B,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.update({app:r,parent:e,prevElement:b,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var KL=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},ZL=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){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:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},ER=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,_=new te;_.label=h,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,e.addChild(_),p&&p.length>0&&(KL(p)?ZL({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Hs({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&dc({container:_,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),rf({app:r,container:_,element:t,eventHandler:s})};var AR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,w=i.scroll||i.anchorToBottom,E=w?hR({container:d}):null;b!==w?w?dc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E}):zy({container:d}):w&&(zy({container:d}),dc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E})),rf({app:r,container:d,element:i,eventHandler:s})}let v=!pe(t.children,i.children),x=fc({children:i.children}),T=Array.from(x).some(b=>Ud(o,b).length>0);if(v||T){let w=d.children.find(E=>E.label===`${i.id}-content`)||d;Hs({app:r,parent:w,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),fR({container:d}),pR({container:d}),mR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var PR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var CR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0;for(let x=0;x<o.length;x++){let T=x<o.length-1?s:0,b=o[x];x>0?t==="horizontal"?(b.x=c,b.y=f):t==="vertical"&&(b.x=p,b.y=u):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let w=e.find(E=>E.type===b.type);if(w){let E=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,B=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=w.parse({state:{...b,...E?{scaleX:B}:{},...I?{scaleY:C}:{}},parserPlugins:e})}t==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=h+s,h=b.height,b.x=0,b.y=f):h=Math.max(h,b.height),c+=b.width+T,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):t==="vertical"?(r.height&&b.height+g>r.height&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),u+=b.height+T,g=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(u,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let v={...xt({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:t,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(v.rightClick=r.rightClick),v};var QL=Je({type:"container",add:ER,update:AR,delete:PR,parse:CR});var MR=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!yn(e)){await vi({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Od(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await vi({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var RR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),JL=(r,e)=>RR(r)!==RR(e),IR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!JL(e,t)){o?.suppressAnimations!==!0&&!yn(t)&&await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!yn(t)){await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Od(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await vi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var BR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Ay(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var eD=r=>r===`
|
|
1416
|
+
`||r==="\r",tD=r=>typeof r=="string"&&De.isBreakingSpace(r),rD=(r,e,t)=>{let i=0,s=0;for(;i<r.length&&s<e.length&&r[i]===e[s];)i+=1,s+=1;if(s<e.length){let a=Math.min(r.length,e.length);return{remainingText:r.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<r.length&&tD(r[n]);)n+=1;if(eD(r[n])){let a=n+1;return r[n]==="\r"&&r[n+1]===`
|
|
1417
|
+
`&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},iD=(r,e)=>{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),_={...p.textStyle,wordWrapWidth:g},v=De.measureText(p.text,new Oe(rr(_)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",w=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let C=rD(m,x,T);b=C.remainingText,w=C.consumedExplicitNewline}if(x.length===0&&m.length>0){let C=m.match(/^\s+/)?.[0]??"";x=C.length>0?C:m[0],b=m.slice(x.length)}if(b===m){let C=m.match(/^\s+/)?.[0]??m[0]??"";if(C.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=C,b=m.slice(C.length)}let E=De.measureText(x,new Oe({...rr(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(E.width??v.lineWidths[0]??0)),B={text:x,textStyle:_,height:E.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let C=De.measureText(p.furigana.text,new Oe(rr(p.furigana.textStyle))),A=-C.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-C.width)/2),y:A};B.furigana=P}i.push(B),n=Math.max(n,E.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||w)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p<t.length;p++){let m=t[p].lineMaxHeight;t[p].lineParts=t[p].lineParts.map(g=>{let _=g.height;g.height&&delete g.height;let v=g.y+(m-_),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},kR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=iD(t,i),a=r.width||o,c=xt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var sD=Je({type:"text-revealing",add:MR,update:IR,delete:BR,parse:kR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>sM(r.children.find(t=>t.label===e.id))});var uf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},hf=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var FR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},qy=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),oD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i<t)return[];let s=r.slice(t,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},nD=(r=[],e=[])=>!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,oD(e,t)]:null}).filter(Boolean)),Mn=(r={})=>{let e=r??{},t=qy(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,FR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,FR(o)])),...Object.keys(t).length>0?{animations:t}:{},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}}:{}}}},Rn=(r={},e={},t={},i=[])=>({...nD(t?.frameTags,i),...qy(e),...qy(r)}),aD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Vs=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??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(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=aD(r,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},df=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Vs({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},ff=r=>typeof r=="number"?r/60:.5;var OR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,_=Mn(f),v=Rn(p,f?.animations,f?.meta,Object.keys(_.frames??{})),x=Vs({atlas:_,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Di(k.from(d),_);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:w}=df({spritesheet:b,atlas:_,clips:v,playback:x}),E=new oc(w);E.label=a,E.zIndex=o,E.animationSpeed=ff(x.fps),E.loop=x.loop,r.debug?uf(E,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&lM(i,E),E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(h),E.alpha=g,e.addChild(E),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var UR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(_=>_.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let _=i.src,v=Mn(i.atlas),x=Rn(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Vs({atlas:v,clips:x,playback:i.playback});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;let b=!pe(t.playback,i.playback),w=!pe(t.clips,i.clips),E=t.src!==_||!pe(t.atlas,i.atlas);if(c.animationSpeed=ff(T.fps),c.loop=T.loop,b||w||E){let I=n?.getVersion?.();n?.track?.(I);try{let B=new Di(k.from(_),v);if(await B.parse(),l?.aborted||c.destroyed)return;let{frameTextures:C}=df({spritesheet:B,atlas:v,clips:x,playback:T});c.textures=C,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(hf(c),uf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var GR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&hf(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var LR=({state:r})=>{let e=xt(r),t=r.atlas,i=Mn(t),s=Rn(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Vs({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var DR=Je({type:"spritesheet-animation",add:OR,update:UR,delete:GR,parse:LR}),lD=DR;var cD=by({type:"tween"});var Ws=new Map,uD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),NR=r=>Ws.has(r),gc=r=>{let e=Ws.get(r);e!==void 0&&(clearTimeout(e),Ws.delete(r))},Ky=({app:r,element:e})=>{let t=uD(e);if(gc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{Ws.delete(t.id),r.audioStage.add(t)},e.delay);Ws.set(t.id,i);return}r.audioStage.add(t)},Zy=()=>{for(let r of Ws.values())clearTimeout(r);Ws.clear()},HR=({app:r,element:e})=>{Ky({app:r,element:e})};var VR=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),Ky({app:r,element:t});return}if(NR(i)){gc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3});return}o.url=t.src,o.loop=t.loop??!1,o.volume=(t.volume??800)/1e3};var WR=({app:r,element:e})=>{gc(e.id),r.audioStage.remove(e.id)};var hD=vy({type:"sound",add:HR,update:VR,delete:WR});var xc=class extends Te{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(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Qy(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function Jy(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function e_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function yc(r,e,t){return r+(e-r)*t}function mf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function zR(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(yc(i,n,t)),u=Math.round(yc(s,a,t)),h=Math.round(yc(o,l,t));return c<<16|u<<8|h}var pf=class r{constructor(e,t,i=!1){this.value=i?mf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,t),o=o.next;return s}},Br=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=pf.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 t=this.first;for(;t.next&&t.next.time<e;)t=t.next;if(!t.next||e>=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?zR(t.value,t.next.value,i):yc(t.value,t.next.value,i)}};var gf=class{static type="alpha";constructor(e){this.list=new Br(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},xf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function $R(r,e,t){return Math.min(Math.max(r,e),t)}function It(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+dD(r,s)*(i-t):s.kind==="normal"?fD(r,t,i,s):t+r()*(i-t)}function dD(r,e){let t=e.toward??"min",i=$R(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function fD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return $R(s+l*o,e,t)}var yf=class{static type="scale";constructor(e){this.list=new Br(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},_f=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var pD=Math.PI/180,bf=class{static type="speed";constructor(e){this.list=new Br(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){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*t,e.y+=e.velocity.y*t}},vf=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Tf=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 t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),this.speed),s=It(t.emitter.random.bind(t.emitter),this.direction)*pD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var Vxe=Math.PI/180,Sf=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 t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,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*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},wf=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var _c=Math.PI/180,Ef=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)*_c}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.startRange)*_c,t.rotationSpeed=It(t.emitter.random.bind(t.emitter),this.speedRange)*_c,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},Af=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.range)*_c,t=t.next}updateParticle(e,t){}},Pf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*_c}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var Cf=class{static type="color";constructor(e){this.list=new Br(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Mf=class{static type="colorStatic";constructor(e){this.color=mf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var Rf=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},If=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,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.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)}},t_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},r_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},mD={rect:Rf,rectangle:Rf,torus:If,circle:If,point:t_,line:r_};var Bf=class{static type="spawnShape";constructor(e){let t=mD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},kf=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 t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var XR=Math.PI/180,Ff=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 t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=It(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;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"?It(e,this.velocity.angle??{min:0,max:360})*XR:It(e,this.velocity.direction??0)*XR:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var jR=new Map,YR=new Map;function i_(r,e){jR.set(r,e)}function wt(r){YR.set(r.type,r)}function qR(r,e){let t=jR.get(r);return t?t(e):null}function KR(r){return YR.get(r)}i_("circle",e_);i_("snowflake",Qy);i_("raindrop",Jy);wt(gf);wt(xf);wt(yf);wt(_f);wt(bf);wt(vf);wt(Tf);wt(Sf);wt(wf);wt(Ef);wt(Af);wt(Pf);wt(Cf);wt(Mf);wt(Bf);wt(kf);wt(Ff);var Of=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 gD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var bc=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,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Of(e.seed):null,e.texture&&(gD(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 t of e.behaviors){let i=KR(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.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 xc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),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=It(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){for(let t of this.recycleBehaviors)t.recycleParticle(e);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,e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e,this.particleCount--}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 t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.x<s.x||t.x>s.x+s.width||t.y<s.y||t.y>s.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=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:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function xD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function yD(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function ZR(r,e){if(typeof e=="object"&&e?.shape)return yD(r,e);let t=e??"circle",i=qR(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function _D(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=ZR(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var vc=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=xD(t.texture)?_D(r,t.texture):ZR(r,t.texture);if(!c)return;l.texture=c;let u=new bc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,uM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Uf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var QR=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){vc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,bD(t,i))Uf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),vc({app:r,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)};ne({animations:s,targetId:t.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 bD(r,e){return r.count!==e.count||!pe(r.texture,e.texture)||!pe(r.behaviors,e.behaviors)||!pe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function s_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Os).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Os).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function JR(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function eI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;e<r.behaviors.length;e++){let t=r.behaviors[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!t.type||typeof t.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function tI(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function rI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function iI(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var vD=new Set(["continuous","burst"]),TD=new Set(["point","rect","circle","line"]),SD=new Set(["single","random","cycle"]),wD=new Set(["perParticle","perWave"]),sI=new Set(["uniform","normal","bias"]),oI=new Set(["min","max","center"]),ED=new Set(["none","fixed","random","spin"]);function cI(r){if(AD(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.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");PD(e),MD(t,i),RD(i),OD(s)}function AD(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function PD(r){if(!vD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(lI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(lI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(is(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!TD.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");CD(r.source.kind,r.source.data)}function CD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(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(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(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&&(ce(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}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function MD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");is(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?is(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&is(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function RD(r){ID(r.texture),r.scale!==void 0&&nI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&nI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&kD(r.color,"modules.appearance.color"),r.rotation!==void 0&&FD(r.rotation)}function ID(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){uI(r,"modules.appearance.texture");return}if(!SD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!wD.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e<r.items.length;e++){let t=r.items[e];BD(t,`modules.appearance.texture.items[${e}]`)}}}function BD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.src!==void 0){if(typeof r.src!="string"||r.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(r.shape)uI(r,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(r.weight!==void 0&&(ce(r.weight,`${e}.weight`),r.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function uI(r,e){if(!["circle","ellipse","rect"].includes(r.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(r.radius!==void 0&&ce(r.radius,`${e}.radius`),r.width!==void 0&&ce(r.width,`${e}.width`),r.height!==void 0&&ce(r.height,`${e}.height`),r.color!==void 0&&typeof r.color!="string"&&typeof r.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function nI(r,e,t){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!t.modes.includes(r.mode))throw new Error(`Input Error: ${e}.mode must be one of ${t.modes.join(", ")}`);if(r.mode==="single"){Tc(r.value,`${e}.value`,t);return}if(r.mode==="range"){is(r,e,t);return}if(!Array.isArray(r.keys)||r.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<r.keys.length;s++){let o=r.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(ce(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,Tc(o.value,`${e}.keys[${s}].value`,t)}}function kD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.mode==="single"){aI(r.value,`${e}.value`);return}if(r.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let t=-1/0;for(let i=0;i<r.keys.length;i++){let s=r.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(ce(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<t)throw new Error(`Input Error: ${e}.keys must be sorted by time`);t=s.time,aI(s.value,`${e}.keys[${i}].value`)}}function aI(r,e){if(typeof r!="string"&&typeof r!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function FD(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!ED.has(r.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(r.mode!=="none"){if(r.mode==="fixed"){ce(r.value,"modules.appearance.rotation.value");return}if(r.mode==="random"){is(r,"modules.appearance.rotation",{allowNegative:!0});return}is(r.start,"modules.appearance.rotation.start",{allowNegative:!0}),is(r.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function OD(r){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.bounds must be an object");if(r.mode!=="none"&&r.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(r.mode!=="none"){if(r.source!=="area"&&r.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(r.padding!==void 0&&UD(r.padding,"modules.bounds.padding"),r.source==="custom"){if(!r.custom||typeof r.custom!="object"||Array.isArray(r.custom))throw new Error("Input Error: modules.bounds.custom must be an object");ce(r.custom.x,"modules.bounds.custom.x"),ce(r.custom.y,"modules.bounds.custom.y"),ce(r.custom.width,"modules.bounds.custom.width"),ce(r.custom.height,"modules.bounds.custom.height")}}}}function UD(r,e){if(typeof r!="number"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or object`);for(let t of["top","right","bottom","left"])ce(r[t],`${e}.${t}`)}}function is(r,e,t={}){if(typeof r=="number"){Tc(r,e,t);return}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or range object`);if(ce(r.min,`${e}.min`),ce(r.max??r.min,`${e}.max`),Tc(r.min,`${e}.min`,t),Tc(r.max??r.min,`${e}.max`,t),r.min>(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&GD(r.distribution,`${e}.distribution`)}function Tc(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&r<t.min)throw new Error(`Input Error: ${e} must be at least ${t.min}`);if(t.max!==void 0&&r>t.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function GD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!sI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...sI].join(", ")}`);if(r.kind==="bias"){if(!oI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...oI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function lI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function hI(r){let e=LD(r),t=[];t.push(DD(r.modules.emission.source));let i=HD(r.modules.movement);i&&t.push(i),t.push(...VD(r.modules.appearance));let s=qD(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=WD(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function LD(r){let{emission:e}=r.modules,t={lifetime:ss(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:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function DD(r){return{type:"spawnShape",config:{type:r.kind,data:ND(r.kind,r.data)}}}function ND(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function HD(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:ss(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=ss(r.velocity.direction):e.velocity.angle=ss(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function VD(r){let e=[];if(r.scale&&e.push($D(r.scale)),r.alpha&&e.push(XD(r.alpha)),r.color&&e.push(jD(r.color)),r.rotation){let t=YD(r.rotation);t&&e.push(t)}return e}function WD(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map(zD)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??dI(t)}return e}function zD(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=dI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function dI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function $D(r){return r.mode==="curve"?{type:"scale",config:{list:o_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:ss(r)}}function XD(r){return r.mode==="curve"?{type:"alpha",config:{list:o_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function jD(r){return r.mode==="gradient"?{type:"color",config:{list:o_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function YD(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=ss(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=ss(r.start),t=ss(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function qD(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=KD(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function KD(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function o_(r){return r.map(e=>({time:e.time,value:e.value}))}function ss(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var fI=({state:r})=>{if(r.modules)return s_(r),cI(r),hI(r);s_(r),JR(r),eI(r),tI(r),rI(r),iI(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var ZD=Je({type:"particles",add:vc,update:QR,delete:Uf,parse:fI});var pI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var n_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=pI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var ir=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(ir||{}),a_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(a_||{}),Gf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Gf||{}),re=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(re||{}),In=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(In||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),Si=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Si||{}),ae=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),br=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(br||{}),Sc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sc||{}),kr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(kr||{}),sr=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(sr||{}),os=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(os||{}),Lf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Lf||{}),Vt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Vt||{}),nt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(nt||{});var Pe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pe||{}),Zt=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Zt||{});var l_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:l_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};mm();var QD=Ui.default??Ui,Fr=QD(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ks=ds(gI(),1),WH=ds(ph(),1);var V_=ds(Bk(),1);var kk={};function fe(r,e,t=3){if(kk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1399
1418
|
Deprecated since v${r}`):(i=i.split(`
|
|
1400
1419
|
`).splice(t).join(`
|
|
1401
1420
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
|
1402
1421
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1403
|
-
Deprecated since v${r}`),console.warn(i))),kk[e]=!0}var W_;function z_(){return typeof W_>"u"&&(W_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let e=K.ADAPTER.createCanvas(),t=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),i=!!t?.getContextAttributes()?.stencil;if(t){let s=t.getExtension("WEBGL_lose_context");s&&s.loseContext()}return t=null,i}catch{return!1}}()),W_}Hp();Vp();Eu([Au]);var Vn=class ep{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 ep)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,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,o)=>s===t[o]);if(e!==null&&t!==null){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[t,i,s]=this._components;return e[0]=t,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[t,i,s,o]=ep.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(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[t,i,s]=this._components;return this._components[0]=Math.round(t*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[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(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),[t,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),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=ep.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Qt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,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,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}};Vn.shared=new Vn,Vn.temp=new Vn,Vn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Or=Vn;function
|
|
1404
|
-
`);function
|
|
1405
|
-
else `),t<r-1&&(e+=`if(test == ${t}.0){}`);return e}function op(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let t=e.createShader(e.FRAGMENT_SHADER);for(;;){let i=WH.replace(/%forloop%/gi,zH(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}var q_=0,K_=1,Z_=2,Q_=3,J_=4,eb=5,si=class r{constructor(){this.data=0,this.blendMode=re.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<q_)}set blend(e){!!(this.data&1<<q_)!==e&&(this.data^=1<<q_)}get offsets(){return!!(this.data&1<<K_)}set offsets(e){!!(this.data&1<<K_)!==e&&(this.data^=1<<K_)}get culling(){return!!(this.data&1<<Z_)}set culling(e){!!(this.data&1<<Z_)!==e&&(this.data^=1<<Z_)}get depthTest(){return!!(this.data&1<<Q_)}set depthTest(e){!!(this.data&1<<Q_)!==e&&(this.data^=1<<Q_)}get depthMask(){return!!(this.data&1<<eb)}set depthMask(e){!!(this.data&1<<eb)!==e&&(this.data^=1<<eb)}get clockwiseFrontFace(){return!!(this.data&1<<J_)}set clockwiseFrontFace(e){!!(this.data&1<<J_)!==e&&(this.data^=1<<J_)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==re.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){let e=new r;return e.depthTest=!1,e.blend=!0,e}};si.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Lc=[];function zn(r,e){if(!r)return null;let t="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(let i=Lc.length-1;i>=0;--i){let s=Lc[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var tt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,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,t,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 t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,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(tt.prototype,{dispatch:{value:tt.prototype.emit},run:{value:tt.prototype.emit}});var nr=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new tt("setRealSize"),this.onUpdate=new tt("update"),this.onError=new tt("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,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}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,t,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,t){return!1}};var Zs=class extends nr{constructor(e,t){let{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===sr.UNPACK);let o=t.realWidth,n=t.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(t.target,0,0,0,o,n,t.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(t.target,0,i.internalFormat,o,n,0,t.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 $H={scaleMode:br.NEAREST,alphaMode:sr.NPM},tb=class $n extends Ks.default{constructor(e=null,t=null){super(),t=Object.assign({},$n.defaultOptions,t);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}=t;e&&!(e instanceof nr)&&(e=zn(e,p),e.internal=!0),this.resolution=f||K.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=Ei(),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,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=tp(this.realWidth)&&tp(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/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 ii[this.cacheId],delete or[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),$n.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,t,i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ei()}`}o=e._pixiId}let n=ii[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new $n(e,t),n.cacheId=o,$n.addToCache(n,o)),n}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);let o=new Zs(e,{width:t,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=H.RGBA,a=ae.FLOAT):e instanceof Int32Array?(n=H.RGBA_INTEGER,a=ae.INT):e instanceof Uint32Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_INT):e instanceof Int16Array?(n=H.RGBA_INTEGER,a=ae.SHORT):e instanceof Uint16Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_SHORT):e instanceof Int8Array?(n=H.RGBA,a=ae.BYTE):(n=H.RGBA,a=ae.UNSIGNED_BYTE),o.internal=!0,new $n(o,Object.assign({},$H,{type:a,format:n},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),ii[t]&&ii[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),ii[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=ii[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete ii[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete ii[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};tb.defaultOptions={mipmap:kr.POW2,anisotropicLevel:0,scaleMode:br.LINEAR,wrapMode:Sc.CLAMP,alphaMode:sr.UNPACK,target:Si.TEXTURE_2D,format:H.RGBA,type:ae.UNSIGNED_BYTE},tb._globalBatch=0;var xe=tb;var Dc=class{constructor(){this.texArray=null,this.blend=0,this.type=In.TRIANGLES,this.start=0,this.size=0,this.data=null}};var XH=0,at=class r{constructor(e,t=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=XH++,this.disposeRunner=new tt("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?Zt.ELEMENT_ARRAY_BUFFER:Zt.ARRAY_BUFFER}get index(){return this.type===Zt.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new r(e)}};var Xn=class r{constructor(e,t=0,i=!1,s=ae.FLOAT,o,n,a,l=1){this.buffer=e,this.size=t,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,t,i,s,o){return new r(e,t,i,s,o)}};var jH={Float32Array,Uint32Array,Int32Array,Uint8Array};function Gk(r,e){let t=0,i=0,s={};for(let l=0;l<r.length;l++)i+=e[l],t+=r[l].length;let o=new ArrayBuffer(t*4),n=null,a=0;for(let l=0;l<r.length;l++){let c=e[l],u=r[l],h=Wn(u);s[h]||(s[h]=new jH[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 Lk={5126:4,5123:2,5121:1},YH=0,qH={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Ai=class r{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=YH++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new tt("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,s=!1,o,n,a,l=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof at||(t instanceof Array&&(t=new Float32Array(t)),t=new at(t));let c=e.split("|");if(c.length>1){for(let h=0;h<c.length;h++)this.addAttribute(c[h],t,i,s,o);return this}let u=this.buffers.indexOf(t);return u===-1&&(this.buffers.push(t),u=this.buffers.length-1),this.attributes[e]=new Xn(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 at||(e instanceof Array&&(e=new Uint16Array(e)),e=new at(e)),e.type=Zt.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=[],t=[],i=new at,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];e.push(n.data),t.push(o.size*Lk[o.type]/4),o.buffer=0}for(i.data=Gk(e,t),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 t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.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 r;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new at(this.buffers[t].data.slice(0));for(let t in this.attributes){let i=this.attributes[t];e.attributes[t]=new Xn(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=Zt.ELEMENT_ARRAY_BUFFER),e}static merge(e){let t=new r,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 qH[Wn(n.buffers[a].data)](s[a]),t.buffers[a]=new at(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(t.attributes=n.attributes,n.indexBuffer){t.indexBuffer=t.buffers[n.buffers.indexOf(n.indexBuffer)],t.indexBuffer.type=Zt.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*Lk[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++)t.indexBuffer.data[f+c]+=a;a+=e[h].buffers[u].data.length/l,c+=d.length}}return t}};var Nc=class extends Ai{constructor(e=!1){super(),this._buffer=new at(null,e,!1),this._indexBuffer=new at(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ae.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ae.FLOAT).addAttribute("aColor",this._buffer,4,!0,ae.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ae.FLOAT).addIndex(this._indexBuffer)}};var rb=Math.PI*2,KH=180/Math.PI,ZH=Math.PI/180,Tr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Tr||{});var lt=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(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,t=e){return this.x=e,this.y=t,this}};lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var np=[new lt,new lt,new lt,new lt],_e=class r{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Tr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(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,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){let I=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=I)return!1;let B=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>B}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=np[0].set(e.left,e.top),l=np[1].set(e.left,e.bottom),c=np[2].set(e.right,e.top),u=np[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.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,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=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=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=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=t,this.width=i-t,this.y=s,this.height=o-s,this}};_e.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var ap=class r{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Tr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}getBounds(){return new _e(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};ap.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var lp=class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Tr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _e(this.x-this.width,this.y-this.height,this.width,this.height)}};lp.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var cp=class r{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.type=Tr.POLY,this.closeStroke=!0}clone(){let e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t}contains(e,t){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>t!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}};cp.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};var up=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o,this.type=Tr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(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=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};up.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ie=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,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,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||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,t){t=t||new lt;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new lt;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return t.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,t,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=t-(i*this.b+s*this.d),this}prepend(e){let t=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=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(rb-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(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*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 r;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 r}static get TEMP_MATRIX(){return new r}};Ie.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 Qs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Js=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],eo=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],to=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ib=[],Dk=[],hp=Math.sign;function QH(){for(let r=0;r<16;r++){let e=[];ib.push(e);for(let t=0;t<16;t++){let i=hp(Qs[r]*Qs[t]+eo[r]*Js[t]),s=hp(Js[r]*Qs[t]+to[r]*Js[t]),o=hp(Qs[r]*eo[t]+eo[r]*to[t]),n=hp(Js[r]*eo[t]+to[r]*to[t]);for(let a=0;a<16;a++)if(Qs[a]===i&&Js[a]===s&&eo[a]===o&&to[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new Ie;e.set(Qs[r],Js[r],eo[r],to[r],0,0),Dk.push(e)}}QH();var Ne={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Qs[r],uY:r=>Js[r],vX:r=>eo[r],vY:r=>to[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>ib[r][e],sub:(r,e)=>ib[r][Ne.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?Ne.S:Ne.N:Math.abs(e)*2<=Math.abs(r)?r>0?Ne.E:Ne.W:e>0?r>0?Ne.SE:Ne.SW:r>0?Ne.NE:Ne.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Dk[Ne.inv(e)];s.tx=t,s.ty=i,r.append(s)}};var Pi=class r{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new r(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,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))}};Pi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var sb=class{constructor(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Pi(this.onChange,this,0,0),this.scale=new Pi(this.onChange,this,1,1),this.pivot=new Pi(this.onChange,this,0,0),this.skew=new Pi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let 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!==r._worldID){let t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};sb.IDENTITY=new sb;var dp=sb;dp.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 Nk=`varying vec2 vTextureCoord;
|
|
1422
|
+
Deprecated since v${r}`),console.warn(i))),kk[e]=!0}var W_;function z_(){return typeof W_>"u"&&(W_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let e=K.ADAPTER.createCanvas(),t=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),i=!!t?.getContextAttributes()?.stencil;if(t){let s=t.getExtension("WEBGL_lose_context");s&&s.loseContext()}return t=null,i}catch{return!1}}()),W_}Hp();Vp();Eu([Au]);var Vn=class ep{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 ep)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,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,o)=>s===t[o]);if(e!==null&&t!==null){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[t,i,s]=this._components;return e[0]=t,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[t,i,s,o]=ep.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(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[t,i,s]=this._components;return this._components[0]=Math.round(t*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[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(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),[t,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),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=ep.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Qt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,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,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}};Vn.shared=new Vn,Vn.temp=new Vn,Vn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Or=Vn;function LH(){let r=[],e=[];for(let i=0;i<32;i++)r[i]=i,e[i]=i;r[re.NORMAL_NPM]=re.NORMAL,r[re.ADD_NPM]=re.ADD,r[re.SCREEN_NPM]=re.SCREEN,e[re.NORMAL]=re.NORMAL_NPM,e[re.ADD]=re.ADD_NPM,e[re.SCREEN]=re.SCREEN_NPM;let t=[];return t.push(e),t.push(r),t}var $_=LH();function Wn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function qs(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function tp(r){return!(r&r-1)&&!!r}function rp(r){let e=(r>65535?1:0)<<4;r>>>=e;let t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function X_(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s<o;++s)r[s]=r[s+t];r.length=o}var DH=0;function Ei(){return++DH}var Fk=class{constructor(r,e,t,i){this.left=r,this.top=e,this.right=t,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}};Fk.EMPTY=new Fk(0,0,0,0);var ip={},or=Object.create(null),ii=Object.create(null);function j_(r,e=globalThis.location){if(r.startsWith("data:"))return"";e=e||globalThis.location;let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function sp(r,e=1){let t=K.RETINA_PREFIX?.exec(r);return t?parseFloat(t[1]):e}var $=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))($||{}),Y_=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Uk=(r,e)=>Y_(r).priority??e,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Y_).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(Y_).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Uk(o,t)-Uk(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};var Gc=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 zH=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
1423
|
+
`);function $H(r){let e="";for(let t=0;t<r;++t)t>0&&(e+=`
|
|
1424
|
+
else `),t<r-1&&(e+=`if(test == ${t}.0){}`);return e}function op(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let t=e.createShader(e.FRAGMENT_SHADER);for(;;){let i=zH.replace(/%forloop%/gi,$H(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}var q_=0,K_=1,Z_=2,Q_=3,J_=4,eb=5,si=class r{constructor(){this.data=0,this.blendMode=re.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<q_)}set blend(e){!!(this.data&1<<q_)!==e&&(this.data^=1<<q_)}get offsets(){return!!(this.data&1<<K_)}set offsets(e){!!(this.data&1<<K_)!==e&&(this.data^=1<<K_)}get culling(){return!!(this.data&1<<Z_)}set culling(e){!!(this.data&1<<Z_)!==e&&(this.data^=1<<Z_)}get depthTest(){return!!(this.data&1<<Q_)}set depthTest(e){!!(this.data&1<<Q_)!==e&&(this.data^=1<<Q_)}get depthMask(){return!!(this.data&1<<eb)}set depthMask(e){!!(this.data&1<<eb)!==e&&(this.data^=1<<eb)}get clockwiseFrontFace(){return!!(this.data&1<<J_)}set clockwiseFrontFace(e){!!(this.data&1<<J_)!==e&&(this.data^=1<<J_)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==re.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){let e=new r;return e.depthTest=!1,e.blend=!0,e}};si.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Lc=[];function zn(r,e){if(!r)return null;let t="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(let i=Lc.length-1;i>=0;--i){let s=Lc[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var tt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,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,t,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 t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,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(tt.prototype,{dispatch:{value:tt.prototype.emit},run:{value:tt.prototype.emit}});var nr=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new tt("setRealSize"),this.onUpdate=new tt("update"),this.onError=new tt("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,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}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,t,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,t){return!1}};var Zs=class extends nr{constructor(e,t){let{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===sr.UNPACK);let o=t.realWidth,n=t.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(t.target,0,0,0,o,n,t.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(t.target,0,i.internalFormat,o,n,0,t.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 XH={scaleMode:br.NEAREST,alphaMode:sr.NPM},tb=class $n extends Ks.default{constructor(e=null,t=null){super(),t=Object.assign({},$n.defaultOptions,t);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}=t;e&&!(e instanceof nr)&&(e=zn(e,p),e.internal=!0),this.resolution=f||K.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=Ei(),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,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=tp(this.realWidth)&&tp(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/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 ii[this.cacheId],delete or[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),$n.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,t,i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ei()}`}o=e._pixiId}let n=ii[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new $n(e,t),n.cacheId=o,$n.addToCache(n,o)),n}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);let o=new Zs(e,{width:t,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=H.RGBA,a=ae.FLOAT):e instanceof Int32Array?(n=H.RGBA_INTEGER,a=ae.INT):e instanceof Uint32Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_INT):e instanceof Int16Array?(n=H.RGBA_INTEGER,a=ae.SHORT):e instanceof Uint16Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_SHORT):e instanceof Int8Array?(n=H.RGBA,a=ae.BYTE):(n=H.RGBA,a=ae.UNSIGNED_BYTE),o.internal=!0,new $n(o,Object.assign({},XH,{type:a,format:n},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),ii[t]&&ii[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),ii[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=ii[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete ii[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete ii[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};tb.defaultOptions={mipmap:kr.POW2,anisotropicLevel:0,scaleMode:br.LINEAR,wrapMode:Sc.CLAMP,alphaMode:sr.UNPACK,target:Si.TEXTURE_2D,format:H.RGBA,type:ae.UNSIGNED_BYTE},tb._globalBatch=0;var xe=tb;var Dc=class{constructor(){this.texArray=null,this.blend=0,this.type=In.TRIANGLES,this.start=0,this.size=0,this.data=null}};var jH=0,at=class r{constructor(e,t=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=jH++,this.disposeRunner=new tt("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?Zt.ELEMENT_ARRAY_BUFFER:Zt.ARRAY_BUFFER}get index(){return this.type===Zt.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new r(e)}};var Xn=class r{constructor(e,t=0,i=!1,s=ae.FLOAT,o,n,a,l=1){this.buffer=e,this.size=t,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,t,i,s,o){return new r(e,t,i,s,o)}};var YH={Float32Array,Uint32Array,Int32Array,Uint8Array};function Gk(r,e){let t=0,i=0,s={};for(let l=0;l<r.length;l++)i+=e[l],t+=r[l].length;let o=new ArrayBuffer(t*4),n=null,a=0;for(let l=0;l<r.length;l++){let c=e[l],u=r[l],h=Wn(u);s[h]||(s[h]=new YH[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 Lk={5126:4,5123:2,5121:1},qH=0,KH={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Ai=class r{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=qH++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new tt("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,s=!1,o,n,a,l=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof at||(t instanceof Array&&(t=new Float32Array(t)),t=new at(t));let c=e.split("|");if(c.length>1){for(let h=0;h<c.length;h++)this.addAttribute(c[h],t,i,s,o);return this}let u=this.buffers.indexOf(t);return u===-1&&(this.buffers.push(t),u=this.buffers.length-1),this.attributes[e]=new Xn(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 at||(e instanceof Array&&(e=new Uint16Array(e)),e=new at(e)),e.type=Zt.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=[],t=[],i=new at,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];e.push(n.data),t.push(o.size*Lk[o.type]/4),o.buffer=0}for(i.data=Gk(e,t),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 t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.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 r;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new at(this.buffers[t].data.slice(0));for(let t in this.attributes){let i=this.attributes[t];e.attributes[t]=new Xn(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=Zt.ELEMENT_ARRAY_BUFFER),e}static merge(e){let t=new r,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 KH[Wn(n.buffers[a].data)](s[a]),t.buffers[a]=new at(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(t.attributes=n.attributes,n.indexBuffer){t.indexBuffer=t.buffers[n.buffers.indexOf(n.indexBuffer)],t.indexBuffer.type=Zt.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*Lk[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++)t.indexBuffer.data[f+c]+=a;a+=e[h].buffers[u].data.length/l,c+=d.length}}return t}};var Nc=class extends Ai{constructor(e=!1){super(),this._buffer=new at(null,e,!1),this._indexBuffer=new at(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ae.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ae.FLOAT).addAttribute("aColor",this._buffer,4,!0,ae.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ae.FLOAT).addIndex(this._indexBuffer)}};var rb=Math.PI*2,ZH=180/Math.PI,QH=Math.PI/180,Tr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Tr||{});var lt=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(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,t=e){return this.x=e,this.y=t,this}};lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var np=[new lt,new lt,new lt,new lt],_e=class r{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Tr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(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,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){let I=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=I)return!1;let B=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>B}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=np[0].set(e.left,e.top),l=np[1].set(e.left,e.bottom),c=np[2].set(e.right,e.top),u=np[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.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,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=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=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=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=t,this.width=i-t,this.y=s,this.height=o-s,this}};_e.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var ap=class r{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Tr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}getBounds(){return new _e(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};ap.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var lp=class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Tr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _e(this.x-this.width,this.y-this.height,this.width,this.height)}};lp.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var cp=class r{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.type=Tr.POLY,this.closeStroke=!0}clone(){let e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t}contains(e,t){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>t!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}};cp.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};var up=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o,this.type=Tr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(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=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};up.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ie=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,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,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||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,t){t=t||new lt;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new lt;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return t.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,t,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=t-(i*this.b+s*this.d),this}prepend(e){let t=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=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(rb-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(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*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 r;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 r}static get TEMP_MATRIX(){return new r}};Ie.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 Qs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Js=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],eo=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],to=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ib=[],Dk=[],hp=Math.sign;function JH(){for(let r=0;r<16;r++){let e=[];ib.push(e);for(let t=0;t<16;t++){let i=hp(Qs[r]*Qs[t]+eo[r]*Js[t]),s=hp(Js[r]*Qs[t]+to[r]*Js[t]),o=hp(Qs[r]*eo[t]+eo[r]*to[t]),n=hp(Js[r]*eo[t]+to[r]*to[t]);for(let a=0;a<16;a++)if(Qs[a]===i&&Js[a]===s&&eo[a]===o&&to[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new Ie;e.set(Qs[r],Js[r],eo[r],to[r],0,0),Dk.push(e)}}JH();var Ne={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Qs[r],uY:r=>Js[r],vX:r=>eo[r],vY:r=>to[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>ib[r][e],sub:(r,e)=>ib[r][Ne.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?Ne.S:Ne.N:Math.abs(e)*2<=Math.abs(r)?r>0?Ne.E:Ne.W:e>0?r>0?Ne.SE:Ne.SW:r>0?Ne.NE:Ne.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Dk[Ne.inv(e)];s.tx=t,s.ty=i,r.append(s)}};var Pi=class r{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new r(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,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))}};Pi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var sb=class{constructor(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Pi(this.onChange,this,0,0),this.scale=new Pi(this.onChange,this,1,1),this.pivot=new Pi(this.onChange,this,0,0),this.skew=new Pi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let 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!==r._worldID){let t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};sb.IDENTITY=new sb;var dp=sb;dp.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 Nk=`varying vec2 vTextureCoord;
|
|
1406
1425
|
|
|
1407
1426
|
uniform sampler2D uSampler;
|
|
1408
1427
|
|
|
@@ -1539,7 +1558,7 @@ void main(void){
|
|
|
1539
1558
|
cv[3] = v[3];
|
|
1540
1559
|
|
|
1541
1560
|
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
1542
|
-
}`}];var
|
|
1561
|
+
}`}];var eV={float:`
|
|
1543
1562
|
if (cv !== v)
|
|
1544
1563
|
{
|
|
1545
1564
|
cu.value = v;
|
|
@@ -1675,7 +1694,7 @@ void main(void){
|
|
|
1675
1694
|
cu.value = v;
|
|
1676
1695
|
|
|
1677
1696
|
gl.uniform1i(location, v);
|
|
1678
|
-
}`},
|
|
1697
|
+
}`},tV={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 nb(r,e){let t=[`
|
|
1679
1698
|
var v = null;
|
|
1680
1699
|
var cv = null;
|
|
1681
1700
|
var cu = null;
|
|
@@ -1685,7 +1704,7 @@ void main(void){
|
|
|
1685
1704
|
renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
|
|
1686
1705
|
`):t.push(`
|
|
1687
1706
|
renderer.shader.syncUniformGroup(uv.${i}, syncData);
|
|
1688
|
-
`));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<oi.length;a++)if(oi[a].test(s,o)){t.push(oi[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?
|
|
1707
|
+
`));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<oi.length;a++)if(oi[a].test(s,o)){t.push(oi[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?eV:tV)[s.type].replace("location",`ud["${i}"].location`);t.push(`
|
|
1689
1708
|
cu = ud["${i}"];
|
|
1690
1709
|
cv = cu.value;
|
|
1691
1710
|
v = uv["${i}"];
|
|
@@ -1693,10 +1712,10 @@ void main(void){
|
|
|
1693
1712
|
`))}var Vk={},pp=Vk;function mp(){if(pp===Vk||pp?.isContextLost()){let r=K.ADAPTER.createCanvas(),e;K.PREFER_ENV>=ir.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),pp=e}return pp}var gp;function ab(){if(!gp){gp=Vt.MEDIUM;let r=mp();if(r&&r.getShaderPrecisionFormat){let e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);e&&(gp=e.precision?Vt.HIGH:Vt.MEDIUM)}}return gp}function Wk(r,e){let t=r.getShaderSource(e).split(`
|
|
1694
1713
|
`).map((c,u)=>`${u}: ${c}`),i=r.getShaderInfoLog(e),s=i.split(`
|
|
1695
1714
|
`),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=>{t[c-1]=`%c${t[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=t.join(`
|
|
1696
|
-
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function lb(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||Wk(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||Wk(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}var
|
|
1697
|
-
${r}`}else if(t!==Vt.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var zc;function _p(){if(typeof zc=="boolean")return zc;try{zc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{zc=!1}return zc}var
|
|
1715
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function lb(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||Wk(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||Wk(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}var rV={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 Vc(r){return rV[r]}var xp=null,zk={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 Wc(r,e){if(!xp){let t=Object.keys(zk);xp={};for(let i=0;i<t.length;++i){let s=t[i];xp[r[s]]=zk[s]}}return xp[e]}function yp(r,e,t){if(r.substring(0,9)!=="precision"){let i=e;return e===Vt.HIGH&&t!==Vt.HIGH&&(i=Vt.MEDIUM),`precision ${i} float;
|
|
1716
|
+
${r}`}else if(t!==Vt.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var zc;function _p(){if(typeof zc=="boolean")return zc;try{zc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{zc=!1}return zc}var iV=0,bp={},cb=class jn{constructor(e,t,i="pixi-shader",s={}){this.extra={},this.id=iV++,this.vertexSrc=e||jn.defaultVertexSrc,this.fragmentSrc=t||jn.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,"-"),bp[i]?(bp[i]++,i+=`-${bp[i]}`):bp[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
1698
1717
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
1699
|
-
${this.fragmentSrc}`,this.vertexSrc=yp(this.vertexSrc,jn.defaultVertexPrecision,Vt.HIGH),this.fragmentSrc=yp(this.fragmentSrc,jn.defaultFragmentPrecision,ab())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Hk}static get defaultFragmentSrc(){return Nk}static from(e,t,i){let s=e+t,o=ip[s];return o||(ip[s]=o=new jn(e,t,i)),o}};cb.defaultVertexPrecision=Vt.HIGH,cb.defaultFragmentPrecision=Fr.apple.device?Vt.HIGH:Vt.MEDIUM;var Sr=cb;var
|
|
1718
|
+
${this.fragmentSrc}`,this.vertexSrc=yp(this.vertexSrc,jn.defaultVertexPrecision,Vt.HIGH),this.fragmentSrc=yp(this.fragmentSrc,jn.defaultFragmentPrecision,ab())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Hk}static get defaultFragmentSrc(){return Nk}static from(e,t,i){let s=e+t,o=ip[s];return o||(ip[s]=o=new jn(e,t,i)),o}};cb.defaultVertexPrecision=Vt.HIGH,cb.defaultFragmentPrecision=Fr.apple.device?Vt.HIGH:Vt.MEDIUM;var Sr=cb;var sV=0,ar=class r{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=sV++,this.static=!!t,this.ubo=!!i,e instanceof at?(this.buffer=e,this.buffer.type=Zt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new at(new Float32Array(1)),this.buffer.type=Zt.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(e,t,i){if(!this.ubo)this.uniforms[e]=new r(t,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(e,t,i){return new r(e,t,i)}static uboFrom(e,t){return new r(e,t??!0,!0)}};var ro=class r{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof ar?this.uniformGroup=t:this.uniformGroup=new ar(t):this.uniformGroup=new ar({}),this.disposeRunner=new tt("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(let i in t.uniforms){let s=t.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,t,i){let s=Sr.from(e,t);return new r(s,i)}};var $c=class{constructor(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},!t.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!t.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]=ar.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 Sr(this.vertexSrc,s)}let t={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ie,default:this.defaultGroupCache[e]};return new ro(this.programCache[e],t)}generateSampleSrc(e){let t="";t+=`
|
|
1700
1719
|
`,t+=`
|
|
1701
1720
|
`;for(let i=0;i<e;i++)i>0&&(t+=`
|
|
1702
1721
|
else `),i<e-1&&(t+=`if(vTextureId < ${i}.5)`),t+=`
|
|
@@ -1768,7 +1787,7 @@ void main(void)
|
|
|
1768
1787
|
gl_Position = filterVertexPosition();
|
|
1769
1788
|
vTextureCoord = filterTextureCoord();
|
|
1770
1789
|
}
|
|
1771
|
-
`;var ub=class Yc extends ro{constructor(e,t,i){let s=Sr.from(e||Yc.defaultVertexSrc,t||Yc.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Yc.defaultResolution,this.multisample=Yc.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new si}apply(e,t,i,s,o){e.applyFilter(this,t,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 Kk}static get defaultFragmentSrc(){return qk}};ub.defaultResolution=1,ub.defaultMultisample=Pe.NONE;var ni=ub;var Mi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Or(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;let{backgroundColor:t,background:i,backgroundAlpha:s}=e,o=i??t;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(){}};Mi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Mi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};Z.add(Mi);var Yn=class{constructor(e){this.renderer=e,this.emptyRenderer=new io(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,t){let{boundTextures:i}=this.renderer.texture;for(let s=t-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,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&&t[h]===u){n[c]=h;continue}for(;l<s;){let d=t[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,u._batchLocation=l,t[l]=u;break}}}destroy(){this.renderer=null}};Yn.extension={type:$.RendererSystem,name:"batch"};Z.add(Yn);var Zk=0,Ri=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=Zk++}init(e){if(e.context)this.initFromContext(e.context);else{let t=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,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=Zk++,this.renderer.runners.contextChange.emit(e);let t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){let t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let i;if(K.PREFER_ENV>=ir.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!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,t={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,t,{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,t,{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 t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.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")}};Ri.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ri.extension={type:$.RendererSystem,name:"context"};Z.add(Ri);var ls=class{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!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 tt("disposeFramebuffer"),this.multisample=Pe.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new xe(null,{scaleMode:br.NEAREST,resolution:1,mipmap:kr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new xe(null,{scaleMode:br.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:kr.OFF,format:H.DEPTH_COMPONENT,type:ae.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,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,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,t/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var so=class extends xe{constructor(e={}){if(typeof e=="number"){let t=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];e={width:t,height:i,scaleMode:s,resolution:o}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=Pe.NONE),super(null,e),this.mipmap=kr.OFF,this.valid=!0,this._clear=new Or([0,0,0,0]),this.framebuffer=new ls(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,t){this.framebuffer.resize(e*this.resolution,t*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 ft=class extends nr{constructor(e){let t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,s=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=j_(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,s){let o=e.gl,n=t.realWidth,a=t.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,t.alphaMode===sr.UNPACK),!this.noSubImage&&t.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,t.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(t.target,0,i.internalFormat,t.format,i.type,s)),!0}update(){if(this.destroyed)return;let e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}};var oo=class extends ft{constructor(e,t){if(t=t||{},typeof e=="string"){let i=new Image;ft.crossOrigin(i,e,t.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=(t.createBitmap??K.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,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?t(this.process()):t(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 t=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=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===sr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let s=!0,o=t._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==t.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 no=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,t,i){let s=t.width,o=t.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=Ne.add(i,Ne.NW),this.x0=l+n*Ne.uX(i),this.y0=c+a*Ne.uY(i),i=Ne.add(i,2),this.x1=l+n*Ne.uX(i),this.y1=c+a*Ne.uY(i),i=Ne.add(i,2),this.x2=l+n*Ne.uX(i),this.y2=c+a*Ne.uY(i),i=Ne.add(i,2),this.x3=l+n*Ne.uX(i),this.y3=c+a*Ne.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}};no.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 Qk=new no;function vp(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var qc=class r extends Ks.default{constructor(e,t,i,s,o,n,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new _e(0,0,1,1)),e instanceof r&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Qk,this.uvMatrix=null,this.orig=i||t,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 lt(n.x,n.y):new lt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t: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:t}=this.baseTexture;t?.url&&or[t.url]&&r.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&e,t,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Qk&&(this._uvs=new no),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else if(e instanceof xe){if(!e.cacheId){let a=t?.pixiIdPrefix||"pixiid";e.cacheId=`${a}-${Ei()}`,xe.addToCache(e,e.cacheId)}o=e.cacheId}else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ei()}`}o=e._pixiId}let n=or[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(e instanceof xe)?(t.resolution||(t.resolution=sp(e)),n=new r(new xe(e,t)),n.baseTexture.cacheId=o,xe.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&e instanceof xe&&(n=new r(e),r.addToCache(n,o)),n}static fromURL(e,t){let i=Object.assign({autoLoad:!1},t?.resourceOptions),s=r.from(e,Object.assign({resourceOptions:i},t),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new r(xe.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){let o=new xe(e,Object.assign({scaleMode:xe.defaultOptions.scaleMode,resolution:sp(t)},s)),{resource:n}=o;n instanceof oo&&(n.url=t);let a=new r(o);return i||(i=t),xe.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==t&&(xe.addToCache(a.baseTexture,t),r.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),or[t]&&or[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),or[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=or[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete or[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)or[e.textureCacheIds[t]]===e&&delete or[e.textureCacheIds[t]];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:t,y:i,width:s,height:o}=e,n=t+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${t} + ${s} = ${t+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 r._EMPTY||(r._EMPTY=new r(new xe),vp(r._EMPTY),vp(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let e=K.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),r._WHITE=new r(xe.from(e)),vp(r._WHITE),vp(r._WHITE.baseTexture)}return r._WHITE}};var ao=class r extends qc{constructor(e,t){super(e,t),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,t,i=!0){let s=this.baseTexture.resolution,o=Math.round(e*s)/s,n=Math.round(t*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:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new r(new so(e))}};var qn=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Pe.NONE){let s=new so(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ao(s)}getOptimalTexture(e,t,i=1,s=Pe.NONE){let o;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=qs(e),t=qs(t),o=((e&65535)<<16|t&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,t,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(e,t,i){let s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){let t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let t in this.texturePool){let i=this.texturePool[t];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 t in this.texturePool){if(!(Number(t)<0))continue;let i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}};qn.SCREEN_KEY=-1;var Kc=class extends Ai{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Zc=class extends Ai{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 at(this.vertices),this.uvBuffer=new at(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+t.width/e.width,this.uvs[3]=s,this.uvs[4]=i+t.width/e.width,this.uvs[5]=s+t.height/e.height,this.uvs[6]=i,this.uvs[7]=s+t.height/e.height,i=t.x,s=t.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+t.width,this.vertices[3]=s,this.vertices[4]=i+t.width,this.vertices[5]=s+t.height,this.vertices[6]=i,this.vertices[7]=s+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Qc=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Pe.NONE,this.sourceFrame=new _e,this.destinationFrame=new _e,this.bindingSourceFrame=new _e,this.bindingDestinationFrame=new _e,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Tp=[new lt,new lt,new lt,new lt],hb=new Ie,Kn=class{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new qn,this.statePool=[],this.quad=new Kc,this.quadUv=new Zc,this.tempRect=new _e,this.activeState={},this.globalUniforms=new ar({outputFrame:new _e,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,t){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Qc,n=i.renderTexture,a,l;if(n.current){let g=n.current;a=g.resolution,l=g.multisample}else a=i.resolution,l=i.multisample;let c=t[0].resolution||a,u=t[0].multisample??l,h=t[0].padding,d=t[0].autoFit,f=t[0].legacy??!0;for(let g=1;g<t.length;g++){let _=t[g];c=Math.min(c,_.resolution||a),u=Math.min(u,_.multisample??l),h=this.useMaxPadding?Math.max(h,_.padding):h+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=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(hb.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=t,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,t=e.pop(),i=t.filters;this.activeState=t;let s=this.globalUniforms.uniforms;s.outputFrame=t.sourceFrame,s.resolution=t.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=t.destinationFrame.width,o[1]=t.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*t.resolution),n[1]=Math.round(o[1]*t.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=t.sourceFrame.width*o[2]-.5*n[2],a[3]=t.sourceFrame.height*o[3]-.5*n[3],t.legacy){let c=s.filterArea;c[0]=t.destinationFrame.width,c[1]=t.destinationFrame.height,c[2]=t.sourceFrame.x,c[3]=t.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,t.renderTexture,l.renderTexture,os.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let c=t.renderTexture,u=this.getOptimalFilterTexture(c.width,c.height,t.resolution);u.filterFrame=c.filterFrame;let h=0;for(h=0;h<i.length-1;++h){h===1&&t.multisample>1&&(u=this.getOptimalFilterTexture(c.width,c.height,t.resolution),u.filterFrame=c.filterFrame),i[h].apply(this,c,u,os.CLEAR,t);let d=c;c=u,u=d}i[h].apply(this,c,l.renderTexture,os.BLEND,t),h>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=os.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;(t===os.CLEAR||t===os.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){let o=this.renderer;o.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(In.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(In.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=t._texture,n=e.set(s.width,0,0,s.height,i.x,i.y),a=t.worldTransform.copyTo(Ie.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(t.anchor.x,t.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,s=Pe.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){let o=e;e=t,t=o}e=e||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.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,t){let i=Tp[0],s=Tp[1],o=Tp[2],n=Tp[3];i.set(t.left,t.top),s.set(t.left,t.bottom),o.set(t.right,t.top),n.set(t.right,t.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);t.x=a,t.y=l,t.width=c-a,t.height=u-l}roundFrame(e,t,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?hb.copyFrom(o):hb.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(t),this.transformAABB(o.invert(),e)}}};Kn.extension={type:$.RendererSystem,name:"filter"};Z.add(Kn);var Jc=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Pe.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var sV=new _e,Zn=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new ls(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 _e,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===ir.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,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),t){let n=t.width>>i,a=t.height>>i,l=n/t.width;this.setViewport(t.x*l,t.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)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,s){let o=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==e||o.y!==t)&&(o.x=e,o.y=t,o.width=i,o.height=s,this.gl.viewport(e,t,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,t,i,s,o=Gf.COLOR|Gf.DEPTH){let{gl:n}=this;n.clearColor(e,t,i,s),n.clear(o)}initFramebuffer(e){let{gl:t}=this,i=new Jc(t.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:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=t.DEPTH_STENCIL:e.depth&&e.stencil?n=t.DEPTH24_STENCIL8:e.depth?n=t.DEPTH_COMPONENT24:n=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,n,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,n,e.width,e.height)}let s=e.colorTextures,o=s.length;t.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&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.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,t){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,t),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,t)}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:t}=this,i=Pe.NONE;if(e<=1||t===null)return i;for(let s=0;s<t.length;s++)if(t[s]<=e){i=t[s];break}return i===1&&(i=Pe.NONE),i}blit(e,t,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 ls(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++)}t||(t=sV,t.width=s.width,t.height=s.height),i||(i=t);let c=t.width===i.width&&t.height===i.height;this.bind(e),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(t.left,t.top,t.right,t.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,t){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),t||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){let t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){let e=this.current;if(!e)return;let t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;let i=e.width,s=e.height,o=this.gl,n=t.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),t.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,t.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 _e}destroy(){this.renderer=null}};Zn.extension={type:$.RendererSystem,name:"framebuffer"};Z.add(Zn);var db={5126:4,5123:2,5121:1},Qn=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,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===ir.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(t.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=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||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[t.program.id]||this.initGeometryVao(e,t,o);this._activeGeometry=e,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];t.update(s)}}checkCompatibility(e,t){let i=e.attributes,s=t.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,t){let i=e.attributes,s=t.attributeData,o=["g",e.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(e,t,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=t.program;a.glPrograms[o]||this.renderer.shader.generateProgram(t),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*db[d[m].type];for(let m in d){let g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*db[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*db[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let m=0;m<h.length;m++){let g=h[m];n.bind(g),i&&g._glBuffers[o].refCount++}return this.activateVao(e,a),c[a.id]=u,c[l]=u,s.bindVertexArray(null),n.unbind(Zt.ARRAY_BUFFER),u}disposeGeometry(e,t){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&&!t&&n.dispose(o[a],t))}if(!t){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 t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){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(t.attributeData[c]){l!==d&&(o.bind(h),l=d);let f=t.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,t,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,t||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(e,t||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(e,i,t||n.getSize(),s||1):o.drawArrays(e,i,t||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Qn.extension={type:$.RendererSystem,name:"geometry"};Z.add(Qn);var Jk=new Ie,eu=class{constructor(e,t){this._texture=e,this.mapCoord=new Ie,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(e){let t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;let i=t._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=t.orig,o=t.trim;o&&(Jk.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(Jk));let n=t.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(t._frame.x+l+c)/n.width,a[1]=(t._frame.y+l+c)/n.height,a[2]=(t._frame.x+t._frame.width-l+c)/n.width,a[3]=(t._frame.y+t._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=t._frame.width===n.width&&t._frame.height===n.height&&t.rotate===0,!0}};var eF=`varying vec2 vMaskCoord;
|
|
1790
|
+
`;var ub=class Yc extends ro{constructor(e,t,i){let s=Sr.from(e||Yc.defaultVertexSrc,t||Yc.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Yc.defaultResolution,this.multisample=Yc.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new si}apply(e,t,i,s,o){e.applyFilter(this,t,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 Kk}static get defaultFragmentSrc(){return qk}};ub.defaultResolution=1,ub.defaultMultisample=Pe.NONE;var ni=ub;var Mi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Or(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;let{backgroundColor:t,background:i,backgroundAlpha:s}=e,o=i??t;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(){}};Mi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Mi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};Z.add(Mi);var Yn=class{constructor(e){this.renderer=e,this.emptyRenderer=new io(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,t){let{boundTextures:i}=this.renderer.texture;for(let s=t-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,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&&t[h]===u){n[c]=h;continue}for(;l<s;){let d=t[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,u._batchLocation=l,t[l]=u;break}}}destroy(){this.renderer=null}};Yn.extension={type:$.RendererSystem,name:"batch"};Z.add(Yn);var Zk=0,Ri=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=Zk++}init(e){if(e.context)this.initFromContext(e.context);else{let t=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,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=Zk++,this.renderer.runners.contextChange.emit(e);let t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){let t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let i;if(K.PREFER_ENV>=ir.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!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,t={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,t,{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,t,{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 t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.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")}};Ri.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ri.extension={type:$.RendererSystem,name:"context"};Z.add(Ri);var ls=class{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!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 tt("disposeFramebuffer"),this.multisample=Pe.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new xe(null,{scaleMode:br.NEAREST,resolution:1,mipmap:kr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new xe(null,{scaleMode:br.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:kr.OFF,format:H.DEPTH_COMPONENT,type:ae.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,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,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,t/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var so=class extends xe{constructor(e={}){if(typeof e=="number"){let t=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];e={width:t,height:i,scaleMode:s,resolution:o}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=Pe.NONE),super(null,e),this.mipmap=kr.OFF,this.valid=!0,this._clear=new Or([0,0,0,0]),this.framebuffer=new ls(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,t){this.framebuffer.resize(e*this.resolution,t*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 ft=class extends nr{constructor(e){let t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,s=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=j_(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,s){let o=e.gl,n=t.realWidth,a=t.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,t.alphaMode===sr.UNPACK),!this.noSubImage&&t.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,t.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(t.target,0,i.internalFormat,t.format,i.type,s)),!0}update(){if(this.destroyed)return;let e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}};var oo=class extends ft{constructor(e,t){if(t=t||{},typeof e=="string"){let i=new Image;ft.crossOrigin(i,e,t.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=(t.createBitmap??K.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,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?t(this.process()):t(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 t=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=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===sr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let s=!0,o=t._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==t.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 no=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,t,i){let s=t.width,o=t.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=Ne.add(i,Ne.NW),this.x0=l+n*Ne.uX(i),this.y0=c+a*Ne.uY(i),i=Ne.add(i,2),this.x1=l+n*Ne.uX(i),this.y1=c+a*Ne.uY(i),i=Ne.add(i,2),this.x2=l+n*Ne.uX(i),this.y2=c+a*Ne.uY(i),i=Ne.add(i,2),this.x3=l+n*Ne.uX(i),this.y3=c+a*Ne.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}};no.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 Qk=new no;function vp(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var qc=class r extends Ks.default{constructor(e,t,i,s,o,n,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new _e(0,0,1,1)),e instanceof r&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Qk,this.uvMatrix=null,this.orig=i||t,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 lt(n.x,n.y):new lt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t: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:t}=this.baseTexture;t?.url&&or[t.url]&&r.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&e,t,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Qk&&(this._uvs=new no),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else if(e instanceof xe){if(!e.cacheId){let a=t?.pixiIdPrefix||"pixiid";e.cacheId=`${a}-${Ei()}`,xe.addToCache(e,e.cacheId)}o=e.cacheId}else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ei()}`}o=e._pixiId}let n=or[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(e instanceof xe)?(t.resolution||(t.resolution=sp(e)),n=new r(new xe(e,t)),n.baseTexture.cacheId=o,xe.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&e instanceof xe&&(n=new r(e),r.addToCache(n,o)),n}static fromURL(e,t){let i=Object.assign({autoLoad:!1},t?.resourceOptions),s=r.from(e,Object.assign({resourceOptions:i},t),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new r(xe.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){let o=new xe(e,Object.assign({scaleMode:xe.defaultOptions.scaleMode,resolution:sp(t)},s)),{resource:n}=o;n instanceof oo&&(n.url=t);let a=new r(o);return i||(i=t),xe.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==t&&(xe.addToCache(a.baseTexture,t),r.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),or[t]&&or[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),or[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=or[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete or[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)or[e.textureCacheIds[t]]===e&&delete or[e.textureCacheIds[t]];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:t,y:i,width:s,height:o}=e,n=t+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${t} + ${s} = ${t+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 r._EMPTY||(r._EMPTY=new r(new xe),vp(r._EMPTY),vp(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let e=K.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),r._WHITE=new r(xe.from(e)),vp(r._WHITE),vp(r._WHITE.baseTexture)}return r._WHITE}};var ao=class r extends qc{constructor(e,t){super(e,t),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,t,i=!0){let s=this.baseTexture.resolution,o=Math.round(e*s)/s,n=Math.round(t*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:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new r(new so(e))}};var qn=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Pe.NONE){let s=new so(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ao(s)}getOptimalTexture(e,t,i=1,s=Pe.NONE){let o;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=qs(e),t=qs(t),o=((e&65535)<<16|t&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,t,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(e,t,i){let s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){let t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let t in this.texturePool){let i=this.texturePool[t];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 t in this.texturePool){if(!(Number(t)<0))continue;let i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}};qn.SCREEN_KEY=-1;var Kc=class extends Ai{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Zc=class extends Ai{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 at(this.vertices),this.uvBuffer=new at(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+t.width/e.width,this.uvs[3]=s,this.uvs[4]=i+t.width/e.width,this.uvs[5]=s+t.height/e.height,this.uvs[6]=i,this.uvs[7]=s+t.height/e.height,i=t.x,s=t.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+t.width,this.vertices[3]=s,this.vertices[4]=i+t.width,this.vertices[5]=s+t.height,this.vertices[6]=i,this.vertices[7]=s+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Qc=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Pe.NONE,this.sourceFrame=new _e,this.destinationFrame=new _e,this.bindingSourceFrame=new _e,this.bindingDestinationFrame=new _e,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Tp=[new lt,new lt,new lt,new lt],hb=new Ie,Kn=class{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new qn,this.statePool=[],this.quad=new Kc,this.quadUv=new Zc,this.tempRect=new _e,this.activeState={},this.globalUniforms=new ar({outputFrame:new _e,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,t){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Qc,n=i.renderTexture,a,l;if(n.current){let g=n.current;a=g.resolution,l=g.multisample}else a=i.resolution,l=i.multisample;let c=t[0].resolution||a,u=t[0].multisample??l,h=t[0].padding,d=t[0].autoFit,f=t[0].legacy??!0;for(let g=1;g<t.length;g++){let _=t[g];c=Math.min(c,_.resolution||a),u=Math.min(u,_.multisample??l),h=this.useMaxPadding?Math.max(h,_.padding):h+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=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(hb.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=t,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,t=e.pop(),i=t.filters;this.activeState=t;let s=this.globalUniforms.uniforms;s.outputFrame=t.sourceFrame,s.resolution=t.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=t.destinationFrame.width,o[1]=t.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*t.resolution),n[1]=Math.round(o[1]*t.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=t.sourceFrame.width*o[2]-.5*n[2],a[3]=t.sourceFrame.height*o[3]-.5*n[3],t.legacy){let c=s.filterArea;c[0]=t.destinationFrame.width,c[1]=t.destinationFrame.height,c[2]=t.sourceFrame.x,c[3]=t.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,t.renderTexture,l.renderTexture,os.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let c=t.renderTexture,u=this.getOptimalFilterTexture(c.width,c.height,t.resolution);u.filterFrame=c.filterFrame;let h=0;for(h=0;h<i.length-1;++h){h===1&&t.multisample>1&&(u=this.getOptimalFilterTexture(c.width,c.height,t.resolution),u.filterFrame=c.filterFrame),i[h].apply(this,c,u,os.CLEAR,t);let d=c;c=u,u=d}i[h].apply(this,c,l.renderTexture,os.BLEND,t),h>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=os.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;(t===os.CLEAR||t===os.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){let o=this.renderer;o.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(In.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(In.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=t._texture,n=e.set(s.width,0,0,s.height,i.x,i.y),a=t.worldTransform.copyTo(Ie.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(t.anchor.x,t.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,s=Pe.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){let o=e;e=t,t=o}e=e||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.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,t){let i=Tp[0],s=Tp[1],o=Tp[2],n=Tp[3];i.set(t.left,t.top),s.set(t.left,t.bottom),o.set(t.right,t.top),n.set(t.right,t.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);t.x=a,t.y=l,t.width=c-a,t.height=u-l}roundFrame(e,t,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?hb.copyFrom(o):hb.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(t),this.transformAABB(o.invert(),e)}}};Kn.extension={type:$.RendererSystem,name:"filter"};Z.add(Kn);var Jc=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Pe.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var oV=new _e,Zn=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new ls(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 _e,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===ir.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,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),t){let n=t.width>>i,a=t.height>>i,l=n/t.width;this.setViewport(t.x*l,t.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)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,s){let o=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==e||o.y!==t)&&(o.x=e,o.y=t,o.width=i,o.height=s,this.gl.viewport(e,t,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,t,i,s,o=Gf.COLOR|Gf.DEPTH){let{gl:n}=this;n.clearColor(e,t,i,s),n.clear(o)}initFramebuffer(e){let{gl:t}=this,i=new Jc(t.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:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=t.DEPTH_STENCIL:e.depth&&e.stencil?n=t.DEPTH24_STENCIL8:e.depth?n=t.DEPTH_COMPONENT24:n=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,n,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,n,e.width,e.height)}let s=e.colorTextures,o=s.length;t.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&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.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,t){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,t),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,t)}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:t}=this,i=Pe.NONE;if(e<=1||t===null)return i;for(let s=0;s<t.length;s++)if(t[s]<=e){i=t[s];break}return i===1&&(i=Pe.NONE),i}blit(e,t,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 ls(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++)}t||(t=oV,t.width=s.width,t.height=s.height),i||(i=t);let c=t.width===i.width&&t.height===i.height;this.bind(e),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(t.left,t.top,t.right,t.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,t){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),t||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){let t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){let e=this.current;if(!e)return;let t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;let i=e.width,s=e.height,o=this.gl,n=t.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),t.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,t.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 _e}destroy(){this.renderer=null}};Zn.extension={type:$.RendererSystem,name:"framebuffer"};Z.add(Zn);var db={5126:4,5123:2,5121:1},Qn=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,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===ir.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(t.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=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||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[t.program.id]||this.initGeometryVao(e,t,o);this._activeGeometry=e,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];t.update(s)}}checkCompatibility(e,t){let i=e.attributes,s=t.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,t){let i=e.attributes,s=t.attributeData,o=["g",e.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(e,t,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=t.program;a.glPrograms[o]||this.renderer.shader.generateProgram(t),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*db[d[m].type];for(let m in d){let g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*db[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*db[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let m=0;m<h.length;m++){let g=h[m];n.bind(g),i&&g._glBuffers[o].refCount++}return this.activateVao(e,a),c[a.id]=u,c[l]=u,s.bindVertexArray(null),n.unbind(Zt.ARRAY_BUFFER),u}disposeGeometry(e,t){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&&!t&&n.dispose(o[a],t))}if(!t){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 t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){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(t.attributeData[c]){l!==d&&(o.bind(h),l=d);let f=t.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,t,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,t||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(e,t||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(e,i,t||n.getSize(),s||1):o.drawArrays(e,i,t||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Qn.extension={type:$.RendererSystem,name:"geometry"};Z.add(Qn);var Jk=new Ie,eu=class{constructor(e,t){this._texture=e,this.mapCoord=new Ie,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(e){let t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;let i=t._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=t.orig,o=t.trim;o&&(Jk.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(Jk));let n=t.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(t._frame.x+l+c)/n.width,a[1]=(t._frame.y+l+c)/n.height,a[2]=(t._frame.x+t._frame.width-l+c)/n.width,a[3]=(t._frame.y+t._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=t._frame.width===n.width&&t._frame.height===n.height&&t.rotate===0,!0}};var eF=`varying vec2 vMaskCoord;
|
|
1772
1791
|
varying vec2 vTextureCoord;
|
|
1773
1792
|
|
|
1774
1793
|
uniform sampler2D uSampler;
|
|
@@ -1809,7 +1828,7 @@ void main(void)
|
|
|
1809
1828
|
vTextureCoord = aTextureCoord;
|
|
1810
1829
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
1811
1830
|
}
|
|
1812
|
-
`;var tu=class extends ni{constructor(e,t,i){let s=null;typeof e!="string"&&t===void 0&&i===void 0&&(s=e,e=void 0,t=void 0,i=void 0),super(e||tF,t||eF,i),this.maskSprite=s,this.maskMatrix=new Ie}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new eu(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,t,i,s))}};var ru=class{constructor(e=null){this.type=nt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ni.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=nt.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 Jn=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,t){let i=t;if(!i.isMaskData){let o=this.maskDataPool.pop()||new ru;o.pooled=!0,o.maskObject=t,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!==nt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case nt.SCISSOR:this.renderer.scissor.push(i);break;case nt.STENCIL:this.renderer.stencil.push(i);break;case nt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case nt.COLOR:this.pushColorMask(i);break;default:break}i.type===nt.SPRITE&&this.maskStack.push(i)}pop(e){let t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case nt.SCISSOR:this.renderer.scissor.pop(t);break;case nt.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case nt.SPRITE:this.popSpriteMask(t);break;case nt.COLOR:this.popColorMask(t);break;default:break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===nt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){let t=e.maskObject;t?t.isSprite?e.type=nt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=nt.SCISSOR:e.type=nt.STENCIL:e.type=nt.COLOR}pushSpriteMask(e){let{maskObject:t}=e,i=e._target,s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new tu])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=t;let o=i.filterArea;i.filterArea=t.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 t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){let t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Jn.extension={type:$.RendererSystem,name:"mask"};Z.add(Jn);var ea=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;let s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var rF=new Ie,iF=[],sF=class Sp extends ea{constructor(e){super(e),this.glConst=K.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 t=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,iF.pop()??new _e);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),t&&n.fit(t),e._scissorRectLocal=n}static isMatrixRotated(e){if(!e)return!1;let{a:t,b:i,c:s,d:o}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(o)>1e-4)}testScissor(e){let{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||Sp.isMatrixRotated(t.worldTransform)||Sp.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,s,o){Sp.isMatrixRotated(o)||(o=o?rF.copyFrom(o):rF.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*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:t}=this.renderer;e&&iF.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};sF.extension={type:$.RendererSystem,name:"scissor"};var fb=sF;Z.add(fb);var ta=class extends ea{constructor(e){super(e),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let t=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),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.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 t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.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,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,t.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)}};ta.extension={type:$.RendererSystem,name:"stencil"};Z.add(ta);var ra=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){let e=this.rendererPlugins;for(let t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};ra.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};Z.add(ra);var ia=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ie,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||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,t,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/t.width*2,o.d=n*(1/t.height*2),o.tx=-1-t.x*o.a,o.ty=-n-t.y*o.d}setTransform(e){}destroy(){this.renderer=null}};ia.extension={type:$.RendererSystem,name:"projection"};Z.add(ia);var oV=new dp,oF=new _e,sa=class{constructor(e){this.renderer=e,this._tempMatrix=new Ie}generateTexture(e,t){let{region:i,...s}=t||{},o=i?.copyTo(oF)||e.getLocalBounds(oF,!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=ao.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=e.transform;return e.transform=oV,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=l,a}destroy(){}};sa.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};Z.add(sa);var lo=new _e,iu=new _e,oa=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _e,this.destinationFrame=new _e,this.viewportFrame=new _e}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){let s=this.renderer;this.current=e;let o,n,a;e?(o=e.baseTexture,a=o.resolution,t||(lo.width=e.frame.width,lo.height=e.frame.height,t=lo),i||(iu.x=e.frame.x,iu.y=e.frame.y,iu.width=t.width,iu.height=t.height,i=iu),n=o.framebuffer):(a=s.resolution,t||(lo.width=s._view.screen.width,lo.height=s._view.screen.height,t=lo),i||(i=lo,i.width=t.width,i.height=t.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,t,a,!n),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Or.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,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};oa.extension={type:$.RendererSystem,name:"renderTexture"};Z.add(oa);var su=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function nF(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=e.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=Wc(e,o.type),a={type:n,name:o.name,size:Vc(n),location:e.getAttribLocation(r,o.name)};t[o.name]=a}return t}function aF(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=e.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Wc(e,o.type);t[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Hc(l,o.size)}}return t}function pb(r,e){let t=fp(r,r.VERTEX_SHADER,e.vertexSrc),i=fp(r,r.FRAGMENT_SHADER,e.fragmentSrc),s=r.createProgram();r.attachShader(s,t),r.attachShader(s,i);let o=e.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||lb(r,s,t,i),e.attributeData=nF(s,r),e.uniformData=aF(s,r),!/^[ \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,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(t),r.deleteShader(i);let n={};for(let a in e.uniformData){let l=e.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:Hc(l.type,l.size)}}return new su(s,n)}function nV(r,e,t,i,s){t.buffer.update(s)}var aV={float:`
|
|
1831
|
+
`;var tu=class extends ni{constructor(e,t,i){let s=null;typeof e!="string"&&t===void 0&&i===void 0&&(s=e,e=void 0,t=void 0,i=void 0),super(e||tF,t||eF,i),this.maskSprite=s,this.maskMatrix=new Ie}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new eu(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,t,i,s))}};var ru=class{constructor(e=null){this.type=nt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ni.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=nt.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 Jn=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,t){let i=t;if(!i.isMaskData){let o=this.maskDataPool.pop()||new ru;o.pooled=!0,o.maskObject=t,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!==nt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case nt.SCISSOR:this.renderer.scissor.push(i);break;case nt.STENCIL:this.renderer.stencil.push(i);break;case nt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case nt.COLOR:this.pushColorMask(i);break;default:break}i.type===nt.SPRITE&&this.maskStack.push(i)}pop(e){let t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case nt.SCISSOR:this.renderer.scissor.pop(t);break;case nt.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case nt.SPRITE:this.popSpriteMask(t);break;case nt.COLOR:this.popColorMask(t);break;default:break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===nt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){let t=e.maskObject;t?t.isSprite?e.type=nt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=nt.SCISSOR:e.type=nt.STENCIL:e.type=nt.COLOR}pushSpriteMask(e){let{maskObject:t}=e,i=e._target,s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new tu])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=t;let o=i.filterArea;i.filterArea=t.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 t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){let t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Jn.extension={type:$.RendererSystem,name:"mask"};Z.add(Jn);var ea=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;let s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var rF=new Ie,iF=[],sF=class Sp extends ea{constructor(e){super(e),this.glConst=K.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 t=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,iF.pop()??new _e);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),t&&n.fit(t),e._scissorRectLocal=n}static isMatrixRotated(e){if(!e)return!1;let{a:t,b:i,c:s,d:o}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(o)>1e-4)}testScissor(e){let{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||Sp.isMatrixRotated(t.worldTransform)||Sp.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,s,o){Sp.isMatrixRotated(o)||(o=o?rF.copyFrom(o):rF.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*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:t}=this.renderer;e&&iF.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};sF.extension={type:$.RendererSystem,name:"scissor"};var fb=sF;Z.add(fb);var ta=class extends ea{constructor(e){super(e),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let t=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),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.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 t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.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,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,t.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)}};ta.extension={type:$.RendererSystem,name:"stencil"};Z.add(ta);var ra=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){let e=this.rendererPlugins;for(let t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};ra.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};Z.add(ra);var ia=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ie,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||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,t,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/t.width*2,o.d=n*(1/t.height*2),o.tx=-1-t.x*o.a,o.ty=-n-t.y*o.d}setTransform(e){}destroy(){this.renderer=null}};ia.extension={type:$.RendererSystem,name:"projection"};Z.add(ia);var nV=new dp,oF=new _e,sa=class{constructor(e){this.renderer=e,this._tempMatrix=new Ie}generateTexture(e,t){let{region:i,...s}=t||{},o=i?.copyTo(oF)||e.getLocalBounds(oF,!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=ao.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=e.transform;return e.transform=nV,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=l,a}destroy(){}};sa.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};Z.add(sa);var lo=new _e,iu=new _e,oa=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _e,this.destinationFrame=new _e,this.viewportFrame=new _e}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){let s=this.renderer;this.current=e;let o,n,a;e?(o=e.baseTexture,a=o.resolution,t||(lo.width=e.frame.width,lo.height=e.frame.height,t=lo),i||(iu.x=e.frame.x,iu.y=e.frame.y,iu.width=t.width,iu.height=t.height,i=iu),n=o.framebuffer):(a=s.resolution,t||(lo.width=s._view.screen.width,lo.height=s._view.screen.height,t=lo),i||(i=lo,i.width=t.width,i.height=t.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,t,a,!n),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Or.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,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};oa.extension={type:$.RendererSystem,name:"renderTexture"};Z.add(oa);var su=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function nF(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=e.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=Wc(e,o.type),a={type:n,name:o.name,size:Vc(n),location:e.getAttribLocation(r,o.name)};t[o.name]=a}return t}function aF(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=e.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Wc(e,o.type);t[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Hc(l,o.size)}}return t}function pb(r,e){let t=fp(r,r.VERTEX_SHADER,e.vertexSrc),i=fp(r,r.FRAGMENT_SHADER,e.fragmentSrc),s=r.createProgram();r.attachShader(s,t),r.attachShader(s,i);let o=e.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||lb(r,s,t,i),e.attributeData=nF(s,r),e.uniformData=aF(s,r),!/^[ \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,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(t),r.deleteShader(i);let n={};for(let a in e.uniformData){let l=e.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:Hc(l.type,l.size)}}return new su(s,n)}function aV(r,e,t,i,s){t.buffer.update(s)}var lV={float:`
|
|
1813
1832
|
data[offset] = v;
|
|
1814
1833
|
`,vec2:`
|
|
1815
1834
|
data[offset] = v[0];
|
|
@@ -1847,7 +1866,7 @@ void main(void)
|
|
|
1847
1866
|
{
|
|
1848
1867
|
data[offset + i] = v[i];
|
|
1849
1868
|
}
|
|
1850
|
-
`},lF={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 cF(r){let e=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),t=0,i=0,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(t=lF[n.data.type],n.data.size>1&&(t=Math.max(t,16)*n.data.size),n.dataLen=t,i%t!==0&&i<16){let a=i%t%16;i+=a,s+=a}i+t>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=t,i=t):(n.offset=s,i+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function uF(r,e){let t=[];for(let i in r)e[i]&&t.push(e[i]);return t.sort((i,s)=>i.index-s.index),t}function mb(r,e){if(!r.autoManage)return{size:0,syncFunc:
|
|
1869
|
+
`},lF={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 cF(r){let e=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),t=0,i=0,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(t=lF[n.data.type],n.data.size>1&&(t=Math.max(t,16)*n.data.size),n.dataLen=t,i%t!==0&&i<16){let a=i%t%16;i+=a,s+=a}i+t>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=t,i=t):(n.offset=s,i+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function uF(r,e){let t=[];for(let i in r)e[i]&&t.push(e[i]);return t.sort((i,s)=>i.index-s.index),t}function mb(r,e){if(!r.autoManage)return{size:0,syncFunc:aV};let t=uF(r.uniforms,e),{uboElements:i,size:s}=cF(t),o=[`
|
|
1851
1870
|
var v = null;
|
|
1852
1871
|
var v2 = null;
|
|
1853
1872
|
var cv = null;
|
|
@@ -1871,7 +1890,7 @@ void main(void)
|
|
|
1871
1890
|
offset += ${p};
|
|
1872
1891
|
}
|
|
1873
1892
|
|
|
1874
|
-
`)}else{let h=
|
|
1893
|
+
`)}else{let h=lV[a.data.type];o.push(`
|
|
1875
1894
|
cv = ud.${c}.value;
|
|
1876
1895
|
v = uv.${c};
|
|
1877
1896
|
offset = ${a.offset/4};
|
|
@@ -1879,7 +1898,7 @@ void main(void)
|
|
|
1879
1898
|
`)}}return o.push(`
|
|
1880
1899
|
renderer.buffer.update(buffer);
|
|
1881
1900
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
|
|
1882
|
-
`))}}var lV=0,wp={textureCount:0,uboCount:0},cs=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=lV++}systemCheck(){if(!_p())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,t){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)),t||(wp.textureCount=0,wp.uboCount=0,this.syncUniformGroup(e.uniformGroup,wp)),s}setUniforms(e){let t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=nb(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){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,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,wp,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.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]=mb(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,i=e.program,s=pb(t,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}};cs.extension={type:$.RendererSystem,name:"shader"};Z.add(cs);var Ii=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};Ii.defaultOptions={hello:!1},Ii.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(Ii);function hF(r,e=[]){return e[re.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD]=[r.ONE,r.ONE],e[re.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.NONE]=[0,0],e[re.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[re.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[re.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[re.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[re.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[re.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[re.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[re.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var cV=0,uV=1,hV=2,dV=3,fV=4,pV=5,dF=class gb{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=re.NONE,this._blendEq=!1,this.map=[],this.map[cV]=this.setBlend,this.map[uV]=this.setOffset,this.map[hV]=this.setCullFace,this.map[dV]=this.setDepthTest,this.map[fV]=this.setFrontFace,this.map[pV]=this.setDepthMask,this.checks=[],this.defaultState=new si,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=hF(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(gb.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(gb.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 t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}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,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};dF.extension={type:$.RendererSystem,name:"state"};var xb=dF;Z.add(xb);var na=class extends Ks.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let t=(e.priority??[]).filter(s=>e.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new tt(t)})}addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](t[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var ou=class Ep{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ep.defaultMaxIdle,this.checkCountMax=Ep.defaultCheckCountMax,this.mode=Ep.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Lf.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,i=!1;for(let s=0;s<t.length;s++){let o=t[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<t.length;o++)t[o]!==null&&(t[s++]=t[o]);t.length=s}}unload(e){let t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};ou.defaultMode=Lf.AUTO,ou.defaultMaxIdle=60*60,ou.defaultCheckCountMax=60*10,ou.extension={type:$.RendererSystem,name:"textureGC"};var ai=ou;Z.add(ai);var co=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=ae.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}};function fF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},e}function pF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[ae.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ae.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[ae.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ae.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[ae.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ae.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[ae.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[ae.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[ae.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[ae.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ae.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},e}var aa=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xe,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=pF(e),this.samplerTypes=fF(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new co(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 co(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,t=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[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=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:t,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&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new co(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??z.FLOAT,this.webGLVersion===2&&e.type===ae.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let i=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(i,e,t))t.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(t.width!==s||t.height!==o||t.dirtyId<0)&&(t.width=s,t.height=o,n.texImage2D(e.target,0,t.internalFormat,s,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){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],!t)){let s=this.managedTextures.indexOf(e);s!==-1&&X_(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===kr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Sc.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let i=this.gl;if(t.mipmap&&e.mipmap!==kr.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===br.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===br.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===br.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===br.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};aa.extension={type:$.RendererSystem,name:"texture"};Z.add(aa);var la=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:i,CONTEXT_UID:s}=this,o=t.createTransformFeedback();e._glTransformFeedbacks[s]=o,t.bindTransformFeedback(t.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++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,t){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&&!t&&o.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};la.extension={type:$.RendererSystem,name:"transformFeedback"};Z.add(la);var Bi=class{constructor(e){this.renderer=e}init(e){this.screen=new _e(0,0,e.width,e.height),this.element=e.view||K.ADAPTER.createCanvas(),this.resolution=e.resolution||K.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*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}};Bi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Bi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};Z.add(Bi);K.PREFER_ENV=ir.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={...Ri.defaultOptions,...Mi.defaultOptions,...Bi.defaultOptions,...Ii.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return xe.defaultOptions.wrapMode},set(r){fe("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xe.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return xe.defaultOptions.scaleMode},set(r){fe("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xe.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return xe.defaultOptions.mipmap},set(r){fe("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xe.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return xe.defaultOptions.anisotropicLevel},set(r){fe("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xe.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return fe("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ni.defaultResolution},set(r){ni.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return fe("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ni.defaultMultisample},set(r){ni.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Ci.defaultMaxTextures},set(r){fe("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ci.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Ci.defaultBatchSize},set(r){fe("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ci.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ci.canUploadSameBuffer},set(r){fe("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ci.canUploadSameBuffer=r}},GC_MODE:{get(){return ai.defaultMode},set(r){fe("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ai.defaultMode=r}},GC_MAX_IDLE:{get(){return ai.defaultMaxIdle},set(r){fe("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ai.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return ai.defaultCheckCountMax},set(r){fe("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ai.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Sr.defaultVertexPrecision},set(r){fe("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Sr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Sr.defaultFragmentPrecision},set(r){fe("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Sr.defaultFragmentPrecision=r}}});var uo=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(uo||{});var ca=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}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 t=this.next;return this.next=e?null:t,this.previous=null,t}};var mF=class lr{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 ca(null,null,1/0),this.deltaMS=1/lr.targetFPMS,this.elapsedMS=1/lr.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,t,i=uo.NORMAL){return this._addListener(new ca(e,t,i))}addOnce(e,t,i=uo.NORMAL){return this._addListener(new ca(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.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 t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*lr.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 t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,lr.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 t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!lr._shared){let e=lr._shared=new lr;e.autoStart=!0,e._protected=!0}return lr._shared}static get system(){if(!lr._system){let e=lr._system=new lr;e.autoStart=!0,e._protected=!0}return lr._system}};mF.targetFPMS=.06;var wr=mF;Object.defineProperties(K,{TARGET_FPMS:{get(){return wr.targetFPMS},set(r){fe("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wr.targetFPMS=r}}});var nu=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,uo.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?wr.shared:new wr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};nu.extension=$.Application;Z.add(nu);var mV=[];Z.handleByList($.Renderer,mV);var au=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Pe.HIGH?this.multisample=Pe.HIGH:t>=Pe.MEDIUM?this.multisample=Pe.MEDIUM:t>=Pe.LOW?this.multisample=Pe.LOW:this.multisample=Pe.NONE}destroy(){}};au.extension={type:$.RendererSystem,name:"_multisample"};Z.add(au);var Ap=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var lu=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:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,o.buffer)}}bindBufferRange(e,t,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}update(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let o=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,o)}}dispose(e,t){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&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){let{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new Ap(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}};lu.extension={type:$.RendererSystem,name:"buffer"};Z.add(lu);var cu=class{constructor(e){this.renderer=e}render(e,t){let i=this.renderer,s,o,n,a;if(t&&(s=t.renderTexture,o=t.clear,n=t.transform,a=t.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&&(t.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}};cu.extension={type:$.RendererSystem,name:"objectRenderer"};Z.add(cu);var Pp=class yb extends na{constructor(e){super(),this.type=a_.WEBGL,e=Object.assign({},K.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ar({projectionMatrix:new Ie},!0);let t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:yb.__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(t),"useContextAlpha"in e&&(fe("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=yb.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:z_()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}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 fe("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return fe("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return fe("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return fe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){fe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return fe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){fe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return fe("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Pp.extension={type:$.Renderer,priority:1},Pp.__plugins={},Pp.__systems={};var Cp=Pp;Z.handleByMap($.RendererPlugin,Cp.__plugins);Z.handleByMap($.RendererSystem,Cp.__systems);Z.add(Cp);var us=class extends nr{constructor(e,t){let{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new xe;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof nr?this.addResourceAt(e[i],i):this.addResourceAt(zn(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].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 t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{let{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}};var uu=class extends us{constructor(e,t){let{width:i,height:s}=t||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=Si.TEXTURE_2D_ARRAY}upload(e,t,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,t.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,t.format,i.type,c.resource.source))}return!0}};var hu=class extends ft{constructor(e){super(e)}static test(e){let{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var gF=class du extends us{constructor(e,t){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=t||{};if(e&&e.length!==du.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<du.SIDES;a++)this.items[a].target=Si.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Si.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Si.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){let s=this.itemDirtyIds;for(let o=0;o<du.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<t.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,t.realWidth,t.realHeight,0,t.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===du.SIDES}};gF.SIDES=6;var _b=gF;var fu=class r extends ft{constructor(e,t){t=t||{};let i,s,o;typeof e=="string"?(i=r.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??o,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{let i=await K.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===sr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,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 r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var bb=class Mp extends ft{constructor(e,t){t=t||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Mp.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;ft.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,o=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Ei()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=Mp.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Mp.SVG_XML.test(e)}};bb.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,bb.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var vb=bb;var Rp=class extends ft{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Tb=class Sb extends ft{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];ft.crossOrigin(i,s,t.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||Sb.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=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.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),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let t=wr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!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((t,i)=>{this.valid?t(this):(this._resolve=t,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 t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&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&&(wr.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||(wr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Sb.TYPES.includes(t)}};Tb.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Tb.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var wb=Tb;Lc.push(fu,oo,hu,wb,Rp,vb,Zs,_b,uu);var gV={vec3(r,e,t,i){(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2])&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],r.uniform3f(e,i[0],i[1],i[2]))},int(r,e,t,i){r.uniform1i(e,i)},ivec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},ivec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},ivec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},uint(r,e,t,i){r.uniform1ui(e,i)},uvec2(r,e,t,i){r.uniform2ui(e,i[0],i[1])},uvec3(r,e,t,i){r.uniform3ui(e,i[0],i[1],i[2])},uvec4(r,e,t,i){r.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},bvec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},bvec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(r,e,t,i){r.uniformMatrix2fv(e,!1,i)},mat4(r,e,t,i){r.uniformMatrix4fv(e,!1,i)}},xV={float(r,e,t,i){r.uniform1fv(e,i)},vec2(r,e,t,i){r.uniform2fv(e,i)},vec3(r,e,t,i){r.uniform3fv(e,i)},vec4(r,e,t,i){r.uniform4fv(e,i)},int(r,e,t,i){r.uniform1iv(e,i)},ivec2(r,e,t,i){r.uniform2iv(e,i)},ivec3(r,e,t,i){r.uniform3iv(e,i)},ivec4(r,e,t,i){r.uniform4iv(e,i)},uint(r,e,t,i){r.uniform1uiv(e,i)},uvec2(r,e,t,i){r.uniform2uiv(e,i)},uvec3(r,e,t,i){r.uniform3uiv(e,i)},uvec4(r,e,t,i){r.uniform4uiv(e,i)},bool(r,e,t,i){r.uniform1iv(e,i)},bvec2(r,e,t,i){r.uniform2iv(e,i)},bvec3(r,e,t,i){r.uniform3iv(e,i)},bvec4(r,e,t,i){r.uniform4iv(e,i)},sampler2D(r,e,t,i){r.uniform1iv(e,i)},samplerCube(r,e,t,i){r.uniform1iv(e,i)},sampler2DArray(r,e,t,i){r.uniform1iv(e,i)}};function xF(r,e,t,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let u=e[c],h=i[c],d=t[c],f=r.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?gV:xV)[u.type].call(null,l,d.location,d.value,h)}}function yV(){Object.assign(cs.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;xF(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}yV();var pu=new(window.AudioContext||window.webkitAudioContext),_V=(r,e)=>{let t,i=pu.createGain();i.gain.value=e.volume??1,i.connect(pu.destination);let s={id:r,url:e.url,loop:e.loop||!1,volume:e.volume??1};return{play:()=>{let m=xn.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}t=pu.createBufferSource(),t.buffer=m,t.loop=s.loop,i.gain.setValueAtTime(s.volume,pu.currentTime),t.connect(i),t.start(0)},stop:()=>{t&&(t.stop(),t.disconnect(),i.disconnect(),i.connect(pu.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},yF=()=>{let r=[],e=[];return{add:a=>{e.push(a)},remove:a=>{e=e.filter(l=>l.id!==a)},getById:a=>e.find(l=>l.id===a),tick:()=>{for(let l of e){let c=r.find(u=>u.id===l.id);if(!c){let u=_V(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(u),u.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)e.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],e=[]}}};var bV=({JSONObject:r,parserPlugins:e=[]})=>r.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 Eb=bV;var _F=({type:r,parse:e})=>({type:r,parse:e});var Ab=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Pb(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function mu(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function TF(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s<t.length;s++)i.push(r[t[s].toLowerCase()]);return i}function SF(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let e=r.split(","),t=e.lastIndexOf("");for(;t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function vV(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o<t.length;o++)i.indexOf(t[o])===-1&&(s=!1);return s}function wF(r){let e=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),e}var yu={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,"-":Ab?173:189,"=":Ab?61:187,";":Ab?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Gr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},gu={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Et={16:!1,18:!1,17:!1,91:!1},Ye={};for(let r=1;r<20;r++)yu[`f${r}`]=111+r;var We=[],xu=null,EF="all",ki=new Map,ua=r=>yu[r.toLowerCase()]||Gr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),TV=r=>Object.keys(yu).find(e=>yu[e]===r),SV=r=>Object.keys(Gr).find(e=>Gr[e]===r),AF=r=>{EF=r||"all"},_u=()=>EF||"all",wV=()=>We.slice(0),EV=()=>We.map(r=>TV(r)||SV(r)||String.fromCharCode(r)),AV=()=>{let r=[];return Object.keys(Ye).forEach(e=>{Ye[e].forEach(({key:t,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:t.split("+").map(n=>ua(n))})})}),r},PF=r=>{let e=r.target||r.srcElement,{tagName:t}=e,i=!0,s=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i},PV=r=>(typeof r=="string"&&(r=ua(r)),We.indexOf(r)!==-1),CV=(r,e)=>{let t,i;r||(r=_u());for(let s in Ye)if(Object.prototype.hasOwnProperty.call(Ye,s))for(t=Ye[s],i=0;i<t.length;)t[i].scope===r?t.splice(i,1).forEach(({element:o})=>Mb(o)):i++;_u()===r&&AF(e||"all")};function MV(r){let e=wF(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=ua(r.key));let t=We.indexOf(e);if(t>=0&&We.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&We.splice(0,We.length),(e===93||e===224)&&(e=91),e in Et){Et[e]=!1;for(let i in Gr)Gr[i]===e&&(cr[i]=!1)}}var CF=(r,...e)=>{if(typeof r>"u")Object.keys(Ye).forEach(t=>{Array.isArray(Ye[t])&&Ye[t].forEach(i=>Ip(i)),delete Ye[t]}),Mb(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&Ip(t)});else if(typeof r=="object")r.key&&Ip(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),Ip({key:r,scope:t,method:i,splitKey:"+"})}},Ip=({key:r,scope:e,method:t,splitKey:i="+"})=>{SF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ua(a);if(!Ye[l])return;e||(e=_u());let c=n>1?TF(Gr,o):[],u=[];Ye[l]=Ye[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&vV(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Mb(h))})};function bF(r,e,t,i){if(e.element!==i)return;let s;if(e.scope===t||e.scope==="all"){s=e.mods.length>0;for(let o in Et)Object.prototype.hasOwnProperty.call(Et,o)&&(!Et[o]&&e.mods.indexOf(+o)>-1||Et[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Et[16]&&!Et[18]&&!Et[17]&&!Et[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(We),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function vF(r,e){let t=Ye["*"],i=wF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(cr.filter||PF).call(this,r))return;if((i===93||i===224)&&(i=91),We.indexOf(i)===-1&&i!==229&&We.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=gu[a];r[a]&&We.indexOf(l)===-1?We.push(l):!r[a]&&We.indexOf(l)>-1?We.splice(We.indexOf(l),1):a==="metaKey"&&r[a]&&(We=We.filter(c=>c in gu||c===i))}),i in Et){Et[i]=!0;for(let a in Gr)if(Object.prototype.hasOwnProperty.call(Gr,a)){let l=gu[Gr[a]];cr[a]=r[l]}if(!t)return}for(let a in Et)Object.prototype.hasOwnProperty.call(Et,a)&&(Et[a]=r[gu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(We.indexOf(17)===-1&&We.push(17),We.indexOf(18)===-1&&We.push(18),Et[17]=!0,Et[18]=!0);let s=_u();if(t)for(let a=0;a<t.length;a++)t[a].scope===s&&(r.type==="keydown"&&t[a].keydown||r.type==="keyup"&&t[a].keyup)&&bF(r,t[a],s,e);if(!(i in Ye))return;let o=Ye[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(ua(u[d]));h.sort().join("")===We.sort().join("")&&bF(r,l,s,e)}}var cr=function(r,e,t){We=[];let i=SF(r),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(t===void 0&&typeof e=="function"&&(t=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&&CF(r,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=TF(Gr,f));let p=f[f.length-1];p=p==="*"?"*":ua(p),p in Ye||(Ye[p]=[]),Ye[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:t,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!ki.has(n)){let f=(m=window.event)=>vF(m,n),p=(m=window.event)=>{vF(m,n),MV(m)};ki.set(n,{keydownListener:f,keyupListenr:p,capture:h}),Pb(n,"keydown",f,h),Pb(n,"keyup",p,h)}if(!xu){let f=()=>{We=[]};xu={listener:f,capture:h},Pb(window,"focus",f,h)}}};function RV(r,e="all"){Object.keys(Ye).forEach(t=>{Ye[t].filter(i=>i.scope===e&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Mb(r){let e=Object.values(Ye).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=ki.get(r)||{};t&&i&&(mu(r,"keyup",i,s),mu(r,"keydown",t,s),ki.delete(r))}if((e.length<=0||ki.size<=0)&&(Array.from(ki.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=ki.get(t)||{};i&&s&&(mu(t,"keyup",s,o),mu(t,"keydown",i,o),ki.delete(t))}),ki.clear(),Object.keys(Ye).forEach(t=>delete Ye[t]),xu)){let{listener:t,capture:i}=xu;mu(window,"focus",t,i),xu=null}}var Cb={getPressedKeyString:EV,setScope:AF,getScope:_u,deleteScope:CV,getPressedKeyCodes:wV,getAllKeyCodes:AV,isPressed:PV,filter:PF,trigger:RV,unbind:CF,keyMap:yu,modifier:Gr,modifierMap:gu};for(let r in Cb){let e=r;Object.prototype.hasOwnProperty.call(Cb,e)&&(cr[e]=Cb[e])}if(typeof window<"u"){let r=window.hotkeys;cr.noConflict=e=>(e&&window.hotkeys===cr&&(window.hotkeys=r),cr),window.hotkeys=cr}var IV=Object.prototype.hasOwnProperty,MF=r=>{let e=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=e.get(l);c?pe(c.payload,s[l].payload)||(n.push(l),cr.unbind(l)):o.push(l)}),e.forEach((l,c)=>{IV.call(s,c)||a.push(c)}),a.forEach(l=>{cr.unbind(l),e.delete(l)}),[...o,...n].forEach(l=>{let u=s[l].payload??{};cr(l,()=>{r&&r("keydown",{_event:{key:l},...u})}),e.set(l,{value:l,payload:u})})},destroy:()=>{for(let s of e.keys())cr.unbind(s);e.clear()}}};var IF=(r,e)=>typeof e!="string"?e:r[e]??e,BV=(r,e,t,i)=>{let s=IF(t,e);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},RF=(r,e,t,i)=>{let s=IF(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},kV=(r,e,t)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},FV=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!Pd[o])throw new Error(`${o} is not a supported property for animation.`);let a=BV(r,o,t,0);if(n.auto){let u=kV(i,o,s);if(a===u)return null;let h=Cn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Cn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),BF=()=>{let r=[],e=new Map,t=new Map,i=0,s=null,o=!1,n=(M,F)=>Math.min(Math.max(M,0),Math.max(F??0,0)),a=(M,F)=>{let O=n(F,M.duration);return M.currentTime=O,M.applyFrame(O),O>=M.duration},l=(M,F)=>{t.get(M)?.forEach(O=>{try{O(F)}catch{}})},c=M=>{if(l("completed",{id:M.id}),M.onComplete)try{M.onComplete()}catch{}},u=M=>{M.applyFrame(0),e.set(M.id,M);let F=s!==null&&a(M,s);l("started",{id:M.id}),F&&(c(M),e.delete(M.id))},h=M=>{let{id:F,element:O,properties:D,targetState:N,onComplete:G,onCancel:Y,propertyPathMap:ue=Cd}=M,J=FV(O,D,ue,N,F);if(J.length===0){c({id:F,onComplete:G});return}let Be={id:F,kind:"property",element:O,timelines:J,duration:pc(J),currentTime:0,stateVersion:i,targetState:N,onComplete:G,onCancel:Y,applyFrame:ke=>{for(let{property:Me,timeline:ze}of J){let rt=mc(ze,ke);try{RF(O,Me,ue,rt)}catch{}}},applyTargetState:()=>{if(!(!O||O.destroyed)){if(N===null){O.destroy();return}if(N)for(let[ke,Me]of Object.entries(N))try{RF(O,ke,ue,Me)}catch{}}},isValid:()=>!!O&&!O.destroyed};u(Be)},d=M=>{let F={id:M.id,kind:"custom",duration:M.duration??0,currentTime:0,stateVersion:i,onComplete:M.onComplete,onCancel:M.onCancel,applyFrame:M.applyFrame??(()=>{}),applyTargetState:M.applyTargetState??(()=>{}),isValid:M.isValid??(()=>!0)};u(F)},f=M=>{if(M.driver==="custom"){d(M);return}h(M)},p=M=>{try{M.applyTargetState?.()}catch{}if(M.onCancel)try{M.onCancel()}catch{}},m=M=>{switch(M.type){case"START":f(M.payload);break;case"CANCEL":v(M.id);break}},g=()=>{let M=r.splice(0);for(let F of M)m(F)},_=()=>{s===null||o||(o=!0,queueMicrotask(()=>{o=!1,s!==null&&g()}))},v=M=>{let F=e.get(M);F&&(p(F),e.delete(M),l("cancelled",{id:M}))},x=M=>{r.push(M),_()},T=()=>{for(let[M,F]of e)p(F),l("cancelled",{id:M});e.clear(),i++},b=M=>{g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}if(D.currentTime+=M,D.currentTime>=D.duration){D.applyFrame(D.duration),c(D),F.push(O);continue}D.applyFrame(D.currentTime)}for(let O of F)e.delete(O)},w=M=>{s=M,g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}a(D,M)&&(c(D),F.push(O))}for(let O of F)e.delete(O)},E=()=>{s=null},I=()=>{g()},B=(M,F)=>(t.has(M)||t.set(M,new Set),t.get(M).add(F),()=>C(M,F)),C=(M,F)=>{t.get(M)?.delete(F)};return{dispatch:x,cancelAll:T,flush:I,tick:b,setTime:w,clearTime:E,on:B,off:C,getState:()=>({stateVersion:i,activeCount:e.size,animations:Array.from(e.entries()).map(([M,F])=>({id:M,currentTime:F.currentTime,duration:F.duration,progress:F.duration>0?F.currentTime/F.duration:0}))}),isAnimating:M=>e.has(M),destroy:()=>{T(),t.clear()}}};var kF=r=>{let e=0,t=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,r?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&r?.("renderComplete",{id:i,aborted:!0}),t++,e=0,i=d,s=!0,o=!1},track:d=>{d===t&&e++},complete:d=>{d!==t||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>t,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var FF=new Set(["update","transition"]),OV=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),UV=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),OF=new Set(["single","sequence","composite"]),Bp=new Set(["red","green","blue","alpha"]),UF=new Set(["max","min","multiply","add"]),LF=new Set(of),li=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},ho=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},bu=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},GV=(r,e)=>{if(li(r,e),bu(r.duration,`${e}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${e}.easing must be a string.`);if(r.easing!==void 0&&!LF.has(r.easing))throw new Error(`${e}.easing must be one of: ${of.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Ib=(r,e)=>{li(r,e);let t={};if(r.initialValue!==void 0&&(bu(r.initialValue,`${e}.initialValue`),t.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return t.keyframes=r.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(li(i,o),bu(i.value,`${o}.value`),bu(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&&!LF.has(i.easing))throw new Error(`${o}.easing must be one of: ${of.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}:{}}}),t},LV=(r,e)=>{li(r,e);let t=r.keyframes!==void 0,i=r.auto!==void 0;if(t&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!t&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:GV(r.auto,`${e}.auto`)}}return Ib(r,e)},DF=(r,e,t,i=Ib)=>{li(r,e);let s=Object.entries(r).map(([o,n])=>{if(!t.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)},DV=(r,e)=>{if(li(r,e),ho(r.texture,`${e}.texture`),r.channel!==void 0&&!Bp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(Bp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},NV=(r,e)=>{if(li(r,e),!OF.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(OF).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!Bp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(Bp).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(bu(r.softness,`${e}.softness`),t.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);t.invert=r.invert}if(r.progress!==void 0&&(t.progress=Ib(r.progress,`${e}.progress`)),r.kind==="single"&&(ho(r.texture,`${e}.texture`),t.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${e}.textures must be a non-empty array.`);t.textures=r.textures.map((i,s)=>(ho(i,`${e}.textures[${s}]`),i)),r.sample!==void 0&&(ho(r.sample,`${e}.sample`),t.sample=r.sample)}if(r.kind==="composite"){if(!UF.has(r.combine??"max"))throw new Error(`${e}.combine must be one of: ${Array.from(UF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${e}.items must be a non-empty array.`);t.combine=r.combine??"max",t.items=r.items.map((i,s)=>DV(i,`${e}.items[${s}]`))}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},GF=(r,e)=>{if(li(r,e),r.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let t={};if(r.tween!==void 0&&(t.tween=DF(r.tween,`${e}.tween`,UV)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},HV=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=GF(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=GF(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=NV(r.mask,`${e}.mask`)),t.prev===void 0&&t.next===void 0&&t.mask===void 0)throw new Error(`${e} must define prev, next, or mask.`);return t},Rb=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},NF=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let e=r.map((i,s)=>{let o=`animations[${s}]`;if(li(i,o),ho(i.id,`${o}.id`),ho(i.targetId,`${o}.targetId`),ho(i.type,`${o}.type`),!FF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(FF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(li(i.complete,`${o}.complete`),n.complete=i.complete),Rb(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Rb(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Rb(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=DF(i.tween,`${o}.tween`,OV,LV),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=HV(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),t=new Map;for(let i of e){let s=t.get(i.targetId)??new Set;s.add(i.type),t.set(i.targetId,s)}for(let[i,s]of t)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return e};var Bb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};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.");return e.animations=NF(e.animations),e};var VV="0",ha=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},ur=r=>({value:r.element.value??"",selectionStart:ha(r.element,"selectionStart"),selectionEnd:ha(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),WV=(r,e)=>!r||!e?!1:r.value===e.value&&r.selectionStart===e.selectionStart&&r.selectionEnd===e.selectionEnd&&r.focused===e.focused&&r.composing===e.composing,zV=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,vu=r=>{r.element.style.pointerEvents="none"},kb=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},$V=({app:r,geometry:e})=>{let t=r.canvas;if(!e||!t||e.visible===!1)return null;let i=t.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.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}},XV=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=$V({app:r,geometry:i}),o=t.clientX,n=t.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},HF=({app:r})=>{let e=new Map,t,i=null,s=()=>{t||(t=document.createElement("div"),t.dataset.routeGraphicsInputBridge="true",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.pointerEvents="none",t.style.zIndex="1000",t.style.width="0",t.style.height="0");let x=r.canvas?.parentNode??document.body;t.isConnected||x.appendChild(t)},o=(x,T=x.lastSnapshot)=>{let b=ur(x);b.focused&&i!==x.id?i=x.id:!b.focused&&i===x.id&&(i=null),vu(x,i),T?.value!==b.value&&x.callbacks.onValueChange?.(b),(T?.selectionStart!==b.selectionStart||T?.selectionEnd!==b.selectionEnd||T?.focused!==b.focused||T?.composing!==b.composing)&&x.callbacks.onSelectionChange?.(b),x.lastSnapshot=b},n=x=>{let{disabled:T=!1,multiline:b=!1,maxLength:w,textStyle:E,padding:I,placeholder:B="",autocomplete:C="off",autocapitalize:A="off",spellcheck:P=!1}=x.options,{element:R}=x;R instanceof HTMLInputElement&&(R.type="text"),R.disabled=T,R.placeholder=B,R.autocomplete=C,R.autocapitalize=A,R.spellcheck=!!P,R.style.opacity=VV,R.style.color="transparent",R.style.caretColor="transparent",R.style.background="transparent",R.style.paddingTop=`${I.top}px`,R.style.paddingRight=`${I.right}px`,R.style.paddingBottom=`${I.bottom}px`,R.style.paddingLeft=`${I.left}px`,R.style.fontFamily=E?.fontFamily??"Arial",R.style.fontSize=`${E?.fontSize??16}px`,R.style.fontWeight=E?.fontWeight??"400",R.style.textAlign=E?.align??"left",R.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",R.style.whiteSpace=b?"pre":"nowrap",R.style.overflowWrap="normal",R.style.resize="none",R.style.overflow="hidden",typeof w=="number"?R.maxLength=w:R.removeAttribute("maxLength"),R.tabIndex=-1,b&&R instanceof HTMLTextAreaElement&&(R.wrap="off",R.rows=1),vu(x,i)},a=x=>{s();let T=r.canvas,b=x.options.getGeometry?.();if(!T||!b||b.visible===!1){x.element.style.display="none";return}let w=T.getBoundingClientRect(),E=r.renderer?.width||w.width||1,I=r.renderer?.height||w.height||1,B=w.width/E,C=w.height/I,A=b.clipInsets??{top:0,right:0,bottom:0,left:0},P={top:A.top*C,right:A.right*B,bottom:A.bottom*C,left:A.left*B};x.element.style.display="block",x.element.style.left=`${w.left+b.x*B}px`,x.element.style.top=`${w.top+b.y*C}px`,x.element.style.width=`${b.width*B}px`,x.element.style.height=`${b.height*C}px`;let R=Object.values(P).some(M=>M>0);x.element.style.clipPath=R?`inset(${P.top}px ${P.right}px ${P.bottom}px ${P.left}px)`:"none"},l=x=>{if(!i)return;let T=e.get(i),b=x.target;!T||b===T.element||T.element.contains(b)||zV(b)&&t?.contains(b)||XV({app:r,entry:T,event:x})||T.element.blur()},c=()=>{for(let x of e.values()){if(a(x),!x.lastSnapshot){x.lastSnapshot=ur(x);continue}let T=ur(x);WV(T,x.lastSnapshot)||o(x,x.lastSnapshot)}},u=({id:x,options:T})=>{let b=T.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=x,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},h=x=>{let{id:T,element:b}=x,w=()=>{o(x)};b.addEventListener("focus",()=>{x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),i=T,vu(x,i);let E=ur(x);x.lastSnapshot=E,x.callbacks.onFocus?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("blur",()=>{i===T&&(i=null),vu(x,i),x.pendingBlurTimer=setTimeout(()=>{x.pendingBlurTimer=null;let E=ur(x);if(E.focused){x.lastSnapshot=E;return}x.lastSnapshot=E,x.callbacks.onBlur?.(E),x.callbacks.onSelectionChange?.(E)},0)}),b.addEventListener("input",w),b.addEventListener("select",w),b.addEventListener("click",()=>queueMicrotask(w)),b.addEventListener("keyup",()=>queueMicrotask(w)),b.addEventListener("keydown",E=>{let I=E.key==="Enter"&&x.options.multiline!==!0&&!E.shiftKey,B=E.key==="Enter"&&x.options.multiline===!0&&(E.ctrlKey||E.metaKey);(I||B)&&(E.preventDefault(),x.callbacks.onSubmit?.(ur(x),E)),E.key==="Escape"&&b.blur(),queueMicrotask(w)}),b.addEventListener("compositionstart",()=>{x.composing=!0;let E=ur(x);x.lastSnapshot=E,x.callbacks.onCompositionStart?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionupdate",()=>{let E=ur(x);x.lastSnapshot=E,x.callbacks.onCompositionUpdate?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionend",()=>{x.composing=!1,w(),x.callbacks.onCompositionEnd?.(ur(x))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(x,T)=>{s();let b=e.get(x);if(b)return b.options=T,b.callbacks=T.callbacks??{},n(b),a(b),typeof T.value=="string"&&b.element.value!==T.value&&(b.element.value=T.value),b.lastSnapshot=ur(b),b.element;let w={id:x,element:u({id:x,options:T}),options:T,callbacks:T.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(w),typeof T.value=="string"&&(w.element.value=T.value),n(w),t.appendChild(w.element),e.set(x,w),a(w),w.lastSnapshot=ur(w),w.element};return{mount:d,update:(x,T)=>{let b=e.get(x);if(!b)return d(x,T);let w=T.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=T,b.callbacks=T.callbacks??{},w){let E=b.element,I=document.activeElement===E,B=ha(E,"selectionStart"),C=ha(E,"selectionEnd");return b.element=u({id:x,options:T}),h(b),E.replaceWith(b.element),b.element.value=typeof T.value=="string"?T.value:E.value,n(b),a(b),b.lastSnapshot=ur(b),I&&!T.disabled&&queueMicrotask(()=>{b.element.focus(),kb(b.element,B,C)}),b.element}return typeof T.value=="string"&&T.value!==b.element.value&&b.composing!==!0&&(b.element.value=T.value),n(b),a(b),b.lastSnapshot=ur(b),b.element},focus:(x,{selectAll:T=!1,selectionStart:b,selectionEnd:w}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=document.activeElement===E.element;if(i=x,vu(E,i),I||E.element.focus(),T){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof b=="number"||typeof w=="number"){let B=typeof b=="number"?b:ha(E.element,"selectionStart"),C=typeof w=="number"?w:typeof b=="number"?b:ha(E.element,"selectionEnd");kb(E.element,B,C)}o(E,E.lastSnapshot)},setSelection:(x,T,b=T,{focus:w=!1}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=()=>{kb(E.element,T,b),o(E,E.lastSnapshot)};if(w&&document.activeElement!==E.element){E.element.focus(),I();return}I()},blur:x=>{e.get(x)?.element.blur()},unmount:x=>{let T=e.get(x);T&&(i===x&&(i=null),T.pendingBlurTimer&&(clearTimeout(T.pendingBlurTimer),T.pendingBlurTimer=null),T.element.remove(),e.delete(x),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let x of e.values())x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),x.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var jV=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=yF(),i={elements:[],animations:[],audio:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,g=[],_,v=new Map,x,T=(A,P,R,M)=>{A.clear(),A.rect(0,0,P,R),A.fill(M??0)},b=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",w=(A,P,{revokable:R=!1}={})=>{v.set(A,{url:P,revokable:R})},E=()=>{for(let A of v.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);v.clear()},I=(A,P,R)=>{n&&n.registerHotkeys(R?.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 M=P?.cursorStyles,F=R?.cursorStyles;pe(M,F)||(F?(F.default&&(A.renderer.events.cursorStyles.default=F.default,A.canvas.style.cursor=F.default),F.hover&&(A.renderer.events.cursorStyles.hover=F.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},B=(A,P,R,M)=>{if(pe(i,R)){typeof A.render=="function"&&A.render();return}h&&h.abort(),h=new AbortController;let F=h.signal;l.reset(R.id),I(A,i.global,R.global),a.cancelAll(),Hs({app:A,parent:P,prevComputedTree:i.elements,nextComputedTree:R.elements,animations:R.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:F}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),n_({app:A,prevAudioTree:i.audio,nextAudioTree:R.audio,audioPlugins:o.audio}),i=R,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},C={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 P=new Q(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:P});let R=e.stage.getChildByLabel(A,!0);if(!R)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:R,frame:P})},assignStageEvent:(A,P)=>{e.stage.eventMode="static",e.stage.on(A,P)},setAnimationPlaybackMode:A=>{r(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let P=Number(A);if(!Number.isFinite(P))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=P),a.flush(),a.setTime(P),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:P,plugins:R,width:M,height:F,backgroundColor:O,debug:D=!1,onFirstRender:N,animationPlaybackMode:G="auto"}=A;c=N,r(G),p=G,m=null,g.forEach(J=>J()),g=[];let Y=[];R?.elements?.forEach(J=>{J?.parse&&Y.push(_F({type:J.type,parse:J.parse}))}),o={animations:R?.animations??[],elements:R?.elements??[],audio:R?.audio??[],parsers:Y},s=P,n=MF(P),l=kF(P),e=new rc,e.audioStage=t,await e.init({width:M,height:F,backgroundColor:O,preference:"webgl",preserveDrawingBuffer:D===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=D,e.inputDomBridge=HF({app:e}),_=J=>{J.preventDefault()},e.canvas.addEventListener("contextmenu",_),x=new Ue,x.label="__route_graphics_background__",T(x,M,F,O),e.stage.addChild(x),e.stage.width=M,e.stage.height=F,e.ticker.add(e.audioStage.tick),a=BF();let ue=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return g=[a.on("started",ue),a.on("completed",ue),a.on("cancelled",ue)],D?(d=J=>{p==="auto"&&J?.detail?.deltaMS&&(a.tick(Number(J.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=J=>{p==="auto"&&(a.tick(J.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),C},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),_&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",_),_=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Zy(),g.forEach(P=>P()),g=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=P=>{for(let R of P.children){let M=R.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),R.children&&A(R)}};e?.stage&&A(e.stage),e&&e.destroy(),p="auto",m=null,x=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[F,O]of Object.entries(A)){let D=b(O.type);P[D][F]=O}await Promise.all(Object.entries(P.audio).map(([F,O])=>xn.load(F,O.buffer))),await Promise.all(Object.entries(P.font).map(async([F,O])=>{let D=new Blob([O.buffer],{type:O.type}),N=URL.createObjectURL(D),G=new FontFace(F,`url(${N})`);try{await G.load(),document.fonts.add(G)}catch(Y){console.error(`Failed to load font ${F}:`,Y)}finally{URL.revokeObjectURL(N)}}));let R=Object.entries(P.texture).map(async([F,O])=>{if(_r.cache.has(F))return _r.cache.get(F);if(O?.source==="url"&&typeof O?.url=="string")return _r.load({alias:F,src:O.url,parser:"loadTextures"});let D=new Blob([O.buffer],{type:O.type}),N=await createImageBitmap(D),G=k.from(N);return _r.cache.set(F,G),G}),M=Object.entries(P.video).map(async([F,O])=>{let D=O?.source==="url"&&typeof O?.url=="string"?O.url:URL.createObjectURL(new Blob([O.buffer],{type:O.type})),N=O?.source!=="url";w(F,D,{revokable:N});let G={alias:F,src:D,parser:"loadVideo",data:{}};return typeof O?.type=="string"&&O.type.length>0&&(G.data.mime=O.type),_r.load(G).then(Y=>Y).catch(Y=>{throw v.delete(F),N&&URL.revokeObjectURL(D),Y})});return Promise.all([...R,...M])},loadAudioAssets:async A=>Promise.all(A.map(async P=>{let M=await(await fetch(P)).arrayBuffer();return xn.load(P,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,x&&T(x,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let P=Bb(A),R=Eb({JSONObject:P.elements,parserPlugins:o.parsers}),M={...P,elements:R};B(e,e.stage,M,s)},parse:A=>{let P=Bb(A),R=Eb({JSONObject:P.elements,parserPlugins:o.parsers});return{...P,elements:R}}};return C},VF=jV;var uIe=VF;export{rc as Application,_r as Assets,xn as AudioAsset,aD as animatedSpritePlugin,ZL as containerPlugin,by as createAnimationPlugin,ZF as createAssetBufferManager,vy as createAudioPlugin,Je as createElementPlugin,uIe as default,pL as inputPlugin,KD as particlesPlugin,VG as rectPlugin,n_ as renderAudio,Hs as renderElements,tL as sliderPlugin,uD as soundPlugin,WG as spritePlugin,DR as spritesheetAnimationPlugin,DG as textPlugin,iD as textRevealingPlugin,lD as tweenPlugin,$G as videoPlugin};
|
|
1901
|
+
`))}}var cV=0,wp={textureCount:0,uboCount:0},cs=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=cV++}systemCheck(){if(!_p())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,t){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)),t||(wp.textureCount=0,wp.uboCount=0,this.syncUniformGroup(e.uniformGroup,wp)),s}setUniforms(e){let t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=nb(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){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,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,wp,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.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]=mb(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,i=e.program,s=pb(t,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}};cs.extension={type:$.RendererSystem,name:"shader"};Z.add(cs);var Ii=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};Ii.defaultOptions={hello:!1},Ii.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(Ii);function hF(r,e=[]){return e[re.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD]=[r.ONE,r.ONE],e[re.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.NONE]=[0,0],e[re.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[re.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[re.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[re.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[re.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[re.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[re.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[re.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var uV=0,hV=1,dV=2,fV=3,pV=4,mV=5,dF=class gb{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=re.NONE,this._blendEq=!1,this.map=[],this.map[uV]=this.setBlend,this.map[hV]=this.setOffset,this.map[dV]=this.setCullFace,this.map[fV]=this.setDepthTest,this.map[pV]=this.setFrontFace,this.map[mV]=this.setDepthMask,this.checks=[],this.defaultState=new si,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=hF(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(gb.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(gb.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 t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}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,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};dF.extension={type:$.RendererSystem,name:"state"};var xb=dF;Z.add(xb);var na=class extends Ks.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let t=(e.priority??[]).filter(s=>e.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new tt(t)})}addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](t[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var ou=class Ep{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ep.defaultMaxIdle,this.checkCountMax=Ep.defaultCheckCountMax,this.mode=Ep.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Lf.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,i=!1;for(let s=0;s<t.length;s++){let o=t[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<t.length;o++)t[o]!==null&&(t[s++]=t[o]);t.length=s}}unload(e){let t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};ou.defaultMode=Lf.AUTO,ou.defaultMaxIdle=60*60,ou.defaultCheckCountMax=60*10,ou.extension={type:$.RendererSystem,name:"textureGC"};var ai=ou;Z.add(ai);var co=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=ae.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}};function fF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},e}function pF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[ae.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ae.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[ae.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ae.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[ae.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ae.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[ae.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[ae.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[ae.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[ae.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ae.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},e}var aa=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xe,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=pF(e),this.samplerTypes=fF(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new co(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 co(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,t=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[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=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:t,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&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new co(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??z.FLOAT,this.webGLVersion===2&&e.type===ae.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let i=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(i,e,t))t.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(t.width!==s||t.height!==o||t.dirtyId<0)&&(t.width=s,t.height=o,n.texImage2D(e.target,0,t.internalFormat,s,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){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],!t)){let s=this.managedTextures.indexOf(e);s!==-1&&X_(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===kr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Sc.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let i=this.gl;if(t.mipmap&&e.mipmap!==kr.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===br.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===br.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===br.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===br.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};aa.extension={type:$.RendererSystem,name:"texture"};Z.add(aa);var la=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:i,CONTEXT_UID:s}=this,o=t.createTransformFeedback();e._glTransformFeedbacks[s]=o,t.bindTransformFeedback(t.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++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,t){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&&!t&&o.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};la.extension={type:$.RendererSystem,name:"transformFeedback"};Z.add(la);var Bi=class{constructor(e){this.renderer=e}init(e){this.screen=new _e(0,0,e.width,e.height),this.element=e.view||K.ADAPTER.createCanvas(),this.resolution=e.resolution||K.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*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}};Bi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Bi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};Z.add(Bi);K.PREFER_ENV=ir.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={...Ri.defaultOptions,...Mi.defaultOptions,...Bi.defaultOptions,...Ii.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return xe.defaultOptions.wrapMode},set(r){fe("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xe.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return xe.defaultOptions.scaleMode},set(r){fe("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xe.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return xe.defaultOptions.mipmap},set(r){fe("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xe.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return xe.defaultOptions.anisotropicLevel},set(r){fe("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xe.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return fe("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ni.defaultResolution},set(r){ni.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return fe("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ni.defaultMultisample},set(r){ni.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Ci.defaultMaxTextures},set(r){fe("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ci.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Ci.defaultBatchSize},set(r){fe("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ci.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ci.canUploadSameBuffer},set(r){fe("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ci.canUploadSameBuffer=r}},GC_MODE:{get(){return ai.defaultMode},set(r){fe("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ai.defaultMode=r}},GC_MAX_IDLE:{get(){return ai.defaultMaxIdle},set(r){fe("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ai.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return ai.defaultCheckCountMax},set(r){fe("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ai.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Sr.defaultVertexPrecision},set(r){fe("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Sr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Sr.defaultFragmentPrecision},set(r){fe("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Sr.defaultFragmentPrecision=r}}});var uo=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(uo||{});var ca=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}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 t=this.next;return this.next=e?null:t,this.previous=null,t}};var mF=class lr{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 ca(null,null,1/0),this.deltaMS=1/lr.targetFPMS,this.elapsedMS=1/lr.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,t,i=uo.NORMAL){return this._addListener(new ca(e,t,i))}addOnce(e,t,i=uo.NORMAL){return this._addListener(new ca(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.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 t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*lr.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 t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,lr.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 t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!lr._shared){let e=lr._shared=new lr;e.autoStart=!0,e._protected=!0}return lr._shared}static get system(){if(!lr._system){let e=lr._system=new lr;e.autoStart=!0,e._protected=!0}return lr._system}};mF.targetFPMS=.06;var wr=mF;Object.defineProperties(K,{TARGET_FPMS:{get(){return wr.targetFPMS},set(r){fe("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wr.targetFPMS=r}}});var nu=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,uo.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?wr.shared:new wr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};nu.extension=$.Application;Z.add(nu);var gV=[];Z.handleByList($.Renderer,gV);var au=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Pe.HIGH?this.multisample=Pe.HIGH:t>=Pe.MEDIUM?this.multisample=Pe.MEDIUM:t>=Pe.LOW?this.multisample=Pe.LOW:this.multisample=Pe.NONE}destroy(){}};au.extension={type:$.RendererSystem,name:"_multisample"};Z.add(au);var Ap=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var lu=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:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,o.buffer)}}bindBufferRange(e,t,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}update(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let o=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,o)}}dispose(e,t){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&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){let{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new Ap(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}};lu.extension={type:$.RendererSystem,name:"buffer"};Z.add(lu);var cu=class{constructor(e){this.renderer=e}render(e,t){let i=this.renderer,s,o,n,a;if(t&&(s=t.renderTexture,o=t.clear,n=t.transform,a=t.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&&(t.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}};cu.extension={type:$.RendererSystem,name:"objectRenderer"};Z.add(cu);var Pp=class yb extends na{constructor(e){super(),this.type=a_.WEBGL,e=Object.assign({},K.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ar({projectionMatrix:new Ie},!0);let t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:yb.__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(t),"useContextAlpha"in e&&(fe("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=yb.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:z_()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}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 fe("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return fe("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return fe("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return fe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){fe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return fe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){fe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return fe("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Pp.extension={type:$.Renderer,priority:1},Pp.__plugins={},Pp.__systems={};var Cp=Pp;Z.handleByMap($.RendererPlugin,Cp.__plugins);Z.handleByMap($.RendererSystem,Cp.__systems);Z.add(Cp);var us=class extends nr{constructor(e,t){let{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new xe;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof nr?this.addResourceAt(e[i],i):this.addResourceAt(zn(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].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 t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{let{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}};var uu=class extends us{constructor(e,t){let{width:i,height:s}=t||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=Si.TEXTURE_2D_ARRAY}upload(e,t,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,t.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,t.format,i.type,c.resource.source))}return!0}};var hu=class extends ft{constructor(e){super(e)}static test(e){let{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var gF=class du extends us{constructor(e,t){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=t||{};if(e&&e.length!==du.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<du.SIDES;a++)this.items[a].target=Si.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Si.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Si.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){let s=this.itemDirtyIds;for(let o=0;o<du.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<t.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,t.realWidth,t.realHeight,0,t.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===du.SIDES}};gF.SIDES=6;var _b=gF;var fu=class r extends ft{constructor(e,t){t=t||{};let i,s,o;typeof e=="string"?(i=r.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??o,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{let i=await K.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===sr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,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 r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var bb=class Mp extends ft{constructor(e,t){t=t||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Mp.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;ft.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,o=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Ei()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=Mp.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Mp.SVG_XML.test(e)}};bb.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,bb.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var vb=bb;var Rp=class extends ft{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Tb=class Sb extends ft{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];ft.crossOrigin(i,s,t.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||Sb.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=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.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),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let t=wr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!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((t,i)=>{this.valid?t(this):(this._resolve=t,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 t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&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&&(wr.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||(wr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Sb.TYPES.includes(t)}};Tb.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Tb.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var wb=Tb;Lc.push(fu,oo,hu,wb,Rp,vb,Zs,_b,uu);var xV={vec3(r,e,t,i){(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2])&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],r.uniform3f(e,i[0],i[1],i[2]))},int(r,e,t,i){r.uniform1i(e,i)},ivec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},ivec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},ivec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},uint(r,e,t,i){r.uniform1ui(e,i)},uvec2(r,e,t,i){r.uniform2ui(e,i[0],i[1])},uvec3(r,e,t,i){r.uniform3ui(e,i[0],i[1],i[2])},uvec4(r,e,t,i){r.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},bvec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},bvec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(r,e,t,i){r.uniformMatrix2fv(e,!1,i)},mat4(r,e,t,i){r.uniformMatrix4fv(e,!1,i)}},yV={float(r,e,t,i){r.uniform1fv(e,i)},vec2(r,e,t,i){r.uniform2fv(e,i)},vec3(r,e,t,i){r.uniform3fv(e,i)},vec4(r,e,t,i){r.uniform4fv(e,i)},int(r,e,t,i){r.uniform1iv(e,i)},ivec2(r,e,t,i){r.uniform2iv(e,i)},ivec3(r,e,t,i){r.uniform3iv(e,i)},ivec4(r,e,t,i){r.uniform4iv(e,i)},uint(r,e,t,i){r.uniform1uiv(e,i)},uvec2(r,e,t,i){r.uniform2uiv(e,i)},uvec3(r,e,t,i){r.uniform3uiv(e,i)},uvec4(r,e,t,i){r.uniform4uiv(e,i)},bool(r,e,t,i){r.uniform1iv(e,i)},bvec2(r,e,t,i){r.uniform2iv(e,i)},bvec3(r,e,t,i){r.uniform3iv(e,i)},bvec4(r,e,t,i){r.uniform4iv(e,i)},sampler2D(r,e,t,i){r.uniform1iv(e,i)},samplerCube(r,e,t,i){r.uniform1iv(e,i)},sampler2DArray(r,e,t,i){r.uniform1iv(e,i)}};function xF(r,e,t,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let u=e[c],h=i[c],d=t[c],f=r.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?xV:yV)[u.type].call(null,l,d.location,d.value,h)}}function _V(){Object.assign(cs.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;xF(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}_V();var pu=new(window.AudioContext||window.webkitAudioContext),bV=(r,e)=>{let t,i=pu.createGain();i.gain.value=e.volume??1,i.connect(pu.destination);let s={id:r,url:e.url,loop:e.loop||!1,volume:e.volume??1};return{play:()=>{let m=xn.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}t=pu.createBufferSource(),t.buffer=m,t.loop=s.loop,i.gain.setValueAtTime(s.volume,pu.currentTime),t.connect(i),t.start(0)},stop:()=>{t&&(t.stop(),t.disconnect(),i.disconnect(),i.connect(pu.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},yF=()=>{let r=[],e=[];return{add:a=>{e.push(a)},remove:a=>{e=e.filter(l=>l.id!==a)},getById:a=>e.find(l=>l.id===a),tick:()=>{for(let l of e){let c=r.find(u=>u.id===l.id);if(!c){let u=bV(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(u),u.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)e.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],e=[]}}};var vV=({JSONObject:r,parserPlugins:e=[]})=>r.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 Eb=vV;var _F=({type:r,parse:e})=>({type:r,parse:e});var Ab=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Pb(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function mu(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function TF(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s<t.length;s++)i.push(r[t[s].toLowerCase()]);return i}function SF(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let e=r.split(","),t=e.lastIndexOf("");for(;t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function TV(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o<t.length;o++)i.indexOf(t[o])===-1&&(s=!1);return s}function wF(r){let e=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),e}var yu={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,"-":Ab?173:189,"=":Ab?61:187,";":Ab?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Gr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},gu={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Et={16:!1,18:!1,17:!1,91:!1},Ye={};for(let r=1;r<20;r++)yu[`f${r}`]=111+r;var We=[],xu=null,EF="all",ki=new Map,ua=r=>yu[r.toLowerCase()]||Gr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),SV=r=>Object.keys(yu).find(e=>yu[e]===r),wV=r=>Object.keys(Gr).find(e=>Gr[e]===r),AF=r=>{EF=r||"all"},_u=()=>EF||"all",EV=()=>We.slice(0),AV=()=>We.map(r=>SV(r)||wV(r)||String.fromCharCode(r)),PV=()=>{let r=[];return Object.keys(Ye).forEach(e=>{Ye[e].forEach(({key:t,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:t.split("+").map(n=>ua(n))})})}),r},PF=r=>{let e=r.target||r.srcElement,{tagName:t}=e,i=!0,s=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i},CV=r=>(typeof r=="string"&&(r=ua(r)),We.indexOf(r)!==-1),MV=(r,e)=>{let t,i;r||(r=_u());for(let s in Ye)if(Object.prototype.hasOwnProperty.call(Ye,s))for(t=Ye[s],i=0;i<t.length;)t[i].scope===r?t.splice(i,1).forEach(({element:o})=>Mb(o)):i++;_u()===r&&AF(e||"all")};function RV(r){let e=wF(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=ua(r.key));let t=We.indexOf(e);if(t>=0&&We.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&We.splice(0,We.length),(e===93||e===224)&&(e=91),e in Et){Et[e]=!1;for(let i in Gr)Gr[i]===e&&(cr[i]=!1)}}var CF=(r,...e)=>{if(typeof r>"u")Object.keys(Ye).forEach(t=>{Array.isArray(Ye[t])&&Ye[t].forEach(i=>Ip(i)),delete Ye[t]}),Mb(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&Ip(t)});else if(typeof r=="object")r.key&&Ip(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),Ip({key:r,scope:t,method:i,splitKey:"+"})}},Ip=({key:r,scope:e,method:t,splitKey:i="+"})=>{SF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ua(a);if(!Ye[l])return;e||(e=_u());let c=n>1?TF(Gr,o):[],u=[];Ye[l]=Ye[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&TV(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Mb(h))})};function bF(r,e,t,i){if(e.element!==i)return;let s;if(e.scope===t||e.scope==="all"){s=e.mods.length>0;for(let o in Et)Object.prototype.hasOwnProperty.call(Et,o)&&(!Et[o]&&e.mods.indexOf(+o)>-1||Et[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Et[16]&&!Et[18]&&!Et[17]&&!Et[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(We),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function vF(r,e){let t=Ye["*"],i=wF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(cr.filter||PF).call(this,r))return;if((i===93||i===224)&&(i=91),We.indexOf(i)===-1&&i!==229&&We.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=gu[a];r[a]&&We.indexOf(l)===-1?We.push(l):!r[a]&&We.indexOf(l)>-1?We.splice(We.indexOf(l),1):a==="metaKey"&&r[a]&&(We=We.filter(c=>c in gu||c===i))}),i in Et){Et[i]=!0;for(let a in Gr)if(Object.prototype.hasOwnProperty.call(Gr,a)){let l=gu[Gr[a]];cr[a]=r[l]}if(!t)return}for(let a in Et)Object.prototype.hasOwnProperty.call(Et,a)&&(Et[a]=r[gu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(We.indexOf(17)===-1&&We.push(17),We.indexOf(18)===-1&&We.push(18),Et[17]=!0,Et[18]=!0);let s=_u();if(t)for(let a=0;a<t.length;a++)t[a].scope===s&&(r.type==="keydown"&&t[a].keydown||r.type==="keyup"&&t[a].keyup)&&bF(r,t[a],s,e);if(!(i in Ye))return;let o=Ye[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(ua(u[d]));h.sort().join("")===We.sort().join("")&&bF(r,l,s,e)}}var cr=function(r,e,t){We=[];let i=SF(r),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(t===void 0&&typeof e=="function"&&(t=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&&CF(r,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=TF(Gr,f));let p=f[f.length-1];p=p==="*"?"*":ua(p),p in Ye||(Ye[p]=[]),Ye[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:t,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!ki.has(n)){let f=(m=window.event)=>vF(m,n),p=(m=window.event)=>{vF(m,n),RV(m)};ki.set(n,{keydownListener:f,keyupListenr:p,capture:h}),Pb(n,"keydown",f,h),Pb(n,"keyup",p,h)}if(!xu){let f=()=>{We=[]};xu={listener:f,capture:h},Pb(window,"focus",f,h)}}};function IV(r,e="all"){Object.keys(Ye).forEach(t=>{Ye[t].filter(i=>i.scope===e&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Mb(r){let e=Object.values(Ye).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=ki.get(r)||{};t&&i&&(mu(r,"keyup",i,s),mu(r,"keydown",t,s),ki.delete(r))}if((e.length<=0||ki.size<=0)&&(Array.from(ki.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=ki.get(t)||{};i&&s&&(mu(t,"keyup",s,o),mu(t,"keydown",i,o),ki.delete(t))}),ki.clear(),Object.keys(Ye).forEach(t=>delete Ye[t]),xu)){let{listener:t,capture:i}=xu;mu(window,"focus",t,i),xu=null}}var Cb={getPressedKeyString:AV,setScope:AF,getScope:_u,deleteScope:MV,getPressedKeyCodes:EV,getAllKeyCodes:PV,isPressed:CV,filter:PF,trigger:IV,unbind:CF,keyMap:yu,modifier:Gr,modifierMap:gu};for(let r in Cb){let e=r;Object.prototype.hasOwnProperty.call(Cb,e)&&(cr[e]=Cb[e])}if(typeof window<"u"){let r=window.hotkeys;cr.noConflict=e=>(e&&window.hotkeys===cr&&(window.hotkeys=r),cr),window.hotkeys=cr}var BV=Object.prototype.hasOwnProperty,MF=r=>{let e=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=e.get(l);c?pe(c.payload,s[l].payload)||(n.push(l),cr.unbind(l)):o.push(l)}),e.forEach((l,c)=>{BV.call(s,c)||a.push(c)}),a.forEach(l=>{cr.unbind(l),e.delete(l)}),[...o,...n].forEach(l=>{let u=s[l].payload??{};cr(l,()=>{r&&r("keydown",{_event:{key:l},...u})}),e.set(l,{value:l,payload:u})})},destroy:()=>{for(let s of e.keys())cr.unbind(s);e.clear()}}};var IF=(r,e)=>typeof e!="string"?e:r[e]??e,kV=(r,e,t,i)=>{let s=IF(t,e);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},RF=(r,e,t,i)=>{let s=IF(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},FV=(r,e,t)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},OV=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!Pd[o])throw new Error(`${o} is not a supported property for animation.`);let a=kV(r,o,t,0);if(n.auto){let u=FV(i,o,s);if(a===u)return null;let h=Cn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Cn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),BF=()=>{let r=[],e=new Map,t=new Map,i=0,s=null,o=!1,n=(M,F)=>Math.min(Math.max(M,0),Math.max(F??0,0)),a=(M,F)=>{let O=n(F,M.duration);return M.currentTime=O,M.applyFrame(O),O>=M.duration},l=(M,F)=>{t.get(M)?.forEach(O=>{try{O(F)}catch{}})},c=M=>{if(l("completed",{id:M.id}),M.onComplete)try{M.onComplete()}catch{}},u=M=>{M.applyFrame(0),e.set(M.id,M);let F=s!==null&&a(M,s);l("started",{id:M.id}),F&&(c(M),e.delete(M.id))},h=M=>{let{id:F,element:O,properties:D,targetState:N,onComplete:L,onCancel:Y,propertyPathMap:ue=Cd}=M,J=OV(O,D,ue,N,F);if(J.length===0){c({id:F,onComplete:L});return}let Be={id:F,kind:"property",element:O,timelines:J,duration:pc(J),currentTime:0,stateVersion:i,targetState:N,onComplete:L,onCancel:Y,applyFrame:ke=>{for(let{property:Me,timeline:ze}of J){let rt=mc(ze,ke);try{RF(O,Me,ue,rt)}catch{}}},applyTargetState:()=>{if(!(!O||O.destroyed)){if(N===null){O.destroy();return}if(N)for(let[ke,Me]of Object.entries(N))try{RF(O,ke,ue,Me)}catch{}}},isValid:()=>!!O&&!O.destroyed};u(Be)},d=M=>{let F={id:M.id,kind:"custom",duration:M.duration??0,currentTime:0,stateVersion:i,onComplete:M.onComplete,onCancel:M.onCancel,applyFrame:M.applyFrame??(()=>{}),applyTargetState:M.applyTargetState??(()=>{}),isValid:M.isValid??(()=>!0)};u(F)},f=M=>{if(M.driver==="custom"){d(M);return}h(M)},p=M=>{try{M.applyTargetState?.()}catch{}if(M.onCancel)try{M.onCancel()}catch{}},m=M=>{switch(M.type){case"START":f(M.payload);break;case"CANCEL":v(M.id);break}},g=()=>{let M=r.splice(0);for(let F of M)m(F)},_=()=>{s===null||o||(o=!0,queueMicrotask(()=>{o=!1,s!==null&&g()}))},v=M=>{let F=e.get(M);F&&(p(F),e.delete(M),l("cancelled",{id:M}))},x=M=>{r.push(M),_()},T=()=>{for(let[M,F]of e)p(F),l("cancelled",{id:M});e.clear(),i++},b=M=>{g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}if(D.currentTime+=M,D.currentTime>=D.duration){D.applyFrame(D.duration),c(D),F.push(O);continue}D.applyFrame(D.currentTime)}for(let O of F)e.delete(O)},w=M=>{s=M,g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}a(D,M)&&(c(D),F.push(O))}for(let O of F)e.delete(O)},E=()=>{s=null},I=()=>{g()},B=(M,F)=>(t.has(M)||t.set(M,new Set),t.get(M).add(F),()=>C(M,F)),C=(M,F)=>{t.get(M)?.delete(F)};return{dispatch:x,cancelAll:T,flush:I,tick:b,setTime:w,clearTime:E,on:B,off:C,getState:()=>({stateVersion:i,activeCount:e.size,animations:Array.from(e.entries()).map(([M,F])=>({id:M,currentTime:F.currentTime,duration:F.duration,progress:F.duration>0?F.currentTime/F.duration:0}))}),isAnimating:M=>e.has(M),destroy:()=>{T(),t.clear()}}};var kF=r=>{let e=0,t=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,r?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&r?.("renderComplete",{id:i,aborted:!0}),t++,e=0,i=d,s=!0,o=!1},track:d=>{d===t&&e++},complete:d=>{d!==t||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>t,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var FF=new Set(["update","transition"]),UV=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),GV=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),OF=new Set(["single","sequence","composite"]),Bp=new Set(["red","green","blue","alpha"]),UF=new Set(["max","min","multiply","add"]),LF=new Set(of),li=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},ho=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},bu=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},LV=(r,e)=>{if(li(r,e),bu(r.duration,`${e}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${e}.easing must be a string.`);if(r.easing!==void 0&&!LF.has(r.easing))throw new Error(`${e}.easing must be one of: ${of.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Ib=(r,e)=>{li(r,e);let t={};if(r.initialValue!==void 0&&(bu(r.initialValue,`${e}.initialValue`),t.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return t.keyframes=r.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(li(i,o),bu(i.value,`${o}.value`),bu(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&&!LF.has(i.easing))throw new Error(`${o}.easing must be one of: ${of.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}:{}}}),t},DV=(r,e)=>{li(r,e);let t=r.keyframes!==void 0,i=r.auto!==void 0;if(t&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!t&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:LV(r.auto,`${e}.auto`)}}return Ib(r,e)},DF=(r,e,t,i=Ib)=>{li(r,e);let s=Object.entries(r).map(([o,n])=>{if(!t.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)},NV=(r,e)=>{if(li(r,e),ho(r.texture,`${e}.texture`),r.channel!==void 0&&!Bp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(Bp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},HV=(r,e)=>{if(li(r,e),!OF.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(OF).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!Bp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(Bp).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(bu(r.softness,`${e}.softness`),t.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);t.invert=r.invert}if(r.progress!==void 0&&(t.progress=Ib(r.progress,`${e}.progress`)),r.kind==="single"&&(ho(r.texture,`${e}.texture`),t.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${e}.textures must be a non-empty array.`);t.textures=r.textures.map((i,s)=>(ho(i,`${e}.textures[${s}]`),i)),r.sample!==void 0&&(ho(r.sample,`${e}.sample`),t.sample=r.sample)}if(r.kind==="composite"){if(!UF.has(r.combine??"max"))throw new Error(`${e}.combine must be one of: ${Array.from(UF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${e}.items must be a non-empty array.`);t.combine=r.combine??"max",t.items=r.items.map((i,s)=>NV(i,`${e}.items[${s}]`))}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},GF=(r,e)=>{if(li(r,e),r.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let t={};if(r.tween!==void 0&&(t.tween=DF(r.tween,`${e}.tween`,GV)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},VV=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=GF(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=GF(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=HV(r.mask,`${e}.mask`)),t.prev===void 0&&t.next===void 0&&t.mask===void 0)throw new Error(`${e} must define prev, next, or mask.`);return t},Rb=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},NF=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let e=r.map((i,s)=>{let o=`animations[${s}]`;if(li(i,o),ho(i.id,`${o}.id`),ho(i.targetId,`${o}.targetId`),ho(i.type,`${o}.type`),!FF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(FF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(li(i.complete,`${o}.complete`),n.complete=i.complete),Rb(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Rb(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Rb(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=DF(i.tween,`${o}.tween`,UV,DV),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=VV(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),t=new Map;for(let i of e){let s=t.get(i.targetId)??new Set;s.add(i.type),t.set(i.targetId,s)}for(let[i,s]of t)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return e};var Bb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};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.");return e.animations=NF(e.animations),e};var WV="0",ha=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},ur=r=>({value:r.element.value??"",selectionStart:ha(r.element,"selectionStart"),selectionEnd:ha(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),zV=(r,e)=>!r||!e?!1:r.value===e.value&&r.selectionStart===e.selectionStart&&r.selectionEnd===e.selectionEnd&&r.focused===e.focused&&r.composing===e.composing,$V=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,vu=r=>{r.element.style.pointerEvents="none"},kb=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},XV=({app:r,geometry:e})=>{let t=r.canvas;if(!e||!t||e.visible===!1)return null;let i=t.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.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}},jV=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=XV({app:r,geometry:i}),o=t.clientX,n=t.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},HF=({app:r})=>{let e=new Map,t,i=null,s=()=>{t||(t=document.createElement("div"),t.dataset.routeGraphicsInputBridge="true",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.pointerEvents="none",t.style.zIndex="1000",t.style.width="0",t.style.height="0");let x=r.canvas?.parentNode??document.body;t.isConnected||x.appendChild(t)},o=(x,T=x.lastSnapshot)=>{let b=ur(x);b.focused&&i!==x.id?i=x.id:!b.focused&&i===x.id&&(i=null),vu(x,i),T?.value!==b.value&&x.callbacks.onValueChange?.(b),(T?.selectionStart!==b.selectionStart||T?.selectionEnd!==b.selectionEnd||T?.focused!==b.focused||T?.composing!==b.composing)&&x.callbacks.onSelectionChange?.(b),x.lastSnapshot=b},n=x=>{let{disabled:T=!1,multiline:b=!1,maxLength:w,textStyle:E,padding:I,placeholder:B="",autocomplete:C="off",autocapitalize:A="off",spellcheck:P=!1}=x.options,{element:R}=x;R instanceof HTMLInputElement&&(R.type="text"),R.disabled=T,R.placeholder=B,R.autocomplete=C,R.autocapitalize=A,R.spellcheck=!!P,R.style.opacity=WV,R.style.color="transparent",R.style.caretColor="transparent",R.style.background="transparent",R.style.paddingTop=`${I.top}px`,R.style.paddingRight=`${I.right}px`,R.style.paddingBottom=`${I.bottom}px`,R.style.paddingLeft=`${I.left}px`,R.style.fontFamily=E?.fontFamily??"Arial",R.style.fontSize=`${E?.fontSize??16}px`,R.style.fontWeight=E?.fontWeight??"400",R.style.textAlign=E?.align??"left",R.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",R.style.whiteSpace=b?"pre":"nowrap",R.style.overflowWrap="normal",R.style.resize="none",R.style.overflow="hidden",typeof w=="number"?R.maxLength=w:R.removeAttribute("maxLength"),R.tabIndex=-1,b&&R instanceof HTMLTextAreaElement&&(R.wrap="off",R.rows=1),vu(x,i)},a=x=>{s();let T=r.canvas,b=x.options.getGeometry?.();if(!T||!b||b.visible===!1){x.element.style.display="none";return}let w=T.getBoundingClientRect(),E=r.renderer?.width||w.width||1,I=r.renderer?.height||w.height||1,B=w.width/E,C=w.height/I,A=b.clipInsets??{top:0,right:0,bottom:0,left:0},P={top:A.top*C,right:A.right*B,bottom:A.bottom*C,left:A.left*B};x.element.style.display="block",x.element.style.left=`${w.left+b.x*B}px`,x.element.style.top=`${w.top+b.y*C}px`,x.element.style.width=`${b.width*B}px`,x.element.style.height=`${b.height*C}px`;let R=Object.values(P).some(M=>M>0);x.element.style.clipPath=R?`inset(${P.top}px ${P.right}px ${P.bottom}px ${P.left}px)`:"none"},l=x=>{if(!i)return;let T=e.get(i),b=x.target;!T||b===T.element||T.element.contains(b)||$V(b)&&t?.contains(b)||jV({app:r,entry:T,event:x})||T.element.blur()},c=()=>{for(let x of e.values()){if(a(x),!x.lastSnapshot){x.lastSnapshot=ur(x);continue}let T=ur(x);zV(T,x.lastSnapshot)||o(x,x.lastSnapshot)}},u=({id:x,options:T})=>{let b=T.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=x,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},h=x=>{let{id:T,element:b}=x,w=()=>{o(x)};b.addEventListener("focus",()=>{x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),i=T,vu(x,i);let E=ur(x);x.lastSnapshot=E,x.callbacks.onFocus?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("blur",()=>{i===T&&(i=null),vu(x,i),x.pendingBlurTimer=setTimeout(()=>{x.pendingBlurTimer=null;let E=ur(x);if(E.focused){x.lastSnapshot=E;return}x.lastSnapshot=E,x.callbacks.onBlur?.(E),x.callbacks.onSelectionChange?.(E)},0)}),b.addEventListener("input",w),b.addEventListener("select",w),b.addEventListener("click",()=>queueMicrotask(w)),b.addEventListener("keyup",()=>queueMicrotask(w)),b.addEventListener("keydown",E=>{let I=E.key==="Enter"&&x.options.multiline!==!0&&!E.shiftKey,B=E.key==="Enter"&&x.options.multiline===!0&&(E.ctrlKey||E.metaKey);(I||B)&&(E.preventDefault(),x.callbacks.onSubmit?.(ur(x),E)),E.key==="Escape"&&b.blur(),queueMicrotask(w)}),b.addEventListener("compositionstart",()=>{x.composing=!0;let E=ur(x);x.lastSnapshot=E,x.callbacks.onCompositionStart?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionupdate",()=>{let E=ur(x);x.lastSnapshot=E,x.callbacks.onCompositionUpdate?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionend",()=>{x.composing=!1,w(),x.callbacks.onCompositionEnd?.(ur(x))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(x,T)=>{s();let b=e.get(x);if(b)return b.options=T,b.callbacks=T.callbacks??{},n(b),a(b),typeof T.value=="string"&&b.element.value!==T.value&&(b.element.value=T.value),b.lastSnapshot=ur(b),b.element;let w={id:x,element:u({id:x,options:T}),options:T,callbacks:T.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(w),typeof T.value=="string"&&(w.element.value=T.value),n(w),t.appendChild(w.element),e.set(x,w),a(w),w.lastSnapshot=ur(w),w.element};return{mount:d,update:(x,T)=>{let b=e.get(x);if(!b)return d(x,T);let w=T.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=T,b.callbacks=T.callbacks??{},w){let E=b.element,I=document.activeElement===E,B=ha(E,"selectionStart"),C=ha(E,"selectionEnd");return b.element=u({id:x,options:T}),h(b),E.replaceWith(b.element),b.element.value=typeof T.value=="string"?T.value:E.value,n(b),a(b),b.lastSnapshot=ur(b),I&&!T.disabled&&queueMicrotask(()=>{b.element.focus(),kb(b.element,B,C)}),b.element}return typeof T.value=="string"&&T.value!==b.element.value&&b.composing!==!0&&(b.element.value=T.value),n(b),a(b),b.lastSnapshot=ur(b),b.element},focus:(x,{selectAll:T=!1,selectionStart:b,selectionEnd:w}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=document.activeElement===E.element;if(i=x,vu(E,i),I||E.element.focus(),T){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof b=="number"||typeof w=="number"){let B=typeof b=="number"?b:ha(E.element,"selectionStart"),C=typeof w=="number"?w:typeof b=="number"?b:ha(E.element,"selectionEnd");kb(E.element,B,C)}o(E,E.lastSnapshot)},setSelection:(x,T,b=T,{focus:w=!1}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=()=>{kb(E.element,T,b),o(E,E.lastSnapshot)};if(w&&document.activeElement!==E.element){E.element.focus(),I();return}I()},blur:x=>{e.get(x)?.element.blur()},unmount:x=>{let T=e.get(x);T&&(i===x&&(i=null),T.pendingBlurTimer&&(clearTimeout(T.pendingBlurTimer),T.pendingBlurTimer=null),T.element.remove(),e.delete(x),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let x of e.values())x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),x.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var YV=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=yF(),i={elements:[],animations:[],audio:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,g=[],_,v=new Map,x,T=(A,P,R,M)=>{A.clear(),A.rect(0,0,P,R),A.fill(M??0)},b=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",w=(A,P,{revokable:R=!1}={})=>{v.set(A,{url:P,revokable:R})},E=()=>{for(let A of v.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);v.clear()},I=(A,P,R)=>{n&&n.registerHotkeys(R?.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 M=P?.cursorStyles,F=R?.cursorStyles;pe(M,F)||(F?(F.default&&(A.renderer.events.cursorStyles.default=F.default,A.canvas.style.cursor=F.default),F.hover&&(A.renderer.events.cursorStyles.hover=F.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},B=(A,P,R,M)=>{if(pe(i,R)){typeof A.render=="function"&&A.render();return}h&&h.abort(),h=new AbortController;let F=h.signal;l.reset(R.id),I(A,i.global,R.global),a.cancelAll(),Hs({app:A,parent:P,prevComputedTree:i.elements,nextComputedTree:R.elements,animations:R.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:F}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),n_({app:A,prevAudioTree:i.audio,nextAudioTree:R.audio,audioPlugins:o.audio}),i=R,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},C={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 P=new Q(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:P});let R=e.stage.getChildByLabel(A,!0);if(!R)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:R,frame:P})},assignStageEvent:(A,P)=>{e.stage.eventMode="static",e.stage.on(A,P)},setAnimationPlaybackMode:A=>{r(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let P=Number(A);if(!Number.isFinite(P))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=P),a.flush(),a.setTime(P),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:P,plugins:R,width:M,height:F,backgroundColor:O,debug:D=!1,onFirstRender:N,animationPlaybackMode:L="auto"}=A;c=N,r(L),p=L,m=null,g.forEach(J=>J()),g=[];let Y=[];R?.elements?.forEach(J=>{J?.parse&&Y.push(_F({type:J.type,parse:J.parse}))}),o={animations:R?.animations??[],elements:R?.elements??[],audio:R?.audio??[],parsers:Y},s=P,n=MF(P),l=kF(P),e=new rc,e.audioStage=t,await e.init({width:M,height:F,backgroundColor:O,preference:"webgl",preserveDrawingBuffer:D===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=D,e.inputDomBridge=HF({app:e}),_=J=>{J.preventDefault()},e.canvas.addEventListener("contextmenu",_),x=new Ue,x.label="__route_graphics_background__",T(x,M,F,O),e.stage.addChild(x),e.stage.width=M,e.stage.height=F,e.ticker.add(e.audioStage.tick),a=BF();let ue=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return g=[a.on("started",ue),a.on("completed",ue),a.on("cancelled",ue)],D?(d=J=>{p==="auto"&&J?.detail?.deltaMS&&(a.tick(Number(J.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=J=>{p==="auto"&&(a.tick(J.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),C},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),_&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",_),_=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Zy(),g.forEach(P=>P()),g=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=P=>{for(let R of P.children){let M=R.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),R.children&&A(R)}};e?.stage&&A(e.stage),e&&e.destroy(),p="auto",m=null,x=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[F,O]of Object.entries(A)){let D=b(O.type);P[D][F]=O}await Promise.all(Object.entries(P.audio).map(([F,O])=>xn.load(F,O.buffer))),await Promise.all(Object.entries(P.font).map(async([F,O])=>{let D=new Blob([O.buffer],{type:O.type}),N=URL.createObjectURL(D),L=new FontFace(F,`url(${N})`);try{await L.load(),document.fonts.add(L)}catch(Y){console.error(`Failed to load font ${F}:`,Y)}finally{URL.revokeObjectURL(N)}}));let R=Object.entries(P.texture).map(async([F,O])=>{if(_r.cache.has(F))return _r.cache.get(F);if(O?.source==="url"&&typeof O?.url=="string")return _r.load({alias:F,src:O.url,parser:"loadTextures"});let D=new Blob([O.buffer],{type:O.type}),N=await createImageBitmap(D),L=k.from(N);return _r.cache.set(F,L),L}),M=Object.entries(P.video).map(async([F,O])=>{let D=O?.source==="url"&&typeof O?.url=="string"?O.url:URL.createObjectURL(new Blob([O.buffer],{type:O.type})),N=O?.source!=="url";w(F,D,{revokable:N});let L={alias:F,src:D,parser:"loadVideo",data:{}};return typeof O?.type=="string"&&O.type.length>0&&(L.data.mime=O.type),_r.load(L).then(Y=>Y).catch(Y=>{throw v.delete(F),N&&URL.revokeObjectURL(D),Y})});return Promise.all([...R,...M])},loadAudioAssets:async A=>Promise.all(A.map(async P=>{let M=await(await fetch(P)).arrayBuffer();return xn.load(P,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,x&&T(x,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let P=Bb(A),R=Eb({JSONObject:P.elements,parserPlugins:o.parsers}),M={...P,elements:R};B(e,e.stage,M,s)},parse:A=>{let P=Bb(A),R=Eb({JSONObject:P.elements,parserPlugins:o.parsers});return{...P,elements:R}}};return C},VF=YV;var hIe=VF;export{rc as Application,_r as Assets,xn as AudioAsset,lD as animatedSpritePlugin,QL as containerPlugin,by as createAnimationPlugin,ZF as createAssetBufferManager,vy as createAudioPlugin,Je as createElementPlugin,hIe as default,pL as inputPlugin,ZD as particlesPlugin,VG as rectPlugin,n_ as renderAudio,Hs as renderElements,tL as sliderPlugin,hD as soundPlugin,WG as spritePlugin,DR as spritesheetAnimationPlugin,DG as textPlugin,sD as textRevealingPlugin,cD as tweenPlugin,$G as videoPlugin};
|
|
1883
1902
|
/*! Bundled license information:
|
|
1884
1903
|
|
|
1885
1904
|
punycode/punycode.js:
|