route-graphics 0.0.34 → 0.1.0
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/README.md +40 -1171
- package/dist/RouteGraphics.js +106 -106
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var sB=Object.create;var Xd=Object.defineProperty;var oB=Object.getOwnPropertyDescriptor;var nB=Object.getOwnPropertyNames;var aB=Object.getPrototypeOf,lB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var Z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),yy=(r,t)=>{for(var e in t)Xd(r,e,{get:t[e],enumerable:!0})},hB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of nB(t))!lB.call(r,s)&&s!==e&&Xd(r,s,{get:()=>t[s],enumerable:!(i=oB(t,s))||i.enumerable});return r};var $i=(r,t,e)=>(e=r!=null?sB(aB(r)):{},hB(t||!r||!r.__esModule?Xd(e,"default",{value:r,enumerable:!0}):e,r));var T,Yd,Sn,U,B=x(()=>{"use strict";T=(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))(T||{}),Yd=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},Sn=(r,t)=>Yd(r).priority??t,U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Yd).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Yd).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Sn(n.value,e)-Sn(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Sn(o,e)-Sn(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var by=Z((HO,qd)=>{"use strict";var uB=Object.prototype.hasOwnProperty,Re="~";function En(){}Object.create&&(En.prototype=Object.create(null),new En().__proto__||(Re=!1));function dB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function _y(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new dB(e,i||r,s),n=Re?Re+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Sh(r,t){--r._eventsCount===0?r._events=new En:delete r._events[t]}function Te(){this._events=new En,this._eventsCount=0}Te.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)uB.call(e,i)&&t.push(Re?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Te.prototype.listeners=function(t){var e=Re?Re+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Te.prototype.listenerCount=function(t){var e=Re?Re+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Te.prototype.emit=function(t,e,i,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Te.prototype.on=function(t,e,i){return _y(this,t,e,i,!1)};Te.prototype.once=function(t,e,i){return _y(this,t,e,i,!0)};Te.prototype.removeListener=function(t,e,i,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return Sh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Sh(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Sh(this,o)}return this};Te.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&Sh(this,e)):(this._events=new En,this._eventsCount=0),this};Te.prototype.off=Te.prototype.removeListener;Te.prototype.addListener=Te.prototype.on;Te.prefixed=Re;Te.EventEmitter=Te;typeof qd<"u"&&(qd.exports=Te)});var vy,Rt,Se=x(()=>{vy=$i(by(),1),Rt=vy.default});var fB,Qr,fe,sr,Ry,Ty,Kd,pB,Eh,My,By,Sy,Ey,wy,wn,mB,gB,xB,yB,Jd,Ay,_B,Zd,Qd,Py,tf,Xe,Cy,wh,ef=x(()=>{fB={grad:.9,turn:360,rad:360/(2*Math.PI)},Qr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},sr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ry=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Ty=function(r){return{r:sr(r.r,0,255),g:sr(r.g,0,255),b:sr(r.b,0,255),a:sr(r.a)}},Kd=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},pB=/^#([0-9a-f]{3,8})$/i,Eh=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},My=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},By=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),h=o%6;return{r:255*[i,a,n,n,l,i][h],g:255*[l,i,i,a,n,n][h],b:255*[n,n,l,i,i,a][h],a:s}},Sy=function(r){return{h:Ry(r.h),s:sr(r.s,0,100),l:sr(r.l,0,100),a:sr(r.a)}},Ey=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},wy=function(r){return By((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},wn=function(r){return{h:(t=My(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},mB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jd={string:[[function(r){var t=pB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=xB.exec(r)||yB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ty({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=mB.exec(r)||gB.exec(r);if(!t)return null;var e,i,s=Sy({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(fB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return wy(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Qr(t)&&Qr(e)&&Qr(i)?Ty({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=Sy({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return wy(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=function(a){return{h:Ry(a.h),s:sr(a.s,0,100),v:sr(a.v,0,100),a:sr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return By(n)},"hsv"]]},Ay=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},_B=function(r){return typeof r=="string"?Ay(r.trim(),Jd.string):typeof r=="object"&&r!==null?Ay(r,Jd.object):[null,void 0]},Zd=function(r,t){var e=wn(r);return{h:e.h,s:sr(e.s+100*t,0,100),l:e.l,a:e.a}},Qd=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Py=function(r,t){var e=wn(r);return{h:e.h,s:e.s,l:sr(e.l+100*t,0,100),a:e.a}},tf=function(){function r(t){this.parsed=_B(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(Qd(this.rgba),2)},r.prototype.isDark=function(){return Qd(this.rgba)<.5},r.prototype.isLight=function(){return Qd(this.rgba)>=.5},r.prototype.toHex=function(){return t=Kd(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?Eh(fe(255*o)):"","#"+Eh(e)+Eh(i)+Eh(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return Kd(this.rgba)},r.prototype.toRgbString=function(){return t=Kd(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return Ey(wn(this.rgba))},r.prototype.toHslString=function(){return t=Ey(wn(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=My(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Xe({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Xe(Zd(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Xe(Zd(this.rgba,-t))},r.prototype.grayscale=function(){return Xe(Zd(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Xe(Py(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Xe(Py(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Xe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=wn(this.rgba);return typeof t=="number"?Xe({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Xe(t).toHex()},r}(),Xe=function(r){return r instanceof tf?r:new tf(r)},Cy=[],wh=function(r){r.forEach(function(t){Cy.indexOf(t)<0&&(t(tf,Jd),Cy.push(t))})}});function Ah(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var g in e){var m=(a=c,l=o[g],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=g)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var rf=x(()=>{});var Us,it,ye=x(()=>{ef();rf();wh([Ah]);Us=class An{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof An)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=An._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=An.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Xe(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof An||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Us.shared=new Us;Us._temp=new Us;Us.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;it=Us});var Iy,Fy=x(()=>{"use strict";Iy={cullArea:null,cullable:!1,cullableChildren:!0}});var ky,Gy,Uy,sf=x(()=>{"use strict";ky=Math.PI*2,Gy=180/Math.PI,Uy=Math.PI/180});var ht,of,or=x(()=>{"use strict";ht=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return of.x=0,of.y=0,of}},of=new ht});var F,bB,vB,mt=x(()=>{sf();or();F=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ht;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ht;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(i*n+o*-s),c=t.x,u=t.y;return e.x=n*h*c+-o*h*u+(l*o-a*n)*h,e.y=i*h*u+-s*h*c+(-l*i+a*s)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,d=e.d;return this.a=i*h+s*u,this.b=i*c+s*d,this.c=o*h+n*u,this.d=o*c+n*d,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*d+e.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(ky-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return vB.identity()}static get shared(){return bB.identity()}},bB=new F,vB=new F});var _e,Ph=x(()=>{"use strict";_e=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function at(r="default"){return nf[r]===void 0&&(nf[r]=-1),++nf[r]}var nf,be=x(()=>{"use strict";nf={default:-1}});function $(r,t,e=3){if(Oy[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1
|
+
var UI=Object.create;var hf=Object.defineProperty;var OI=Object.getOwnPropertyDescriptor;var LI=Object.getOwnPropertyNames;var DI=Object.getPrototypeOf,NI=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var Q=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Oy=(r,t)=>{for(var e in t)hf(r,e,{get:t[e],enumerable:!0})},HI=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of LI(t))!NI.call(r,s)&&s!==e&&hf(r,s,{get:()=>t[s],enumerable:!(i=OI(t,s))||i.enumerable});return r};var Yi=(r,t,e)=>(e=r!=null?UI(DI(r)):{},HI(t||!r||!r.__esModule?hf(e,"default",{value:r,enumerable:!0}):e,r));var T,cf,Pn,U,B=x(()=>{"use strict";T=(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))(T||{}),cf=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},Pn=(r,t)=>cf(r).priority??t,U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(cf).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(cf).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Pn(n.value,e)-Pn(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Pn(o,e)-Pn(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var Dy=Q((LL,uf)=>{"use strict";var WI=Object.prototype.hasOwnProperty,Me="~";function Cn(){}Object.create&&(Cn.prototype=Object.create(null),new Cn().__proto__||(Me=!1));function zI(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function Ly(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new zI(e,i||r,s),n=Me?Me+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Mh(r,t){--r._eventsCount===0?r._events=new Cn:delete r._events[t]}function we(){this._events=new Cn,this._eventsCount=0}we.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)WI.call(e,i)&&t.push(Me?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};we.prototype.listeners=function(t){var e=Me?Me+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};we.prototype.listenerCount=function(t){var e=Me?Me+t:t,i=this._events[e];return i?i.fn?1:i.length:0};we.prototype.emit=function(t,e,i,s,o,n){var a=Me?Me+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};we.prototype.on=function(t,e,i){return Ly(this,t,e,i,!1)};we.prototype.once=function(t,e,i){return Ly(this,t,e,i,!0)};we.prototype.removeListener=function(t,e,i,s){var o=Me?Me+t:t;if(!this._events[o])return this;if(!e)return Mh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Mh(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Mh(this,o)}return this};we.prototype.removeAllListeners=function(t){var e;return t?(e=Me?Me+t:t,this._events[e]&&Mh(this,e)):(this._events=new Cn,this._eventsCount=0),this};we.prototype.off=we.prototype.removeListener;we.prototype.addListener=we.prototype.on;we.prefixed=Me;we.EventEmitter=we;typeof uf<"u"&&(uf.exports=we)});var Ny,Mt,Ee=x(()=>{Ny=Yi(Dy(),1),Mt=Ny.default});var $I,Jr,me,sr,Yy,Hy,df,XI,Ih,qy,Ky,Vy,Wy,zy,Rn,jI,YI,qI,KI,mf,$y,ZI,ff,pf,Xy,gf,je,jy,Bh,xf=x(()=>{$I={grad:.9,turn:360,rad:360/(2*Math.PI)},Jr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},me=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},sr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Yy=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Hy=function(r){return{r:sr(r.r,0,255),g:sr(r.g,0,255),b:sr(r.b,0,255),a:sr(r.a)}},df=function(r){return{r:me(r.r),g:me(r.g),b:me(r.b),a:me(r.a,3)}},XI=/^#([0-9a-f]{3,8})$/i,Ih=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},qy=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Ky=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),h=o%6;return{r:255*[i,a,n,n,l,i][h],g:255*[l,i,i,a,n,n][h],b:255*[n,n,l,i,i,a][h],a:s}},Vy=function(r){return{h:Yy(r.h),s:sr(r.s,0,100),l:sr(r.l,0,100),a:sr(r.a)}},Wy=function(r){return{h:me(r.h),s:me(r.s),l:me(r.l),a:me(r.a,3)}},zy=function(r){return Ky((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Rn=function(r){return{h:(t=qy(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},jI=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YI=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qI=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,KI=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mf={string:[[function(r){var t=XI.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?me(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?me(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=qI.exec(r)||KI.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Hy({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=jI.exec(r)||YI.exec(r);if(!t)return null;var e,i,s=Vy({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*($I[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zy(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Jr(t)&&Jr(e)&&Jr(i)?Hy({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=Vy({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return zy(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=function(a){return{h:Yy(a.h),s:sr(a.s,0,100),v:sr(a.v,0,100),a:sr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return Ky(n)},"hsv"]]},$y=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},ZI=function(r){return typeof r=="string"?$y(r.trim(),mf.string):typeof r=="object"&&r!==null?$y(r,mf.object):[null,void 0]},ff=function(r,t){var e=Rn(r);return{h:e.h,s:sr(e.s+100*t,0,100),l:e.l,a:e.a}},pf=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Xy=function(r,t){var e=Rn(r);return{h:e.h,s:e.s,l:sr(e.l+100*t,0,100),a:e.a}},gf=function(){function r(t){this.parsed=ZI(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return me(pf(this.rgba),2)},r.prototype.isDark=function(){return pf(this.rgba)<.5},r.prototype.isLight=function(){return pf(this.rgba)>=.5},r.prototype.toHex=function(){return t=df(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?Ih(me(255*o)):"","#"+Ih(e)+Ih(i)+Ih(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return df(this.rgba)},r.prototype.toRgbString=function(){return t=df(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return Wy(Rn(this.rgba))},r.prototype.toHslString=function(){return t=Wy(Rn(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=qy(this.rgba),{h:me(t.h),s:me(t.s),v:me(t.v),a:me(t.a,3)};var t},r.prototype.invert=function(){return je({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),je(ff(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),je(ff(this.rgba,-t))},r.prototype.grayscale=function(){return je(ff(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),je(Xy(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),je(Xy(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?je({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):me(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Rn(this.rgba);return typeof t=="number"?je({h:t,s:e.s,l:e.l,a:e.a}):me(e.h)},r.prototype.isEqual=function(t){return this.toHex()===je(t).toHex()},r}(),je=function(r){return r instanceof gf?r:new gf(r)},jy=[],Bh=function(r){r.forEach(function(t){jy.indexOf(t)<0&&(t(gf,mf),jy.push(t))})}});function Fh(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var m in e){var g=(a=c,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<u&&(u=g,d=m)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var yf=x(()=>{});var Ns,ot,be=x(()=>{xf();yf();Bh([Fh]);Ns=class Mn{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Mn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Mn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Mn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Mn||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ns.shared=new Ns;Ns._temp=new Ns;Ns.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;ot=Ns});var Zy,Qy=x(()=>{"use strict";Zy={cullArea:null,cullable:!1,cullableChildren:!0}});var Jy,t_,e_,_f=x(()=>{"use strict";Jy=Math.PI*2,t_=180/Math.PI,e_=Math.PI/180});var ut,bf,or=x(()=>{"use strict";ut=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return bf.x=0,bf.y=0,bf}},bf=new ut});var F,QI,JI,mt=x(()=>{_f();or();F=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ut;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ut;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(i*n+o*-s),c=t.x,u=t.y;return e.x=n*h*c+-o*h*u+(l*o-a*n)*h,e.y=i*h*u+-s*h*c+(-l*i+a*s)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,d=e.d;return this.a=i*h+s*u,this.b=i*c+s*d,this.c=o*h+n*u,this.d=o*c+n*d,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*d+e.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(Jy-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return JI.identity()}static get shared(){return QI.identity()}},QI=new F,JI=new F});var ve,kh=x(()=>{"use strict";ve=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ct(r="default"){return vf[r]===void 0&&(vf[r]=-1),++vf[r]}var vf,Te=x(()=>{"use strict";vf={default:-1}});function $(r,t,e=3){if(r_[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
2
2
|
Deprecated since v${r}`):(i=i.split(`
|
|
3
3
|
`).splice(e).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
5
5
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${r}`),console.warn(i))),Oy[t]=!0}var Oy,J,Ly,Vt=x(()=>{"use strict";Oy={},J="8.0.0",Ly="8.3.4"});var ji,af=x(()=>{"use strict";ji=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var lf,tt,Me=x(()=>{af();lf=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new ji(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},tt=new lf});var Dy,Ny=x(()=>{Vt();Dy={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){$("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Ch(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var hf=x(()=>{"use strict"});var Hy,Vy=x(()=>{hf();Vt();Hy={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Ch(this.children,r,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||$(J,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var Wy,zy=x(()=>{"use strict";Wy={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var Jr,Rh=x(()=>{"use strict";Jr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var cf,Mh,$y=x(()=>{B();Me();cf=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let i=this._tests[e];if(i.test(t))return tt.get(i.maskClass,t)}return t}returnMaskEffect(t){tt.return(t)}},Mh=new cf;U.handleByList(T.MaskEffect,Mh._effectClasses)});var jy,Xy=x(()=>{Rh();$y();jy={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),Mh.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=Mh.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new Jr);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Jr),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var Yy,qy=x(()=>{Vt();Yy={label:null,get name(){return $(J,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){$(J,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Bh,et,ne=x(()=>{or();Bh=[new ht,new ht,new ht,new ht],et=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,h=i*(1-s),c=i-h,u=a-h,d=a+o+h,f=l-h,g=l+n+h,m=a+c,p=a+o-c,_=l+c,y=l+n-c;return t>=u&&t<=d&&e>=f&&e<=g&&!(t>m&&t<p&&e>_&&e<y)}intersects(t,e){if(!e){let w=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=w)return!1;let C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Bh[0].set(t.left,t.top),l=Bh[1].set(t.left,t.bottom),h=Bh[2].set(t.right,t.top),c=Bh[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),g=d*i+f*o,m=d*s+f*o,p=d*i+f*n,_=d*s+f*n;if(Math.max(g,m,p,_)<=d*a.x+f*a.y||Math.min(g,m,p,_)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),v=u*(h.x-a.x),b=y*i+v*o,E=y*s+v*o,A=y*i+v*n,S=y*s+v*n;return!(Math.max(b,E,A,S)<=y*a.x+v*a.y||Math.min(b,E,A,S)>=y*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Ky,wt,Ne=x(()=>{mt();ne();Ky=new F,wt=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ky,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new et);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ky,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,g=this.maxX,m=this.maxY,p=n*t+l*e+c,_=a*t+h*e+u;p<d&&(d=p),_<f&&(f=_),p>g&&(g=p),_>m&&(m=_),p=n*i+l*e+c,_=a*i+h*e+u,p<d&&(d=p),_<f&&(f=_),p>g&&(g=p),_>m&&(m=_),p=n*t+l*s+c,_=a*t+h*s+u,p<d&&(d=p),_<f&&(f=_),p>g&&(g=p),_>m&&(m=_),p=n*i+l*s+c,_=a*i+h*s+u,p<d&&(d=p),_<f&&(f=_),p>g&&(g=p),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=g,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:c,ty:u}=t,d=n*e+l*i+c,f=a*e+h*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+c,f=a*s+h*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+c,f=a*e+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+c,f=a*s+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,g=s.ty;for(let m=e;m<i;m+=2){let p=t[m],_=t[m+1],y=h*p+u*_+f,v=c*p+d*_+g;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,l=v>l?v:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var ee,Ye,Xi=x(()=>{mt();af();Ne();ee=new ji(F),Ye=new ji(wt)});var TB,Zy,Qy=x(()=>{mt();Ne();Xi();TB=new F,Zy={getFastGlobalBounds(r,t){t||(t=new wt),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ye.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(TB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ye.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ye.return(i))}}});function Os(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ee.get().identity(),i=Ih(r,s)):i=F.IDENTITY,Jy(r,e,i,t),s&&ee.return(s),e.isValid||e.set(0,0,0,0),e}function Jy(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ee.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)Jy(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,F.IDENTITY),Ye.return(t)}i||ee.return(s)}function Ih(r,t){let e=r.parent;return e&&(Ih(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Pn=x(()=>{mt();Xi()});function Fh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=i*n/255|0,c=s*a/255|0;return(l<<16)+(h<<8)+c}var uf=x(()=>{"use strict"});function Ls(r,t){return r===t_?t:t===t_?r:Fh(r,t)}var t_,df=x(()=>{uf();t_=16777215});function Cn(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var e_,r_=x(()=>{Pn();Xi();df();e_={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Ih(this,ee.get().identity());return r.appendFrom(this.localTransform,e),ee.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Cn(this.renderGroup.worldColor):this.parentRenderGroup?Cn(Ls(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ls(t,e.localColor),e=e.parent;return Cn(t)}}});function D(...r){ff!==i_&&(ff++,ff===i_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var ff,i_,At=x(()=>{"use strict";ff=0,i_=500});function Ds(r,t,e){return t.clear(),e||(e=F.IDENTITY),s_(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function s_(r,t,e,i,s){let o;if(s)o=ee.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ee.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let h=0;h<l.length;h++)s_(l[h],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,F.IDENTITY),Ye.return(t)}ee.return(o)}var kh=x(()=>{mt();Xi()});function pf(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&pf(s,t)}return t.didChange}var o_=x(()=>{"use strict"});var SB,n_,a_=x(()=>{mt();Ne();Pn();kh();o_();SB=new F,n_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new wt});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),pf(this,r),r.didChange&&Ds(this,r.localBounds,SB),r.localBounds},getBounds(r,t){return Os(this,r,t||new wt)}}});var l_,h_=x(()=>{"use strict";l_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function EB(r,t){return r._zIndex-t._zIndex}var c_,u_=x(()=>{"use strict";c_={_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(EB))}}});var d_,f_=x(()=>{or();Xi();d_={getGlobalPosition(r=new ht,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ee.get(),e);return t=i.apply(r,t),ee.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ee.get(),i);return e=s.applyInverse(r,e),ee.return(s),e}}});var Ns,mf=x(()=>{be();Ns=class{constructor(){this.uid=at("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function ti(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 gf(r){return!(r&r-1)&&!!r}var Rn=x(()=>{"use strict"});function Gh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var xf=x(()=>{"use strict"});function wB(r){let t=p_[r];return t===void 0&&(p_[r]=at("resource")),t}var p_,m_,Uh,yf=x(()=>{Se();be();Vt();p_=Object.create(null);m_=class g_ extends Rt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...g_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){$(J,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=wB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};m_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Uh=m_});var x_,St,He=x(()=>{Se();Rn();xf();be();yf();x_=class y_ extends Rt{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...y_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Uh(Gh(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=at("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=at("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=gf(this.pixelWidth)&&gf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};x_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};St=x_});function AB(){for(let r=0;r<16;r++){let t=[];_f.push(t);for(let e=0;e<16;e++){let i=Oh(Yi[r]*Yi[e]+Ki[r]*qi[e]),s=Oh(qi[r]*Yi[e]+Zi[r]*qi[e]),o=Oh(Yi[r]*Ki[e]+Ki[r]*Zi[e]),n=Oh(qi[r]*Ki[e]+Zi[r]*Zi[e]);for(let a=0;a<16;a++)if(Yi[a]===i&&qi[a]===s&&Ki[a]===o&&Zi[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new F;t.set(Yi[r],qi[r],Ki[r],Zi[r],0,0),__.push(t)}}var Yi,qi,Ki,Zi,_f,__,Oh,Lt,b_=x(()=>{mt();Yi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],qi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ki=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],_f=[],__=[],Oh=Math.sign;AB();Lt={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=>Yi[r],uY:r=>qi[r],vX:r=>Ki[r],vY:r=>Zi[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>_f[r][t],sub:(r,t)=>_f[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=__[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var bf,v_=x(()=>{"use strict";bf=()=>{}});var Qi,vf=x(()=>{B();He();Qi=class extends St{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Qi.extension=T.TextureSource});var T_,Hs,Tf=x(()=>{mt();T_=new F,Hs=class{constructor(t,e){this.mapCoord=new F,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let i=t.orig,s=t.trim;s&&(T_.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(T_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var R,bt=x(()=>{Se();b_();ne();be();Vt();v_();vf();He();Tf();R=class extends Rt{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new et,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new St,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Hs(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,h=this.rotate;if(h){let c=a/2,u=l/2,d=o+c,f=n+u;h=Lt.add(h,Lt.NW),t.x0=d+c*Lt.uX(h),t.y0=f+u*Lt.uY(h),h=Lt.add(h,2),t.x1=d+c*Lt.uX(h),t.y1=f+u*Lt.uY(h),h=Lt.add(h,2),t.x2=d+c*Lt.uX(h),t.y2=f+u*Lt.uY(h),h=Lt.add(h,2),t.x3=d+c*Lt.uX(h),t.y3=f+u*Lt.uY(h)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return $(J,"Texture.baseTexture is now Texture.source"),this._source}};R.EMPTY=new R({label:"EMPTY",source:new St({label:"EMPTY"})});R.EMPTY.destroy=bf;R.WHITE=new R({source:new Qi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});R.WHITE.destroy=bf});var PB,Sf,Wt,vi=x(()=>{Rn();He();bt();PB=0,Sf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new St({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new R({source:s,label:`texturePool_${PB++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ti(o),n=ti(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Wt=new Sf});var Lh,S_=x(()=>{mt();mf();vi();Lh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new F,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 Ns,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Wt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new F),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new F),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new F),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function E_(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var w_=x(()=>{"use strict"});var Ef,wf,Af,Vs,Mn,Ji,yt,yr=x(()=>{Se();ye();Fy();B();mt();sf();Ph();be();Vt();Me();Ny();Vy();zy();Xy();qy();Qy();r_();a_();h_();u_();f_();S_();w_();Ef=new _e(null),wf=new _e(null),Af=new _e(null,1,1),Vs=1,Mn=2,Ji=4,yt=class r extends Rt{constructor(t={}){super(),this.uid=at("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 F,this.relativeGroupTransform=new F,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new _e(this,0,0),this._scale=Af,this._pivot=wf,this._skew=Ef,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=[],E_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){$("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),U.mixin(r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||$(J,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=tt.get(Lh,this),this.groupTransform=F.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),tt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new F),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Gy}set angle(t){this.rotation=t*Uy}get pivot(){return this._pivot===wf&&(this._pivot=new _e(this,0,0)),this._pivot}set pivot(t){this._pivot===wf&&(this._pivot=new _e(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ef&&(this._skew=new _e(this,0,0)),this._skew}set skew(t){this._skew===Ef&&(this._skew=new _e(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Af&&(this._scale=new _e(this,1,1)),this._scale}set scale(t){this._scale===Af&&(this._scale=new _e(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,h=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(l*e.a+h*e.c),e.ty=o._y-(l*e.b+h*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Vs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=it.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Vs,this._onUpdate())}get tint(){return Cn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Mn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ji,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ji,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Ji,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};U.mixin(yt,Hy,Zy,d_,l_,n_,jy,Yy,c_,Iy,Dy,e_,Wy)});var Ti,Dh=x(()=>{or();Ti=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ht,this.page=new ht,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function CB(r){return function(t){return t.test(r)}}function Si(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=CB(e),o={apple:{phone:s(Pf)&&!s(ei),ipod:s(A_),tablet:!s(Pf)&&(s(P_)||U_(t))&&!s(ei),universal:s(C_),device:(s(Pf)||s(A_)||s(P_)||s(C_)||U_(t))&&!s(ei)},amazon:{phone:s(Ws),tablet:!s(Ws)&&s(Nh),device:s(Ws)||s(Nh)},android:{phone:!s(ei)&&s(Ws)||!s(ei)&&s(Cf),tablet:!s(ei)&&!s(Ws)&&!s(Cf)&&(s(Nh)||s(R_)),device:!s(ei)&&(s(Ws)||s(Nh)||s(Cf)||s(R_))||s(/\bokhttp\b/i)},windows:{phone:s(ei),tablet:s(M_),device:s(ei)||s(M_)},other:{blackberry:s(B_),blackberry10:s(I_),opera:s(F_),firefox:s(G_),chrome:s(k_),device:s(B_)||s(I_)||s(F_)||s(G_)||s(k_)},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 Pf,A_,P_,C_,Cf,R_,Ws,Nh,ei,M_,B_,I_,F_,k_,G_,U_,Rf=x(()=>{Pf=/iPhone/i,A_=/iPod/i,P_=/iPad/i,C_=/\biOS-universal(?:.+)Mac\b/i,Cf=/\bAndroid(?:.+)Mobile\b/i,R_=/Android/i,Ws=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Nh=/Silk/i,ei=/Windows Phone/i,M_=/\bWindows(?:.+)ARM\b/i,B_=/BlackBerry/i,I_=/BB10/i,F_=/Opera Mini/i,k_=/\b(CriOS|Chrome)(?:.+)Mobile/i,G_=/Mobile(?:.+)Firefox\b/i,U_=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var Mf=x(()=>{Rf();Rf()});var RB,O_,L_=x(()=>{Mf();RB=Si.default??Si,O_=RB(globalThis.navigator)});var MB,Hh,BB,IB,D_,N_,FB,kB,GB,Bf,V_,W_=x(()=>{Dh();B();L_();hf();MB=9,Hh=100,BB=0,IB=0,D_=2,N_=1,FB=-1e3,kB=-1e3,GB=2,Bf=class H_{constructor(t,e=O_){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${N_}px`,t.style.height=`${N_}px`,t.style.position="absolute",t.style.top=`${FB}px`,t.style.left=`${kB}px`,t.style.zIndex=GB.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Hh}px`,this._div.style.height=`${Hh}px`,this._div.style.position="absolute",this._div.style.top=`${BB}px`,this._div.style.left=`${IB}px`,this._div.style.zIndex=D_.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...H_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Ch(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,h=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*h}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*h}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
6
|
+
Deprecated since v${r}`),console.warn(i))),r_[t]=!0}var r_,et,i_,Wt=x(()=>{"use strict";r_={},et="8.0.0",i_="8.3.4"});var qi,Tf=x(()=>{"use strict";qi=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Sf,rt,Ie=x(()=>{Tf();Sf=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new qi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},rt=new Sf});var s_,o_=x(()=>{Wt();s_={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){$("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Gh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var wf=x(()=>{"use strict"});var n_,a_=x(()=>{wf();Wt();n_={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Gh(this.children,r,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||$(et,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var l_,h_=x(()=>{"use strict";l_={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ti,Uh=x(()=>{"use strict";ti=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var Ef,Oh,c_=x(()=>{B();Ie();Ef=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let i=this._tests[e];if(i.test(t))return rt.get(i.maskClass,t)}return t}returnMaskEffect(t){rt.return(t)}},Oh=new Ef;U.handleByList(T.MaskEffect,Oh._effectClasses)});var u_,d_=x(()=>{Uh();c_();u_={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),Oh.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=Oh.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new ti);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ti),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var f_,p_=x(()=>{Wt();f_={label:null,get name(){return $(et,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){$(et,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Lh,it,ae=x(()=>{or();Lh=[new ut,new ut,new ut,new ut],it=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,h=i*(1-s),c=i-h,u=a-h,d=a+o+h,f=l-h,m=l+n+h,g=a+c,p=a+o-c,v=l+c,y=l+n-c;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>g&&t<p&&e>v&&e<y)}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Lh[0].set(t.left,t.top),l=Lh[1].set(t.left,t.bottom),h=Lh[2].set(t.right,t.top),c=Lh[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),m=d*i+f*o,g=d*s+f*o,p=d*i+f*n,v=d*s+f*n;if(Math.max(m,g,p,v)<=d*a.x+f*a.y||Math.min(m,g,p,v)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),_=u*(h.x-a.x),w=y*i+_*o,E=y*s+_*o,b=y*i+_*n,S=y*s+_*n;return!(Math.max(w,E,b,S)<=y*a.x+_*a.y||Math.min(w,E,b,S)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var m_,Et,Ne=x(()=>{mt();ae();m_=new F,Et=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=m_,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new it);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=m_,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,m=this.maxX,g=this.maxY,p=n*t+l*e+c,v=a*t+h*e+u;p<d&&(d=p),v<f&&(f=v),p>m&&(m=p),v>g&&(g=v),p=n*i+l*e+c,v=a*i+h*e+u,p<d&&(d=p),v<f&&(f=v),p>m&&(m=p),v>g&&(g=v),p=n*t+l*s+c,v=a*t+h*s+u,p<d&&(d=p),v<f&&(f=v),p>m&&(m=p),v>g&&(g=v),p=n*i+l*s+c,v=a*i+h*s+u,p<d&&(d=p),v<f&&(f=v),p>m&&(m=p),v>g&&(g=v),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:c,ty:u}=t,d=n*e+l*i+c,f=a*e+h*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+c,f=a*s+h*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+c,f=a*e+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+c,f=a*s+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let g=e;g<i;g+=2){let p=t[g],v=t[g+1],y=h*p+u*v+f,_=c*p+d*v+m;o=y<o?y:o,n=_<n?_:n,a=y>a?y:a,l=_>l?_:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var ee,Ye,Ki=x(()=>{mt();Tf();Ne();ee=new qi(F),Ye=new qi(Et)});var tB,g_,x_=x(()=>{mt();Ne();Ki();tB=new F,g_={getFastGlobalBounds(r,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ye.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(tB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ye.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ye.return(i))}}});function Hs(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ee.get().identity(),i=Dh(r,s)):i=F.IDENTITY,y_(r,e,i,t),s&&ee.return(s),e.isValid||e.set(0,0,0,0),e}function y_(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ee.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)y_(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,F.IDENTITY),Ye.return(t)}i||ee.return(s)}function Dh(r,t){let e=r.parent;return e&&(Dh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var In=x(()=>{mt();Ki()});function Nh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=i*n/255|0,c=s*a/255|0;return(l<<16)+(h<<8)+c}var Af=x(()=>{"use strict"});function Vs(r,t){return r===__?t:t===__?r:Nh(r,t)}var __,Pf=x(()=>{Af();__=16777215});function Bn(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var b_,v_=x(()=>{In();Ki();Pf();b_={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Dh(this,ee.get().identity());return r.appendFrom(this.localTransform,e),ee.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Bn(this.renderGroup.worldColor):this.parentRenderGroup?Bn(Vs(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Vs(t,e.localColor),e=e.parent;return Bn(t)}}});function D(...r){Cf!==T_&&(Cf++,Cf===T_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Cf,T_,At=x(()=>{"use strict";Cf=0,T_=500});function Ws(r,t,e){return t.clear(),e||(e=F.IDENTITY),S_(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function S_(r,t,e,i,s){let o;if(s)o=ee.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ee.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let h=0;h<l.length;h++)S_(l[h],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,F.IDENTITY),Ye.return(t)}ee.return(o)}var Hh=x(()=>{mt();Ki()});function Rf(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Rf(s,t)}return t.didChange}var w_=x(()=>{"use strict"});var eB,E_,A_=x(()=>{mt();Ne();In();Hh();w_();eB=new F,E_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Rf(this,r),r.didChange&&Ws(this,r.localBounds,eB),r.localBounds},getBounds(r,t){return Hs(this,r,t||new Et)}}});var P_,C_=x(()=>{"use strict";P_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function rB(r,t){return r._zIndex-t._zIndex}var R_,M_=x(()=>{"use strict";R_={_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(rB))}}});var I_,B_=x(()=>{or();Ki();I_={getGlobalPosition(r=new ut,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ee.get(),e);return t=i.apply(r,t),ee.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ee.get(),i);return e=s.applyInverse(r,e),ee.return(s),e}}});var zs,Mf=x(()=>{Te();zs=class{constructor(){this.uid=ct("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function ei(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 If(r){return!(r&r-1)&&!!r}var Fn=x(()=>{"use strict"});function Vh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Bf=x(()=>{"use strict"});function iB(r){let t=F_[r];return t===void 0&&(F_[r]=ct("resource")),t}var F_,k_,Wh,Ff=x(()=>{Ee();Te();Wt();F_=Object.create(null);k_=class G_ extends Mt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...G_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){$(et,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=iB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};k_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Wh=k_});var U_,St,He=x(()=>{Ee();Fn();Bf();Te();Ff();U_=class O_ extends Mt{constructor(t={}){super(),this.options=t,this.uid=ct("textureSource"),this._resourceType="textureSource",this._resourceId=ct("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...O_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Wh(Vh(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ct("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=ct("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=If(this.pixelWidth)&&If(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};U_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};St=U_});function sB(){for(let r=0;r<16;r++){let t=[];kf.push(t);for(let e=0;e<16;e++){let i=zh(Zi[r]*Zi[e]+Ji[r]*Qi[e]),s=zh(Qi[r]*Zi[e]+ts[r]*Qi[e]),o=zh(Zi[r]*Ji[e]+Ji[r]*ts[e]),n=zh(Qi[r]*Ji[e]+ts[r]*ts[e]);for(let a=0;a<16;a++)if(Zi[a]===i&&Qi[a]===s&&Ji[a]===o&&ts[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new F;t.set(Zi[r],Qi[r],Ji[r],ts[r],0,0),L_.push(t)}}var Zi,Qi,Ji,ts,kf,L_,zh,Dt,D_=x(()=>{mt();Zi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Qi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ji=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ts=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],kf=[],L_=[],zh=Math.sign;sB();Dt={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=>Zi[r],uY:r=>Qi[r],vX:r=>Ji[r],vY:r=>ts[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>kf[r][t],sub:(r,t)=>kf[r][Dt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Dt.S:Dt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Dt.E:Dt.W:t>0?r>0?Dt.SE:Dt.SW:r>0?Dt.NE:Dt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=L_[Dt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Gf,N_=x(()=>{"use strict";Gf=()=>{}});var es,Uf=x(()=>{B();He();es=class extends St{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};es.extension=T.TextureSource});var H_,$s,Of=x(()=>{mt();H_=new F,$s=class{constructor(t,e){this.mapCoord=new F,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let i=t.orig,s=t.trim;s&&(H_.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(H_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var R,_t=x(()=>{Ee();D_();ae();Te();Wt();N_();Uf();He();Of();R=class extends Mt{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=ct("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new it,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new St,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new $s(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,h=this.rotate;if(h){let c=a/2,u=l/2,d=o+c,f=n+u;h=Dt.add(h,Dt.NW),t.x0=d+c*Dt.uX(h),t.y0=f+u*Dt.uY(h),h=Dt.add(h,2),t.x1=d+c*Dt.uX(h),t.y1=f+u*Dt.uY(h),h=Dt.add(h,2),t.x2=d+c*Dt.uX(h),t.y2=f+u*Dt.uY(h),h=Dt.add(h,2),t.x3=d+c*Dt.uX(h),t.y3=f+u*Dt.uY(h)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return $(et,"Texture.baseTexture is now Texture.source"),this._source}};R.EMPTY=new R({label:"EMPTY",source:new St({label:"EMPTY"})});R.EMPTY.destroy=Gf;R.WHITE=new R({source:new es({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});R.WHITE.destroy=Gf});var oB,Lf,zt,Si=x(()=>{Fn();He();_t();oB=0,Lf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new St({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new R({source:s,label:`texturePool_${oB++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ei(o),n=ei(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},zt=new Lf});var $h,V_=x(()=>{mt();Mf();Si();$h=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new F,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 zs,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(zt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new F),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new F),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new F),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function W_(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var z_=x(()=>{"use strict"});var Df,Nf,Hf,Xs,kn,rs,ht,_r=x(()=>{Ee();be();Qy();B();mt();_f();kh();Te();Wt();Ie();o_();a_();h_();d_();p_();x_();v_();A_();C_();M_();B_();V_();z_();Df=new ve(null),Nf=new ve(null),Hf=new ve(null,1,1),Xs=1,kn=2,rs=4,ht=class r extends Mt{constructor(t={}){super(),this.uid=ct("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 F,this.relativeGroupTransform=new F,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ve(this,0,0),this._scale=Hf,this._pivot=Nf,this._skew=Df,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=[],W_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){$("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),U.mixin(r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||$(et,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=rt.get($h,this),this.groupTransform=F.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),rt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new F),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*t_}set angle(t){this.rotation=t*e_}get pivot(){return this._pivot===Nf&&(this._pivot=new ve(this,0,0)),this._pivot}set pivot(t){this._pivot===Nf&&(this._pivot=new ve(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Df&&(this._skew=new ve(this,0,0)),this._skew}set skew(t){this._skew===Df&&(this._skew=new ve(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Hf&&(this._scale=new ve(this,1,1)),this._scale}set scale(t){this._scale===Hf&&(this._scale=new ve(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,h=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(l*e.a+h*e.c),e.ty=o._y-(l*e.b+h*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Xs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ot.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Xs,this._onUpdate())}get tint(){return Bn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=kn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=rs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};U.mixin(ht,n_,g_,I_,P_,E_,u_,f_,R_,Zy,s_,b_,l_)});var wi,Xh=x(()=>{or();wi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ut,this.page=new ut,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function nB(r){return function(t){return t.test(r)}}function Ei(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=nB(e),o={apple:{phone:s(Vf)&&!s(ri),ipod:s($_),tablet:!s(Vf)&&(s(X_)||eb(t))&&!s(ri),universal:s(j_),device:(s(Vf)||s($_)||s(X_)||s(j_)||eb(t))&&!s(ri)},amazon:{phone:s(js),tablet:!s(js)&&s(jh),device:s(js)||s(jh)},android:{phone:!s(ri)&&s(js)||!s(ri)&&s(Wf),tablet:!s(ri)&&!s(js)&&!s(Wf)&&(s(jh)||s(Y_)),device:!s(ri)&&(s(js)||s(jh)||s(Wf)||s(Y_))||s(/\bokhttp\b/i)},windows:{phone:s(ri),tablet:s(q_),device:s(ri)||s(q_)},other:{blackberry:s(K_),blackberry10:s(Z_),opera:s(Q_),firefox:s(tb),chrome:s(J_),device:s(K_)||s(Z_)||s(Q_)||s(tb)||s(J_)},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 Vf,$_,X_,j_,Wf,Y_,js,jh,ri,q_,K_,Z_,Q_,J_,tb,eb,zf=x(()=>{Vf=/iPhone/i,$_=/iPod/i,X_=/iPad/i,j_=/\biOS-universal(?:.+)Mac\b/i,Wf=/\bAndroid(?:.+)Mobile\b/i,Y_=/Android/i,js=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,jh=/Silk/i,ri=/Windows Phone/i,q_=/\bWindows(?:.+)ARM\b/i,K_=/BlackBerry/i,Z_=/BB10/i,Q_=/Opera Mini/i,J_=/\b(CriOS|Chrome)(?:.+)Mobile/i,tb=/Mobile(?:.+)Firefox\b/i,eb=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var $f=x(()=>{zf();zf()});var aB,rb,ib=x(()=>{$f();aB=Ei.default??Ei,rb=aB(globalThis.navigator)});var lB,Yh,hB,cB,sb,ob,uB,dB,fB,Xf,ab,lb=x(()=>{Xh();B();ib();wf();lB=9,Yh=100,hB=0,cB=0,sb=2,ob=1,uB=-1e3,dB=-1e3,fB=2,Xf=class nb{constructor(t,e=rb){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${ob}px`,t.style.height=`${ob}px`,t.style.position="absolute",t.style.top=`${uB}px`,t.style.left=`${dB}px`,t.style.zIndex=fB.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Yh}px`,this._div.style.height=`${Yh}px`,this._div.style.position="absolute",this._div.style.top=`${hB}px`,this._div.style.left=`${cB}px`,this._div.style.zIndex=sb.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...nb.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Gh(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,h=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*h}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*h}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${r}`),console.warn(i))),Oy[t]=!0}var Oy,J,Ly,Vt=x(()=>{"use s
|
|
|
16
16
|
-webkit-user-select: none;
|
|
17
17
|
-moz-user-select: none;
|
|
18
18
|
-ms-user-select: none;
|
|
19
|
-
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Hh}px`,e.style.height=`${Hh}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=D_.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ti(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==MB||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Bf.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"accessibility"};Bf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};V_=Bf});var z_,$_=x(()=>{"use strict";z_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var j_=x(()=>{B();yr();W_();$_();U.add(V_);U.mixin(yt,z_)});var Bn,X_=x(()=>{B();Bn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Bn.extension=T.Application});var Br,In=x(()=>{"use strict";Br=(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))(Br||{})});var zs,Y_=x(()=>{"use strict";zs=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var q_,ae,$s=x(()=>{In();Y_();q_=class qe{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 zs(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Br.NORMAL){return this._addListener(new zs(t,e,i))}addOnce(t,e,i=Br.NORMAL){return this._addListener(new zs(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};q_.targetFPMS=.06;ae=q_});var Fn,K_=x(()=>{B();In();$s();Fn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Br.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ae.shared:new ae,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Fn.extension=T.Application});var If=x(()=>{B();X_();K_();U.add(Bn);U.add(Fn)});var Ff,Ir,kf=x(()=>{In();$s();Ff=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(ae.system.add(this._tickerUpdate,this,Br.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ae.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Ir=new Ff});var ri,Vh=x(()=>{or();Dh();ri=class extends Ti{constructor(){super(...arguments),this.client=new ht,this.movement=new ht,this.offset=new ht,this.global=new ht,this.screen=new ht}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,l,h,c,u,d,f,g,m){throw new Error("Method not implemented.")}}});var Be,Gf=x(()=>{Vh();Be=class extends ri{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Fr,Uf=x(()=>{Vh();Fr=class extends ri{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Fr.DOM_DELTA_PIXEL=0;Fr.DOM_DELTA_LINE=1;Fr.DOM_DELTA_PAGE=2});var UB,OB,kn,Wh,Z_=x(()=>{Se();or();At();kf();Vh();Gf();Uf();UB=2048,OB=new ht,kn=new ht,Wh=class{constructor(t){this.dispatch=new Rt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else D(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ir.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,OB.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<UB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,o,n||o(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let g=t.isInteractive();(f.length>0||g)&&(g&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,h=i;for(let c=l.length-1;c>=0;c--){let u=l[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,h,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,kn),!t.hitArea.contains(kn.x,kn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,kn),t.containsPoint(kn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Fr)){D("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Be);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Fr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Be);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Be&&e instanceof Be&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof ri&&e instanceof ri&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var LB,DB,Lf,zh,Df=x(()=>{B();Z_();kf();Gf();Uf();LB=1,DB={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Lf=class Of{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Wh(null),Ir.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Be(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Of.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Of._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){let o=e[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ir.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Ir.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ir.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Ir.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=LB),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=DB[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Lf.extension={name:"events",type:[T.WebGLSystem,T.CanvasSystem,T.WebGPUSystem],priority:-1};Lf.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};zh=Lf});var Q_,J_=x(()=>{Df();Dh();Q_={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??zh.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Ti))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var tb=x(()=>{B();yr();Df();J_();U.add(zh);U.mixin(yt,Q_)});var Gn,eb=x(()=>{B();Gn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,h=s.height*a.y;o.style.transformOrigin=`${l}px ${h}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-h})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Gn.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"dom"}});var Ei,$h=x(()=>{Ne();yr();Ei=class extends yt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new wt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let h=0;h<l;h++)a[h].collectRenderables(t,e,i)}}});var rb=x(()=>{B();eb();U.add(Gn)});var pe,ii=x(()=>{"use strict";pe=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(pe||{})});var ib,sb=x(()=>{"use strict";ib={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var ob,j,Mt=x(()=>{sb();ob=ib,j={get(){return ob},set(r){ob=r}}});function _r(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Un(r){return r.split("?")[0].split("#")[0]}function NB(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HB(r,t,e){return r.replace(new RegExp(NB(t),"g"),e)}function VB(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var le,ts=x(()=>{Mt();le={toPosix(r){return HB(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){_r(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(_r(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Un(this.toPosix(t??j.get().getBaseUrl())),s=Un(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?le.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(_r(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=VB(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return _r(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(_r(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(_r(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){_r(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){_r(r),t&&_r(t),r=Un(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){_r(r),r=Un(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){_r(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Un(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,h=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}l===-1&&(h=!1,l=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||l===-1||u===0||u===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,l)):(t.name=r.slice(a,n),t.base=r.slice(a,l)),t.ext=r.slice(n,l)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ie,On=x(()=>{"use strict";Ie=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function nb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?nb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function ab(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),nb(r,s,0,e,i)}else i.push(r);return i}var lb=x(()=>{"use strict"});var es,jh=x(()=>{"use strict";es=r=>!Array.isArray(r)});function WB(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Ke,js=x(()=>{At();ts();On();lb();jh();Ke=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Ie(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&D("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{let h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...o,alias:l,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&D(`[Resolver] already has key: ${o} overwriting`)},Ie(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,c=Ie(n).map(f=>typeof f=="string"?ab(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(g=>{let m={};if(typeof g!="object"){m.src=g;for(let p=0;p<this._parsers.length;p++){let _=this._parsers[p];if(_.test(g)){m=_.parse(g);break}}}else a=g.data??a,l=g.format??l,h=g.loadParser??h,m={...m,...g};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:l,loadParser:h}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=es(t);t=Ie(t);let i={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=es(t);t=Ie(t);let i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(c=>c[a]?c[a]===l:!1);h.length&&(o=h)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=le.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??WB(t.src),t}};Ke.RETINA_PREFIX=/@([0-9\.]+)x/});var Ln,Nf=x(()=>{"use strict";Ln=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var hb,wi,Hf=x(()=>{ne();bt();hb=class Dn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof R?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Dn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Dn.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new et(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?a=new et(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new et(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new et(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new R({source:this.textureSource,frame:a,orig:c,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){let s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Dn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Dn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};hb.BATCH_SIZE=1e3;wi=hb});function cb(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=le.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=cb([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var zB,ub,db=x(()=>{ii();js();Nf();B();bt();ts();Hf();zB=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];ub={extension:T.Asset,cache:{test:r=>r instanceof wi,getCacheableAssets:(r,t)=>cb(r,t,!1)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&zB.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:T.LoadParser,priority:pe.Normal,name:"spritesheetLoader"},async testParse(r,t){return le.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=le.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof R)a=i;else{let c=Ln(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let l=new wi(a.source,r);await l.parse();let h=r?.meta?.related_multi_packs;if(Array.isArray(h)){let c=[];for(let d of h){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Ln(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);l.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var Xh=x(()=>{B();db();U.add(ub)});function Yh(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var Vf=x(()=>{"use strict"});var Gt,Nn=x(()=>{Ph();bt();Vf();Vt();$h();Gt=class r extends Ei{constructor(t=R.EMPTY){t instanceof R&&(t={texture:t});let{texture:e=R.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new _e({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof R?new r(t):new r(R.from(t,e))}set texture(t){t||(t=R.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return Yh(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return $("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function qh(r,t,e){let i=$B;r.measurable=!0,Os(r,e,i),t.addBoundsMask(i),r.measurable=!1}var $B,Wf=x(()=>{Ne();Pn();$B=new wt});function Kh(r,t,e){let i=Ye.get();r.measurable=!0;let s=ee.get().identity(),o=fb(r,e,s);Ds(r,i,o),r.measurable=!1,t.addBoundsMask(i),ee.return(s),Ye.return(i)}function fb(r,t,e){return r?(r!==t&&(fb(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(D("Mask bounds, renderable is not inside the root container"),e)}var zf=x(()=>{kh();Xi();At()});var Hn,pb=x(()=>{B();Nn();Wf();zf();Hn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Gt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||qh(this.mask,t,e)}addLocalBounds(t,e){Kh(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Gt}};Hn.extension=T.MaskEffect});var Vn,mb=x(()=>{B();Vn=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};Vn.extension=T.MaskEffect});var Wn,gb=x(()=>{B();yr();Wf();zf();Wn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){qh(this.mask,t,e)}addLocalBounds(t,e){Kh(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof yt}};Wn.extension=T.MaskEffect});var Ee,Xs=x(()=>{Mt();B();He();Ee=class extends St{constructor(t){t.resource||(t.resource=j.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Ee.extension=T.TextureSource});var Ve,Ys=x(()=>{Mt();B();At();He();Ve=class extends St{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=j.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,D("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Ve.extension=T.TextureSource});async function Zh(){return $f??($f=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),$f}var $f,jf=x(()=>{"use strict"});var Qh,qs,Xf=x(()=>{B();$s();jf();He();Qh=class xb extends St{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...xb.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=ae.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Zh(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ae.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ae.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ae.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Qh.extension=T.TextureSource;Qh.defaultOptions={...St.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Qh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};qs=Qh});var Yf,vt,Ai=x(()=>{At();On();Yf=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||D(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Ie(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&D("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){D(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},vt=new Yf});function yb(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<qf.length;s++){let o=qf[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function _b(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&vt.has(i))return vt.get(i);let o=new R({source:yb(s)});return o.on("destroy",()=>{vt.has(i)&&vt.remove(i)}),t||vt.set(i,o),o}function bb(r,t=!1){return typeof r=="string"?vt.get(r):r instanceof St?new R({source:r}):_b(r,t)}var qf,Kf=x(()=>{Ai();B();He();bt();qf=[];U.handleByList(T.TextureSource,qf);R.from=bb;St.from=yb});var Jh=x(()=>{B();pb();mb();gb();vf();Xs();Ys();Xf();Kf();U.add(Hn,Vn,Wn,qs,Ve,Ee,Qi)});var me,Pi=x(()=>{"use strict";me=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function ec(){return(!tc||tc?.isContextLost())&&(tc=j.get().createCanvas().getContext("webgl",{})),tc}var tc,Zf=x(()=>{Mt()});function XB(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
20
|
-
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function
|
|
21
|
-
`)});function nr(){if(Ks)return Ks;let r=ec();return Ks=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),Ks=vb(Ks,r),r.getExtension("WEBGL_lose_context")?.loseContext(),Ks}var Ks,rs=x(()=>{Zf();Tb();Ks=null});function Zs(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return Sb[e]||YB(r,t,e)}function YB(r,t,e){let i={},s=0;Qf||(Qf=nr());for(let n=0;n<Qf;n++){let a=n<t?r[n]:R.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new me(i);return Sb[e]=o,o}var Sb,Qf,rc=x(()=>{Pi();bt();rs();Sb={};Qf=0});var kr,Jf=x(()=>{"use strict";kr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function zn(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var tp=x(()=>{"use strict"});var Eb,Ft,is=x(()=>{"use strict";Eb={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ft=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Ft||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&Eb[r]||r}var $n=x(()=>{is()});var ic,wb=x(()=>{"use strict";ic=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function Ab(){return rp>0?Cb[--rp]:new ep}function Pb(r){Cb[rp++]=r}var ep,Cb,rp,jn,Rb,Mb,Bb=x(()=>{be();Jf();tp();$n();rs();wb();ep=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new ic,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Cb=[],rp=0;jn=0,Rb=class sc{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],sc.defaultOptions.maxTextures=sc.defaultOptions.maxTextures??nr(),t={...sc.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new kr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Pb(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let i=Ab(),s=i.textures;s.clear();let o=e[this.elementStart],n=si(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",g=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let p=e[m];e[m]=null;let y=p.texture._source,v=si(p.blendMode,y),b=n!==v||a!==p.topology;if(y._batchTick===jn&&!b){p._textureId=y._textureBindLocation,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,h,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,h,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize)),p._batch=i;continue}y._batchTick=jn,(s.count>=g||b)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=p.topology,i=Ab(),s=i.textures,s.clear(),++jn),p._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,p._batch=i,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,h,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,h,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++jn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=i,++jn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),i=new kr(e);zn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else zn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[i++]=s+o[h+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)Pb(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};Rb.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Mb=Rb});var ot,oi=x(()=>{"use strict";ot=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(ot||{})});var jt,Ci=x(()=>{Se();be();oi();jt=class extends Rt{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ot.STATIC)}set static(t){t?this.descriptor.usage|=ot.STATIC:this.descriptor.usage&=~ot.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=at("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function ip(r,t){if(!(r instanceof jt)){let e=t?ot.INDEX:ot.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=ot.INDEX|ot.COPY_DST):(r=new Float32Array(r),e=ot.VERTEX|ot.COPY_DST)),r=new jt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var Ib=x(()=>{Ci();oi()});function Fb(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let d=c;d<s.length;d+=u){let f=s[d],g=s[d+1];f>a&&(a=f),g>l&&(l=g),f<o&&(o=f),g<n&&(n=g)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var kb=x(()=>{"use strict"});function qB(r){return(r instanceof jt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=ip(r.buffer,!1),r}var ar,Qs=x(()=>{Se();Ne();be();Ci();Ib();kb();ar=class extends Rt{constructor(t={}){super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new wt,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let i=qB(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=ip(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Fb(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var KB,ZB,oc,Gb=x(()=>{Ci();oi();Qs();KB=new Float32Array(1),ZB=new Uint32Array(1),oc=class extends ar{constructor(){let e=new jt({data:KB,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),i=new jt({data:ZB,label:"index-batch-buffer",usage:ot.INDEX|ot.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function ni(r,t){let e=Ub[r];return e===void 0&&(sp[t]===void 0&&(sp[t]=1),Ub[r]=e=sp[t]++),e}var sp,Ub,Xn=x(()=>{"use strict";sp=Object.create(null),Ub=Object.create(null)});function Ob(){if(!nc){nc="mediump";let r=ec();r&&r.getShaderPrecisionFormat&&(nc=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return nc}var nc,Lb=x(()=>{Zf()});function Db(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
|
|
19
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Yh}px`,e.style.height=`${Yh}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=sb.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new wi(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==lB||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Xf.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"accessibility"};Xf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};ab=Xf});var hb,cb=x(()=>{"use strict";hb={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var ub=x(()=>{B();_r();lb();cb();U.add(ab);U.mixin(ht,hb)});var Gn,db=x(()=>{B();Gn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Gn.extension=T.Application});var Br,Un=x(()=>{"use strict";Br=(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))(Br||{})});var Ys,fb=x(()=>{"use strict";Ys=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var pb,le,qs=x(()=>{Un();fb();pb=class qe{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 Ys(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Br.NORMAL){return this._addListener(new Ys(t,e,i))}addOnce(t,e,i=Br.NORMAL){return this._addListener(new Ys(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};pb.targetFPMS=.06;le=pb});var On,mb=x(()=>{B();Un();qs();On=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Br.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?le.shared:new le,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};On.extension=T.Application});var jf=x(()=>{B();db();mb();U.add(Gn);U.add(On)});var Yf,Fr,qf=x(()=>{Un();qs();Yf=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(le.system.add(this._tickerUpdate,this,Br.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(le.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Fr=new Yf});var ii,qh=x(()=>{or();Xh();ii=class extends wi{constructor(){super(...arguments),this.client=new ut,this.movement=new ut,this.offset=new ut,this.global=new ut,this.screen=new ut}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,l,h,c,u,d,f,m,g){throw new Error("Method not implemented.")}}});var Be,Kf=x(()=>{qh();Be=class extends ii{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var kr,Zf=x(()=>{qh();kr=class extends ii{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};kr.DOM_DELTA_PIXEL=0;kr.DOM_DELTA_LINE=1;kr.DOM_DELTA_PAGE=2});var pB,mB,Ln,Kh,gb=x(()=>{Ee();or();At();qf();qh();Kf();Zf();pB=2048,mB=new ut,Ln=new ut,Kh=class{constructor(t){this.dispatch=new Mt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else D(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Fr.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,mB.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<pB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Fr.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,o,n||o(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Fr.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,h=i;for(let c=l.length-1;c>=0;c--){let u=l[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,h,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Ln),!t.hitArea.contains(Ln.x,Ln.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Ln),t.containsPoint(Ln)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Be)){D("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof kr)){D("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Be);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(kr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Be);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Be&&e instanceof Be&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof ii&&e instanceof ii&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var gB,xB,Jf,Zh,tp=x(()=>{B();gb();qf();Kf();Zf();gB=1,xB={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Jf=class Qf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Kh(null),Fr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Be(null),this._rootWheelEvent=new kr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Qf.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Qf._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){let o=e[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Fr.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Fr.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Fr.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Fr.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=gB),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=xB[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Jf.extension={name:"events",type:[T.WebGLSystem,T.CanvasSystem,T.WebGPUSystem],priority:-1};Jf.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Zh=Jf});var xb,yb=x(()=>{tp();Xh();xb={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Zh.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof wi))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var _b=x(()=>{B();_r();tp();yb();U.add(Zh);U.mixin(ht,xb)});var Dn,bb=x(()=>{B();Dn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,h=s.height*a.y;o.style.transformOrigin=`${l}px ${h}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-h})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Dn.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"dom"}});var Ai,Qh=x(()=>{Ne();_r();Ai=class extends ht{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Et(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let h=0;h<l;h++)a[h].collectRenderables(t,e,i)}}});var vb=x(()=>{B();bb();U.add(Dn)});var ge,si=x(()=>{"use strict";ge=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ge||{})});var Tb,Sb=x(()=>{"use strict";Tb={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var wb,X,Ft=x(()=>{Sb();wb=Tb,X={get(){return wb},set(r){wb=r}}});function br(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Nn(r){return r.split("?")[0].split("#")[0]}function yB(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _B(r,t,e){return r.replace(new RegExp(yB(t),"g"),e)}function bB(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var he,is=x(()=>{Ft();he={toPosix(r){return _B(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){br(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(br(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Nn(this.toPosix(t??X.get().getBaseUrl())),s=Nn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?he.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(br(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=bB(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return br(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(br(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(br(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){br(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){br(r),t&&br(t),r=Nn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){br(r),r=Nn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){br(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Nn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,h=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}l===-1&&(h=!1,l=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||l===-1||u===0||u===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,l)):(t.name=r.slice(a,n),t.base=r.slice(a,l)),t.ext=r.slice(n,l)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Fe,Hn=x(()=>{"use strict";Fe=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function Eb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Eb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function Ab(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Eb(r,s,0,e,i)}else i.push(r);return i}var Pb=x(()=>{"use strict"});var ss,Jh=x(()=>{"use strict";ss=r=>!Array.isArray(r)});function vB(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Ke,Ks=x(()=>{At();is();Hn();Pb();Jh();Ke=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Fe(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&D("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{let h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...o,alias:l,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&D(`[Resolver] already has key: ${o} overwriting`)},Fe(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,c=Fe(n).map(f=>typeof f=="string"?Ab(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(m=>{let g={};if(typeof m!="object"){g.src=m;for(let p=0;p<this._parsers.length;p++){let v=this._parsers[p];if(v.test(m)){g=v.parse(m);break}}}else a=m.data??a,l=m.format??l,h=m.loadParser??h,g={...g,...m};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:l,loadParser:h}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=ss(t);t=Fe(t);let i={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=ss(t);t=Fe(t);let i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(c=>c[a]?c[a]===l:!1);h.length&&(o=h)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=he.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??vB(t.src),t}};Ke.RETINA_PREFIX=/@([0-9\.]+)x/});var Vn,ep=x(()=>{"use strict";Vn=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var Cb,Pi,rp=x(()=>{ae();_t();Cb=class Wn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof R?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Wn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Wn.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new it(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?a=new it(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new it(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new it(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new R({source:this.textureSource,frame:a,orig:c,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){let s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Wn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Wn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Cb.BATCH_SIZE=1e3;Pi=Cb});function Rb(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=he.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=Rb([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var TB,Mb,Ib=x(()=>{si();Ks();ep();B();_t();is();rp();TB=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Mb={extension:T.Asset,cache:{test:r=>r instanceof Pi,getCacheableAssets:(r,t)=>Rb(r,t,!1)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&TB.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:T.LoadParser,priority:ge.Normal,name:"spritesheetLoader"},async testParse(r,t){return he.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=he.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof R)a=i;else{let c=Vn(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let l=new Pi(a.source,r);await l.parse();let h=r?.meta?.related_multi_packs;if(Array.isArray(h)){let c=[];for(let d of h){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Vn(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);l.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var tc=x(()=>{B();Ib();U.add(Mb)});function ec(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var ip=x(()=>{"use strict"});var Pt,zn=x(()=>{kh();_t();ip();Wt();Qh();Pt=class r extends Ai{constructor(t=R.EMPTY){t instanceof R&&(t={texture:t});let{texture:e=R.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ve({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof R?new r(t):new r(R.from(t,e))}set texture(t){t||(t=R.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return ec(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return $("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function rc(r,t,e){let i=SB;r.measurable=!0,Hs(r,e,i),t.addBoundsMask(i),r.measurable=!1}var SB,sp=x(()=>{Ne();In();SB=new Et});function ic(r,t,e){let i=Ye.get();r.measurable=!0;let s=ee.get().identity(),o=Bb(r,e,s);Ws(r,i,o),r.measurable=!1,t.addBoundsMask(i),ee.return(s),Ye.return(i)}function Bb(r,t,e){return r?(r!==t&&(Bb(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(D("Mask bounds, renderable is not inside the root container"),e)}var op=x(()=>{Hh();Ki();At()});var $n,Fb=x(()=>{B();zn();sp();op();$n=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Pt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||rc(this.mask,t,e)}addLocalBounds(t,e){ic(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Pt}};$n.extension=T.MaskEffect});var Xn,kb=x(()=>{B();Xn=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};Xn.extension=T.MaskEffect});var jn,Gb=x(()=>{B();_r();sp();op();jn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){rc(this.mask,t,e)}addLocalBounds(t,e){ic(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof ht}};jn.extension=T.MaskEffect});var Ae,Zs=x(()=>{Ft();B();He();Ae=class extends St{constructor(t){t.resource||(t.resource=X.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Ae.extension=T.TextureSource});var Ve,Qs=x(()=>{Ft();B();At();He();Ve=class extends St{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=X.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,D("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Ve.extension=T.TextureSource});async function sc(){return np??(np=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),np}var np,ap=x(()=>{"use strict"});var oc,Js,lp=x(()=>{B();qs();ap();He();oc=class Ub extends St{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Ub.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=le.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await sc(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(le.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(le.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(le.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};oc.extension=T.TextureSource;oc.defaultOptions={...St.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};oc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Js=oc});var hp,bt,Ci=x(()=>{At();Hn();hp=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||D(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Fe(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&D("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){D(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},bt=new hp});function Ob(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<cp.length;s++){let o=cp[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function Lb(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&bt.has(i))return bt.get(i);let o=new R({source:Ob(s)});return o.on("destroy",()=>{bt.has(i)&&bt.remove(i)}),t||bt.set(i,o),o}function Db(r,t=!1){return typeof r=="string"?bt.get(r):r instanceof St?new R({source:r}):Lb(r,t)}var cp,up=x(()=>{Ci();B();He();_t();cp=[];U.handleByList(T.TextureSource,cp);R.from=Db;St.from=Ob});var nc=x(()=>{B();Fb();kb();Gb();Uf();Zs();Qs();lp();up();U.add($n,Xn,jn,Js,Ve,Ae,es)});var xe,Ri=x(()=>{"use strict";xe=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function lc(){return(!ac||ac?.isContextLost())&&(ac=X.get().createCanvas().getContext("webgl",{})),ac}var ac,dp=x(()=>{Ft()});function EB(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
20
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Nb(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let i=wB.replace(/%forloop%/gi,EB(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}var wB,Hb=x(()=>{"use strict";wB=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
+
`)});function nr(){if(to)return to;let r=lc();return to=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),to=Nb(to,r),r.getExtension("WEBGL_lose_context")?.loseContext(),to}var to,os=x(()=>{dp();Hb();to=null});function eo(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return Vb[e]||AB(r,t,e)}function AB(r,t,e){let i={},s=0;fp||(fp=nr());for(let n=0;n<fp;n++){let a=n<t?r[n]:R.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new xe(i);return Vb[e]=o,o}var Vb,fp,hc=x(()=>{Ri();_t();os();Vb={};fp=0});var Gr,pp=x(()=>{"use strict";Gr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Yn(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var mp=x(()=>{"use strict"});var Wb,Ut,ns=x(()=>{"use strict";Wb={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ut=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Ut||{})});function oi(r,t){return t.alphaMode==="no-premultiply-alpha"&&Wb[r]||r}var qn=x(()=>{ns()});var cc,zb=x(()=>{"use strict";cc=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function $b(){return xp>0?jb[--xp]:new gp}function Xb(r){jb[xp++]=r}var gp,jb,xp,Kn,Yb,qb,Kb=x(()=>{Te();pp();mp();qn();os();zb();gp=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new cc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},jb=[],xp=0;Kn=0,Yb=class uc{constructor(t={}){this.uid=ct("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],uc.defaultOptions.maxTextures=uc.defaultOptions.maxTextures??nr(),t={...uc.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new Gr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Xb(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let i=$b(),s=i.textures;s.clear();let o=e[this.elementStart],n=oi(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let p=e[g];e[g]=null;let y=p.texture._source,_=oi(p.blendMode,y),w=n!==_||a!==p.topology;if(y._batchTick===Kn&&!w){p._textureId=y._textureBindLocation,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,h,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,h,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize)),p._batch=i;continue}y._batchTick=Kn,(s.count>=m||w)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=_,a=p.topology,i=$b(),s=i.textures,s.clear(),++Kn),p._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,p._batch=i,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,h,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,h,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++Kn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=i,++Kn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),i=new Gr(e);Yn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Yn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[i++]=s+o[h+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)Xb(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};Yb.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};qb=Yb});var at,ni=x(()=>{"use strict";at=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(at||{})});var jt,Mi=x(()=>{Ee();Te();ni();jt=class extends Mt{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=ct("buffer"),this._resourceType="buffer",this._resourceId=ct("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&at.STATIC)}set static(t){t?this.descriptor.usage|=at.STATIC:this.descriptor.usage&=~at.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ct("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function yp(r,t){if(!(r instanceof jt)){let e=t?at.INDEX:at.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=at.INDEX|at.COPY_DST):(r=new Float32Array(r),e=at.VERTEX|at.COPY_DST)),r=new jt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var Zb=x(()=>{Mi();ni()});function Qb(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let d=c;d<s.length;d+=u){let f=s[d],m=s[d+1];f>a&&(a=f),m>l&&(l=m),f<o&&(o=f),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var Jb=x(()=>{"use strict"});function PB(r){return(r instanceof jt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=yp(r.buffer,!1),r}var ar,ro=x(()=>{Ee();Ne();Te();Mi();Zb();Jb();ar=class extends Mt{constructor(t={}){super(),this.uid=ct("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let i=PB(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=yp(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Qb(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var CB,RB,dc,tv=x(()=>{Mi();ni();ro();CB=new Float32Array(1),RB=new Uint32Array(1),dc=class extends ar{constructor(){let e=new jt({data:CB,label:"attribute-batch-buffer",usage:at.VERTEX|at.COPY_DST,shrinkToFit:!1}),i=new jt({data:RB,label:"index-batch-buffer",usage:at.INDEX|at.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function ai(r,t){let e=ev[r];return e===void 0&&(_p[t]===void 0&&(_p[t]=1),ev[r]=e=_p[t]++),e}var _p,ev,Zn=x(()=>{"use strict";_p=Object.create(null),ev=Object.create(null)});function rv(){if(!fc){fc="mediump";let r=lc();r&&r.getShaderPrecisionFormat&&(fc=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return fc}var fc,iv=x(()=>{dp()});function sv(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -33,27 +33,27 @@ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function vb(r,t){if(r===0)th
|
|
|
33
33
|
#define out varying
|
|
34
34
|
#endif
|
|
35
35
|
${r}
|
|
36
|
-
`}var
|
|
37
|
-
${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var
|
|
38
|
-
${r}`:r}var
|
|
39
|
-
${r}`}var
|
|
36
|
+
`}var ov=x(()=>{"use strict"});function nv(r,t,e){let i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
37
|
+
${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var av=x(()=>{"use strict"});function lv(r,t){return t?`#version 300 es
|
|
38
|
+
${r}`:r}var hv=x(()=>{"use strict"});function cv(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let i=e?MB:IB;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
|
|
39
|
+
${r}`}var MB,IB,uv=x(()=>{"use strict";MB={},IB={}});function dv(r,t){return t?r.replace("#version 300 es",""):r}var fv=x(()=>{"use strict"});var bp,vp,pv,lr,as=x(()=>{Zn();iv();ov();av();hv();uv();fv();bp={stripVersion:dv,ensurePrecision:nv,addProgramDefines:sv,setProgramName:cv,insertVersion:lv},vp=Object.create(null),pv=class Tp{constructor(t){t={...Tp.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:rv()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(bp).forEach(n=>{let a=i[n];s=bp[n](s,a,!0),o=bp[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=ai(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){let e=`${t.vertex}:${t.fragment}`;return vp[e]||(vp[e]=new Tp(t)),vp[e]}};pv.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};lr=pv});function We(r){return mv[r]??mv.float32}var mv,ls=x(()=>{"use strict";mv={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function gv({source:r,entryPoint:t}){let e={},i=r.indexOf(`fn ${t}`);if(i!==-1){let s=r.indexOf("->",i);if(s!==-1){let o=r.substring(i,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=BB[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:We(l).stride,offset:0,instance:!1,start:0}}}}return e}var BB,xv=x(()=>{ls();BB={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function pc(r){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=r.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(i)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!h)return{groups:[],structs:[]};let c=r.match(n)?.map(u=>{let d=u.match(l)[1],f=u.match(a).reduce((m,g)=>{let[p,v]=g.split(":");return m[p.trim()]=v.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>h.some(d=>d.type===u))??[];return{groups:h,structs:c}}var yv=x(()=>{"use strict"});var io,_v=x(()=>{"use strict";io=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(io||{})});function bv({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:io.VERTEX|io.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:io.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&t[i.group].push({binding:i.binding,visibility:io.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var vv=x(()=>{_v()});function Tv({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}var Sv=x(()=>{"use strict"});function wv(r,t){let e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...r.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:o}}var Ev=x(()=>{"use strict"});var Sp,hr,so=x(()=>{Zn();xv();yv();vv();Sv();Ev();Sp=Object.create(null),hr=class r{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:i,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=i,e.source===i.source){let a=pc(e.source);this.structsAndGroups=a}else{let a=pc(i.source),l=pc(e.source);this.structsAndGroups=wv(a,l)}this.layout=s??Tv(this.structsAndGroups),this.gpuLayout=o??bv(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ai(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=gv(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Sp[e]||(Sp[e]=new r(t)),Sp[e]}}});function wp(r,t,e){if(r)for(let i in r){let s=i.toLocaleLowerCase(),o=t[s];if(o){let n=r[i];i==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else D(`${i} placement hook does not exist in shader`)}}var Av=x(()=>{At()});function Ep(r){let t={};return(r.match(FB)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var FB,Pv=x(()=>{"use strict";FB=/\{\{(.*?)\}\}/g});function Cv(r,t){let e,i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Ap(r,t,e=!1){let i=[];Cv(t,i),r.forEach(a=>{a.header&&Cv(a.header,i)});let s=i;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
40
40
|
`),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
|
|
41
41
|
${o}
|
|
42
|
-
`),n}var
|
|
43
|
-
`),o=e.sort().map(l=>` var ${
|
|
42
|
+
`),n}var Rv=x(()=>{"use strict"});function Mv(r,t){let e,i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function kB(r){let e=/\b(\w+)\s*:/g.exec(r);return e?e[1]:""}function GB(r){let t=/@.*?\s+/g;return r.replace(t,"")}function Iv(r,t){let e=[];Mv(t,e),r.forEach(l=>{l.header&&Mv(l.header,e)});let i=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
|
|
43
|
+
`),o=e.sort().map(l=>` var ${GB(l)};`).join(`
|
|
44
44
|
`),n=`return VSOutput(
|
|
45
|
-
${e.sort().map(l=>` ${
|
|
45
|
+
${e.sort().map(l=>` ${kB(l)}`).join(`,
|
|
46
46
|
`)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
47
47
|
${s}
|
|
48
48
|
`),a=a.replace("{{start}}",`
|
|
49
49
|
${o}
|
|
50
50
|
`),a=a.replace("{{return}}",`
|
|
51
51
|
${n}
|
|
52
|
-
`),a}var
|
|
52
|
+
`),a}var Bv=x(()=>{"use strict"});function Pp(r,t){let e=r;for(let i in t){let s=t[i];s.join(`
|
|
53
53
|
`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
|
|
54
54
|
${s.join(`
|
|
55
55
|
`)}
|
|
56
|
-
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}var
|
|
56
|
+
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}var Fv=x(()=>{"use strict"});function kv({template:r,bits:t}){let e=Uv(r,t);if(Ii[e])return Ii[e];let{vertex:i,fragment:s}=OB(r,t);return Ii[e]=Ov(i,s,t),Ii[e]}function Gv({template:r,bits:t}){let e=Uv(r,t);return Ii[e]||(Ii[e]=Ov(r.vertex,r.fragment,t)),Ii[e]}function OB(r,t){let e=t.map(n=>n.vertex).filter(n=>!!n),i=t.map(n=>n.fragment).filter(n=>!!n),s=Ap(e,r.vertex,!0);s=Iv(e,s);let o=Ap(i,r.fragment,!0);return{vertex:s,fragment:o}}function Uv(r,t){return t.map(e=>(Cp.has(e)||Cp.set(e,UB++),Cp.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function Ov(r,t,e){let i=Ep(r),s=Ep(t);return e.forEach(o=>{wp(o.vertex,i,o.name),wp(o.fragment,s,o.name)}),{vertex:Pp(r,i),fragment:Pp(t,s)}}var Ii,Cp,UB,Lv=x(()=>{Av();Pv();Rv();Bv();Fv();Ii=Object.create(null),Cp=new Map,UB=0});var Dv,Nv,Hv,Vv,Wv=x(()=>{"use strict";Dv=`
|
|
57
57
|
@in aPosition: vec2<f32>;
|
|
58
58
|
@in aUV: vec2<f32>;
|
|
59
59
|
|
|
@@ -97,7 +97,7 @@ ${s.join(`
|
|
|
97
97
|
|
|
98
98
|
{{return}}
|
|
99
99
|
};
|
|
100
|
-
`,
|
|
100
|
+
`,Nv=`
|
|
101
101
|
@in vUV : vec2<f32>;
|
|
102
102
|
@in vColor : vec4<f32>;
|
|
103
103
|
|
|
@@ -120,7 +120,7 @@ ${s.join(`
|
|
|
120
120
|
|
|
121
121
|
return finalColor;
|
|
122
122
|
};
|
|
123
|
-
`,
|
|
123
|
+
`,Hv=`
|
|
124
124
|
in vec2 aPosition;
|
|
125
125
|
in vec2 aUV;
|
|
126
126
|
|
|
@@ -156,7 +156,7 @@ ${s.join(`
|
|
|
156
156
|
|
|
157
157
|
{{end}}
|
|
158
158
|
}
|
|
159
|
-
`,
|
|
159
|
+
`,Vv=`
|
|
160
160
|
|
|
161
161
|
in vec4 vColor;
|
|
162
162
|
in vec2 vUV;
|
|
@@ -177,7 +177,7 @@ ${s.join(`
|
|
|
177
177
|
|
|
178
178
|
{{end}}
|
|
179
179
|
}
|
|
180
|
-
`});var
|
|
180
|
+
`});var zv,$v,Xv=x(()=>{"use strict";zv={name:"global-uniforms-bit",vertex:{header:`
|
|
181
181
|
struct GlobalUniforms {
|
|
182
182
|
uProjectionMatrix:mat3x3<f32>,
|
|
183
183
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
@@ -186,22 +186,22 @@ ${s.join(`
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
189
|
-
`}}
|
|
189
|
+
`}},$v={name:"global-uniforms-bit",vertex:{header:`
|
|
190
190
|
uniform mat3 uProjectionMatrix;
|
|
191
191
|
uniform mat3 uWorldTransformMatrix;
|
|
192
192
|
uniform vec4 uWorldColorAlpha;
|
|
193
193
|
uniform vec2 uResolution;
|
|
194
|
-
`}}});function
|
|
194
|
+
`}}});function Ur({bits:r,name:t}){let e=kv({template:{fragment:Nv,vertex:Dv},bits:[zv,...r]});return hr.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Or({bits:r,name:t}){return new lr({name:t,...Gv({template:{vertex:Hv,fragment:Vv},bits:[$v,...r]})})}var Bi=x(()=>{as();so();Lv();Wv();Xv()});var oo,no,Qn=x(()=>{"use strict";oo={name:"color-bit",vertex:{header:`
|
|
195
195
|
@in aColor: vec4<f32>;
|
|
196
196
|
`,main:`
|
|
197
197
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
198
|
-
`}},
|
|
198
|
+
`}},no={name:"color-bit",vertex:{header:`
|
|
199
199
|
in vec4 aColor;
|
|
200
200
|
`,main:`
|
|
201
201
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
202
|
-
`}}});function
|
|
203
|
-
`)}function
|
|
204
|
-
`)}function
|
|
202
|
+
`}}});function LB(r){let t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
|
|
203
|
+
`)}function DB(r){let t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
204
|
+
`)}function ao(r){return Rp[r]||(Rp[r]={name:"texture-batch-bit",vertex:{header:`
|
|
205
205
|
@in aTextureIdAndRound: vec2<u32>;
|
|
206
206
|
@out @interpolate(flat) vTextureId : u32;
|
|
207
207
|
`,main:`
|
|
@@ -214,14 +214,14 @@ ${s.join(`
|
|
|
214
214
|
`},fragment:{header:`
|
|
215
215
|
@in @interpolate(flat) vTextureId: u32;
|
|
216
216
|
|
|
217
|
-
${
|
|
217
|
+
${LB(r)}
|
|
218
218
|
`,main:`
|
|
219
219
|
var uvDx = dpdx(vUV);
|
|
220
220
|
var uvDy = dpdy(vUV);
|
|
221
221
|
|
|
222
|
-
${
|
|
223
|
-
`}}),
|
|
224
|
-
`)}function
|
|
222
|
+
${DB(r)}
|
|
223
|
+
`}}),Rp[r]}function NB(r){let t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
224
|
+
`)}function lo(r){return Mp[r]||(Mp[r]={name:"texture-batch-bit",vertex:{header:`
|
|
225
225
|
in vec2 aTextureIdAndRound;
|
|
226
226
|
out float vTextureId;
|
|
227
227
|
|
|
@@ -239,18 +239,18 @@ ${s.join(`
|
|
|
239
239
|
|
|
240
240
|
`,main:`
|
|
241
241
|
|
|
242
|
-
${
|
|
243
|
-
`}}),
|
|
242
|
+
${NB(r)}
|
|
243
|
+
`}}),Mp[r]}var Rp,Mp,Jn=x(()=>{"use strict";Rp={};Mp={}});var Lr,Dr,Fi=x(()=>{"use strict";Lr={name:"round-pixels-bit",vertex:{header:`
|
|
244
244
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
245
245
|
{
|
|
246
246
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
247
247
|
}
|
|
248
|
-
`}},
|
|
248
|
+
`}},Dr={name:"round-pixels-bit",vertex:{header:`
|
|
249
249
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
250
250
|
{
|
|
251
251
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
252
252
|
}
|
|
253
|
-
`}}});var gp,Cv,Rv=x(()=>{"use strict";gp=["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>"],Cv=gp.reduce((r,t)=>(r[t]=!0,r),{})});function Mv(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Bv=x(()=>{"use strict"});var Iv,Pt,Fe=x(()=>{be();Xn();Rv();Bv();Iv=class Fv{constructor(t,e){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Fv.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Cv[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${gp.join(", ")}`);o.value??(o.value=Mv(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Iv.defaultOptions={ubo:!1,isStatic:!1};Pt=Iv});function oo(r){let t=kv[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=kv[r]=new Pt({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var kv,lc=x(()=>{Fe();kv={}});var re,Dr=x(()=>{"use strict";re=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(re||{})});var Xt,br=x(()=>{Se();be();ss();Pi();to();Dr();Fe();Xt=class r extends Rt{constructor(t){super(),this.uid=at("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=re.WEBGPU),i&&(n|=re.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let h in a)for(let c in a[h]){let u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let c in o)l[c]||(s[99]||(s[99]=new me,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Pt(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new me,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new me,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var hc,Gv=x(()=>{Mi();Yn();qn();Bi();lc();br();hc=class extends Xt{constructor(t){let e=Ur({name:"batch",bits:[ro,so(t),Lr]}),i=Gr({name:"batch",bits:[eo,io(t),Or]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:oo(t)}})}}});var Uv,Ov,Kn,xp=x(()=>{B();Bb();Gb();Gv();Uv=null,Ov=class Lv extends Mb{constructor(){super(...arguments),this.geometry=new oc,this.shader=Uv||(Uv=new hc(this.maxTextures)),this.name=Lv.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:g,uvs:m}=t,p=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let v=_;v<y;v++){let b=v*2,E=g[b],A=g[b+1];e[s++]=l*E+c*A+d,e[s++]=u*A+h*E+f,e[s++]=m[b],e[s++]=m[b+1],i[s++]=p,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,g=t.bounds,m=g.maxX,p=g.minX,_=g.maxY,y=g.minY,v=n.uvs,b=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=l*p+c*y+d,e[s+1]=u*y+h*p+f,e[s+2]=v.x0,e[s+3]=v.y0,i[s+4]=b,i[s+5]=E,e[s+6]=l*m+c*y+d,e[s+7]=u*y+h*m+f,e[s+8]=v.x1,e[s+9]=v.y1,i[s+10]=b,i[s+11]=E,e[s+12]=l*m+c*_+d,e[s+13]=u*_+h*m+f,e[s+14]=v.x2,e[s+15]=v.y2,i[s+16]=b,i[s+17]=E,e[s+18]=l*p+c*_+d,e[s+19]=u*_+h*p+f,e[s+20]=v.x3,e[s+21]=v.y3,i[s+22]=b,i[s+23]=E}};Ov.extension={type:[T.Batcher],name:"default"};Kn=Ov});function Dv(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,g=a.ty;for(;l<n;){let m=r[e],p=r[e+1];i[s]=h*m+u*p+f,i[s+1]=c*m+d*p+g,s+=o,e+=t,l++}}function Nv(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var Hv=x(()=>{"use strict"});function yp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],g=r[u+1];r[u]=o*f+a*g+h,r[u+1]=n*f+l*g+c,u+=i}}var Vv=x(()=>{"use strict"});var hI,ns,_p=x(()=>{mt();uf();hI=new F,ns=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Fh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||hI}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var no,Wv,zv,$v=x(()=>{B();no={extension:{type:T.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let b=r;e=b.x,i=b.y,n=a=b.radius,s=o=0}else if(r.type==="ellipse"){let b=r;e=b.x,i=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0}else{let b=r,E=b.width/2,A=b.height/2;e=b.x+E,i=b.y+A,n=a=Math.max(0,Math.min(b.radius,Math.min(E,A))),s=E-n,o=A-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=l*4+(s?2:0)+2,d=u,f=h,g=s+n,m=o,p=e+g,_=e-g,y=i+m;if(t[c++]=p,t[c++]=y,t[--u]=y,t[--u]=_,o){let b=i-m;t[d++]=_,t[d++]=b,t[--f]=b,t[--f]=p}for(let b=1;b<l;b++){let E=Math.PI/2*(b/l),A=s+Math.cos(E)*n,S=o+Math.sin(E)*a,w=e+A,P=e-A,C=i+S,M=i-S;t[c++]=w,t[c++]=C,t[--u]=C,t[--u]=P,t[d++]=P,t[d++]=M,t[--f]=M,t[--f]=w}g=s,m=o+a,p=e+g,_=e-g,y=i+m;let v=i-m;return t[c++]=p,t[c++]=y,t[--f]=v,t[--f]=p,s&&(t[c++]=_,t[c++]=y,t[--f]=v,t[--f]=_),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1}},Wv={...no,extension:{...no.extension,name:"ellipse"}},zv={...no,extension:{...no.extension,name:"roundedRectangle"}}});function jv(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Xv=x(()=>{"use strict"});function Yv(r,t,e,i,s,o,n,a){let l=r-e*s,h=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let g=l+d,m=h+f,p=c+d,_=u+f;return a.push(g,m),a.push(p,_),2}function as(r,t,e,i,s,o,n,a){let l=e-r,h=i-t,c=Math.atan2(l,h),u=Math.atan2(s-r,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,g=Math.abs(f),m=Math.sqrt(l*l+h*h),p=(15*g*Math.sqrt(m)/Math.PI>>0)+1,_=f/p;if(d+=_,a){n.push(r,t),n.push(e,i);for(let y=1,v=d;y<p;y++,v+=_)n.push(r,t),n.push(r+Math.sin(v)*m,t+Math.cos(v)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let y=1,v=d;y<p;y++,v+=_)n.push(r+Math.sin(v)*m,t+Math.cos(v)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return p*2}function qv(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let L=jv(r);e&&(L*=-1),l=(l-.5)*L+.5}let h=new ht(r[0],r[1]),c=new ht(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(h.x-c.x)<n&&Math.abs(h.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let L=(h.x+c.x)*.5,z=(c.y+h.y)*.5;r.unshift(L,z),r.push(L,z)}let f=s,g=r.length/2,m=r.length,p=f.length/2,_=a.width/2,y=_*_,v=a.miterLimit*a.miterLimit,b=r[0],E=r[1],A=r[2],S=r[3],w=0,P=0,C=-(E-S),M=b-A,I=0,k=0,G=Math.sqrt(C*C+M*M);C/=G,M/=G,C*=_,M*=_;let ut=l,H=(1-ut)*2,K=ut*2;u||(a.cap==="round"?m+=as(b-C*(H-K)*.5,E-M*(H-K)*.5,b-C*H,E-M*H,b+C*K,E+M*K,f,!0)+2:a.cap==="square"&&(m+=Yv(b,E,C,M,H,K,!0,f))),f.push(b-C*H,E-M*H),f.push(b+C*K,E+M*K);for(let L=1;L<g-1;++L){b=r[(L-1)*2],E=r[(L-1)*2+1],A=r[L*2],S=r[L*2+1],w=r[(L+1)*2],P=r[(L+1)*2+1],C=-(E-S),M=b-A,G=Math.sqrt(C*C+M*M),C/=G,M/=G,C*=_,M*=_,I=-(S-P),k=A-w,G=Math.sqrt(I*I+k*k),I/=G,k/=G,I*=_,k*=_;let z=A-b,rt=E-S,nt=A-w,Tt=P-S,Ot=z*nt+rt*Tt,Ht=rt*nt-Tt*z,Qt=Ht<0;if(Math.abs(Ht)<.001*Math.abs(Ot)){f.push(A-C*H,S-M*H),f.push(A+C*K,S+M*K),Ot>=0&&(a.join==="round"?m+=as(A,S,A-C*H,S-M*H,A-I*H,S-k*H,f,!1)+4:m+=2,f.push(A-I*K,S-k*K),f.push(A+I*H,S+k*H));continue}let Ce=(-C+b)*(-M+S)-(-C+A)*(-M+E),pt=(-I+w)*(-k+S)-(-I+A)*(-k+P),lt=(z*pt-nt*Ce)/Ht,_t=(Tt*Ce-rt*pt)/Ht,kt=(lt-A)*(lt-A)+(_t-S)*(_t-S),Jt=A+(lt-A)*H,te=S+(_t-S)*H,De=A-(lt-A)*K,zi=S-(_t-S)*K,rB=Math.min(z*z+rt*rt,nt*nt+Tt*Tt),xy=Qt?H:K,iB=rB+xy*xy*y;kt<=iB?a.join==="bevel"||kt/y>v?(Qt?(f.push(Jt,te),f.push(A+C*K,S+M*K),f.push(Jt,te),f.push(A+I*K,S+k*K)):(f.push(A-C*H,S-M*H),f.push(De,zi),f.push(A-I*H,S-k*H),f.push(De,zi)),m+=2):a.join==="round"?Qt?(f.push(Jt,te),f.push(A+C*K,S+M*K),m+=as(A,S,A+C*K,S+M*K,A+I*K,S+k*K,f,!0)+4,f.push(Jt,te),f.push(A+I*K,S+k*K)):(f.push(A-C*H,S-M*H),f.push(De,zi),m+=as(A,S,A-C*H,S-M*H,A-I*H,S-k*H,f,!1)+4,f.push(A-I*H,S-k*H),f.push(De,zi)):(f.push(Jt,te),f.push(De,zi)):(f.push(A-C*H,S-M*H),f.push(A+C*K,S+M*K),a.join==="round"?Qt?m+=as(A,S,A+C*K,S+M*K,A+I*K,S+k*K,f,!0)+2:m+=as(A,S,A-C*H,S-M*H,A-I*H,S-k*H,f,!1)+2:a.join==="miter"&&kt/y<=v&&(Qt?(f.push(De,zi),f.push(De,zi)):(f.push(Jt,te),f.push(Jt,te)),m+=2),f.push(A-I*H,S-k*H),f.push(A+I*K,S+k*K),m+=2)}b=r[(g-2)*2],E=r[(g-2)*2+1],A=r[(g-1)*2],S=r[(g-1)*2+1],C=-(E-S),M=b-A,G=Math.sqrt(C*C+M*M),C/=G,M/=G,C*=_,M*=_,f.push(A-C*H,S-M*H),f.push(A+C*K,S+M*K),u||(a.cap==="round"?m+=as(A-C*(H-K)*.5,S-M*(H-K)*.5,A-C*H,S-M*H,A+C*K,S+M*K,f,!1)+2:a.cap==="square"&&(m+=Yv(A,S,C,M,H,K,!1,f)));let W=1e-4*1e-4;for(let L=p;L<m+p-2;++L)b=f[L*2],E=f[L*2+1],A=f[(L+1)*2],S=f[(L+1)*2+1],w=f[(L+2)*2],P=f[(L+2)*2+1],!(Math.abs(b*(S-P)+A*(P-E)+w*(E-S))<W)&&o.push(L,L+1,L+2)}var Kv=x(()=>{or();Xv()});function Zv(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);h&&i.push(d+u-1,d)}var Qv=x(()=>{});var pc=Z((XW,Sp)=>{"use strict";Sp.exports=dc;Sp.exports.default=dc;function dc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=t0(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,h,c,u,d,f;if(i&&(o=gI(r,t,o,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var g=e;g<s;g+=e)u=r[g],d=r[g+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return Zn(o,n,e,a,l,f,0),n}function t0(r,t,e,i,s){var o,n;if(s===Tp(r,t,e,i)>0)for(o=t;o<e;o+=i)n=Jv(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=Jv(o,r[o],r[o+1],n);return n&&fc(n,n.next)&&(Jn(n),n=n.next),n}function ls(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(fc(e,e.next)||zt(e.prev,e,e.next)===0)){if(Jn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Zn(r,t,e,i,s,o,n){if(r){!n&&o&&vI(r,i,s,o);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,o?fI(r,i,s,o):dI(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),Jn(r),r=h.next,a=h.next;continue}if(r=h,r===a){n?n===1?(r=pI(ls(r),t,e),Zn(r,t,e,i,s,o,2)):n===2&&mI(r,t,e,i,s,o):Zn(ls(r),t,e,i,s,o,1);break}}}}function dI(r){var t=r.prev,e=r,i=r.next;if(zt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,h=i.y,c=s<o?s<n?s:n:o<n?o:n,u=a<l?a<h?a:h:l<h?l:h,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>h?a:h:l>h?l:h,g=i.next;g!==t;){if(g.x>=c&&g.x<=d&&g.y>=u&&g.y<=f&&ao(s,a,o,l,n,h,g.x,g.y)&&zt(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function fI(r,t,e,i){var s=r.prev,o=r,n=r.next;if(zt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,h=n.x,c=s.y,u=o.y,d=n.y,f=a<l?a<h?a:h:l<h?l:h,g=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,p=c>u?c>d?c:d:u>d?u:d,_=bp(f,g,t,e,i),y=bp(m,p,t,e,i),v=r.prevZ,b=r.nextZ;v&&v.z>=_&&b&&b.z<=y;){if(v.x>=f&&v.x<=m&&v.y>=g&&v.y<=p&&v!==s&&v!==n&&ao(a,c,l,u,h,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=m&&b.y>=g&&b.y<=p&&b!==s&&b!==n&&ao(a,c,l,u,h,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=_;){if(v.x>=f&&v.x<=m&&v.y>=g&&v.y<=p&&v!==s&&v!==n&&ao(a,c,l,u,h,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=m&&b.y>=g&&b.y<=p&&b!==s&&b!==n&&ao(a,c,l,u,h,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function pI(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!fc(s,o)&&e0(s,i,i.next,o)&&Qn(s,o)&&Qn(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),Jn(i),Jn(i.next),i=r=o),i=i.next}while(i!==r);return ls(i)}function mI(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&EI(n,a)){var l=r0(n,a);n=ls(n,n.next),l=ls(l,l.next),Zn(n,t,e,i,s,o,0),Zn(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function gI(r,t,e,i){var s=[],o,n,a,l,h;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,h=t0(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(SI(h));for(s.sort(xI),o=0;o<s.length;o++)e=yI(s[o],e);return e}function xI(r,t){return r.x-t.x}function yI(r,t){var e=_I(r,t);if(!e)return t;var i=r0(e,r);return ls(i,i.next),ls(e,e.next)}function _I(r,t){var e=t,i=r.x,s=r.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,h=n.x,c=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=h&&i!==e.x&&ao(s<c?i:o,s,h,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Qn(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&bI(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function bI(r,t){return zt(r.prev,r,t.prev)<0&&zt(t.next,r,r.next)<0}function vI(r,t,e,i){var s=r;do s.z===0&&(s.z=bp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,TI(s)}function TI(r){var t,e,i,s,o,n,a,l,h=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,h*=2}while(n>1);return r}function bp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function SI(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function ao(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function EI(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!wI(r,t)&&(Qn(r,t)&&Qn(t,r)&&AI(r,t)&&(zt(r.prev,r,t.prev)||zt(r,t.prev,t))||fc(r,t)&&zt(r.prev,r,r.next)>0&&zt(t.prev,t,t.next)>0)}function zt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function fc(r,t){return r.x===t.x&&r.y===t.y}function e0(r,t,e,i){var s=uc(zt(r,t,e)),o=uc(zt(r,t,i)),n=uc(zt(e,i,r)),a=uc(zt(e,i,t));return!!(s!==o&&n!==a||s===0&&cc(r,e,t)||o===0&&cc(r,i,t)||n===0&&cc(e,r,i)||a===0&&cc(e,t,i))}function cc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function uc(r){return r>0?1:r<0?-1:0}function wI(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&e0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qn(r,t){return zt(r.prev,r,r.next)<0?zt(r,t,r.next)>=0&&zt(r,r.prev,t)>=0:zt(r,t,r.prev)<0||zt(r,r.next,t)<0}function AI(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function r0(r,t){var e=new vp(r.i,r.x,r.y),i=new vp(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Jv(r,t,e,i){var s=new vp(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Jn(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 vp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}dc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(Tp(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:r.length;n-=Math.abs(Tp(r,h,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,g=i[a+2]*e;u+=Math.abs((r[d]-r[g])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[g+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Tp(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}dc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function mc(r,t,e,i,s,o,n){let a=(0,i0.default)(r,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*i;for(let h=0;h<r.length;h+=2)e[l]=r[h],e[l+1]=r[h+1],l+=i}var i0,Ep=x(()=>{i0=$i(pc(),1)});var PI,s0,o0=x(()=>{B();Ep();PI=[],s0={extension:{type:T.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){mc(r,PI,t,e,i,s,o)}}});var n0,a0=x(()=>{B();n0={extension:{type:T.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var l0,h0=x(()=>{B();l0={extension:{type:T.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function u0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function d0(r,t){let e=j.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function CI(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&($("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ze.defaultLinearOptions.textureSize}),t}var c0,Ap,ze,lo=x(()=>{ye();Mt();mt();Ys();bt();be();Vt();xf();c0=[{offset:0,color:"white"},{offset:1,color:"black"}],Ap=class wp{constructor(...t){this.uid=at("fillGradient"),this.type="linear",this.colorStops=[];let e=CI(t);e={...e.type==="radial"?wp.defaultRadialOptions:wp.defaultLinearOptions,...Gh(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:it.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let p=t;t=i,i=p,o*=-1}if(n<0){let p=e;e=s,s=p,n*=-1}}let l=this.colorStops.length?this.colorStops:c0,h=this._textureSize,{canvas:c,context:u}=d0(h,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);u0(d,l),u.fillStyle=d,u.fillRect(0,0,h,1),this.texture=new R({source:new Ve({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),g=Math.atan2(n,o),m=new F;m.scale(f/h,1),m.rotate(g),m.translate(t,e),this.textureSpace==="local"&&m.scale(h,h),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:c0,e=this._textureSize,{canvas:i,context:s}=d0(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,d=l-c,f=e/(c*2),g=(o-u)*f,m=(n-d)*f,p=s.createRadialGradient(g,m,h*f,(a-u)*f,(l-d)*f,c*f);u0(p,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=p,s.translate(g,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-g,-m),s.fillRect(0,0,e,e),this.texture=new R({source:new Ve({resource:i,addressMode:this._wrapMode})});let _=new F;_.scale(1/f,1/f),_.translate(u,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Ap.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Ap.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ze=Ap});function f0(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(MI);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,c=1/n.height,u=-a*h,d=-l*c,f=s.a,g=s.b,m=s.c,p=s.d;s.a*=h,s.b*=h,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*g+d*p+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ze)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(RI.copyFrom(i).invert()),s}var RI,MI,p0=x(()=>{mt();ne();lo();RI=new F,MI=new et});function g0(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")FI(o.data,i,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&m0(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),m0(a,l,n,i,e)}}}function FI(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],h=gc.rectangle,c=BI,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;h.build(c,l),d&&yp(l,d),h.triangulate(l,i,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let g=tt.get(ns);g.indexOffset=n,g.indexSize=o.length-n,g.attributeOffset=a,g.attributeSize=i.length/2-a,g.baseColor=r.style,g.alpha=r.alpha,g.texture=u,g.geometryData=e,t.push(g)}function m0(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{let u=a.length,d=o.length/2,f=[],g=gc[l.type],m="triangle-list";if(g.build(l,f),h&&yp(f,h),e){let v=l.closePath??!0,b=t;b.pixelLine?(Zv(f,v,o,a),m="line-list"):qv(f,b,!1,v,o,a)}else if(c){let v=[],b=f.slice();kI(c).forEach(A=>{v.push(b.length/2),b.push(...A)}),mc(b,v,o,2,d,a,u)}else g.triangulate(f,o,2,d,a,u);let p=n.length/2,_=t.texture;if(_!==R.WHITE){let v=f0(II,t,l,h);Dv(o,2,d,n,p,2,o.length/2-d,v)}else Nv(n,p,2,o.length/2-d);let y=tt.get(ns);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=t.color,y.alpha=t.alpha,y.texture=_,y.geometryData=s,y.topology=m,i.push(y)})}function kI(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];gc[i.type].build(i,s),t.push(s)}return t}var gc,BI,II,x0=x(()=>{B();mt();ne();Hv();Vv();bt();Me();_p();$v();Kv();Qv();o0();a0();h0();p0();Ep();gc={};U.handleByMap(T.ShapeBuilder,gc);U.add(n0,s0,l0,no,Wv,zv);BI=new et,II=new F});var Pp,Cp,Mp,ho,xc=x(()=>{B();rc();xp();mf();Vt();Me();x0();Pp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Cp=class{constructor(){this.batcher=new Kn,this.instructions=new Ns}init(){this.instructions.reset()}get geometry(){return $(Ly,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Mp=class Rp{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Rp.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Rp.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),g0(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=tt.get(Cp),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[c];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let h=a.batches;for(let c=0;c<h.length;c++){let u=h[c];u.bindGroup=Zs(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Pp;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(tt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{tt.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Mp.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"graphicsContext"};Mp.defaultOptions={bezierSmoothness:.5};ho=Mp});var GI,Bp,Ip,Fp,kp,Gp,Up,Op,qt,vr=x(()=>{"use strict";GI={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},Bp=0,Ip=1,Fp=2,kp=3,Gp=4,Up=5,Op=class y0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bp)}set blend(t){!!(this.data&1<<Bp)!==t&&(this.data^=1<<Bp)}get offsets(){return!!(this.data&1<<Ip)}set offsets(t){!!(this.data&1<<Ip)!==t&&(this.data^=1<<Ip)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Fp)}set culling(t){!!(this.data&1<<Fp)!==t&&(this.data^=1<<Fp)}get depthTest(){return!!(this.data&1<<kp)}set depthTest(t){!!(this.data&1<<kp)!==t&&(this.data^=1<<kp)}get depthMask(){return!!(this.data&1<<Up)}set depthMask(t){!!(this.data&1<<Up)!==t&&(this.data^=1<<Up)}get clockwiseFrontFace(){return!!(this.data&1<<Gp)}set clockwiseFrontFace(t){!!(this.data&1<<Gp)!==t&&(this.data^=1<<Gp)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=GI[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new y0;return t.depthTest=!1,t.blend=!0,t}};Op.default2d=Op.for2d();qt=Op});function Nr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var co=x(()=>{"use strict"});var ta,_0=x(()=>{B();vr();Me();co();_p();ta=class{constructor(t,e){this.state=qt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=tt.get(ns);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{tt.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};ta.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"graphics"}});var Lp=x(()=>{B();xc();_0();U.add(ta);U.add(ho)});var Ii,yc=x(()=>{"use strict";Ii=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var ea,b0=x(()=>{B();mt();Pi();Fe();$n();Me();co();yc();ea=class{constructor(t,e){this.localUniforms=new Pt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new me({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(tt.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Nr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=tt.get(Ii);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&tt.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};ea.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"mesh"}});var Dp=x(()=>{B();b0();U.add(ea)});var _c,v0=x(()=>{"use strict";_c=class{execute(t,e){let i=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0)}}});function Np(r,t=null){let e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var T0=x(()=>{"use strict"});function E0(r){return{dynamicUpdate:S0(r,!0),staticUpdate:S0(r,!1)}}function S0(r,t){let e=[];e.push(`
|
|
253
|
+
`}}});var Ip,jv,Yv=x(()=>{"use strict";Ip=["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>"],jv=Ip.reduce((r,t)=>(r[t]=!0,r),{})});function qv(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Kv=x(()=>{"use strict"});var Zv,Ct,ke=x(()=>{Te();Zn();Yv();Kv();Zv=class Qv{constructor(t,e){this._touched=0,this.uid=ct("uniform"),this._resourceType="uniformGroup",this._resourceId=ct("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Qv.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!jv[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Ip.join(", ")}`);o.value??(o.value=qv(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ai(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Zv.defaultOptions={ubo:!1,isStatic:!1};Ct=Zv});function ho(r){let t=Jv[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=Jv[r]=new Ct({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var Jv,mc=x(()=>{ke();Jv={}});var re,Nr=x(()=>{"use strict";re=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(re||{})});var Yt,vr=x(()=>{Ee();Te();as();Ri();so();Nr();ke();Yt=class r extends Mt{constructor(t){super(),this.uid=ct("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=re.WEBGPU),i&&(n|=re.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let h in a)for(let c in a[h]){let u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let c in o)l[c]||(s[99]||(s[99]=new xe,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Ct(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new xe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new xe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var gc,t0=x(()=>{Bi();Qn();Jn();Fi();mc();vr();gc=class extends Yt{constructor(t){let e=Or({name:"batch",bits:[no,lo(t),Dr]}),i=Ur({name:"batch",bits:[oo,ao(t),Lr]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:ho(t)}})}}});var e0,r0,ta,Bp=x(()=>{B();Kb();tv();t0();e0=null,r0=class i0 extends qb{constructor(){super(...arguments),this.geometry=new dc,this.shader=e0||(e0=new gc(this.maxTextures)),this.name=i0.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:g}=t,p=t.color,v=t.attributeOffset,y=v+t.attributeSize;for(let _=v;_<y;_++){let w=_*2,E=m[w],b=m[w+1];e[s++]=l*E+c*b+d,e[s++]=u*b+h*E+f,e[s++]=g[w],e[s++]=g[w+1],i[s++]=p,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,m=t.bounds,g=m.maxX,p=m.minX,v=m.maxY,y=m.minY,_=n.uvs,w=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=l*p+c*y+d,e[s+1]=u*y+h*p+f,e[s+2]=_.x0,e[s+3]=_.y0,i[s+4]=w,i[s+5]=E,e[s+6]=l*g+c*y+d,e[s+7]=u*y+h*g+f,e[s+8]=_.x1,e[s+9]=_.y1,i[s+10]=w,i[s+11]=E,e[s+12]=l*g+c*v+d,e[s+13]=u*v+h*g+f,e[s+14]=_.x2,e[s+15]=_.y2,i[s+16]=w,i[s+17]=E,e[s+18]=l*p+c*v+d,e[s+19]=u*v+h*p+f,e[s+20]=_.x3,e[s+21]=_.y3,i[s+22]=w,i[s+23]=E}};r0.extension={type:[T.Batcher],name:"default"};ta=r0});function s0(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,m=a.ty;for(;l<n;){let g=r[e],p=r[e+1];i[s]=h*g+u*p+f,i[s+1]=c*g+d*p+m,s+=o,e+=t,l++}}function o0(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var n0=x(()=>{"use strict"});function Fp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],m=r[u+1];r[u]=o*f+a*m+h,r[u+1]=n*f+l*m+c,u+=i}}var a0=x(()=>{"use strict"});var HB,hs,kp=x(()=>{mt();Af();HB=new F,hs=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Nh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||HB}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var co,l0,h0,c0=x(()=>{B();co={extension:{type:T.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let w=r;e=w.x,i=w.y,n=a=w.radius,s=o=0}else if(r.type==="ellipse"){let w=r;e=w.x,i=w.y,n=w.halfWidth,a=w.halfHeight,s=o=0}else{let w=r,E=w.width/2,b=w.height/2;e=w.x+E,i=w.y+b,n=a=Math.max(0,Math.min(w.radius,Math.min(E,b))),s=E-n,o=b-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=l*4+(s?2:0)+2,d=u,f=h,m=s+n,g=o,p=e+m,v=e-m,y=i+g;if(t[c++]=p,t[c++]=y,t[--u]=y,t[--u]=v,o){let w=i-g;t[d++]=v,t[d++]=w,t[--f]=w,t[--f]=p}for(let w=1;w<l;w++){let E=Math.PI/2*(w/l),b=s+Math.cos(E)*n,S=o+Math.sin(E)*a,P=e+b,A=e-b,C=i+S,M=i-S;t[c++]=P,t[c++]=C,t[--u]=C,t[--u]=A,t[d++]=A,t[d++]=M,t[--f]=M,t[--f]=P}m=s,g=o+a,p=e+m,v=e-m,y=i+g;let _=i-g;return t[c++]=p,t[c++]=y,t[--f]=_,t[--f]=p,s&&(t[c++]=v,t[c++]=y,t[--f]=_,t[--f]=v),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1}},l0={...co,extension:{...co.extension,name:"ellipse"}},h0={...co,extension:{...co.extension,name:"roundedRectangle"}}});function u0(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var d0=x(()=>{"use strict"});function f0(r,t,e,i,s,o,n,a){let l=r-e*s,h=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let m=l+d,g=h+f,p=c+d,v=u+f;return a.push(m,g),a.push(p,v),2}function cs(r,t,e,i,s,o,n,a){let l=e-r,h=i-t,c=Math.atan2(l,h),u=Math.atan2(s-r,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,m=Math.abs(f),g=Math.sqrt(l*l+h*h),p=(15*m*Math.sqrt(g)/Math.PI>>0)+1,v=f/p;if(d+=v,a){n.push(r,t),n.push(e,i);for(let y=1,_=d;y<p;y++,_+=v)n.push(r,t),n.push(r+Math.sin(_)*g,t+Math.cos(_)*g);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let y=1,_=d;y<p;y++,_+=v)n.push(r+Math.sin(_)*g,t+Math.cos(_)*g),n.push(r,t);n.push(s,o),n.push(r,t)}return p*2}function p0(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let O=u0(r);e&&(O*=-1),l=(l-.5)*O+.5}let h=new ut(r[0],r[1]),c=new ut(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(h.x-c.x)<n&&Math.abs(h.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let O=(h.x+c.x)*.5,W=(c.y+h.y)*.5;r.unshift(O,W),r.push(O,W)}let f=s,m=r.length/2,g=r.length,p=f.length/2,v=a.width/2,y=v*v,_=a.miterLimit*a.miterLimit,w=r[0],E=r[1],b=r[2],S=r[3],P=0,A=0,C=-(E-S),M=w-b,I=0,k=0,G=Math.sqrt(C*C+M*M);C/=G,M/=G,C*=v,M*=v;let J=l,H=(1-J)*2,j=J*2;u||(a.cap==="round"?g+=cs(w-C*(H-j)*.5,E-M*(H-j)*.5,w-C*H,E-M*H,w+C*j,E+M*j,f,!0)+2:a.cap==="square"&&(g+=f0(w,E,C,M,H,j,!0,f))),f.push(w-C*H,E-M*H),f.push(w+C*j,E+M*j);for(let O=1;O<m-1;++O){w=r[(O-1)*2],E=r[(O-1)*2+1],b=r[O*2],S=r[O*2+1],P=r[(O+1)*2],A=r[(O+1)*2+1],C=-(E-S),M=w-b,G=Math.sqrt(C*C+M*M),C/=G,M/=G,C*=v,M*=v,I=-(S-A),k=b-P,G=Math.sqrt(I*I+k*k),I/=G,k/=G,I*=v,k*=v;let W=b-w,st=E-S,lt=b-P,vt=A-S,Lt=W*lt+st*vt,Vt=st*lt-vt*W,te=Vt<0;if(Math.abs(Vt)<.001*Math.abs(Lt)){f.push(b-C*H,S-M*H),f.push(b+C*j,S+M*j),Lt>=0&&(a.join==="round"?g+=cs(b,S,b-C*H,S-M*H,b-I*H,S-k*H,f,!1)+4:g+=2,f.push(b-I*j,S-k*j),f.push(b+I*H,S+k*H));continue}let Tt=(-C+w)*(-M+S)-(-C+b)*(-M+E),It=(-I+P)*(-k+S)-(-I+b)*(-k+A),pt=(W*It-lt*Tt)/Vt,Bt=(vt*Tt-st*It)/Vt,ne=(pt-b)*(pt-b)+(Bt-S)*(Bt-S),Kt=b+(pt-b)*H,pe=S+(Bt-S)*H,yr=b-(pt-b)*j,ji=S-(Bt-S)*j,kI=Math.min(W*W+st*st,lt*lt+vt*vt),Uy=te?H:j,GI=kI+Uy*Uy*y;ne<=GI?a.join==="bevel"||ne/y>_?(te?(f.push(Kt,pe),f.push(b+C*j,S+M*j),f.push(Kt,pe),f.push(b+I*j,S+k*j)):(f.push(b-C*H,S-M*H),f.push(yr,ji),f.push(b-I*H,S-k*H),f.push(yr,ji)),g+=2):a.join==="round"?te?(f.push(Kt,pe),f.push(b+C*j,S+M*j),g+=cs(b,S,b+C*j,S+M*j,b+I*j,S+k*j,f,!0)+4,f.push(Kt,pe),f.push(b+I*j,S+k*j)):(f.push(b-C*H,S-M*H),f.push(yr,ji),g+=cs(b,S,b-C*H,S-M*H,b-I*H,S-k*H,f,!1)+4,f.push(b-I*H,S-k*H),f.push(yr,ji)):(f.push(Kt,pe),f.push(yr,ji)):(f.push(b-C*H,S-M*H),f.push(b+C*j,S+M*j),a.join==="round"?te?g+=cs(b,S,b+C*j,S+M*j,b+I*j,S+k*j,f,!0)+2:g+=cs(b,S,b-C*H,S-M*H,b-I*H,S-k*H,f,!1)+2:a.join==="miter"&&ne/y<=_&&(te?(f.push(yr,ji),f.push(yr,ji)):(f.push(Kt,pe),f.push(Kt,pe)),g+=2),f.push(b-I*H,S-k*H),f.push(b+I*j,S+k*j),g+=2)}w=r[(m-2)*2],E=r[(m-2)*2+1],b=r[(m-1)*2],S=r[(m-1)*2+1],C=-(E-S),M=w-b,G=Math.sqrt(C*C+M*M),C/=G,M/=G,C*=v,M*=v,f.push(b-C*H,S-M*H),f.push(b+C*j,S+M*j),u||(a.cap==="round"?g+=cs(b-C*(H-j)*.5,S-M*(H-j)*.5,b-C*H,S-M*H,b+C*j,S+M*j,f,!1)+2:a.cap==="square"&&(g+=f0(b,S,C,M,H,j,!1,f)));let V=1e-4*1e-4;for(let O=p;O<g+p-2;++O)w=f[O*2],E=f[O*2+1],b=f[(O+1)*2],S=f[(O+1)*2+1],P=f[(O+2)*2],A=f[(O+2)*2+1],!(Math.abs(w*(S-A)+b*(A-E)+P*(E-S))<V)&&o.push(O,O+1,O+2)}var m0=x(()=>{or();d0()});function g0(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);h&&i.push(d+u-1,d)}var x0=x(()=>{});var vc=Q((zz,Lp)=>{"use strict";Lp.exports=_c;Lp.exports.default=_c;function _c(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=_0(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,h,c,u,d,f;if(i&&(o=YB(r,t,o,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var m=e;m<s;m+=e)u=r[m],d=r[m+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return ea(o,n,e,a,l,f,0),n}function _0(r,t,e,i,s){var o,n;if(s===Op(r,t,e,i)>0)for(o=t;o<e;o+=i)n=y0(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=y0(o,r[o],r[o+1],n);return n&&bc(n,n.next)&&(ia(n),n=n.next),n}function us(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(bc(e,e.next)||$t(e.prev,e,e.next)===0)){if(ia(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function ea(r,t,e,i,s,o,n){if(r){!n&&o&&JB(r,i,s,o);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,o?$B(r,i,s,o):zB(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),ia(r),r=h.next,a=h.next;continue}if(r=h,r===a){n?n===1?(r=XB(us(r),t,e),ea(r,t,e,i,s,o,2)):n===2&&jB(r,t,e,i,s,o):ea(us(r),t,e,i,s,o,1);break}}}}function zB(r){var t=r.prev,e=r,i=r.next;if($t(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,h=i.y,c=s<o?s<n?s:n:o<n?o:n,u=a<l?a<h?a:h:l<h?l:h,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>h?a:h:l>h?l:h,m=i.next;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&uo(s,a,o,l,n,h,m.x,m.y)&&$t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function $B(r,t,e,i){var s=r.prev,o=r,n=r.next;if($t(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,h=n.x,c=s.y,u=o.y,d=n.y,f=a<l?a<h?a:h:l<h?l:h,m=c<u?c<d?c:d:u<d?u:d,g=a>l?a>h?a:h:l>h?l:h,p=c>u?c>d?c:d:u>d?u:d,v=Gp(f,m,t,e,i),y=Gp(g,p,t,e,i),_=r.prevZ,w=r.nextZ;_&&_.z>=v&&w&&w.z<=y;){if(_.x>=f&&_.x<=g&&_.y>=m&&_.y<=p&&_!==s&&_!==n&&uo(a,c,l,u,h,d,_.x,_.y)&&$t(_.prev,_,_.next)>=0||(_=_.prevZ,w.x>=f&&w.x<=g&&w.y>=m&&w.y<=p&&w!==s&&w!==n&&uo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;_&&_.z>=v;){if(_.x>=f&&_.x<=g&&_.y>=m&&_.y<=p&&_!==s&&_!==n&&uo(a,c,l,u,h,d,_.x,_.y)&&$t(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;w&&w.z<=y;){if(w.x>=f&&w.x<=g&&w.y>=m&&w.y<=p&&w!==s&&w!==n&&uo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function XB(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!bc(s,o)&&b0(s,i,i.next,o)&&ra(s,o)&&ra(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),ia(i),ia(i.next),i=r=o),i=i.next}while(i!==r);return us(i)}function jB(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&rF(n,a)){var l=v0(n,a);n=us(n,n.next),l=us(l,l.next),ea(n,t,e,i,s,o,0),ea(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function YB(r,t,e,i){var s=[],o,n,a,l,h;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,h=_0(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(eF(h));for(s.sort(qB),o=0;o<s.length;o++)e=KB(s[o],e);return e}function qB(r,t){return r.x-t.x}function KB(r,t){var e=ZB(r,t);if(!e)return t;var i=v0(e,r);return us(i,i.next),us(e,e.next)}function ZB(r,t){var e=t,i=r.x,s=r.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,h=n.x,c=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=h&&i!==e.x&&uo(s<c?i:o,s,h,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),ra(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&QB(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function QB(r,t){return $t(r.prev,r,t.prev)<0&&$t(t.next,r,r.next)<0}function JB(r,t,e,i){var s=r;do s.z===0&&(s.z=Gp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,tF(s)}function tF(r){var t,e,i,s,o,n,a,l,h=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,h*=2}while(n>1);return r}function Gp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function eF(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function uo(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function rF(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!iF(r,t)&&(ra(r,t)&&ra(t,r)&&sF(r,t)&&($t(r.prev,r,t.prev)||$t(r,t.prev,t))||bc(r,t)&&$t(r.prev,r,r.next)>0&&$t(t.prev,t,t.next)>0)}function $t(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function bc(r,t){return r.x===t.x&&r.y===t.y}function b0(r,t,e,i){var s=yc($t(r,t,e)),o=yc($t(r,t,i)),n=yc($t(e,i,r)),a=yc($t(e,i,t));return!!(s!==o&&n!==a||s===0&&xc(r,e,t)||o===0&&xc(r,i,t)||n===0&&xc(e,r,i)||a===0&&xc(e,t,i))}function xc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function yc(r){return r>0?1:r<0?-1:0}function iF(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&b0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function ra(r,t){return $t(r.prev,r,r.next)<0?$t(r,t,r.next)>=0&&$t(r,r.prev,t)>=0:$t(r,t,r.prev)<0||$t(r,r.next,t)<0}function sF(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function v0(r,t){var e=new Up(r.i,r.x,r.y),i=new Up(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function y0(r,t,e,i){var s=new Up(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function ia(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 Up(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}_c.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(Op(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:r.length;n-=Math.abs(Op(r,h,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,m=i[a+2]*e;u+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Op(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}_c.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function Tc(r,t,e,i,s,o,n){let a=(0,T0.default)(r,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*i;for(let h=0;h<r.length;h+=2)e[l]=r[h],e[l+1]=r[h+1],l+=i}var T0,Dp=x(()=>{T0=Yi(vc(),1)});var oF,S0,w0=x(()=>{B();Dp();oF=[],S0={extension:{type:T.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){Tc(r,oF,t,e,i,s,o)}}});var E0,A0=x(()=>{B();E0={extension:{type:T.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var P0,C0=x(()=>{B();P0={extension:{type:T.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function M0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function I0(r,t){let e=X.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function nF(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&($("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ze.defaultLinearOptions.textureSize}),t}var R0,Hp,ze,fo=x(()=>{be();Ft();mt();Qs();_t();Te();Wt();Bf();R0=[{offset:0,color:"white"},{offset:1,color:"black"}],Hp=class Np{constructor(...t){this.uid=ct("fillGradient"),this.type="linear",this.colorStops=[];let e=nF(t);e={...e.type==="radial"?Np.defaultRadialOptions:Np.defaultLinearOptions,...Vh(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:ot.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let p=t;t=i,i=p,o*=-1}if(n<0){let p=e;e=s,s=p,n*=-1}}let l=this.colorStops.length?this.colorStops:R0,h=this._textureSize,{canvas:c,context:u}=I0(h,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);M0(d,l),u.fillStyle=d,u.fillRect(0,0,h,1),this.texture=new R({source:new Ve({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new F;g.scale(f/h,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(h,h),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:R0,e=this._textureSize,{canvas:i,context:s}=I0(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,d=l-c,f=e/(c*2),m=(o-u)*f,g=(n-d)*f,p=s.createRadialGradient(m,g,h*f,(a-u)*f,(l-d)*f,c*f);M0(p,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=p,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,e,e),this.texture=new R({source:new Ve({resource:i,addressMode:this._wrapMode})});let v=new F;v.scale(1/f,1/f),v.translate(u,d),this.textureSpace==="local"&&v.scale(e,e),this.transform=v}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Hp.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Hp.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ze=Hp});function B0(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(lF);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,c=1/n.height,u=-a*h,d=-l*c,f=s.a,m=s.b,g=s.c,p=s.d;s.a*=h,s.b*=h,s.c*=c,s.d*=c,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*p+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ze)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(aF.copyFrom(i).invert()),s}var aF,lF,F0=x(()=>{mt();ae();fo();aF=new F,lF=new it});function G0(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")uF(o.data,i,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&k0(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),k0(a,l,n,i,e)}}}function uF(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],h=Sc.rectangle,c=hF,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;h.build(c,l),d&&Fp(l,d),h.triangulate(l,i,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=rt.get(hs);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=i.length/2-a,m.baseColor=r.style,m.alpha=r.alpha,m.texture=u,m.geometryData=e,t.push(m)}function k0(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{let u=a.length,d=o.length/2,f=[],m=Sc[l.type],g="triangle-list";if(m.build(l,f),h&&Fp(f,h),e){let _=l.closePath??!0,w=t;w.pixelLine?(g0(f,_,o,a),g="line-list"):p0(f,w,!1,_,o,a)}else if(c){let _=[],w=f.slice();dF(c).forEach(b=>{_.push(w.length/2),w.push(...b)}),Tc(w,_,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let p=n.length/2,v=t.texture;if(v!==R.WHITE){let _=B0(cF,t,l,h);s0(o,2,d,n,p,2,o.length/2-d,_)}else o0(n,p,2,o.length/2-d);let y=rt.get(hs);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=t.color,y.alpha=t.alpha,y.texture=v,y.geometryData=s,y.topology=g,i.push(y)})}function dF(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];Sc[i.type].build(i,s),t.push(s)}return t}var Sc,hF,cF,U0=x(()=>{B();mt();ae();n0();a0();_t();Ie();kp();c0();m0();x0();w0();A0();C0();F0();Dp();Sc={};U.handleByMap(T.ShapeBuilder,Sc);U.add(E0,S0,P0,co,l0,h0);hF=new it,cF=new F});var Vp,Wp,$p,po,wc=x(()=>{B();hc();Bp();Mf();Wt();Ie();U0();Vp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Wp=class{constructor(){this.batcher=new ta,this.instructions=new zs}init(){this.instructions.reset()}get geometry(){return $(i_,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},$p=class zp{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){zp.defaultOptions.bezierSmoothness=t?.bezierSmoothness??zp.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),G0(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=rt.get(Wp),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[c];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let h=a.batches;for(let c=0;c<h.length;c++){let u=h[c];u.bindGroup=eo(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Vp;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(rt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{rt.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};$p.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"graphicsContext"};$p.defaultOptions={bezierSmoothness:.5};po=$p});var fF,Xp,jp,Yp,qp,Kp,Zp,Qp,Zt,Tr=x(()=>{"use strict";fF={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},Xp=0,jp=1,Yp=2,qp=3,Kp=4,Zp=5,Qp=class O0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Xp)}set blend(t){!!(this.data&1<<Xp)!==t&&(this.data^=1<<Xp)}get offsets(){return!!(this.data&1<<jp)}set offsets(t){!!(this.data&1<<jp)!==t&&(this.data^=1<<jp)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Yp)}set culling(t){!!(this.data&1<<Yp)!==t&&(this.data^=1<<Yp)}get depthTest(){return!!(this.data&1<<qp)}set depthTest(t){!!(this.data&1<<qp)!==t&&(this.data^=1<<qp)}get depthMask(){return!!(this.data&1<<Zp)}set depthMask(t){!!(this.data&1<<Zp)!==t&&(this.data^=1<<Zp)}get clockwiseFrontFace(){return!!(this.data&1<<Kp)}set clockwiseFrontFace(t){!!(this.data&1<<Kp)!==t&&(this.data^=1<<Kp)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=fF[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new O0;return t.depthTest=!1,t.blend=!0,t}};Qp.default2d=Qp.for2d();Zt=Qp});function Hr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var mo=x(()=>{"use strict"});var sa,L0=x(()=>{B();Tr();Ie();mo();kp();sa=class{constructor(t,e){this.state=Zt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Hr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=rt.get(hs);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{rt.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};sa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"graphics"}});var Jp=x(()=>{B();wc();L0();U.add(sa);U.add(po)});var ki,Ec=x(()=>{"use strict";ki=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var oa,D0=x(()=>{B();mt();Ri();ke();qn();Ie();mo();Ec();oa=class{constructor(t,e){this.localUniforms=new Ct({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new xe({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(rt.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=oi(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Hr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=rt.get(ki);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&rt.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};oa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"mesh"}});var tm=x(()=>{B();D0();U.add(oa)});var Ac,N0=x(()=>{"use strict";Ac=class{execute(t,e){let i=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0)}}});function em(r,t=null){let e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var H0=x(()=>{"use strict"});function W0(r){return{dynamicUpdate:V0(r,!0),staticUpdate:V0(r,!1)}}function V0(r,t){let e=[];e.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -264,7 +264,7 @@ ${s.join(`
|
|
|
264
264
|
`),e.unshift(`
|
|
265
265
|
var stride = ${i};
|
|
266
266
|
`);let s=e.join(`
|
|
267
|
-
`);return new Function("ps","f32v","u32v",s)}var
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}var z0=x(()=>{ls()});function pF(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var Pc,$0=x(()=>{Mi();ni();ro();ls();pp();H0();z0();Pc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=We(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Gr(e*4*s),this.dynamicAttributeBuffer=new Gr(e*4*o),this.indexBuffer=em(e);let n=new ar,a=0,l=0;this._staticBuffer=new jt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:at.VERTEX|at.COPY_DST}),this._dynamicBuffer=new jt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:at.VERTEX|at.COPY_DST});for(let c in i){let u=i[c],d=We(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:u.format}),l+=d.size)}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(i);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=pF(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return W0(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Gr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Gr(this._size*this._dynamicStride*4*4),this.indexBuffer=em(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var X0,j0=x(()=>{X0=`varying vec2 vUV;
|
|
268
268
|
varying vec4 vColor;
|
|
269
269
|
|
|
270
270
|
uniform sampler2D uTexture;
|
|
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
|
|
|
272
272
|
void main(void){
|
|
273
273
|
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
274
274
|
gl_FragColor = color;
|
|
275
|
-
}`});var
|
|
275
|
+
}`});var Y0,q0=x(()=>{Y0=`attribute vec2 aVertex;
|
|
276
276
|
attribute vec2 aUV;
|
|
277
277
|
attribute vec4 aColor;
|
|
278
278
|
|
|
@@ -311,7 +311,7 @@ void main(void){
|
|
|
311
311
|
vUV = aUV;
|
|
312
312
|
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
313
313
|
}
|
|
314
|
-
`});var
|
|
314
|
+
`});var rm,K0=x(()=>{rm=`
|
|
315
315
|
struct ParticleUniforms {
|
|
316
316
|
uProjectionMatrix:mat3x3<f32>,
|
|
317
317
|
uColor:vec4<f32>,
|
|
@@ -364,8 +364,8 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`});var vc,I0=x(()=>{ye();mt();ss();to();br();bt();yf();C0();M0();B0();vc=class extends Xt{constructor(){let t=lr.from({vertex:R0,fragment:P0}),e=hr.from({fragment:{source:Hp,entryPoint:"mainFragment"},vertex:{source:Hp,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:R.WHITE.source,uSampler:new Uh({}),uniforms:{uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new it(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var uo,Vp=x(()=>{mt();Fe();$n();vr();co();A0();I0();uo=class{constructor(t,e){this.state=qt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Pt({uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new vc,this.state=qt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new bc({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ra,F0=x(()=>{B();v0();Vp();ra=class extends uo{constructor(t){super(t,new _c)}};ra.extension={type:[T.WebGLPipes],name:"particle"}});var Tc,k0=x(()=>{"use strict";Tc=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var ia,G0=x(()=>{B();k0();Vp();ia=class extends uo{constructor(t){super(t,new Tc)}};ia.extension={type:[T.WebGPUPipes],name:"particle"}});var Wp=x(()=>{B();F0();G0();U.add(ra);U.add(ia)});var Hr,sa=x(()=>{"use strict";Hr=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 oa(r,t){let{texture:e,bounds:i}=r;Yh(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var zp=x(()=>{Vf()});var na,U0=x(()=>{B();Me();sa();zp();na=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),tt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,oa(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:tt.get(Hr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};na.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"}});var $p,$e,fo=x(()=>{Mt();Rn();$p=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=j.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ti(t),e=ti(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},$e=new $p});function O0(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function L0(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function D0(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,h=e-1,c=i-1;for(;l<i&&O0(n,e,l);)++l;if(l===i)return et.EMPTY;for(;O0(n,e,c);)--c;for(;L0(n,e,a,l,c);)++a;for(;L0(n,e,h,l,c);)--h;return++h,++c,new et(a/t,l/t,(h-a)/t,(c-l)/t)}var N0=x(()=>{ne()});var H0,ai,Sc=x(()=>{mt();be();H0={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"}},ai=class{constructor(t,e){this.uid=at("fillPattern"),this.transform=new F,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=H0[e].addressModeU,t.source.style.addressModeV=H0[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var W0=Z((x$,V0)=>{V0.exports=LI;var jp={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},OI=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function LI(r){var t=[];return r.replace(OI,function(e,i,s){var o=i.toLowerCase();for(s=NI(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==jp[o])return s.unshift(i),t.push(s);if(s.length<jp[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,jp[o])))}}),t}var DI=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function NI(r){var t=r.match(DI);return t?t.map(Number):[]}});function $0(r,t){let e=(0,z0.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],c=l;switch(h){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:D(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var z0,j0=x(()=>{z0=$i(W0(),1);At()});var Ec,X0=x(()=>{ne();Ec=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new et),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var wc,Y0=x(()=>{ne();wc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,h=o-l,c=n-l,u=o+a,d=n+a,f=t-this.x,g=e-this.y,m=f*f/(h*h)+g*g/(c*c),p=f*f/(u*u)+g*g/(d*d);return m>1&&p<=1}getBounds(t){return t||(t=new et),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function q0(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,h=o-i,c=n*l+a*h,u=l*l+h*h,d=-1;u!==0&&(d=c/u);let f,g;d<0?(f=e,g=i):d>1?(f=s,g=o):(f=e+d*l,g=i+d*h);let m=r-f,p=t-g;return m*m+p*p}var K0=x(()=>{"use strict"});var HI,VI,po,Z0=x(()=>{K0();ne();po=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(HI),i=t.getBounds(VI);if(!e.containsRect(i))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){let u=l[c],d=l[c+1],f=l[(c+2)%l.length],g=l[(c+3)%l.length],m=q0(t,e,u,d,f,g),p=Math.sign((f-u)*(e-d)-(g-d)*(t-u));if(m<=(p<0?a:n))return!0}return!1}getBounds(t){t||(t=new et);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let h=e[a],c=e[a+1];i=h<i?h:i,s=h>s?h:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Ac,Pc,Q0=x(()=>{ne();Ac=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},Pc=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new et),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,c=i*(1-s),u=i-c,d=o+h,f=n+h,g=a-h*2,m=l-h*2,p=o+a,_=n+l;return(t>=o-c&&t<=o+u||t>=p-u&&t<=p+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=d&&t<=d+g?!0:t<d&&e<f&&Ac(t,e,d,f,h,u,c)||t>p-h&&e<f&&Ac(t,e,p-h,f,h,u,c)||t>p-h&&e>_-h&&Ac(t,e,p-h,_-h,h,u,c)||t<d&&e>_-h&&Ac(t,e,d,_-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Rc(r,t,e,i,s,o,n,a,l,h){let u=Math.min(.99,Math.max(0,h??ho.defaultOptions.bezierSmoothness)),d=(zI-u)/1;return d*=d,$I(t,e,i,s,o,n,a,l,r,d),r}function $I(r,t,e,i,s,o,n,a,l,h){Yp(r,t,e,i,s,o,n,a,l,h,0),l.push(n,a)}function Yp(r,t,e,i,s,o,n,a,l,h,c){if(c>WI)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,g=(e+s)/2,m=(i+o)/2,p=(s+n)/2,_=(o+a)/2,y=(d+g)/2,v=(f+m)/2,b=(g+p)/2,E=(m+_)/2,A=(y+b)/2,S=(v+E)/2;if(c>0){let w=n-r,P=a-t,C=Math.abs((e-n)*P-(i-a)*w),M=Math.abs((s-n)*P-(o-a)*w),I,k;if(C>Cc&&M>Cc){if((C+M)*(C+M)<=h*(w*w+P*P)){if(mo<Xp){l.push(A,S);return}let G=Math.atan2(o-i,s-e);if(I=Math.abs(G-Math.atan2(i-t,e-r)),k=Math.abs(Math.atan2(a-o,n-s)-G),I>=u&&(I=2*u-I),k>=u&&(k=2*u-k),I+k<mo){l.push(A,S);return}if(hs!==0){if(I>hs){l.push(e,i);return}if(k>hs){l.push(s,o);return}}}}else if(C>Cc){if(C*C<=h*(w*w+P*P)){if(mo<Xp){l.push(A,S);return}if(I=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),I>=u&&(I=2*u-I),I<mo){l.push(e,i),l.push(s,o);return}if(hs!==0&&I>hs){l.push(e,i);return}}}else if(M>Cc){if(M*M<=h*(w*w+P*P)){if(mo<Xp){l.push(A,S);return}if(I=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),I>=u&&(I=2*u-I),I<mo){l.push(e,i),l.push(s,o);return}if(hs!==0&&I>hs){l.push(s,o);return}}}else if(w=A-(r+n)/2,P=S-(t+a)/2,w*w+P*P<=h){l.push(A,S);return}}Yp(r,t,d,f,y,v,A,S,l,h,c+1),Yp(A,S,b,E,p,_,n,a,l,h,c+1)}var WI,Cc,zI,Xp,mo,hs,qp=x(()=>{xc();WI=8,Cc=11920929e-14,zI=1,Xp=.01,mo=0,hs=0});function tT(r,t,e,i,s,o,n,a){let h=Math.min(.99,Math.max(0,a??ho.defaultOptions.bezierSmoothness)),c=(YI-h)/1;return c*=c,KI(t,e,i,s,o,n,r,c),r}function KI(r,t,e,i,s,o,n,a){Kp(n,r,t,e,i,s,o,a,0),n.push(s,o)}function Kp(r,t,e,i,s,o,n,a,l){if(l>jI)return;let h=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,g=(c+d)/2,m=(u+f)/2,p=o-t,_=n-e,y=Math.abs((i-o)*_-(s-n)*p);if(y>XI){if(y*y<=a*(p*p+_*_)){if(J0<qI){r.push(g,m);return}let v=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(v>=h&&(v=2*h-v),v<J0){r.push(g,m);return}}}else if(p=g-(t+o)/2,_=m-(e+n)/2,p*p+_*_<=a){r.push(g,m);return}Kp(r,t,e,c,u,g,m,a,l+1),Kp(r,g,m,d,f,o,n,a,l+1)}var jI,XI,YI,qI,J0,eT=x(()=>{xc();jI=8,XI=11920929e-14,YI=1,qI=.01,J0=0});function Mc(r,t,e,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=s;h*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),g=t+d*i,m=e+f*i;r.push(g,m),c+=h}}var Zp=x(()=>{"use strict"});function rT(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,h=n-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+h*h,g=c*c+u*u,m=l*c+h*u,p=o*Math.sqrt(f)/d,_=o*Math.sqrt(g)/d,y=p*m/f,v=_*m/g,b=p*u+_*h,E=p*c+_*l,A=h*(_+y),S=l*(_+y),w=u*(p+v),P=c*(p+v),C=Math.atan2(S-E,A-b),M=Math.atan2(P-E,w-b);Mc(r,b+t,E+e,o,C,M,h*c>u*l)}var iT=x(()=>{Zp()});function ZI(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function oT(r,t,e,i,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let c=Math.sin(a*aa/360),u=Math.cos(a*aa/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let g=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);g>1&&(o*=Math.sqrt(g),n*=Math.sqrt(g)),QI(t,e,i,s,o,n,l,h,c,u,d,f,Qp);let{ang1:m,ang2:p}=Qp,{centerX:_,centerY:y}=Qp,v=Math.abs(p)/(aa/4);Math.abs(1-v)<1e-7&&(v=1);let b=Math.max(Math.ceil(v),1);p/=b;let E=r[r.length-2],A=r[r.length-1],S={x:0,y:0};for(let w=0;w<b;w++){let P=ZI(m,p),{x:C,y:M}=Jp(P[0],o,n,u,c,_,y,S),{x:I,y:k}=Jp(P[1],o,n,u,c,_,y,S),{x:G,y:ut}=Jp(P[2],o,n,u,c,_,y,S);Rc(r,E,A,C,M,I,k,G,ut),E=G,A=ut,m+=p}}var aa,Qp,Jp,sT,QI,nT=x(()=>{qp();aa=Math.PI*2,Qp={centerX:0,centerY:0,ang1:0,ang2:0},Jp=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let h=s*r-o*t,c=o*r+s*t;return l.x=h+n,l.y=c+a,l};sT=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},QI=(r,t,e,i,s,o,n,a,l,h,c,u,d)=>{let f=Math.pow(s,2),g=Math.pow(o,2),m=Math.pow(c,2),p=Math.pow(u,2),_=f*g-f*p-g*m;_<0&&(_=0),_/=f*p+g*m,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*u,v=_*-o/s*c,b=h*y-l*v+(r+e)/2,E=l*y+h*v+(t+i)/2,A=(c-y)/s,S=(u-v)/o,w=(-c-y)/s,P=(-u-v)/o,C=sT(1,0,A,S),M=sT(A,S,w,P);a===0&&M>0&&(M-=aa),a===1&&M<0&&(M+=aa),d.centerX=b,d.centerY=E,d.ang1=C,d.ang2=M}});function aT(r,t,e){let i=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,c=Math.sqrt(l*l+h*h),u=l/c,d=h/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],c=i(a,o),u=i(a,h);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,g=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,g=!0):d>0&&(f=-1,g=!0);let m=d/2,p,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),p=Math.abs(_*Math.sin(m)/Math.cos(m))):p=l;let y=a.x+u.nx*_+-u.ny*p*f,v=a.y+u.ny*_+u.nx*p*f,b=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(y+Math.cos(b)*p,v+Math.sin(b)*p),r.arc(y,v,p,b,E,g),o=a}}function lT(r,t,e,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],h=l.radius??e;if(h<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,l),f;if(d<1e-4)f=l;else{let p=Math.min(d/2,h);f=o(l,c,p/d)}let g=s(u,l),m;if(g<1e-4)m=l;else{let p=Math.min(g/2,h);m=o(l,u,p/g)}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 hT=x(()=>{"use strict"});var JI,Bc,cT=x(()=>{X0();Y0();Z0();ne();Q0();Ne();qp();eT();Zp();iT();nT();hT();JI=new et,Bc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new wt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Mc(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return rT(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return oT(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Rc(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return tT(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new et(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Ec(t,e,i),s),this}poly(t,e,i){let s=new po(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let c=0;c<s;c++){let u=a-c*l;h.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(h,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+h,g=t+i*Math.cos(f),m=e+i*Math.sin(f),p=f+Math.PI+u,_=f-Math.PI-u,y=g+o*Math.cos(p),v=m+o*Math.sin(p),b=g+o*Math.cos(_),E=m+o*Math.sin(_);d===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(g,m,b,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?lT(this,t,e,s):aT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,h=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+i-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,h=e+s,c=[t+a,e,l-a,e,l,e+a,l,h-a,l-a,h,t+a,h,t,h-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,i,s,o){return this.drawShape(new wc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Pc(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new po,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new po,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(JI);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function la(r,t){return r?r.prepend(t):t.clone()}var Fi,tm=x(()=>{or();be();At();j0();cT();Fi=class r{constructor(t,e=!1){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?$0(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Bc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ht.shared),l=0,h=0;if(!n||n.action!=="bezierCurveTo")l=a.x,h=a.y;else{l=n.data[2],h=n.data[3];let c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ht.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,h=o.y;n=l+(l-n),a=h+(h-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=i*2,c=Math.PI*2/h,u=[];for(let d=0;d<h;d++){let f=d%2?o:s,g=d*c+l;u.push(t+f*Math.cos(g),e+f*Math.sin(g))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,c=0,u=0,d=0,f=0,g=0,m=0;for(let p=0;p<this.instructions.length;p++){let _=this.instructions[p],y=_.data;switch(_.action){case"moveTo":case"lineTo":l=y[0],h=y[1],y[0]=e*l+s*h+n,y[1]=i*l+o*h+a;break;case"bezierCurveTo":c=y[0],u=y[1],d=y[2],f=y[3],l=y[4],h=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*d+s*f+n,y[3]=i*d+o*f+a,y[4]=e*l+s*h+n,y[5]=i*l+o*h+a;break;case"quadraticCurveTo":c=y[0],u=y[1],l=y[2],h=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*l+s*h+n,y[3]=i*l+o*h+a;break;case"arcToSvg":l=y[5],h=y[6],g=y[0],m=y[1],y[0]=e*g+s*m,y[1]=i*g+o*m,y[5]=e*l+s*h+n,y[6]=i*l+o*h+a;break;case"circle":y[4]=la(y[3],t);break;case"rect":y[4]=la(y[4],t);break;case"ellipse":y[8]=la(y[8],t);break;case"roundRect":y[5]=la(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=la(y[2],t);break;default:D("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Dt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var em=x(()=>{"use strict"});function uT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=tF(n);break;case"radialgradient":t.defs[n.id]=eF(n);break;default:break}}}}function tF(r){let t=Dt(r,"x1",0),e=Dt(r,"y1",0),i=Dt(r,"x2",1),s=Dt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ze(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],h=Dt(l,"offset",0),c=it.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,c)}return n}function eF(r){return D("[SVG Parser] Radial gradients are not yet supported"),new ze(0,0,1,0)}var dT=x(()=>{ye();At();lo();em()});function rm(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var fT=x(()=>{"use strict"});function im(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in pT){let a=r.getAttribute(n);a&&mT(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[h,c]=l.split(":");pT[h]&&mT(t,o,h,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function mT(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=rm(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=it.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=rm(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=it.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var pT,gT=x(()=>{ye();fT();pT={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 xT(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Fi};uT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=im(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&yT(a,e,s,o)}return t}function yT(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=im(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,h,c,u,d,f,g,m,p,_,y,v,b,E,A,S,w;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&D("SVG Evenodd fill rule not supported, your svg may render incorrectly"),A=new Fi(E,!0),t.context.path(A),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":g=Dt(r,"cx",0),m=Dt(r,"cy",0),p=Dt(r,"r",0),t.context.ellipse(g,m,p,p),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Dt(r,"x",0),h=Dt(r,"y",0),S=Dt(r,"width",0),w=Dt(r,"height",0),_=Dt(r,"rx",0),y=Dt(r,"ry",0),_||y?t.context.roundRect(l,h,S,w,_||y):t.context.rect(l,h,S,w),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":g=Dt(r,"cx",0),m=Dt(r,"cy",0),_=Dt(r,"rx",0),y=Dt(r,"ry",0),t.context.beginPath(),t.context.ellipse(g,m,_,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Dt(r,"x1",0),u=Dt(r,"y1",0),d=Dt(r,"x2",0),f=Dt(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":b=r.getAttribute("points"),v=b.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":b=r.getAttribute("points"),v=b.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{D(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)yT(s[P],t,e,i)}var _T=x(()=>{At();tm();dT();em();gT()});function rF(r){return it.isColorLike(r)}function bT(r){return r instanceof ai}function vT(r){return r instanceof ze}function iF(r){return r instanceof R}function sF(r,t,e){let i=it.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=R.WHITE,{...e,...r}}function oF(r,t,e){return r.texture=t,{...e,...r}}function TT(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function ST(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function nF(r,t){let e={...t,...r},i=it.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function li(r,t){if(r==null)return null;let e={},i=r;return rF(r)?sF(e,r,t):iF(r)?oF(e,r,t):bT(r)?TT(e,r,t):vT(r)?ST(e,r,t):i.fill&&bT(i.fill)?TT(i,i.fill,t):i.fill&&vT(i.fill)?ST(i,i.fill,t):nF(i,t)}function go(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=li(r,l);return h?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var sm=x(()=>{ye();bt();lo();Sc()});var aF,ET,om,ke,Ic=x(()=>{Se();ye();mt();or();bt();be();Vt();Ne();tm();_T();sm();aF=new ht,ET=new F,om=class Vr extends Rt{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Fi,this._transform=new F,this._fillStyle={...Vr.defaultFillStyle},this._strokeStyle={...Vr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new wt,this._boundsDirty=!0}clone(){let t=new Vr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=li(t,Vr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=go(t,Vr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=li(t,Vr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=li(t,Vr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?it.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Fi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&($(J,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=li(t,Vr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ht.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=go(t,Vr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,xT(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof F?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof F?(this._transform.append(t),this):(ET.set(t,e,i,s,o,n),this._transform.append(ET),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,i=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let c=0;c<h.length;c++){let u=h[c].shape;if(!l||!u)continue;let d=h[c].transform,f=d?d.applyInverse(t,aF):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=l;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let g=n.hole;if(g){let m=g.shapePath?.shapePrimitives;if(m)for(let p=0;p<m.length;p++)m[p].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};om.defaultFillStyle={color:16777215,alpha:1,texture:R.WHITE,matrix:null,fill:null,textureSpace:"local"};om.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:R.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};ke=om});function Fc(r){let t=[],e=0;for(let i=0;i<wT.length;i++){let s=`_${wT[i]}`;t[e++]=r[s]}return e=AT(r._fill,t,e),e=lF(r._stroke,t,e),e=hF(r.dropShadow,t,e),t.join("-")}function AT(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function lF(r,t,e){return r&&(e=AT(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function hF(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=it.shared.setValue(r.color).toNumber()),e}var wT,nm=x(()=>{ye();wT=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function cF(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Bt.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){$(J,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(it.isColorLike(e))i.color=e;else if(e instanceof ze||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){$(J,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Bt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new ze({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>it.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var am,Bt,cs=x(()=>{Se();ye();Vt();lo();Sc();Ic();sm();nm();am=class xo extends Rt{constructor(t={}){super(),cF(t);let e={...xo.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...xo.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...xo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...ke.defaultFillStyle,...t},()=>{this._fill=li({...this._originalFill},ke.defaultFillStyle)})),this._fill=li(t===0?"black":t,ke.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...ke.defaultStrokeStyle,...t},()=>{this._stroke=go({...this._originalStroke},ke.defaultStrokeStyle)})),this._stroke=go(t,ke.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Fc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=xo.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new xo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(it.isColorLike(t)||t instanceof ze||t instanceof ai)}};am.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};am.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};Bt=am});function kc(r,t,e,i){let s=uF;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Wt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var uF,lm=x(()=>{vi();Ne();uF=new wt});function us(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!dF.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var dF,Gc=x(()=>{"use strict";dF=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var hm,Tr,Kt,ha=x(()=>{Mt();Gc();hm={willReadFrequently:!0},Tr=class X{static get experimentalLetterSpacingSupported(){let t=X._experimentalLetterSpacingSupported;if(t!==void 0){let e=j.get().getCanvasRenderingContext2D().prototype;t=X._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",e,i=X._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(X._measurementCache[o])return X._measurementCache[o];let n=us(e),a=X.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=X.__context;l.font=n;let c=(s?X._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y<c.length;y++){let v=X._measureText(c[y],e.letterSpacing,l);u[y]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,g=d+f;e.dropShadow&&(g+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,p=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(p+=e.dropShadow.distance),new X(t,e,g,p,c,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;X.experimentalLetterSpacingSupported&&(X.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else{let c=(X.graphemeSegmenter(t).length-1)*e;n+=c,h+=c}return Math.max(n,h)}static _wordWrap(t,e,i=X._canvas){let s=i.getContext("2d",hm),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=X._collapseSpaces(c),d=X._collapseNewlines(c),f=!u,g=e.wordWrapWidth+h,m=X._tokenize(t);for(let p=0;p<m.length;p++){let _=m[p];if(X._isNewline(_)){if(!d){a+=X._addLine(n),f=!u,n="",o=0;continue}_=" "}if(u){let v=X.isBreakingSpace(_),b=X.isBreakingSpace(n[n.length-1]);if(v&&b)continue}let y=X._getFromCache(_,h,l,s);if(y>g)if(n!==""&&(a+=X._addLine(n),n="",o=0),X.canBreakWords(_,e.breakWords)){let v=X.wordWrapSplit(_);for(let b=0;b<v.length;b++){let E=v[b],A=E,S=1;for(;v[b+S];){let P=v[b+S];if(!X.canBreakChars(A,P,_,b,e.breakWords))E+=P;else break;A=P,S++}b+=S-1;let w=X._getFromCache(E,h,l,s);w+o>g&&(a+=X._addLine(n),f=!1,n="",o=0),n+=E,o+=w}}else{n.length>0&&(a+=X._addLine(n),n="",o=0);let v=p===m.length-1;a+=X._addLine(_,!v),f=!1,n="",o=0}else y+o>g&&(f=!1,a+=X._addLine(n),n="",o=0),(n.length>0||!X.isBreakingSpace(_)||f)&&(n+=_,o+=y)}return a+=X._addLine(n,!1),a}static _addLine(t,e=!0){return t=X._trimRight(t),t=e?`${t}
|
|
368
|
-
`:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=X._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!X.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:X._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:X._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(X.isBreakingSpace(o,n)||X._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return X.graphemeSegmenter(t)}static measureFont(t){if(X._fonts[t])return X._fonts[t];let e=X._context;e.font=t;let i=e.measureText(X.METRICS_STRING+X.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return X._fonts[t]=s,s}static clearMetrics(t=""){t?delete X._fonts[t]:X._fonts={}}static get _canvas(){if(!X.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",hm)?.measureText)return X.__canvas=e,e;t=j.get().createCanvas()}catch{t=j.get().createCanvas()}t.width=t.height=10,X.__canvas=t}return X.__canvas}static get _context(){return X.__context||(X.__context=X._canvas.getContext("2d",hm)),X.__context}};Tr.METRICS_STRING="|\xC9q\xC5";Tr.BASELINE_SYMBOL="M";Tr.BASELINE_MULTIPLIER=1.4;Tr.HEIGHT_MULTIPLIER=2;Tr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Tr.experimentalLetterSpacing=!1;Tr._fonts={};Tr._newlines=[10,13];Tr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Tr._measurementCache={};Kt=Tr});function yo(r,t,e,i=0){if(r.texture===R.WHITE&&!r.fill)return it.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(F.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ze){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let h,c=!1;if(o){let{start:u,end:d}=s;h=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:g}=s;h=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,g*a)}if(c&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(g=>{let m=f+g.offset*u;h.addColorStop(Math.floor(m*PT)/PT,it.shared.setValue(g.color).toHex())})}}else s.colorStops.forEach(u=>{h.addColorStop(u.offset,it.shared.setValue(u.color).toHex())});return h}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(F.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return D("FillStyle not recognised",r),"red"}var PT,cm=x(()=>{ye();mt();bt();At();lo();Sc();PT=1e5});var ca,CT=x(()=>{ye();B();Rn();fo();vi();N0();Vt();cs();lm();ha();Gc();cm();ca=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Kt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ti(o),n=ti(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&($("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Bt||(t.style=new Bt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),$e.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Kt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=$e.getOptimalCanvasAndContext(n,a),{canvas:h}=l;this.renderTextToCanvas(e,i,s,l);let c=kc(h,n,a,s);if(i.trim){let u=D0(h,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Wt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&($e.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=us(e),l=Kt.measureText(t||" ",e),h=l.lines,c=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,g=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let m,p,_=e.dropShadow?2:1;for(let y=0;y<_;++y){let v=e.dropShadow&&y===0,b=v?Math.ceil(Math.max(1,g)+e.padding*2):0,E=b*i;if(v){n.fillStyle="black",n.strokeStyle="black";let w=e.dropShadow,P=w.color,C=w.alpha;n.shadowColor=it.shared.setValue(P).setAlpha(C).toRgbaString();let M=w.blur*i,I=w.distance*i;n.shadowBlur=M,n.shadowOffsetX=Math.cos(w.angle)*I,n.shadowOffsetY=Math.sin(w.angle)*I+E}else{if(n.fillStyle=e._fill?yo(e._fill,n,l):null,e._stroke?.width){let w=e._stroke.width*e._stroke.alignment;n.strokeStyle=yo(e._stroke,n,l,w)}n.shadowColor="black"}let A=(c-f.fontSize)/2;c-f.fontSize<0&&(A=0);let S=e._stroke?.width??0;for(let w=0;w<h.length;w++)m=S/2,p=S/2+w*c+f.ascent+A,e.align==="right"?m+=d-u[w]:e.align==="center"&&(m+=(d-u[w])/2),e._stroke?.width&&this._drawLetterSpacing(h[w],e,s,m+e.padding,p+e.padding-b,!0),e._fill!==void 0&&this._drawLetterSpacing(h[w],e,s,m+e.padding,p+e.padding-b)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,h=!1;if(Kt.experimentalLetterSpacingSupported&&(Kt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Kt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let g=0;g<u.length;++g){let m=u[g];n?a.strokeText(m,c,o):a.fillText(m,c,o);let p="";for(let _=g+1;_<u.length;++_)p+=u[_];f=a.measureText(p).width,c+=d-f+l,d=f}}destroy(){this._activeTextures=null}};ca.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"}});var um=x(()=>{B();U0();CT();U.add(ca);U.add(na)});var he,dm=x(()=>{Vt();$h();Ic();he=class r extends Ei{constructor(t){t instanceof ke&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new ke,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){$(J,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){$(J,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){$(J,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==ke.defaultStrokeStyle.width||t.color!==ke.defaultStrokeStyle.color||t.alpha!==ke.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return $(J,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return $(J,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return $(J,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return $(J,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return $(J,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return $(J,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var RT,MT,BT=x(()=>{"use strict";RT={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`});var Cc,Z0=x(()=>{be();mt();as();so();vr();_t();Ff();j0();q0();K0();Cc=class extends Yt{constructor(){let t=lr.from({vertex:Y0,fragment:X0}),e=hr.from({fragment:{source:rm,entryPoint:"mainFragment"},vertex:{source:rm,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:R.WHITE.source,uSampler:new Wh({}),uniforms:{uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new ot(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var go,im=x(()=>{mt();ke();qn();Tr();mo();$0();Z0();go=class{constructor(t,e){this.state=Zt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Cc,this.state=Zt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Pc({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=oi(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Hr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var na,Q0=x(()=>{B();N0();im();na=class extends go{constructor(t){super(t,new Ac)}};na.extension={type:[T.WebGLPipes],name:"particle"}});var Rc,J0=x(()=>{"use strict";Rc=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var aa,tT=x(()=>{B();J0();im();aa=class extends go{constructor(t){super(t,new Rc)}};aa.extension={type:[T.WebGPUPipes],name:"particle"}});var sm=x(()=>{B();Q0();tT();U.add(na);U.add(aa)});var Vr,la=x(()=>{"use strict";Vr=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 ha(r,t){let{texture:e,bounds:i}=r;ec(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var om=x(()=>{ip()});var ca,eT=x(()=>{B();Ie();la();om();ca=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),rt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ha(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:rt.get(Vr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};ca.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"}});var nm,$e,xo=x(()=>{Ft();Fn();nm=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=X.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ei(t),e=ei(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},$e=new nm});function rT(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function iT(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function sT(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,h=e-1,c=i-1;for(;l<i&&rT(n,e,l);)++l;if(l===i)return it.EMPTY;for(;rT(n,e,c);)--c;for(;iT(n,e,a,l,c);)++a;for(;iT(n,e,h,l,c);)--h;return++h,++c,new it(a/t,l/t,(h-a)/t,(c-l)/t)}var oT=x(()=>{ae()});var nT,li,Mc=x(()=>{mt();Te();nT={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"}},li=class{constructor(t,e){this.uid=ct("fillPattern"),this.transform=new F,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=nT[e].addressModeU,t.source.style.addressModeV=nT[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var lT=Q((p6,aT)=>{aT.exports=gF;var am={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},mF=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function gF(r){var t=[];return r.replace(mF,function(e,i,s){var o=i.toLowerCase();for(s=yF(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==am[o])return s.unshift(i),t.push(s);if(s.length<am[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,am[o])))}}),t}var xF=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function yF(r){var t=r.match(xF);return t?t.map(Number):[]}});function cT(r,t){let e=(0,hT.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],c=l;switch(h){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:D(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var hT,uT=x(()=>{hT=Yi(lT(),1);At()});var Ic,dT=x(()=>{ae();Ic=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new it),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Bc,fT=x(()=>{ae();Bc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,h=o-l,c=n-l,u=o+a,d=n+a,f=t-this.x,m=e-this.y,g=f*f/(h*h)+m*m/(c*c),p=f*f/(u*u)+m*m/(d*d);return g>1&&p<=1}getBounds(t){return t||(t=new it),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function pT(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,h=o-i,c=n*l+a*h,u=l*l+h*h,d=-1;u!==0&&(d=c/u);let f,m;d<0?(f=e,m=i):d>1?(f=s,m=o):(f=e+d*l,m=i+d*h);let g=r-f,p=t-m;return g*g+p*p}var mT=x(()=>{"use strict"});var _F,bF,yo,gT=x(()=>{mT();ae();yo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(_F),i=t.getBounds(bF);if(!e.containsRect(i))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){let u=l[c],d=l[c+1],f=l[(c+2)%l.length],m=l[(c+3)%l.length],g=pT(t,e,u,d,f,m),p=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(g<=(p<0?a:n))return!0}return!1}getBounds(t){t||(t=new it);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let h=e[a],c=e[a+1];i=h<i?h:i,s=h>s?h:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Fc,kc,xT=x(()=>{ae();Fc=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},kc=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new it),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,c=i*(1-s),u=i-c,d=o+h,f=n+h,m=a-h*2,g=l-h*2,p=o+a,v=n+l;return(t>=o-c&&t<=o+u||t>=p-u&&t<=p+c)&&e>=f&&e<=f+g||(e>=n-c&&e<=n+u||e>=v-u&&e<=v+c)&&t>=d&&t<=d+m?!0:t<d&&e<f&&Fc(t,e,d,f,h,u,c)||t>p-h&&e<f&&Fc(t,e,p-h,f,h,u,c)||t>p-h&&e>v-h&&Fc(t,e,p-h,v-h,h,u,c)||t<d&&e>v-h&&Fc(t,e,d,v-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Uc(r,t,e,i,s,o,n,a,l,h){let u=Math.min(.99,Math.max(0,h??po.defaultOptions.bezierSmoothness)),d=(TF-u)/1;return d*=d,SF(t,e,i,s,o,n,a,l,r,d),r}function SF(r,t,e,i,s,o,n,a,l,h){hm(r,t,e,i,s,o,n,a,l,h,0),l.push(n,a)}function hm(r,t,e,i,s,o,n,a,l,h,c){if(c>vF)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,m=(e+s)/2,g=(i+o)/2,p=(s+n)/2,v=(o+a)/2,y=(d+m)/2,_=(f+g)/2,w=(m+p)/2,E=(g+v)/2,b=(y+w)/2,S=(_+E)/2;if(c>0){let P=n-r,A=a-t,C=Math.abs((e-n)*A-(i-a)*P),M=Math.abs((s-n)*A-(o-a)*P),I,k;if(C>Gc&&M>Gc){if((C+M)*(C+M)<=h*(P*P+A*A)){if(_o<lm){l.push(b,S);return}let G=Math.atan2(o-i,s-e);if(I=Math.abs(G-Math.atan2(i-t,e-r)),k=Math.abs(Math.atan2(a-o,n-s)-G),I>=u&&(I=2*u-I),k>=u&&(k=2*u-k),I+k<_o){l.push(b,S);return}if(ds!==0){if(I>ds){l.push(e,i);return}if(k>ds){l.push(s,o);return}}}}else if(C>Gc){if(C*C<=h*(P*P+A*A)){if(_o<lm){l.push(b,S);return}if(I=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),I>=u&&(I=2*u-I),I<_o){l.push(e,i),l.push(s,o);return}if(ds!==0&&I>ds){l.push(e,i);return}}}else if(M>Gc){if(M*M<=h*(P*P+A*A)){if(_o<lm){l.push(b,S);return}if(I=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),I>=u&&(I=2*u-I),I<_o){l.push(e,i),l.push(s,o);return}if(ds!==0&&I>ds){l.push(s,o);return}}}else if(P=b-(r+n)/2,A=S-(t+a)/2,P*P+A*A<=h){l.push(b,S);return}}hm(r,t,d,f,y,_,b,S,l,h,c+1),hm(b,S,w,E,p,v,n,a,l,h,c+1)}var vF,Gc,TF,lm,_o,ds,cm=x(()=>{wc();vF=8,Gc=11920929e-14,TF=1,lm=.01,_o=0,ds=0});function _T(r,t,e,i,s,o,n,a){let h=Math.min(.99,Math.max(0,a??po.defaultOptions.bezierSmoothness)),c=(AF-h)/1;return c*=c,CF(t,e,i,s,o,n,r,c),r}function CF(r,t,e,i,s,o,n,a){um(n,r,t,e,i,s,o,a,0),n.push(s,o)}function um(r,t,e,i,s,o,n,a,l){if(l>wF)return;let h=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,m=(c+d)/2,g=(u+f)/2,p=o-t,v=n-e,y=Math.abs((i-o)*v-(s-n)*p);if(y>EF){if(y*y<=a*(p*p+v*v)){if(yT<PF){r.push(m,g);return}let _=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(_>=h&&(_=2*h-_),_<yT){r.push(m,g);return}}}else if(p=m-(t+o)/2,v=g-(e+n)/2,p*p+v*v<=a){r.push(m,g);return}um(r,t,e,c,u,m,g,a,l+1),um(r,m,g,d,f,o,n,a,l+1)}var wF,EF,AF,PF,yT,bT=x(()=>{wc();wF=8,EF=11920929e-14,AF=1,PF=.01,yT=0});function Oc(r,t,e,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=s;h*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),m=t+d*i,g=e+f*i;r.push(m,g),c+=h}}var dm=x(()=>{"use strict"});function vT(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,h=n-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+h*h,m=c*c+u*u,g=l*c+h*u,p=o*Math.sqrt(f)/d,v=o*Math.sqrt(m)/d,y=p*g/f,_=v*g/m,w=p*u+v*h,E=p*c+v*l,b=h*(v+y),S=l*(v+y),P=u*(p+_),A=c*(p+_),C=Math.atan2(S-E,b-w),M=Math.atan2(A-E,P-w);Oc(r,w+t,E+e,o,C,M,h*c>u*l)}var TT=x(()=>{dm()});function RF(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function wT(r,t,e,i,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let c=Math.sin(a*ua/360),u=Math.cos(a*ua/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),MF(t,e,i,s,o,n,l,h,c,u,d,f,fm);let{ang1:g,ang2:p}=fm,{centerX:v,centerY:y}=fm,_=Math.abs(p)/(ua/4);Math.abs(1-_)<1e-7&&(_=1);let w=Math.max(Math.ceil(_),1);p/=w;let E=r[r.length-2],b=r[r.length-1],S={x:0,y:0};for(let P=0;P<w;P++){let A=RF(g,p),{x:C,y:M}=pm(A[0],o,n,u,c,v,y,S),{x:I,y:k}=pm(A[1],o,n,u,c,v,y,S),{x:G,y:J}=pm(A[2],o,n,u,c,v,y,S);Uc(r,E,b,C,M,I,k,G,J),E=G,b=J,g+=p}}var ua,fm,pm,ST,MF,ET=x(()=>{cm();ua=Math.PI*2,fm={centerX:0,centerY:0,ang1:0,ang2:0},pm=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let h=s*r-o*t,c=o*r+s*t;return l.x=h+n,l.y=c+a,l};ST=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},MF=(r,t,e,i,s,o,n,a,l,h,c,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(c,2),p=Math.pow(u,2),v=f*m-f*p-m*g;v<0&&(v=0),v/=f*p+m*g,v=Math.sqrt(v)*(n===a?-1:1);let y=v*s/o*u,_=v*-o/s*c,w=h*y-l*_+(r+e)/2,E=l*y+h*_+(t+i)/2,b=(c-y)/s,S=(u-_)/o,P=(-c-y)/s,A=(-u-_)/o,C=ST(1,0,b,S),M=ST(b,S,P,A);a===0&&M>0&&(M-=ua),a===1&&M<0&&(M+=ua),d.centerX=w,d.centerY=E,d.ang1=C,d.ang2=M}});function AT(r,t,e){let i=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,c=Math.sqrt(l*l+h*h),u=l/c,d=h/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],c=i(a,o),u=i(a,h);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,m=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let g=d/2,p,v=Math.abs(Math.cos(g)*l/Math.sin(g));v>Math.min(c.len/2,u.len/2)?(v=Math.min(c.len/2,u.len/2),p=Math.abs(v*Math.sin(g)/Math.cos(g))):p=l;let y=a.x+u.nx*v+-u.ny*p*f,_=a.y+u.ny*v+u.nx*p*f,w=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(y+Math.cos(w)*p,_+Math.sin(w)*p),r.arc(y,_,p,w,E,m),o=a}}function PT(r,t,e,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],h=l.radius??e;if(h<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,l),f;if(d<1e-4)f=l;else{let p=Math.min(d/2,h);f=o(l,c,p/d)}let m=s(u,l),g;if(m<1e-4)g=l;else{let p=Math.min(m/2,h);g=o(l,u,p/m)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}var CT=x(()=>{"use strict"});var IF,Lc,RT=x(()=>{dT();fT();gT();ae();xT();Ne();cm();bT();dm();TT();ET();CT();IF=new it,Lc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Et,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Oc(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return vT(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return wT(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Uc(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return _T(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new it(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Ic(t,e,i),s),this}poly(t,e,i){let s=new yo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let c=0;c<s;c++){let u=a-c*l;h.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(h,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+h,m=t+i*Math.cos(f),g=e+i*Math.sin(f),p=f+Math.PI+u,v=f-Math.PI-u,y=m+o*Math.cos(p),_=g+o*Math.sin(p),w=m+o*Math.cos(v),E=g+o*Math.sin(v);d===0?this.moveTo(y,_):this.lineTo(y,_),this.quadraticCurveTo(m,g,w,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?PT(this,t,e,s):AT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,h=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+i-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,h=e+s,c=[t+a,e,l-a,e,l,e+a,l,h-a,l-a,h,t+a,h,t,h-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,i,s,o){return this.drawShape(new Bc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new kc(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new yo,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new yo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(IF);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function da(r,t){return r?r.prepend(t):t.clone()}var Gi,mm=x(()=>{or();Te();At();uT();RT();Gi=class r{constructor(t,e=!1){this.instructions=[],this.uid=ct("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?cT(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Lc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ut.shared),l=0,h=0;if(!n||n.action!=="bezierCurveTo")l=a.x,h=a.y;else{l=n.data[2],h=n.data[3];let c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ut.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,h=o.y;n=l+(l-n),a=h+(h-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=i*2,c=Math.PI*2/h,u=[];for(let d=0;d<h;d++){let f=d%2?o:s,m=d*c+l;u.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,c=0,u=0,d=0,f=0,m=0,g=0;for(let p=0;p<this.instructions.length;p++){let v=this.instructions[p],y=v.data;switch(v.action){case"moveTo":case"lineTo":l=y[0],h=y[1],y[0]=e*l+s*h+n,y[1]=i*l+o*h+a;break;case"bezierCurveTo":c=y[0],u=y[1],d=y[2],f=y[3],l=y[4],h=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*d+s*f+n,y[3]=i*d+o*f+a,y[4]=e*l+s*h+n,y[5]=i*l+o*h+a;break;case"quadraticCurveTo":c=y[0],u=y[1],l=y[2],h=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*l+s*h+n,y[3]=i*l+o*h+a;break;case"arcToSvg":l=y[5],h=y[6],m=y[0],g=y[1],y[0]=e*m+s*g,y[1]=i*m+o*g,y[5]=e*l+s*h+n,y[6]=i*l+o*h+a;break;case"circle":y[4]=da(y[3],t);break;case"rect":y[4]=da(y[4],t);break;case"ellipse":y[8]=da(y[8],t);break;case"roundRect":y[5]=da(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=da(y[2],t);break;default:D("unknown transform action",v.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Nt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var gm=x(()=>{"use strict"});function MT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=BF(n);break;case"radialgradient":t.defs[n.id]=FF(n);break;default:break}}}}function BF(r){let t=Nt(r,"x1",0),e=Nt(r,"y1",0),i=Nt(r,"x2",1),s=Nt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ze(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],h=Nt(l,"offset",0),c=ot.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,c)}return n}function FF(r){return D("[SVG Parser] Radial gradients are not yet supported"),new ze(0,0,1,0)}var IT=x(()=>{be();At();fo();gm()});function xm(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var BT=x(()=>{"use strict"});function ym(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in FT){let a=r.getAttribute(n);a&&kT(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[h,c]=l.split(":");FT[h]&&kT(t,o,h,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function kT(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=xm(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=ot.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=xm(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=ot.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var FT,GT=x(()=>{be();BT();FT={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 UT(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Gi};MT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=ym(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&OT(a,e,s,o)}return t}function OT(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=ym(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,h,c,u,d,f,m,g,p,v,y,_,w,E,b,S,P;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&D("SVG Evenodd fill rule not supported, your svg may render incorrectly"),b=new Gi(E,!0),t.context.path(b),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":m=Nt(r,"cx",0),g=Nt(r,"cy",0),p=Nt(r,"r",0),t.context.ellipse(m,g,p,p),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Nt(r,"x",0),h=Nt(r,"y",0),S=Nt(r,"width",0),P=Nt(r,"height",0),v=Nt(r,"rx",0),y=Nt(r,"ry",0),v||y?t.context.roundRect(l,h,S,P,v||y):t.context.rect(l,h,S,P),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":m=Nt(r,"cx",0),g=Nt(r,"cy",0),v=Nt(r,"rx",0),y=Nt(r,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,v,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Nt(r,"x1",0),u=Nt(r,"y1",0),d=Nt(r,"x2",0),f=Nt(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":w=r.getAttribute("points"),_=w.match(/\d+/g).map(A=>parseInt(A,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=r.getAttribute("points"),_=w.match(/\d+/g).map(A=>parseInt(A,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{D(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let A=0;A<s.length;A++)OT(s[A],t,e,i)}var LT=x(()=>{At();mm();IT();gm();GT()});function kF(r){return ot.isColorLike(r)}function DT(r){return r instanceof li}function NT(r){return r instanceof ze}function GF(r){return r instanceof R}function UF(r,t,e){let i=ot.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=R.WHITE,{...e,...r}}function OF(r,t,e){return r.texture=t,{...e,...r}}function HT(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function VT(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function LF(r,t){let e={...t,...r},i=ot.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function hi(r,t){if(r==null)return null;let e={},i=r;return kF(r)?UF(e,r,t):GF(r)?OF(e,r,t):DT(r)?HT(e,r,t):NT(r)?VT(e,r,t):i.fill&&DT(i.fill)?HT(i,i.fill,t):i.fill&&NT(i.fill)?VT(i,i.fill,t):LF(i,t)}function bo(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=hi(r,l);return h?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var _m=x(()=>{be();_t();fo();Mc()});var DF,WT,bm,Ge,Dc=x(()=>{Ee();be();mt();or();_t();Te();Wt();Ne();mm();LT();_m();DF=new ut,WT=new F,bm=class Wr extends Mt{constructor(){super(...arguments),this.uid=ct("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Gi,this._transform=new F,this._fillStyle={...Wr.defaultFillStyle},this._strokeStyle={...Wr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Wr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=hi(t,Wr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=bo(t,Wr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=hi(t,Wr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=hi(t,Wr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?ot.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Gi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&($(et,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=hi(t,Wr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ut.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=bo(t,Wr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,UT(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof F?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof F?(this._transform.append(t),this):(WT.set(t,e,i,s,o,n),this._transform.append(WT),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,i=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let c=0;c<h.length;c++){let u=h[c].shape;if(!l||!u)continue;let d=h[c].transform,f=d?d.applyInverse(t,DF):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let g=l;i=u.strokeContains(f.x,f.y,g.width,g.alignment)}let m=n.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let p=0;p<g.length;p++)g[p].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};bm.defaultFillStyle={color:16777215,alpha:1,texture:R.WHITE,matrix:null,fill:null,textureSpace:"local"};bm.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:R.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ge=bm});function Nc(r){let t=[],e=0;for(let i=0;i<zT.length;i++){let s=`_${zT[i]}`;t[e++]=r[s]}return e=$T(r._fill,t,e),e=NF(r._stroke,t,e),e=HF(r.dropShadow,t,e),t.join("-")}function $T(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function NF(r,t,e){return r&&(e=$T(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function HF(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=ot.shared.setValue(r.color).toNumber()),e}var zT,vm=x(()=>{be();zT=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function VF(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=kt.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){$(et,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(ot.isColorLike(e))i.color=e;else if(e instanceof ze||e instanceof li)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){$(et,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=kt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new ze({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>ot.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Tm,kt,fs=x(()=>{Ee();be();Wt();fo();Mc();Dc();_m();vm();Tm=class vo extends Mt{constructor(t={}){super(),VF(t);let e={...vo.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...vo.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...vo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ge.defaultFillStyle,...t},()=>{this._fill=hi({...this._originalFill},Ge.defaultFillStyle)})),this._fill=hi(t===0?"black":t,Ge.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ge.defaultStrokeStyle,...t},()=>{this._stroke=bo({...this._originalStroke},Ge.defaultStrokeStyle)})),this._stroke=bo(t,Ge.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Nc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=vo.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new vo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ot.isColorLike(t)||t instanceof ze||t instanceof li)}};Tm.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Tm.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};kt=Tm});function Hc(r,t,e,i){let s=WF;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=zt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var WF,Sm=x(()=>{Si();Ne();WF=new Et});function ps(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!zF.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var zF,Vc=x(()=>{"use strict";zF=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var wm,Sr,Qt,fa=x(()=>{Ft();Vc();wm={willReadFrequently:!0},Sr=class Y{static get experimentalLetterSpacingSupported(){let t=Y._experimentalLetterSpacingSupported;if(t!==void 0){let e=X.get().getCanvasRenderingContext2D().prototype;t=Y._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",e,i=Y._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(Y._measurementCache[o])return Y._measurementCache[o];let n=ps(e),a=Y.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=Y.__context;l.font=n;let c=(s?Y._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y<c.length;y++){let _=Y._measureText(c[y],e.letterSpacing,l);u[y]=_,d=Math.max(d,_)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,p=Math.max(g,a.fontSize+f)+(c.length-1)*(g+e.leading);return e.dropShadow&&(p+=e.dropShadow.distance),new Y(t,e,m,p,c,u,g+e.leading,d,a)}static _measureText(t,e,i){let s=!1;Y.experimentalLetterSpacingSupported&&(Y.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else{let c=(Y.graphemeSegmenter(t).length-1)*e;n+=c,h+=c}return Math.max(n,h)}static _wordWrap(t,e,i=Y._canvas){let s=i.getContext("2d",wm),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=Y._collapseSpaces(c),d=Y._collapseNewlines(c),f=!u,m=e.wordWrapWidth+h,g=Y._tokenize(t);for(let p=0;p<g.length;p++){let v=g[p];if(Y._isNewline(v)){if(!d){a+=Y._addLine(n),f=!u,n="",o=0;continue}v=" "}if(u){let _=Y.isBreakingSpace(v),w=Y.isBreakingSpace(n[n.length-1]);if(_&&w)continue}let y=Y._getFromCache(v,h,l,s);if(y>m)if(n!==""&&(a+=Y._addLine(n),n="",o=0),Y.canBreakWords(v,e.breakWords)){let _=Y.wordWrapSplit(v);for(let w=0;w<_.length;w++){let E=_[w],b=E,S=1;for(;_[w+S];){let A=_[w+S];if(!Y.canBreakChars(b,A,v,w,e.breakWords))E+=A;else break;b=A,S++}w+=S-1;let P=Y._getFromCache(E,h,l,s);P+o>m&&(a+=Y._addLine(n),f=!1,n="",o=0),n+=E,o+=P}}else{n.length>0&&(a+=Y._addLine(n),n="",o=0);let _=p===g.length-1;a+=Y._addLine(v,!_),f=!1,n="",o=0}else y+o>m&&(f=!1,a+=Y._addLine(n),n="",o=0),(n.length>0||!Y.isBreakingSpace(v)||f)&&(n+=v,o+=y)}return a+=Y._addLine(n,!1),a}static _addLine(t,e=!0){return t=Y._trimRight(t),t=e?`${t}
|
|
368
|
+
`:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=Y._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!Y.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Y._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:Y._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(Y.isBreakingSpace(o,n)||Y._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return Y.graphemeSegmenter(t)}static measureFont(t){if(Y._fonts[t])return Y._fonts[t];let e=Y._context;e.font=t;let i=e.measureText(Y.METRICS_STRING+Y.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Y._fonts[t]=s,s}static clearMetrics(t=""){t?delete Y._fonts[t]:Y._fonts={}}static get _canvas(){if(!Y.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",wm)?.measureText)return Y.__canvas=e,e;t=X.get().createCanvas()}catch{t=X.get().createCanvas()}t.width=t.height=10,Y.__canvas=t}return Y.__canvas}static get _context(){return Y.__context||(Y.__context=Y._canvas.getContext("2d",wm)),Y.__context}};Sr.METRICS_STRING="|\xC9q\xC5";Sr.BASELINE_SYMBOL="M";Sr.BASELINE_MULTIPLIER=1.4;Sr.HEIGHT_MULTIPLIER=2;Sr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Sr.experimentalLetterSpacing=!1;Sr._fonts={};Sr._newlines=[10,13];Sr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Sr._measurementCache={};Qt=Sr});function To(r,t,e,i=0){if(r.texture===R.WHITE&&!r.fill)return ot.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof li){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(F.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ze){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let h,c=!1;if(o){let{start:u,end:d}=s;h=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:m}=s;h=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,m*a)}if(c&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(m=>{let g=f+m.offset*u;h.addColorStop(Math.floor(g*XT)/XT,ot.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{h.addColorStop(u.offset,ot.shared.setValue(u.color).toHex())});return h}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(F.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return D("FillStyle not recognised",r),"red"}var XT,Em=x(()=>{be();mt();_t();At();fo();Mc();XT=1e5});var pa,jT=x(()=>{be();B();Fn();xo();Si();oT();Wt();fs();Sm();fa();Vc();Em();pa=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Qt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ei(o),n=ei(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&($("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof kt||(t.style=new kt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),$e.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Qt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=$e.getOptimalCanvasAndContext(n,a),{canvas:h}=l;this.renderTextToCanvas(e,i,s,l);let c=Hc(h,n,a,s);if(i.trim){let u=sT(h,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",zt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&($e.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=ps(e),l=Qt.measureText(t||" ",e),h=l.lines,c=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,m=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let g,p,v=e.dropShadow?2:1;for(let y=0;y<v;++y){let _=e.dropShadow&&y===0,w=_?Math.ceil(Math.max(1,m)+e.padding*2):0,E=w*i;if(_){n.fillStyle="black",n.strokeStyle="black";let P=e.dropShadow,A=P.color,C=P.alpha;n.shadowColor=ot.shared.setValue(A).setAlpha(C).toRgbaString();let M=P.blur*i,I=P.distance*i;n.shadowBlur=M,n.shadowOffsetX=Math.cos(P.angle)*I,n.shadowOffsetY=Math.sin(P.angle)*I+E}else{if(n.fillStyle=e._fill?To(e._fill,n,l):null,e._stroke?.width){let P=e._stroke.width*e._stroke.alignment;n.strokeStyle=To(e._stroke,n,l,P)}n.shadowColor="black"}let b=(c-f.fontSize)/2;c-f.fontSize<0&&(b=0);let S=e._stroke?.width??0;for(let P=0;P<h.length;P++)g=S/2,p=S/2+P*c+f.ascent+b,e.align==="right"?g+=d-u[P]:e.align==="center"&&(g+=(d-u[P])/2),e._stroke?.width&&this._drawLetterSpacing(h[P],e,s,g+e.padding,p+e.padding-w,!0),e._fill!==void 0&&this._drawLetterSpacing(h[P],e,s,g+e.padding,p+e.padding-w)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,h=!1;if(Qt.experimentalLetterSpacingSupported&&(Qt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Qt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let m=0;m<u.length;++m){let g=u[m];n?a.strokeText(g,c,o):a.fillText(g,c,o);let p="";for(let v=m+1;v<u.length;++v)p+=u[v];f=a.measureText(p).width,c+=d-f+l,d=f}}destroy(){this._activeTextures=null}};pa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"}});var Am=x(()=>{B();eT();jT();U.add(pa);U.add(ca)});var ce,Pm=x(()=>{Wt();Qh();Dc();ce=class r extends Ai{constructor(t){t instanceof Ge&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Ge,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){$(et,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){$(et,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){$(et,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ge.defaultStrokeStyle.width||t.color!==Ge.defaultStrokeStyle.color||t.alpha!==Ge.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return $(et,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return $(et,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return $(et,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return $(et,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return $(et,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return $(et,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var YT,qT,KT=x(()=>{"use strict";YT={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
371
371
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -392,7 +392,7 @@ fn mainFragment(
|
|
|
392
392
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
393
393
|
`,main:`
|
|
394
394
|
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
395
|
-
`}},
|
|
395
|
+
`}},qT={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
396
396
|
uniform mat3 uTransformMatrix;
|
|
397
397
|
uniform vec4 uColor;
|
|
398
398
|
uniform float uRound;
|
|
@@ -408,7 +408,7 @@ fn mainFragment(
|
|
|
408
408
|
uniform float uDistance;
|
|
409
409
|
`,main:`
|
|
410
410
|
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
411
|
-
`}}});var
|
|
411
|
+
`}}});var ZT,QT,JT=x(()=>{"use strict";ZT={name:"msdf-bit",fragment:{header:`
|
|
412
412
|
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
413
413
|
|
|
414
414
|
// MSDF
|
|
@@ -435,7 +435,7 @@ fn mainFragment(
|
|
|
435
435
|
return coverage;
|
|
436
436
|
|
|
437
437
|
}
|
|
438
|
-
`}},
|
|
438
|
+
`}},QT={name:"msdf-bit",fragment:{header:`
|
|
439
439
|
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
440
440
|
|
|
441
441
|
// MSDF
|
|
@@ -462,16 +462,16 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}}});var
|
|
466
|
-
`&&
|
|
467
|
-
`||p){if(!a&&t.wordWrap&&o.width+l.width-d>f?(c(),h(l),p||o.charPositions.push(0)):(l.start=o.width,h(l),p||o.charPositions.push(0)),
|
|
468
|
-
`)o.width!==0&&c();else if(!p){let E=_.xAdvance+(_.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let b=_.kerning[n]||0,E=_.xAdvance+b+d;l.positions[l.index++]=l.width+b,l.chars.push(m),l.width+=E}n=m}return c(),t.align==="center"?fF(s):t.align==="right"?pF(s):t.align==="justify"&&mF(s),s}function fF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function pF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function mF(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,h=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=h),i.charPositions[c]+=n}}var ym=x(()=>{"use strict"});var Dc,_m,ua,bm=x(()=>{Ai();Vt();At();cs();LT();ym();gm();Dc=0,_m=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!vt.has(i)){let n=new xm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Dc++,Dc>50&&D("BitmapText",`You have dynamically created ${Dc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Dc--,vt.remove(i)}),vt.set(i,n)}let o=vt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Lc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},$(J,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Bt?s:new Bt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new xm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=Oc(e.chars);return a.ensureCharacters(l.join("")),vt.set(`${i}-bitmap`,a),a.once("destroy",()=>vt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=vt.get(e);i&&i.destroy()}},ua=new _m});function DT(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var da,NT=x(()=>{Ai();B();Me();dm();GT();bm();ym();da=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);DT(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(tt.return(e.customShader),e.customShader=null),tt.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);DT(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ua.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=tt.get(Uc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=Lc(o,n,s,!0),h=0,c=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let g=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<l.lines.length;m++){let p=l.lines[m];for(let _=0;_<p.charPositions.length;_++){let y=o[h++],v=s.chars[y];v?.texture&&i.texture(v.texture,g||"black",Math.round(p.charPositions[_]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=tt.get(he);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,s=vt.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};da.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"bitmapText"}});var vm=x(()=>{B();NT();U.add(da)});var fa,HT=x(()=>{B();bt();Me();sa();zp();fa=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),tt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,oa(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),oa(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:R.EMPTY,currentKey:"--",batchableSprite:tt.get(Hr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=R.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};fa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"htmlText"}});function VT(){let{userAgent:r}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var WT=x(()=>{Mt()});var zT,$T,bo,Tm=x(()=>{"use strict";zT="http://www.w3.org/2000/svg",$T="http://www.w3.org/1999/xhtml",bo=class{constructor(){this.svgRoot=document.createElementNS(zT,"svg"),this.foreignObject=document.createElementNS(zT,"foreignObject"),this.domElement=document.createElementNS($T,"div"),this.styleElement=document.createElementNS($T,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function YT(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${it.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[KT(t)]:[],...r.dropShadow?[qT(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return gF(r.tagStyles,s),s.join(" ")}function qT(r){let t=it.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function KT(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${it.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${it.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function gF(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)XT[o]?s.push(XT[o](i[o])):jT[o]&&s.push(jT[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var jT,XT,ZT=x(()=>{ye();jT={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"},XT={fill:r=>`color: ${it.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:KT,dropShadow:qT}});var Nc,QT=x(()=>{At();cs();nm();ZT();Nc=class r extends Bt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Fc(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=YT(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&D("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&D("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function JT(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let h=l.split(":")[1].trim();a(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;a(h)}return i}var tS=x(()=>{"use strict"});async function eS(r){let e=await(await j.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var rS=x(()=>{Mt()});async function Sm(r,t){let e=await eS(t);return`@font-face {
|
|
465
|
+
`}}});var Cm,Rm,Wc,tS=x(()=>{mt();os();Bi();Qn();Jn();Fi();mc();vr();ke();KT();JT();Wc=class extends Yt{constructor(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=nr();Cm??(Cm=Ur({name:"sdf-shader",bits:[oo,ao(e),YT,ZT,Lr]})),Rm??(Rm=Or({name:"sdf-shader",bits:[no,lo(e),qT,QT,Dr]})),super({glProgram:Rm,gpuProgram:Cm,resources:{localUniforms:t,batchSamplers:ho(e)}})}}});var So,Mm=x(()=>{Ee();Wt();So=class extends Mt{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 $(et,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return $(et,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return $(et,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return $(et,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return $(et,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function zc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,l=n;a<=l;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var Im=x(()=>{"use strict"});var eS,Bm,iS=x(()=>{be();ae();xo();Qs();_t();Wt();fa();Vc();Em();fs();Mm();Im();eS=class rS extends So{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={...rS.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=R.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=ps(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Qt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=zc(t).filter(p=>!this._currentChars.includes(p)).filter((p,v,y)=>y.indexOf(p)===v);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,h=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,m=s.width/this.resolution,g=s.height/this.resolution;for(let p=0;p<e.length;p++){let v=e[p],y=Qt.measureText(v,a,s,!1);y.lineHeight=y.height;let _=y.width*c,w=Math.ceil((a.fontStyle==="italic"?2:1)*_),E=y.height*c,b=w+u*2,S=E+u*2;if(f=!1,v!==`
|
|
466
|
+
`&&v!=="\r"&&v!==" "&&v!==" "&&(f=!0,d=Math.ceil(Math.max(S,d))),l+b>m&&(h+=d,d=S,l=0,h+d>g)){n.update();let A=this._nextPage();s=A.canvasAndContext.canvas,o=A.canvasAndContext.context,n=A.texture.source,h=0}let P=_/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[v]={id:v.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},f){this._drawGlyph(o,y,l+u,h+u,c,a);let A=n.width*c,C=n.height*c,M=new it(l/A*n.width,h/C*n.height,b/A*n.width,S/C*n.height);this.chars[v].texture=new R({source:n,frame:M}),l+=Math.ceil(b)}}n.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return $(et,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=e.measureText(o).width);let h=i[a];h||(h=i[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(l+h);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(l+h),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=$e.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new R({source:new Ve({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=ps(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=To(s,t)),e._fill&&(t.fillStyle=To(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=ot.shared.setValue(n.color).toArray(),l=n.blur*i,h=n.distance*i;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*h,t.shadowOffsetY=Math.sin(n.angle)*h}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,o,n){let a=e.text,l=e.fontProperties,c=(n._stroke?.width??0)*o,u=i+c/2,d=s-c/2,f=l.descent*o,m=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+m-f),n._fill&&t.fillText(a,u,d+m-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:i}=this.pages[t];$e.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};eS.defaultOptions={textureSize:512,style:new kt,mipmap:!0};Bm=eS});function $c(r,t,e,i){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=m=>{let g=o.width;for(let p=0;p<l.index;p++){let v=m.positions[p];o.chars.push(m.chars[p]),o.charPositions.push(v+g)}o.width+=m.width,a=!1,l.width=0,l.index=0,l.chars.length=0},c=()=>{let m=o.chars.length-1;if(i){let g=o.chars[m];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--m]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let m=0;m<r.length+1;m++){let g,p=m===r.length;p||(g=r[m]);let v=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
|
|
467
|
+
`||p){if(!a&&t.wordWrap&&o.width+l.width-d>f?(c(),h(l),p||o.charPositions.push(0)):(l.start=o.width,h(l),p||o.charPositions.push(0)),g==="\r"||g===`
|
|
468
|
+
`)o.width!==0&&c();else if(!p){let E=v.xAdvance+(v.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let w=v.kerning[n]||0,E=v.xAdvance+w+d;l.positions[l.index++]=l.width+w,l.chars.push(g),l.width+=E}n=g}return c(),t.align==="center"?$F(s):t.align==="right"?XF(s):t.align==="justify"&&jF(s),s}function $F(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function XF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function jF(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,h=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=h),i.charPositions[c]+=n}}var Fm=x(()=>{"use strict"});var Xc,km,ma,Gm=x(()=>{Ci();Wt();At();fs();iS();Fm();Im();Xc=0,km=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!bt.has(i)){let n=new Bm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Xc++,Xc>50&&D("BitmapText",`You have dynamically created ${Xc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Xc--,bt.remove(i)}),bt.set(i,n)}let o=bt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return $c([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},$(et,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof kt?s:new kt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Bm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=zc(e.chars);return a.ensureCharacters(l.join("")),bt.set(`${i}-bitmap`,a),a.once("destroy",()=>bt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=bt.get(e);i&&i.destroy()}},ma=new km});function sS(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var ga,oS=x(()=>{Ci();B();Ie();Pm();tS();Gm();Fm();ga=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);sS(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(rt.return(e.customShader),e.customShader=null),rt.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);sS(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ma.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=rt.get(Wc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=$c(o,n,s,!0),h=0,c=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<l.lines.length;g++){let p=l.lines[g];for(let v=0;v<p.charPositions.length;v++){let y=o[h++],_=s.chars[y];_?.texture&&i.texture(_.texture,m||"black",Math.round(p.charPositions[v]+_.xOffset),Math.round(a+_.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=rt.get(ce);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,s=bt.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};ga.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"bitmapText"}});var Um=x(()=>{B();oS();U.add(ga)});var xa,nS=x(()=>{B();_t();Ie();la();om();xa=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),rt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ha(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),ha(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:R.EMPTY,currentKey:"--",batchableSprite:rt.get(Vr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=R.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};xa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"htmlText"}});function aS(){let{userAgent:r}=X.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var lS=x(()=>{Ft()});var hS,cS,wo,Om=x(()=>{"use strict";hS="http://www.w3.org/2000/svg",cS="http://www.w3.org/1999/xhtml",wo=class{constructor(){this.svgRoot=document.createElementNS(hS,"svg"),this.foreignObject=document.createElementNS(hS,"foreignObject"),this.domElement=document.createElementNS(cS,"div"),this.styleElement=document.createElementNS(cS,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function fS(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${ot.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[mS(t)]:[],...r.dropShadow?[pS(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return YF(r.tagStyles,s),s.join(" ")}function pS(r){let t=ot.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function mS(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function YF(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)dS[o]?s.push(dS[o](i[o])):uS[o]&&s.push(uS[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var uS,dS,gS=x(()=>{be();uS={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"},dS={fill:r=>`color: ${ot.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:mS,dropShadow:pS}});var jc,xS=x(()=>{At();fs();vm();gS();jc=class r extends kt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Nc(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=fS(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&D("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&D("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function yS(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let h=l.split(":")[1].trim();a(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;a(h)}return i}var _S=x(()=>{"use strict"});async function bS(r){let e=await(await X.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var vS=x(()=>{Ft()});async function Lm(r,t){let e=await bS(t);return`@font-face {
|
|
469
469
|
font-family: "${r.fontFamily}";
|
|
470
470
|
src: url('${e}');
|
|
471
471
|
font-weight: ${r.fontWeight};
|
|
472
472
|
font-style: ${r.fontStyle};
|
|
473
|
-
}`}var
|
|
474
|
-
`)}var
|
|
473
|
+
}`}var TS=x(()=>{vS()});async function SS(r,t,e){let i=r.filter(s=>bt.has(`${s}-and-url`)).map((s,o)=>{if(!Yc.has(s)){let{url:n}=bt.get(`${s}-and-url`);o===0?Yc.set(s,Lm({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Yc.set(s,Lm({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Yc.get(s)});return(await Promise.all(i)).join(`
|
|
474
|
+
`)}var Yc,wS=x(()=>{Ci();TS();Yc=new Map});function ES(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var AS=x(()=>{"use strict"});function PS(r,t){let e=$e.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var CS=x(()=>{xo()});function RS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var MS=x(()=>{"use strict"});function BS(r,t,e,i){i||(i=IS||(IS=new wo));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return{width:a.width-l,height:a.height-l}}var IS,FS=x(()=>{Om()});var Eo,kS=x(()=>{B();xo();Si();Nr();lS();At();Ie();Sm();Om();xS();_S();wS();AS();CS();MS();FS();Eo=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===re.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=rt.get(wo),o=yS(t,i),n=await SS(o,i,jc.defaultTextStyle),a=BS(t,i,n,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),h=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(l|0)+u,c.height=(h|0)+u;let d=ES(t,i,e,n,s);await RS(c,d,aS()&&o.length>0);let f=c,m;this._createCanvas&&(m=PS(c,e));let g=Hc(m?m.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),$e.returnCanvasAndContext(m)),rt.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{D("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){zt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};Eo.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"htmlText"};Eo.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Dm=x(()=>{B();nS();kS();U.add(Eo);U.add(xa)});var GS,Ao,qc=x(()=>{Mi();ni();ro();Wt();GS=class US extends ar{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&($(et,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...US.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new jt({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:at.VERTEX|at.COPY_DST}),l=new jt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:at.VERTEX|at.COPY_DST}),h=new jt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:at.INDEX|at.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};GS.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Ao=GS});var ms,OS,Po,Co=x(()=>{"use strict";ms={name:"local-uniform-bit",vertex:{header:`
|
|
475
475
|
|
|
476
476
|
struct LocalUniforms {
|
|
477
477
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -488,7 +488,7 @@ fn mainFragment(
|
|
|
488
488
|
{
|
|
489
489
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
490
490
|
}
|
|
491
|
-
`}},
|
|
491
|
+
`}},OS={...ms,vertex:{...ms.vertex,header:ms.vertex.header.replace("group(1)","group(2)")}},Po={name:"local-uniform-bit",vertex:{header:`
|
|
492
492
|
|
|
493
493
|
uniform mat3 uTransformMatrix;
|
|
494
494
|
uniform vec4 uColor;
|
|
@@ -501,7 +501,7 @@ fn mainFragment(
|
|
|
501
501
|
{
|
|
502
502
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
503
503
|
}
|
|
504
|
-
`}}});var
|
|
504
|
+
`}}});var LS,DS,NS=x(()=>{"use strict";LS={name:"tiling-bit",vertex:{header:`
|
|
505
505
|
struct TilingUniforms {
|
|
506
506
|
uMapCoord:mat3x3<f32>,
|
|
507
507
|
uClampFrame:vec4<f32>,
|
|
@@ -544,7 +544,7 @@ fn mainFragment(
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
547
|
-
`}},
|
|
547
|
+
`}},DS={name:"tiling-bit",vertex:{header:`
|
|
548
548
|
uniform mat3 uTextureTransform;
|
|
549
549
|
uniform vec4 uSizeAnchor;
|
|
550
550
|
|
|
@@ -566,7 +566,7 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}}});var wm,Am,Wc,TS=x(()=>{mt();Mi();Eo();Bi();br();Fe();bt();vS();Wc=class extends Xt{constructor(){wm??(wm=Gr({name:"tiling-sprite-shader",bits:[ds,_S,Or]})),Am??(Am=Ur({name:"tiling-sprite-shader",bits:[So,bS,Lr]}));let t=new Pt({uMapCoord:{value:new F,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 F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Am,gpuProgram:wm,resources:{localUniforms:new Pt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:R.EMPTY.source,uSampler:R.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*h/t,i.d*h/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var zc,SS=x(()=>{Vc();zc=class extends To{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 ES(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var wS=x(()=>{"use strict"});function AS(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,h=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+c,r[e+1]=a*d+h*f+u,e+=t,s++}}var PS=x(()=>{"use strict"});function CS(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),AS(t,2,0,a)}var RS=x(()=>{mt();PS()});var $c,pa,MS=x(()=>{B();$n();vr();Dr();co();yc();Vc();TS();SS();wS();RS();$c=new zc,pa=class{constructor(t){this._state=qt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ii);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Wc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:$c,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new To({indices:$c.indices,positions:$c.positions.slice(),uvs:$c.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),CS(t,i.uvs),ES(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=!0;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};pa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"}});var Pm=x(()=>{B();MS();U.add(pa)});var BS,FS,kS=x(()=>{Vt();Vc();BS=class IS extends To{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&($(J,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...IS.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*h),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,g=f*this.verticesX+d,m=f*this.verticesX+d+1,p=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(g,m,p,m,_,p)}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()}};BS.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};FS=BS});var GS,OS,LS=x(()=>{kS();GS=class US extends FS{constructor(t={}){t={...US.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=i>d?1:i/d,g=Math.min(u,f),m=l*e,p=h*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*g-m,t[4]=t[12]=t[20]=t[28]=e-o*g-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-p,t[9]=t[11]=t[13]=t[15]=n*g-p,t[17]=t[19]=t[21]=t[23]=i-a*g-p,t[25]=t[27]=t[29]=t[31]=i-p,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};GS.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};OS=GS});var ma,DS=x(()=>{B();Me();yc();LS();ma=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];tt.return(e.geometry),tt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=tt.get(Ii);return e.geometry=tt.get(OS),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};ma.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"}});var Cm=x(()=>{B();DS();U.add(ma)});var ga,NS=x(()=>{B();ga=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ga.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"}});function HS(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var VS=x(()=>{"use strict"});var xF,xa,WS=x(()=>{B();mt();or();Pi();Qs();Fe();bt();vi();Dr();Ne();VS();At();xF=new ar({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),xa=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Pt({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 me({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?HS(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let g=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;g&&o.applyMatrix(g)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,h=!0,c=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let g=i[f];if(a=Math.min(a,g.resolution==="inherit"?n._resolution:g.resolution),l+=g.padding,g.antialias==="off"?h=!1:g.antialias==="inherit"&&h&&(h=n.antialias),g.clipToViewport||(d=!1),!!!(g.compatibleRenderers&e.type)){u=!1;break}if(g.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){D("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=g.enabled||u,c||(c=g.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,g=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/g,0,f.height/g)}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=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Wt.getOptimalTexture(o.width,o.height,a,h),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=R.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),Wt.returnTexture(i);else{let a=e.inputTexture,l=Wt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,a,l,!0);let u=a;a=l,l=u}n[h].apply(this,a,e.previousRenderSurface,!1),Wt.returnTexture(a),Wt.returnTexture(l)}e.blendRequired&&Wt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=Wt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ht.shared,c=n.previousRenderSurface===i,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,g=f.uniforms,m=g.uOutputFrame,p=g.uInputSize,_=g.uInputPixel,y=g.uInputClamp,v=g.uGlobalFrame,b=g.uOutputTexture;if(c){let S=this._filterStackIndex;for(;S>0;){S--;let w=this._filterStack[this._filterStackIndex-1];if(!w.skip){l.x=w.bounds.minX,l.y=w.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,p[0]=e.source.width,p[1]=e.source.height,p[2]=1/p[0],p[3]=1/p[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*p[2]-.5*_[2],y[3]=e.frame.height*p[3]-.5*_[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=l.x*u,v[1]=l.y*u,v[2]=E.source.width*u,v[3]=E.source.height*u;let A=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof R?(b[0]=i.frame.width,b[1]=i.frame.height):(b[0]=A.width,b[1]=A.height),b[2]=A.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let S=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(S,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:xF,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new wt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(F.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};xa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"}});var Rm=x(()=>{B();NS();WS();U.add(xa);U.add(ga)});var yF={};var zS=x(()=>{j_();If();tb();rb();Xh();Jh();Lp();Dp();Wp();um();vm();Em();Pm();Cm();Rm()});var _F={};var jS=x(()=>{If();Xh();Jh();Lp();Dp();Wp();um();vm();Em();Pm();Cm();Rm()});var YS,qS,KS=x(()=>{ss();to();br();vr();YS=class Mm extends Xt{constructor(t){t={...Mm.defaultOptions,...t},super(t),this.enabled=!0,this._state=qt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new Mm({gpuProgram:o,glProgram:n,...s})}};YS.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};qS=YS});async function ZS(r){if(!r)for(let t=0;t<Bm.length;t++){let e=Bm[t];if(e.value.test()){await e.value.load();return}}}var Bm,QS=x(()=>{B();Bm=[];U.handleByNamedList(T.Environment,Bm)});function jc(){if(typeof ya=="boolean")return ya;try{ya=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ya=!1}return ya}var ya,Im=x(()=>{"use strict"});var ge,wo=x(()=>{"use strict";ge=(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))(ge||{})});var Ao,Fm=x(()=>{"use strict";Ao=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:h,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var bF,JS,ki,_a=x(()=>{ye();QS();yr();Im();Vt();wo();Fm();Se();bF=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],JS=class tE extends Rt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...bF,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await ZS(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...tE.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof yt&&(i={container:i},e&&($(J,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:it.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ge.ALL);let{clear:i,clearColor:s,target:o}=t;it.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,it.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Ao(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!jc())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()}};JS.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};ki=JS});var ba,iE=x(()=>{B();mt();rs();rc();Mi();Yn();qn();Eo();Bi();br();Fe();ba=class{init(){let t=new Pt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Gr({name:"graphics",bits:[eo,io(nr()),yS,Or]});this.shader=new Xt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),h=o.encoder;h.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;h.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);h.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let g=0;g<l.instructionSize;g++){let m=d[g];if(m.topology!==f&&(f=m.topology,h.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let p=m.textures;m.bindGroup=Zs(p.textures,p.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}h.setBindGroup(1,m.bindGroup,s.gpuProgram),h.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};ba.extension={type:[T.WebGPUPipesAdaptor],name:"graphics"}});var sE,oE,km=x(()=>{"use strict";sE={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var Nm,Hm,Kc,HS=x(()=>{mt();Bi();Co();Fi();vr();ke();_t();NS();Kc=class extends Yt{constructor(){Nm??(Nm=Ur({name:"tiling-sprite-shader",bits:[ms,LS,Lr]})),Hm??(Hm=Or({name:"tiling-sprite-shader",bits:[Po,DS,Dr]}));let t=new Ct({uMapCoord:{value:new F,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 F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Hm,gpuProgram:Nm,resources:{localUniforms:new Ct({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:R.EMPTY.source,uSampler:R.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*h/t,i.d*h/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var Zc,VS=x(()=>{qc();Zc=class extends Ao{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 WS(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var zS=x(()=>{"use strict"});function $S(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,h=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+c,r[e+1]=a*d+h*f+u,e+=t,s++}}var XS=x(()=>{"use strict"});function jS(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),$S(t,2,0,a)}var YS=x(()=>{mt();XS()});var Qc,ya,qS=x(()=>{B();qn();Tr();Nr();mo();Ec();qc();HS();VS();zS();YS();Qc=new Zc,ya=class{constructor(t){this._state=Zt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ki);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Kc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Hr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=oi(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Qc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ao({indices:Qc.indices,positions:Qc.positions.slice(),uvs:Qc.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),jS(t,i.uvs),WS(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=!0;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};ya.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"}});var Vm=x(()=>{B();qS();U.add(ya)});var KS,QS,JS=x(()=>{Wt();qc();KS=class ZS extends Ao{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&($(et,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...ZS.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*h),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,m=f*this.verticesX+d,g=f*this.verticesX+d+1,p=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(m,g,p,g,v,p)}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()}};KS.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};QS=KS});var tw,rw,iw=x(()=>{JS();tw=class ew extends QS{constructor(t={}){t={...ew.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=i>d?1:i/d,m=Math.min(u,f),g=l*e,p=h*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-p,t[9]=t[11]=t[13]=t[15]=n*m-p,t[17]=t[19]=t[21]=t[23]=i-a*m-p,t[25]=t[27]=t[29]=t[31]=i-p,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};tw.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};rw=tw});var _a,sw=x(()=>{B();Ie();Ec();iw();_a=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];rt.return(e.geometry),rt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=rt.get(ki);return e.geometry=rt.get(rw),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};_a.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"}});var Wm=x(()=>{B();sw();U.add(_a)});var ba,ow=x(()=>{B();ba=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"}});function nw(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var aw=x(()=>{"use strict"});var qF,va,lw=x(()=>{B();mt();or();Ri();ro();ke();_t();Si();Nr();Ne();aw();At();qF=new ar({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])}),va=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ct({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 xe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?nw(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,h=!0,c=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let m=i[f];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),l+=m.padding,m.antialias==="off"?h=!1:m.antialias==="inherit"&&h&&(h=n.antialias),m.clipToViewport||(d=!1),!!!(m.compatibleRenderers&e.type)){u=!1;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){D("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=m.enabled||u,c||(c=m.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/m,0,f.height/m)}if(o.scale(a).ceil().scale(1/a).pad(l|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=zt.getOptimalTexture(o.width,o.height,a,h),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=R.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),zt.returnTexture(i);else{let a=e.inputTexture,l=zt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,a,l,!0);let u=a;a=l,l=u}n[h].apply(this,a,e.previousRenderSurface,!1),zt.returnTexture(a),zt.returnTexture(l)}e.blendRequired&&zt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=zt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ut.shared,c=n.previousRenderSurface===i,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,m=f.uniforms,g=m.uOutputFrame,p=m.uInputSize,v=m.uInputPixel,y=m.uInputClamp,_=m.uGlobalFrame,w=m.uOutputTexture;if(c){let S=this._filterStackIndex;for(;S>0;){S--;let P=this._filterStack[this._filterStackIndex-1];if(!P.skip){l.x=P.bounds.minX,l.y=P.bounds.minY;break}}g[0]=a.minX-l.x,g[1]=a.minY-l.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,p[0]=e.source.width,p[1]=e.source.height,p[2]=1/p[0],p[3]=1/p[1],v[0]=e.source.pixelWidth,v[1]=e.source.pixelHeight,v[2]=1/v[0],v[3]=1/v[1],y[0]=.5*v[2],y[1]=.5*v[3],y[2]=e.frame.width*p[2]-.5*v[2],y[3]=e.frame.height*p[3]-.5*v[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;_[0]=l.x*u,_[1]=l.y*u,_[2]=E.source.width*u,_[3]=E.source.height*u;let b=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof R?(w[0]=i.frame.width,w[1]=i.frame.height):(w[0]=b.width,w[1]=b.height),w[2]=b.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let S=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(S,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:qF,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Et,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(F.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};va.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"}});var zm=x(()=>{B();ow();lw();U.add(va);U.add(ba)});var KF={};var hw=x(()=>{ub();jf();_b();vb();tc();nc();Jp();tm();sm();Am();Um();Dm();Vm();Wm();zm()});var ZF={};var uw=x(()=>{jf();tc();nc();Jp();tm();sm();Am();Um();Dm();Vm();Wm();zm()});var fw,pw,mw=x(()=>{as();so();vr();Tr();fw=class $m extends Yt{constructor(t){t={...$m.defaultOptions,...t},super(t),this.enabled=!0,this._state=Zt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new $m({gpuProgram:o,glProgram:n,...s})}};fw.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};pw=fw});async function gw(r){if(!r)for(let t=0;t<Xm.length;t++){let e=Xm[t];if(e.value.test()){await e.value.load();return}}}var Xm,xw=x(()=>{B();Xm=[];U.handleByNamedList(T.Environment,Xm)});function Jc(){if(typeof Ta=="boolean")return Ta;try{Ta=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ta=!1}return Ta}var Ta,jm=x(()=>{"use strict"});var ye,Ro=x(()=>{"use strict";ye=(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))(ye||{})});var Mo,Ym=x(()=>{"use strict";Mo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:h,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var QF,yw,Ui,Sa=x(()=>{be();xw();_r();jm();Wt();Ro();Ym();Ee();QF=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],yw=class _w extends Mt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...QF,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await gw(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={..._w.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof ht&&(i={container:i},e&&($(et,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:ot.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ye.ALL);let{clear:i,clearColor:s,target:o}=t;ot.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,ot.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Mo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Jc())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()}};yw.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ui=yw});var wa,Tw=x(()=>{B();mt();os();hc();Bi();Qn();Jn();Co();Fi();vr();ke();wa=class{init(){let t=new Ct({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Ur({name:"graphics",bits:[oo,ao(nr()),OS,Lr]});this.shader=new Yt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),h=o.encoder;h.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;h.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);h.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let m=0;m<l.instructionSize;m++){let g=d[m];if(g.topology!==f&&(f=g.topology,h.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let p=g.textures;g.bindGroup=eo(p.textures,p.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}h.setBindGroup(1,g.bindGroup,s.gpuProgram),h.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};wa.extension={type:[T.WebGPUPipesAdaptor],name:"graphics"}});var Sw,ww,qm=x(()=>{"use strict";Sw={name:"texture-bit",vertex:{header:`
|
|
570
570
|
|
|
571
571
|
struct TextureUniforms {
|
|
572
572
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -582,7 +582,7 @@ fn mainFragment(
|
|
|
582
582
|
|
|
583
583
|
`,main:`
|
|
584
584
|
outColor = textureSample(uTexture, uSampler, vUV);
|
|
585
|
-
`}},
|
|
585
|
+
`}},ww={name:"texture-bit",vertex:{header:`
|
|
586
586
|
uniform mat3 uTextureMatrix;
|
|
587
587
|
`,main:`
|
|
588
588
|
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
@@ -592,7 +592,7 @@ fn mainFragment(
|
|
|
592
592
|
|
|
593
593
|
`,main:`
|
|
594
594
|
outColor = texture(uTexture, vUV);
|
|
595
|
-
`}}});var va,nE=x(()=>{B();mt();Mi();Eo();Bi();km();br();bt();At();va=class{init(){let t=Gr({name:"mesh",bits:[ds,sE,Or]});this._shader=new Xt({gpuProgram:t,resources:{uTexture:R.EMPTY._source,uSampler:R.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){D("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};va.extension={type:[T.WebGPUPipesAdaptor],name:"mesh"}});var qc,Ta,aE=x(()=>{B();vr();rc();qc=qt.for2d(),Ta=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=e,o.setGeometry(e,n),qc.blendMode="normal",s.pipeline.getPipeline(e,n,qc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=Zs(l.textures,l.count)}qc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,qc,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Ta.extension={type:[T.WebGPUPipesAdaptor],name:"batch"}});var Sa,lE=x(()=>{B();Sa=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Sa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"customRender"}});function Ea(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var Gm=x(()=>{"use strict"});var vF,wa,hE=x(()=>{B();mt();Me();sa();Gm();vF=new F,wa=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(tt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=tt.get(Hr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=vF.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Ea(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ea(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};wa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"renderGroup"}});function Aa(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var Um=x(()=>{"use strict"});function Om(r,t=!1){SF(r);let e=r.childrenToUpdate,i=r.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let h=0;h<l;h++){let c=a[h];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===o&&dE(c,i,0)}Aa(a,l),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Om(r.renderGroupChildren[s],t)}function SF(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Ls(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function dE(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&cE&&uE(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&cE&&uE(r,TF,e)),!r.renderGroup){let o=r.children,n=o.length;for(let h=0;h<n;h++)dE(o[h],t,e);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function uE(r,t,e){if(e&Vs){r.groupColor=Ls(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&Mn&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Ji&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var TF,cE,fE=x(()=>{yr();Um();df();TF=new yt,cE=Ji|Vs|Mn});function pE(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var mE=x(()=>{"use strict"});var EF,Pa,gE=x(()=>{B();mt();vi();Ne();Um();Gm();fE();mE();EF=new F,Pa=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=EF;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ea(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&Wt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Wt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new wt),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Wt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Aa(t.childrenRenderablesToUpdate.list,0):pE(t,i),Om(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Aa(e,i)}_buildInstructions(t,e){let i=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Pa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"renderGroup"}});var Ca,xE=x(()=>{B();Me();sa();Ca=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];tt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=tt.get(Hr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)tt.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ca.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"sprite"}});var Po,Lm=x(()=>{Se();Po="8.9.2"});var Ra,Ma,Dm=x(()=>{B();Lm();Ra=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Po)}static destroy(){}};Ra.extension=T.Application;Ma=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Po)}destroy(){this._renderer=null}};Ma.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"initHook",priority:-10}});var Nm,Hm,_E=x(()=>{B();vr();xp();Nm=class yE{constructor(t,e){this.state=qt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Kn)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=yE.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let i in e){let s=e[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Nm.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"batch"};Nm._availableBatchers=Object.create(null);Hm=Nm;U.handleByMap(T.Batcher,Hm._availableBatchers);U.add(Kn)});var bE,vE=x(()=>{bE=`in vec2 vMaskCoord;
|
|
595
|
+
`}}});var Ea,Ew=x(()=>{B();mt();Bi();Co();Fi();qm();vr();_t();At();Ea=class{init(){let t=Ur({name:"mesh",bits:[ms,Sw,Lr]});this._shader=new Yt({gpuProgram:t,resources:{uTexture:R.EMPTY._source,uSampler:R.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){D("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Ea.extension={type:[T.WebGPUPipesAdaptor],name:"mesh"}});var ru,Aa,Aw=x(()=>{B();Tr();hc();ru=Zt.for2d(),Aa=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=e,o.setGeometry(e,n),ru.blendMode="normal",s.pipeline.getPipeline(e,n,ru);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=eo(l.textures,l.count)}ru.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,ru,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Aa.extension={type:[T.WebGPUPipesAdaptor],name:"batch"}});var Pa,Pw=x(()=>{B();Pa=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Pa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"customRender"}});function Ca(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var Km=x(()=>{"use strict"});var JF,Ra,Cw=x(()=>{B();mt();Ie();la();Km();JF=new F,Ra=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(rt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=rt.get(Vr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=JF.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Ca(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ca(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ra.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"renderGroup"}});function Ma(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var Zm=x(()=>{"use strict"});function Qm(r,t=!1){ek(r);let e=r.childrenToUpdate,i=r.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let h=0;h<l;h++){let c=a[h];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===o&&Iw(c,i,0)}Ma(a,l),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Qm(r.renderGroupChildren[s],t)}function ek(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Vs(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Iw(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&Rw&&Mw(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&Rw&&Mw(r,tk,e)),!r.renderGroup){let o=r.children,n=o.length;for(let h=0;h<n;h++)Iw(o[h],t,e);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function Mw(r,t,e){if(e&Xs){r.groupColor=Vs(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&kn&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&rs&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var tk,Rw,Bw=x(()=>{_r();Zm();Pf();tk=new ht,Rw=rs|Xs|kn});function Fw(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var kw=x(()=>{"use strict"});var rk,Ia,Gw=x(()=>{B();mt();Si();Ne();Zm();Km();Bw();kw();rk=new F,Ia=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=rk;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ca(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&zt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=zt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(zt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Ma(t.childrenRenderablesToUpdate.list,0):Fw(t,i),Qm(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Ma(e,i)}_buildInstructions(t,e){let i=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Ia.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"renderGroup"}});var Ba,Uw=x(()=>{B();Ie();la();Ba=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];rt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=rt.get(Vr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)rt.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"sprite"}});var Io,Jm=x(()=>{Ee();Io="8.9.2"});var Fa,ka,tg=x(()=>{B();Jm();Fa=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Io)}static destroy(){}};Fa.extension=T.Application;ka=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Io)}destroy(){this._renderer=null}};ka.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"initHook",priority:-10}});var eg,rg,Lw=x(()=>{B();Tr();Bp();eg=class Ow{constructor(t,e){this.state=Zt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new ta)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=Ow.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let i in e){let s=e[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};eg.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"batch"};eg._availableBatchers=Object.create(null);rg=eg;U.handleByMap(T.Batcher,rg._availableBatchers);U.add(ta)});var Dw,Nw=x(()=>{Dw=`in vec2 vMaskCoord;
|
|
596
596
|
in vec2 vTextureCoord;
|
|
597
597
|
|
|
598
598
|
uniform sampler2D uTexture;
|
|
@@ -626,7 +626,7 @@ void main(void)
|
|
|
626
626
|
|
|
627
627
|
finalColor = original * a;
|
|
628
628
|
}
|
|
629
|
-
`});var
|
|
629
|
+
`});var Hw,Vw=x(()=>{Hw=`in vec2 aPosition;
|
|
630
630
|
|
|
631
631
|
out vec2 vTextureCoord;
|
|
632
632
|
out vec2 vMaskCoord;
|
|
@@ -663,7 +663,7 @@ void main(void)
|
|
|
663
663
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
664
664
|
vMaskCoord = getFilterCoord(aPosition);
|
|
665
665
|
}
|
|
666
|
-
`});var
|
|
666
|
+
`});var ig,Ww=x(()=>{ig=`struct GlobalFilterUniforms {
|
|
667
667
|
uInputSize:vec4<f32>,
|
|
668
668
|
uInputPixel:vec4<f32>,
|
|
669
669
|
uInputClamp:vec4<f32>,
|
|
@@ -761,9 +761,9 @@ fn mainFragment(
|
|
|
761
761
|
|
|
762
762
|
return source * a;
|
|
763
763
|
}
|
|
764
|
-
`});var Kc,wE=x(()=>{mt();ss();to();Fe();Tf();KS();vE();SE();EE();Kc=class extends qS{constructor(t){let{sprite:e,...i}=t,s=new Hs(e.texture),o=new Pt({uFilterMatrix:{value:new F,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=hr.from({vertex:{source:Vm,entryPoint:"mainVertex"},fragment:{source:Vm,entryPoint:"mainFragment"}}),a=lr.from({vertex:TE,fragment:bE,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var wF,Wm,Ba,AE=x(()=>{B();Rh();wE();Ne();Pn();Nn();Me();bt();vi();Dr();wF=new wt,Wm=class extends Jr{constructor(){super(),this.filters=[new Kc({sprite:new Gt(R.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Ba=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=tt.get(Wm);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=Os(t.mask.mask,!0,wF);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Wt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.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:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===re.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();i&&Wt.returnTexture(s.filterTexture),tt.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"alphaMask"}});var Ia,PE=x(()=>{B();Ia=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,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(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Ia.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"colorMask"}});var Fa,CE=x(()=>{B();wo();is();Fa=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let 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:t,inverse:e._maskOptions.inverse,canBundle:!1});let h=i.instructionSize-l.instructionsStart-1;l.instructionsLength=h;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Ft.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(Ft.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ft.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Ft.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ge.STENCIL),i.stencil.setStencilMode(Ft.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(Ft.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ft.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Fa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"stencilMask"}});var zm,ME,BE=x(()=>{ye();B();zm=class RE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new it(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...RE.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};zm.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"background",priority:0};zm.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};ME=zm});var ka,Ga,IE=x(()=>{B();Rh();At();ka={};U.handle(T.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");ka[r.name]=r.ref},r=>{delete ka[r.name]});Ga=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!ka[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ka[e]){D(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new Jr,i.filters=[new ka[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Ga.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"blendMode"}});var $m,jm,kE,GE=x(()=>{B();yr();bt();$m={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},jm=class FE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof yt||t instanceof R?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,FE.defaultImageOptions);let{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},$m[e],i)});if(s.toDataURL!==void 0)return s.toDataURL($m[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:$m[e],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(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer;if(e instanceof R)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof R?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof yt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof R?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};jm.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"extract"};jm.defaultImageOptions={format:"png",quality:1};kE=jm});var Zc,UE=x(()=>{He();bt();Zc=class r extends R{static create(t){return new r({source:new St(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var AF,PF,CF,Ua,OE=x(()=>{ye();B();mt();ne();Ne();kh();yr();UE();AF=new et,PF=new wt,CF=[0,0,0,0],Ua=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof yt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:it.shared.setValue(o).toArray():o=CF;let n=t.frame?.copyTo(AF)||Ds(s,PF).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Zc.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:i}),l=F.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}};Ua.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGenerator"}});var Oa,LE=x(()=>{B();mt();or();co();Pi();Dr();Fe();Oa=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new F,worldColor:4294967295,offset:new ht},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},h=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(h);let c=h.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Nr(l.worldColor,c.uWorldColorAlpha,0),h.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(h,!1):(u=this._bindGroupPool.pop()||new me,this._activeBindGroups.push(u),u.setResource(h,0)),l.bindGroup=u,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===re.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 Pt({uProjectionMatrix:{value:new F,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new F,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Oa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"globalUniforms"}});var RF,La,DE=x(()=>{B();$s();RF=1,La=class{constructor(){this._tasks=[],this._offset=0}init(){ae.system.add(this._update,this)}repeat(t,e,i=!0){let s=RF++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){ae.system.remove(this._update,this),this._tasks.length=0}};La.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"scheduler",priority:0}});function HE(r){if(!NE){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Po} (${r}) http://www.pixijs.com/
|
|
764
|
+
`});var iu,zw=x(()=>{mt();as();so();ke();Of();mw();Nw();Vw();Ww();iu=class extends pw{constructor(t){let{sprite:e,...i}=t,s=new $s(e.texture),o=new Ct({uFilterMatrix:{value:new F,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=hr.from({vertex:{source:ig,entryPoint:"mainVertex"},fragment:{source:ig,entryPoint:"mainFragment"}}),a=lr.from({vertex:Hw,fragment:Dw,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var ik,sg,Ga,$w=x(()=>{B();Uh();zw();Ne();In();zn();Ie();_t();Si();Nr();ik=new Et,sg=class extends ti{constructor(){super(),this.filters=[new iu({sprite:new Pt(R.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Ga=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=rt.get(sg);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=Hs(t.mask.mask,!0,ik);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=zt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.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:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===re.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();i&&zt.returnTexture(s.filterTexture),rt.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Ga.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"alphaMask"}});var Ua,Xw=x(()=>{B();Ua=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,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(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Ua.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"colorMask"}});var Oa,jw=x(()=>{B();Ro();ns();Oa=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let 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:t,inverse:e._maskOptions.inverse,canBundle:!1});let h=i.instructionSize-l.instructionsStart-1;l.instructionsLength=h;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Ut.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(Ut.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ut.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Ut.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ye.STENCIL),i.stencil.setStencilMode(Ut.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(Ut.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ut.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Oa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"stencilMask"}});var og,qw,Kw=x(()=>{be();B();og=class Yw{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ot(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...Yw.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};og.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"background",priority:0};og.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};qw=og});var La,Da,Zw=x(()=>{B();Uh();At();La={};U.handle(T.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");La[r.name]=r.ref},r=>{delete La[r.name]});Da=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!La[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!La[e]){D(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new ti,i.filters=[new La[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Da.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"blendMode"}});var ng,ag,Jw,tE=x(()=>{B();_r();_t();ng={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},ag=class Qw{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof ht||t instanceof R?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Qw.defaultImageOptions);let{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},ng[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(ng[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:ng[e],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(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer;if(e instanceof R)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof R?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof ht&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof R?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};ag.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"extract"};ag.defaultImageOptions={format:"png",quality:1};Jw=ag});var ci,lg=x(()=>{He();_t();ci=class r extends R{static create(t){return new r({source:new St(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var sk,ok,nk,Na,eE=x(()=>{be();B();mt();ae();Ne();Hh();_r();lg();sk=new it,ok=new Et,nk=[0,0,0,0],Na=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof ht&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:ot.shared.setValue(o).toArray():o=nk;let n=t.frame?.copyTo(sk)||Ws(s,ok).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=ci.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:i}),l=F.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}};Na.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGenerator"}});var Ha,rE=x(()=>{B();mt();or();mo();Ri();Nr();ke();Ha=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new F,worldColor:4294967295,offset:new ut},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},h=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(h);let c=h.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Hr(l.worldColor,c.uWorldColorAlpha,0),h.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(h,!1):(u=this._bindGroupPool.pop()||new xe,this._activeBindGroups.push(u),u.setResource(h,0)),l.bindGroup=u,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===re.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 Ct({uProjectionMatrix:{value:new F,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new F,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ha.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"globalUniforms"}});var ak,Va,iE=x(()=>{B();qs();ak=1,Va=class{constructor(){this._tasks=[],this._offset=0}init(){le.system.add(this._update,this)}repeat(t,e,i=!0){let s=ak++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){le.system.remove(this._update,this),this._tasks.length=0}};Va.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"scheduler",priority:0}});function oE(r){if(!sE){if(X.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Io} (${r}) http://www.pixijs.com/
|
|
765
765
|
|
|
766
|
-
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Po} - ${r} - http://www.pixijs.com/`);NE=!0}}var NE,VE=x(()=>{Mt();Lm();NE=!1});var Co,WE=x(()=>{B();VE();Dr();Co=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===re.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),HE(e)}}};Co.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"hello",priority:-2};Co.defaultOptions={hello:!1}});function zE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function $E(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var jE=x(()=>{"use strict"});var MF,Xm,YE,qE=x(()=>{B();jE();MF=0,Xm=class XE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...XE.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=zE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)$E(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=MF++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let h=i;a&&(a.structureDidChange=!0),h[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};Xm.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"renderableGC",priority:0};Xm.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};YE=Xm});var Ym,ZE,QE=x(()=>{B();Ym=class KE{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...KE.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Ym.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGC"};Ym.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};ZE=Ym});var JE,Da,qm=x(()=>{be();He();bt();JE=class tw{constructor(t={}){if(this.uid=at("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...tw.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new St({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof R||t.depthStencilTexture instanceof St?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new St({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};JE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Da=JE});function Qc(r,t){if(!Na.has(r)){let e=new R({source:new Ee({resource:r,...t})}),i=()=>{Na.get(r)===e&&Na.delete(r)};e.once("destroy",i),e.source.once("destroy",i),Na.set(r,e)}return Na.get(r)}var Na,Km=x(()=>{Xs();bt();Na=new Map});var Zm,rw,iw=x(()=>{Mt();B();ne();Vt();qm();Km();Zm=class ew{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...ew.defaultOptions,...t},t.view&&($(J,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new et(0,0,t.width,t.height),this.canvas=t.canvas||j.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Qc(this.canvas,t),this.renderTarget=new Da({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Zm.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"view",priority:0};Zm.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};rw=Zm});var Jc,tu,Qm=x(()=>{lE();hE();gE();xE();Dm();_E();AE();PE();CE();BE();IE();GE();OE();LE();DE();WE();qE();QE();iw();Jc=[ME,Oa,Co,rw,Pa,ZE,Ua,kE,Ma,YE,La],tu=[Ga,Hm,Ca,wa,Ba,Fa,Ia,Sa]});var Ha,sw=x(()=>{B();Ha=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let g=f.buffer;d={buffer:a.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let l=a.shader.getProgramData(e).bindGroups[i],h=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=h,h}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Ha.extension={type:[T.WebGPUSystem],name:"bindGroup"}});var Va,ow=x(()=>{B();tp();Va=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(zn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};Va.extension={type:[T.WebGPUSystem],name:"buffer"}});var Wa,nw=x(()=>{B();Wa=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Wa.extension={type:[T.WebGPUSystem],name:"colorMask"}});var Ro,aw=x(()=>{Mt();B();Ro=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await j.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Ro.extension={type:[T.WebGPUSystem],name:"device"};Ro.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var za,lw=x(()=>{B();za=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:h}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,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(e);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 t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};za.extension={type:[T.WebGPUSystem],name:"encoder",priority:1}});var $a,hw=x(()=>{B();is();$a=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Ft.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};$a.extension={type:[T.WebGPUSystem],name:"stencil"}});var Mo,Jm=x(()=>{Im();Ci();oi();Mo=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!jc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new jt({data:new Float32Array(e.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new jt({data:new Float32Array(s.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function cw(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=ja[s.data.type].size,n=ja[s.data.type].align;if(!ja[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var ja,tg=x(()=>{"use strict";ja={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 hi,eg=x(()=>{"use strict";hi=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
|
|
766
|
+
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Io} - ${r} - http://www.pixijs.com/`);sE=!0}}var sE,nE=x(()=>{Ft();Jm();sE=!1});var Bo,aE=x(()=>{B();nE();Nr();Bo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===re.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),oE(e)}}};Bo.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"hello",priority:-2};Bo.defaultOptions={hello:!1}});function lE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function hE(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var cE=x(()=>{"use strict"});var lk,hg,dE,fE=x(()=>{B();cE();lk=0,hg=class uE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...uE.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=lE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)hE(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=lk++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let h=i;a&&(a.structureDidChange=!0),h[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};hg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"renderableGC",priority:0};hg.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};dE=hg});var cg,mE,gE=x(()=>{B();cg=class pE{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...pE.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};cg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGC"};cg.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};mE=cg});var xE,Wa,ug=x(()=>{Te();He();_t();xE=class yE{constructor(t={}){if(this.uid=ct("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...yE.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new St({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof R||t.depthStencilTexture instanceof St?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new St({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};xE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Wa=xE});function su(r,t){if(!za.has(r)){let e=new R({source:new Ae({resource:r,...t})}),i=()=>{za.get(r)===e&&za.delete(r)};e.once("destroy",i),e.source.once("destroy",i),za.set(r,e)}return za.get(r)}var za,dg=x(()=>{Zs();_t();za=new Map});var fg,bE,vE=x(()=>{Ft();B();ae();Wt();ug();dg();fg=class _E{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={..._E.defaultOptions,...t},t.view&&($(et,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new it(0,0,t.width,t.height),this.canvas=t.canvas||X.get().createCanvas(),this.antialias=!!t.antialias,this.texture=su(this.canvas,t),this.renderTarget=new Wa({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};fg.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"view",priority:0};fg.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};bE=fg});var ou,nu,pg=x(()=>{Pw();Cw();Gw();Uw();tg();Lw();$w();Xw();jw();Kw();Zw();tE();eE();rE();iE();aE();fE();gE();vE();ou=[qw,Ha,Bo,bE,Ia,mE,Na,Jw,ka,dE,Va],nu=[Da,rg,Ba,Ra,Ga,Oa,Ua,Pa]});var $a,TE=x(()=>{B();$a=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let m=f.buffer;d={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let l=a.shader.getProgramData(e).bindGroups[i],h=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=h,h}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};$a.extension={type:[T.WebGPUSystem],name:"bindGroup"}});var Xa,SE=x(()=>{B();mp();Xa=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Yn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};Xa.extension={type:[T.WebGPUSystem],name:"buffer"}});var ja,wE=x(()=>{B();ja=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};ja.extension={type:[T.WebGPUSystem],name:"colorMask"}});var Fo,EE=x(()=>{Ft();B();Fo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await X.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Fo.extension={type:[T.WebGPUSystem],name:"device"};Fo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ya,AE=x(()=>{B();Ya=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:h}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,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(e);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 t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Ya.extension={type:[T.WebGPUSystem],name:"encoder",priority:1}});var qa,PE=x(()=>{B();ns();qa=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Ut.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};qa.extension={type:[T.WebGPUSystem],name:"stencil"}});var ko,mg=x(()=>{jm();Mi();ni();ko=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Jc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new jt({data:new Float32Array(e.layout.size/4),usage:at.UNIFORM|at.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new jt({data:new Float32Array(s.layout.size/4),usage:at.UNIFORM|at.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function CE(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=Ka[s.data.type].size,n=Ka[s.data.type].align;if(!Ka[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Ka,gg=x(()=>{"use strict";Ka={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 ui,xg=x(()=>{"use strict";ui=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
|
|
767
767
|
var matrix = uv[name].toArray(true);
|
|
768
768
|
data[offset] = matrix[0];
|
|
769
769
|
data[offset + 1] = matrix[1];
|
|
@@ -834,23 +834,23 @@ fn mainFragment(
|
|
|
834
834
|
cv[2] = v.blue;
|
|
835
835
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
836
836
|
}
|
|
837
|
-
`}]});function
|
|
837
|
+
`}]});function au(r,t,e,i){let s=[`
|
|
838
838
|
var v = null;
|
|
839
839
|
var v2 = null;
|
|
840
840
|
var t = 0;
|
|
841
841
|
var index = 0;
|
|
842
842
|
var name = null;
|
|
843
843
|
var arrayOffset = null;
|
|
844
|
-
`],o=0;for(let a=0;a<r.length;a++){let l=r[a],h=l.data.name,c=!1,u=0;for(let d=0;d<
|
|
844
|
+
`],o=0;for(let a=0;a<r.length;a++){let l=r[a],h=l.data.name,c=!1,u=0;for(let d=0;d<ui.length;d++)if(ui[d].test(l.data)){u=l.offset/4,s.push(`name = "${h}";`,`offset += ${u-o};`,ui[d][t]||ui[d].ubo),c=!0;break}if(!c)if(l.data.size>1)u=l.offset/4,s.push(e(l,u-o));else{let d=i[l.data.type];u=l.offset/4,s.push(`
|
|
845
845
|
v = uv.${h};
|
|
846
846
|
offset += ${u-o};
|
|
847
847
|
${d};
|
|
848
848
|
`)}o=u}let n=s.join(`
|
|
849
|
-
`);return new Function("uv","data","dataInt32","offset",n)}var
|
|
849
|
+
`);return new Function("uv","data","dataInt32","offset",n)}var yg=x(()=>{xg()});function Go(r,t){return`
|
|
850
850
|
for (let i = 0; i < ${r*t}; i++) {
|
|
851
851
|
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
|
|
852
852
|
}
|
|
853
|
-
`}var
|
|
853
|
+
`}var _g,RE,bg=x(()=>{"use strict";_g={f32:`
|
|
854
854
|
data[offset] = v;`,i32:`
|
|
855
855
|
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
856
856
|
data[offset] = v[0];
|
|
@@ -886,12 +886,12 @@ fn mainFragment(
|
|
|
886
886
|
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
887
887
|
for (let i = 0; i < 16; i++) {
|
|
888
888
|
data[offset + i] = v[i];
|
|
889
|
-
}`,"mat3x2<f32>":
|
|
889
|
+
}`,"mat3x2<f32>":Go(3,2),"mat4x2<f32>":Go(4,2),"mat2x3<f32>":Go(2,3),"mat4x3<f32>":Go(4,3),"mat2x4<f32>":Go(2,4),"mat3x4<f32>":Go(3,4)},RE={..._g,"mat2x2<f32>":`
|
|
890
890
|
data[offset] = v[0];
|
|
891
891
|
data[offset + 1] = v[1];
|
|
892
892
|
data[offset + 2] = v[2];
|
|
893
893
|
data[offset + 3] = v[3];
|
|
894
|
-
`}});function
|
|
894
|
+
`}});function ME(r,t){let{size:e,align:i}=Ka[r.data.type],s=(i-e)/4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
895
895
|
v = uv.${r.data.name};
|
|
896
896
|
${t!==0?`offset += ${t};`:""}
|
|
897
897
|
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var fw=x(()=>{tg()});function pw(r){return eu(r,"uboWgsl",dw,uw)}var mw=x(()=>{rg();sg();fw()});var Xa,gw=x(()=>{B();Jm();tg();mw();Xa=class extends Mo{constructor(){super({createUboElements:cw,generateUboSync:pw})}};Xa.extension={type:[T.WebGPUSystem],name:"ubo"}});var Gi,ru=x(()=>{Se();be();Gi=class extends Rt{constructor({buffer:t,offset:e,size:i}){super(),this.uid=at("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=at("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=at("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var iu,xw=x(()=>{"use strict";iu=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*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,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Ui,Ya,yw=x(()=>{B();Ci();ru();oi();xw();Pi();Ui=128,Ya=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new iu({minUniformOffsetAlignment:Ui});let e=256/Ui;for(let i=0;i<e;i++){let s=ot.UNIFORM|ot.COPY_DST;i===0&&(s|=ot.COPY_SRC),this._buffers.push(new jt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Ui),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Ui)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ui)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Ui;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Gi({buffer:e,offset:(t/2|0)*256,size:Ui})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new me({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Ui,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Ya.extension={type:[T.WebGPUPipes],name:"uniformBatch"}});function su(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):D(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}BF(r)}function BF(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=We(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=We(n.format).stride}}var og=x(()=>{At();os()});var Wr,ng=x(()=>{is();Wr=[];Wr[Ft.NONE]=void 0;Wr[Ft.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Wr[Ft.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Wr[Ft.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Wr[Ft.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Wr[Ft.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function FF(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function kF(r,t,e,i){return e<<6|r<<3|i<<1|t}var IF,qa,_w=x(()=>{B();At();og();is();Xn();ng();IF={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};qa=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Ft.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Wr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(su(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=FF(t._layoutKey,e._layoutKey,i.data,i._blendModeId,IF[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Ft.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,h={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(h.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(h)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ni(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ni(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let h=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===h){o[a]=c;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let h=t.attributes[l];(h.divisor??1)!==1&&D(`Attribute ${l} has an invalid divisor value of '${h.divisor}'. WebGPU only supports a divisor value of 1`),h.buffer===o&&(n.arrayStride=h.stride,n.stepMode=h.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:h.offset,format:h.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let t=kF(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};qa.extension={type:[T.WebGPUSystem],name:"pipeline"}});function bw(r,t,e,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-t*r.a,r.ty=-n-e*r.d,r}var vw=x(()=>{"use strict"});function Tw(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Sw=x(()=>{"use strict"});var Io,ag=x(()=>{mt();ne();wo();vw();Fm();Xs();He();bt();Km();Sw();qm();Io=class{constructor(t){this.rootViewPort=new et,this.viewport=new et,this.onRenderTargetChange=new Ao("onRenderTargetChange"),this.projectionMatrix=new F,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Tw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,h=this.viewport,c=l.pixelWidth,u=l.pixelHeight;if(!s&&t instanceof R&&(s=t.frame),s){let d=l._resolution;h.x=s.x*d+.5|0,h.y=s.y*d+.5|0,h.width=s.width*d+.5|0,h.height=s.height*d+.5|0}else h.x=0,h.y=0,h.width=c,h.height=u;return bw(this.projectionMatrix,0,0,h.width/l.resolution,h.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ge.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ge.ALL,i,s){let o=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,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}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,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((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Ee.test(t)&&(t=Qc(t).source),t instanceof Da?e=t:t instanceof St&&(e=new Da({colorTextures:[t]}),Ee.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var ou,Ew=x(()=>{"use strict";ou=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var nu,ww=x(()=>{wo();Xs();He();Ew();nu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,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(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?ge.ALL:ge.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((h,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(h).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let g=e&ge.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:g}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let h=e&ge.STENCIL?"clear":"load",c=e&ge.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:h,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let h=a.createCommandEncoder(),c=this.getDescriptor(t,e,i),u=h.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=h.finish();a.queue.submit([d])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new ou;return t.colorTextures.forEach((i,s)=>{if(Ee.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)}e.contexts[s]=o}if(e.msaa=i.source.antialias,i.source.antialias){let o=new St({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Ka,Aw=x(()=>{B();ag();ww();Ka=class extends Io{constructor(t){super(t),this.adaptor=new nu,this.adaptor.init(t,this)}};Ka.extension={type:[T.WebGPUSystem],name:"renderTarget"}});var Za,Pw=x(()=>{B();Za=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Za.extension={type:[T.WebGPUSystem],name:"shader"}});var Ge,Cw=x(()=>{"use strict";Ge={};Ge.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ge.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ge["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ge["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ge.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ge.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ge.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Qa,Rw=x(()=>{B();vr();Cw();Qa=class{constructor(){this.defaultState=new qt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ge[t.blendMode]||Ge.normal}]}destroy(){this.gpu=null}};Qa.extension={type:[T.WebGPUSystem],name:"state"}});var Mw,Bw=x(()=>{"use strict";Mw={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var lg,GF,Iw,Fw=x(()=>{"use strict";lg={"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}},GF={blockBytes:4,blockWidth:1,blockHeight:1},Iw={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=lg[r.format]||GF;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,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 au,hg=x(()=>{"use strict";au={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var kw,Gw=x(()=>{hg();kw={type:"video",upload(r,t,e){au.upload(r,t,e)}}});var lu,Uw=x(()=>{"use strict";lu=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
910
|
+
`}var IE=x(()=>{gg()});function BE(r){return au(r,"uboWgsl",ME,RE)}var FE=x(()=>{yg();bg();IE()});var Za,kE=x(()=>{B();mg();gg();FE();Za=class extends ko{constructor(){super({createUboElements:CE,generateUboSync:BE})}};Za.extension={type:[T.WebGPUSystem],name:"ubo"}});var Oi,lu=x(()=>{Ee();Te();Oi=class extends Mt{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ct("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ct("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ct("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var hu,GE=x(()=>{"use strict";hu=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*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,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Li,Qa,UE=x(()=>{B();Mi();lu();ni();GE();Ri();Li=128,Qa=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new hu({minUniformOffsetAlignment:Li});let e=256/Li;for(let i=0;i<e;i++){let s=at.UNIFORM|at.COPY_DST;i===0&&(s|=at.COPY_SRC),this._buffers.push(new jt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Li),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Li)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Li)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Li;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Oi({buffer:e,offset:(t/2|0)*256,size:Li})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new xe({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Li,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Qa.extension={type:[T.WebGPUPipes],name:"uniformBatch"}});function cu(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):D(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}hk(r)}function hk(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=We(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=We(n.format).stride}}var vg=x(()=>{At();ls()});var zr,Tg=x(()=>{ns();zr=[];zr[Ut.NONE]=void 0;zr[Ut.DISABLED]={stencilWriteMask:0,stencilReadMask:0};zr[Ut.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};zr[Ut.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};zr[Ut.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};zr[Ut.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function uk(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function dk(r,t,e,i){return e<<6|r<<3|i<<1|t}var ck,Ja,OE=x(()=>{B();At();vg();ns();Zn();Tg();ck={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ja=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Ut.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=zr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(cu(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=uk(t._layoutKey,e._layoutKey,i.data,i._blendModeId,ck[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Ut.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,h={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(h.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(h)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ai(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ai(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let h=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===h){o[a]=c;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let h=t.attributes[l];(h.divisor??1)!==1&&D(`Attribute ${l} has an invalid divisor value of '${h.divisor}'. WebGPU only supports a divisor value of 1`),h.buffer===o&&(n.arrayStride=h.stride,n.stepMode=h.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:h.offset,format:h.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let t=dk(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Ja.extension={type:[T.WebGPUSystem],name:"pipeline"}});function LE(r,t,e,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-t*r.a,r.ty=-n-e*r.d,r}var DE=x(()=>{"use strict"});function NE(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var HE=x(()=>{"use strict"});var Uo,Sg=x(()=>{mt();ae();Ro();DE();Ym();Zs();He();_t();dg();HE();ug();Uo=class{constructor(t){this.rootViewPort=new it,this.viewport=new it,this.onRenderTargetChange=new Mo("onRenderTargetChange"),this.projectionMatrix=new F,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=NE(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,h=this.viewport,c=l.pixelWidth,u=l.pixelHeight;if(!s&&t instanceof R&&(s=t.frame),s){let d=l._resolution;h.x=s.x*d+.5|0,h.y=s.y*d+.5|0,h.width=s.width*d+.5|0,h.height=s.height*d+.5|0}else h.x=0,h.y=0,h.width=c,h.height=u;return LE(this.projectionMatrix,0,0,h.width/l.resolution,h.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ye.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ye.ALL,i,s){let o=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,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}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,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((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Ae.test(t)&&(t=su(t).source),t instanceof Wa?e=t:t instanceof St&&(e=new Wa({colorTextures:[t]}),Ae.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var uu,VE=x(()=>{"use strict";uu=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var du,WE=x(()=>{Ro();Zs();He();VE();du=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,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(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((h,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(h).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let m=e&ye.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let h=e&ye.STENCIL?"clear":"load",c=e&ye.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:h,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let h=a.createCommandEncoder(),c=this.getDescriptor(t,e,i),u=h.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=h.finish();a.queue.submit([d])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new uu;return t.colorTextures.forEach((i,s)=>{if(Ae.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)}e.contexts[s]=o}if(e.msaa=i.source.antialias,i.source.antialias){let o=new St({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var tl,zE=x(()=>{B();Sg();WE();tl=class extends Uo{constructor(t){super(t),this.adaptor=new du,this.adaptor.init(t,this)}};tl.extension={type:[T.WebGPUSystem],name:"renderTarget"}});var el,$E=x(()=>{B();el=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};el.extension={type:[T.WebGPUSystem],name:"shader"}});var Ue,XE=x(()=>{"use strict";Ue={};Ue.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ue.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ue.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ue.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ue.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ue.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ue["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ue["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ue["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ue.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ue.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ue.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var rl,jE=x(()=>{B();Tr();XE();rl=class{constructor(){this.defaultState=new Zt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ue[t.blendMode]||Ue.normal}]}destroy(){this.gpu=null}};rl.extension={type:[T.WebGPUSystem],name:"state"}});var YE,qE=x(()=>{"use strict";YE={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var wg,fk,KE,ZE=x(()=>{"use strict";wg={"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}},fk={blockBytes:4,blockWidth:1,blockHeight:1},KE={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=wg[r.format]||fk;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,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 fu,Eg=x(()=>{"use strict";fu={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var QE,JE=x(()=>{Eg();QE={type:"video",upload(r,t,e){fu.upload(r,t,e)}}});var pu,tA=x(()=>{"use strict";pu=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -931,7 +931,7 @@ fn mainFragment(
|
|
|
931
931
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
932
932
|
return textureSample(img, imgSampler, texCoord);
|
|
933
933
|
}
|
|
934
|
-
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let h=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=i.createView({baseMipLevel:c++,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}}]}),g=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:h}]});f.setPipeline(e),f.setBindGroup(0,g),f.draw(3,1,0,0),f.end(),h=d}}if(!o){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let h=1;h<t.mipLevelCount;++h)n.copyTextureToTexture({texture:i,mipLevel:h-1},{texture:t,mipLevel:h},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(),t}}});var Ja,Ow=x(()=>{Mt();B();Fe();fo();Pi();Bw();Fw();hg();Gw();Uw();Ja=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:au,buffer:Mw,video:kw,compressed:Iw},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=lg[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new lu(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new me({0:e,1:e.style,2:new Pt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=j.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:j.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=$e.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return $e.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Ja.extension={type:[T.WebGPUSystem],name:"texture"}});var Hw={};yy(Hw,{WebGPURenderer:()=>cg});var UF,OF,LF,Lw,Dw,Nw,cg,Vw=x(()=>{B();iE();nE();aE();_a();Qm();Dr();sw();ow();nw();aw();lw();hw();gw();yw();_w();Aw();Pw();Rw();Ow();UF=[...Jc,Xa,za,Ro,Va,Ja,Ka,Za,Qa,qa,Wa,$a,Ha],OF=[...tu,Ya],LF=[Ta,va,ba],Lw=[],Dw=[],Nw=[];U.handleByNamedList(T.WebGPUSystem,Lw);U.handleByNamedList(T.WebGPUPipes,Dw);U.handleByNamedList(T.WebGPUPipesAdaptor,Nw);U.add(...UF,...OF,...LF);cg=class extends ki{constructor(){let t={name:"webgpu",type:re.WEBGPU,systems:Lw,renderPipes:Dw,renderPipeAdaptors:Nw};super(t)}}});var tl,Ww=x(()=>{B();mt();rs();Mi();Yn();qn();Eo();Bi();lc();br();Fe();tl=class{init(){let t=new Pt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=nr(),i=Ur({name:"graphics",bits:[ro,so(e),So,Lr]});this.shader=new Xt({glProgram:i,resources:{localUniforms:t,batchSamplers:oo(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let h=l.instructions;for(let c=0;c<l.instructionSize;c++){let u=h[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};tl.extension={type:[T.WebGLPipesAdaptor],name:"graphics"}});var el,zw=x(()=>{B();mt();Mi();Eo();Bi();km();br();bt();At();el=class{init(){let t=Ur({name:"mesh",bits:[So,oE,Lr]});this._shader=new Xt({glProgram:t,resources:{uTexture:R.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){D("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};el.extension={type:[T.WebGLPipesAdaptor],name:"mesh"}});var rl,$w=x(()=>{B();vr();rl=class{constructor(){this._tempState=qt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.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(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};rl.extension={type:[T.WebGLPipesAdaptor],name:"batch"}});var il,jw=x(()=>{"use strict";il=(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))(il||{})});var hu,Xw=x(()=>{"use strict";hu=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var sl,Yw=x(()=>{B();oi();jw();Xw();sl=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let 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 e=s,this._nextBindBaseIndex=s+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&ot.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=il.ARRAY_BUFFER;t.descriptor.usage&ot.INDEX?i=il.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ot.UNIFORM&&(i=il.UNIFORM_BUFFER);let s=new hu(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};sl.extension={type:[T.WebGLSystem],name:"buffer"}});var ug,Kw,Zw=x(()=>{Mt();B();At();ug=class qw{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...qw.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(D("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=j.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&D("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof j.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!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:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&D("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||D("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};ug.extension={type:[T.WebGLSystem],name:"context"};ug.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};Kw=ug});var cu,dg,gt,fg=x(()=>{"use strict";cu=(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))(cu||{}),dg=(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))(dg||{}),gt=(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))(gt||{})});function Jw(r){return Qw[r]??Qw.float32}var Qw,tA=x(()=>{fg();Qw={uint8x2:gt.UNSIGNED_BYTE,uint8x4:gt.UNSIGNED_BYTE,sint8x2:gt.BYTE,sint8x4:gt.BYTE,unorm8x2:gt.UNSIGNED_BYTE,unorm8x4:gt.UNSIGNED_BYTE,snorm8x2:gt.BYTE,snorm8x4:gt.BYTE,uint16x2:gt.UNSIGNED_SHORT,uint16x4:gt.UNSIGNED_SHORT,sint16x2:gt.SHORT,sint16x4:gt.SHORT,unorm16x2:gt.UNSIGNED_SHORT,unorm16x4:gt.UNSIGNED_SHORT,snorm16x2:gt.SHORT,snorm16x4:gt.SHORT,float16x2:gt.HALF_FLOAT,float16x4:gt.HALF_FLOAT,float32:gt.FLOAT,float32x2:gt.FLOAT,float32x3:gt.FLOAT,float32x4:gt.FLOAT,uint32:gt.UNSIGNED_INT,uint32x2:gt.UNSIGNED_INT,uint32x3:gt.UNSIGNED_INT,uint32x4:gt.UNSIGNED_INT,sint32:gt.INT,sint32x2:gt.INT,sint32x3:gt.INT,sint32x4:gt.INT}});var DF,ol,eA=x(()=>{B();os();og();tA();DF={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},ol=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],l=a[n];if(l)return a[e._key]=l,l;su(t,e._attributeData);let h=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let c=0;c<h.length;c++){let u=h[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){let i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let l=o[a],h=l.buffer,c=s.getGlBuffer(h),u=e._attributeData[a];if(u){n!==c&&(s.bind(h),n=c);let d=u.location;i.enableVertexAttribArray(d);let f=We(l.format),g=Jw(l.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,g,l.stride,l.offset):i.vertexAttribPointer(d,f.size,g,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(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=DF[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,h=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,h,(i||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,h,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};ol.extension={type:[T.WebGLSystem],name:"geometry"}});var NF,pg,iA,sA=x(()=>{B();At();Qs();br();vr();He();bt();ss();NF=new ar({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),pg=class rA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...rA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(D("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=qt.for2d();let s=new lr({vertex:`
|
|
934
|
+
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let h=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=i.createView({baseMipLevel:c++,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}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:h}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),h=d}}if(!o){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let h=1;h<t.mipLevelCount;++h)n.copyTextureToTexture({texture:i,mipLevel:h-1},{texture:t,mipLevel:h},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(),t}}});var il,eA=x(()=>{Ft();B();ke();xo();Ri();qE();ZE();Eg();JE();tA();il=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:fu,buffer:YE,video:QE,compressed:KE},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=wg[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new pu(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new xe({0:e,1:e.style,2:new Ct({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=X.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:X.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=$e.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return $e.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};il.extension={type:[T.WebGPUSystem],name:"texture"}});var oA={};Oy(oA,{WebGPURenderer:()=>Ag});var pk,mk,gk,rA,iA,sA,Ag,nA=x(()=>{B();Tw();Ew();Aw();Sa();pg();Nr();TE();SE();wE();EE();AE();PE();kE();UE();OE();zE();$E();jE();eA();pk=[...ou,Za,Ya,Fo,Xa,il,tl,el,rl,Ja,ja,qa,$a],mk=[...nu,Qa],gk=[Aa,Ea,wa],rA=[],iA=[],sA=[];U.handleByNamedList(T.WebGPUSystem,rA);U.handleByNamedList(T.WebGPUPipes,iA);U.handleByNamedList(T.WebGPUPipesAdaptor,sA);U.add(...pk,...mk,...gk);Ag=class extends Ui{constructor(){let t={name:"webgpu",type:re.WEBGPU,systems:rA,renderPipes:iA,renderPipeAdaptors:sA};super(t)}}});var sl,aA=x(()=>{B();mt();os();Bi();Qn();Jn();Co();Fi();mc();vr();ke();sl=class{init(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=nr(),i=Or({name:"graphics",bits:[no,lo(e),Po,Dr]});this.shader=new Yt({glProgram:i,resources:{localUniforms:t,batchSamplers:ho(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let h=l.instructions;for(let c=0;c<l.instructionSize;c++){let u=h[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};sl.extension={type:[T.WebGLPipesAdaptor],name:"graphics"}});var ol,lA=x(()=>{B();mt();Bi();Co();Fi();qm();vr();_t();At();ol=class{init(){let t=Or({name:"mesh",bits:[Po,ww,Dr]});this._shader=new Yt({glProgram:t,resources:{uTexture:R.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){D("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ol.extension={type:[T.WebGLPipesAdaptor],name:"mesh"}});var nl,hA=x(()=>{B();Tr();nl=class{constructor(){this._tempState=Zt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.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(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};nl.extension={type:[T.WebGLPipesAdaptor],name:"batch"}});var al,cA=x(()=>{"use strict";al=(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))(al||{})});var mu,uA=x(()=>{"use strict";mu=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var ll,dA=x(()=>{B();ni();cA();uA();ll=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let 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 e=s,this._nextBindBaseIndex=s+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&at.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=al.ARRAY_BUFFER;t.descriptor.usage&at.INDEX?i=al.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&at.UNIFORM&&(i=al.UNIFORM_BUFFER);let s=new mu(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};ll.extension={type:[T.WebGLSystem],name:"buffer"}});var Pg,pA,mA=x(()=>{Ft();B();At();Pg=class fA{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...fA.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(D("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=X.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&D("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof X.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!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:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&D("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||D("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Pg.extension={type:[T.WebGLSystem],name:"context"};Pg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};pA=Pg});var gu,Cg,xt,Rg=x(()=>{"use strict";gu=(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))(gu||{}),Cg=(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))(Cg||{}),xt=(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))(xt||{})});function xA(r){return gA[r]??gA.float32}var gA,yA=x(()=>{Rg();gA={uint8x2:xt.UNSIGNED_BYTE,uint8x4:xt.UNSIGNED_BYTE,sint8x2:xt.BYTE,sint8x4:xt.BYTE,unorm8x2:xt.UNSIGNED_BYTE,unorm8x4:xt.UNSIGNED_BYTE,snorm8x2:xt.BYTE,snorm8x4:xt.BYTE,uint16x2:xt.UNSIGNED_SHORT,uint16x4:xt.UNSIGNED_SHORT,sint16x2:xt.SHORT,sint16x4:xt.SHORT,unorm16x2:xt.UNSIGNED_SHORT,unorm16x4:xt.UNSIGNED_SHORT,snorm16x2:xt.SHORT,snorm16x4:xt.SHORT,float16x2:xt.HALF_FLOAT,float16x4:xt.HALF_FLOAT,float32:xt.FLOAT,float32x2:xt.FLOAT,float32x3:xt.FLOAT,float32x4:xt.FLOAT,uint32:xt.UNSIGNED_INT,uint32x2:xt.UNSIGNED_INT,uint32x3:xt.UNSIGNED_INT,uint32x4:xt.UNSIGNED_INT,sint32:xt.INT,sint32x2:xt.INT,sint32x3:xt.INT,sint32x4:xt.INT}});var xk,hl,_A=x(()=>{B();ls();vg();yA();xk={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},hl=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],l=a[n];if(l)return a[e._key]=l,l;cu(t,e._attributeData);let h=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let c=0;c<h.length;c++){let u=h[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){let i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let l=o[a],h=l.buffer,c=s.getGlBuffer(h),u=e._attributeData[a];if(u){n!==c&&(s.bind(h),n=c);let d=u.location;i.enableVertexAttribArray(d);let f=We(l.format),m=xA(l.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,m,l.stride,l.offset):i.vertexAttribPointer(d,f.size,m,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let g=l.divisor??1;i.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=xk[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,h=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,h,(i||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,h,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};hl.extension={type:[T.WebGLSystem],name:"geometry"}});var yk,Mg,vA,TA=x(()=>{B();At();ro();vr();Tr();He();_t();as();yk=new ar({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Mg=class bA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...bA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(D("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Zt.for2d();let s=new lr({vertex:`
|
|
935
935
|
attribute vec2 aPosition;
|
|
936
936
|
out vec2 vUv;
|
|
937
937
|
|
|
@@ -950,7 +950,7 @@ fn mainFragment(
|
|
|
950
950
|
|
|
951
951
|
void main() {
|
|
952
952
|
finalColor = texture(uTexture, vUv);
|
|
953
|
-
}`,name:"big-triangle"});this._bigTriangleShader=new
|
|
953
|
+
}`,name:"big-triangle"});this._bigTriangleShader=new Yt({glProgram:s,resources:{uTexture:R.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:yk,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new R({source:new St({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Mg.extension={type:[T.WebGLSystem],name:"backBuffer",priority:1};Mg.defaultOptions={useBackBuffer:!1};vA=Mg});var cl,SA=x(()=>{B();cl=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};cl.extension={type:[T.WebGLSystem],name:"colorMask"}});var ul,wA=x(()=>{B();ul=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:i,shader:s,state:o,skipSync:n,topology:a,size:l,start:h,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,l,h,c??i.instanceCount)}destroy(){this._renderer=null}};ul.extension={type:[T.WebGLSystem],name:"encoder"}});var dl,EA=x(()=>{B();Tg();ns();dl=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Ut.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Ut.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Ut.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=zr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===Ut.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};dl.extension={type:[T.WebGLSystem],name:"stencil"}});function AA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(i=Ig[n.data.type],!i)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let l=s%e;l>0&&e-l<a?s+=(e-l)%16:s+=(i-l%i)%i,n.offset=s,s+=i}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var Ig,Bg=x(()=>{"use strict";Ig={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function PA(r,t){let e=Math.max(Ig[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
954
954
|
v = uv.${r.data.name};
|
|
955
955
|
offset += ${t};
|
|
956
956
|
|
|
@@ -966,7 +966,7 @@ fn mainFragment(
|
|
|
966
966
|
}
|
|
967
967
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
968
968
|
}
|
|
969
|
-
`}var
|
|
969
|
+
`}var CA=x(()=>{Bg()});function RA(r){return au(r,"uboStd40",PA,_g)}var MA=x(()=>{yg();bg();CA()});var fl,IA=x(()=>{B();mg();Bg();MA();fl=class extends ko{constructor(){super({createUboElements:AA,generateUboSync:RA})}};fl.extension={type:[T.WebGLSystem],name:"ubo"}});var xu,BA=x(()=>{"use strict";xu=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var yu,FA=x(()=>{ae();At();Zs();Ro();BA();yu=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new it}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new it}copyToTexture(t,e,i,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(t),h=a.gl;return this.finishRenderPass(t),h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),h.copyTexSubImage2D(h.TEXTURE_2D,0,o.x,o.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),l=s.y;t.isRoot&&(l=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let h=this._renderer.gl;h.bindFramebuffer(h.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,h.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new xu,o=t.colorTexture;return Ae.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let o=this._renderer.gl;if(e&ye.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:D("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);let c=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=s.createRenderbuffer();e.msaaRenderBuffer[l]=h})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=a.source;s.texture.bindSource(h,0);let u=s.texture.getGlSource(h).internalFormat,d=e.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,h.pixelWidth,h.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&Ae.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Ae.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var pl,kA=x(()=>{B();Sg();FA();pl=class extends Uo{constructor(t){super(t),this.adaptor=new yu,this.adaptor.init(t,this)}};pl.extension={type:[T.WebGLSystem],name:"renderTarget"}});function GA(r,t){let e=[],i=[`
|
|
970
970
|
var g = s.groups;
|
|
971
971
|
var sS = r.shader;
|
|
972
972
|
var p = s.glProgram;
|
|
@@ -974,7 +974,7 @@ fn mainFragment(
|
|
|
974
974
|
var resources;
|
|
975
975
|
`],s=!1,o=0,n=t._getProgramData(r.glProgram);for(let l in r.groups){let h=r.groups[l];e.push(`
|
|
976
976
|
resources = g[${l}].resources;
|
|
977
|
-
`);for(let c in h.resources){let u=h.resources[c];if(u instanceof
|
|
977
|
+
`);for(let c in h.resources){let u=h.resources[c];if(u instanceof Ct)if(u.ubo){let d=r._uniformBindMap[l][Number(c)];e.push(`
|
|
978
978
|
sS.bindUniformBlock(
|
|
979
979
|
resources[${c}],
|
|
980
980
|
'${d}',
|
|
@@ -982,7 +982,7 @@ fn mainFragment(
|
|
|
982
982
|
);
|
|
983
983
|
`)}else e.push(`
|
|
984
984
|
ugS.updateUniformGroup(resources[${c}], p, sD);
|
|
985
|
-
`);else if(u instanceof
|
|
985
|
+
`);else if(u instanceof Oi){let d=r._uniformBindMap[l][Number(c)];e.push(`
|
|
986
986
|
sS.bindUniformBlock(
|
|
987
987
|
resources[${c}],
|
|
988
988
|
'${d}',
|
|
@@ -993,10 +993,10 @@ fn mainFragment(
|
|
|
993
993
|
`)),t._gl.uniform1i(f.location,o),e.push(`
|
|
994
994
|
tS.bind(resources[${c}], ${o});
|
|
995
995
|
`),o++)}}}let a=[...i,...e].join(`
|
|
996
|
-
`);return new Function("r","s","sD",a)}var
|
|
996
|
+
`);return new Function("r","s","sD",a)}var UA=x(()=>{lu();ke();He()});var _u,OA=x(()=>{"use strict";_u=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function Fg(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}var LA=x(()=>{"use strict"});function kg(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function bu(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return kg(2*t);case"bvec3":return kg(3*t);case"bvec4":return kg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Gg=x(()=>{"use strict"});function Ug(r,t){if(!vu){let e=Object.keys(DA);vu={};for(let i=0;i<e.length;++i){let s=e[i];vu[r[s]]=DA[s]}}return vu[t]}function NA(r,t){let e=Ug(r,t);return _k[e]||"float32"}var vu,DA,_k,Og=x(()=>{"use strict";vu=null,DA={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"},_k={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function HA(r,t,e=!1){let i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(r,n);if(a.name.startsWith("gl_"))continue;let l=NA(t,a.type);i[a.name]={location:0,format:l,stride:We(l).stride,offset:0,instance:!1,start:0}}let o=Object.keys(i);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)i[o[n]].location=n,t.bindAttribLocation(r,n,o[n]);t.linkProgram(r)}else for(let n=0;n<o.length;n++)i[o[n]].location=t.getAttribLocation(r,o[n]);return i}var VA=x(()=>{ls();Og()});function WA(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){let o=t.getActiveUniformBlockName(r,s),n=t.getUniformBlockIndex(r,o),a=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var zA=x(()=>{"use strict"});function $A(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Ug(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:bu(l,o.size)}}return e}var XA=x(()=>{Gg();Og()});function jA(r,t){let e=r.getShaderSource(t).split(`
|
|
997
997
|
`).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
998
998
|
`),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
|
|
999
|
-
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
999
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function YA(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||jA(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||jA(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var qA=x(()=>{"use strict"});function KA(r,t){let e=Fg(r,r.VERTEX_SHADER,t.vertex),i=Fg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?D("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)||YA(r,s,e,i),t._attributeData=HA(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=$A(s,r),t._uniformBlockData=WA(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let l in t._uniformData){let h=t._uniformData[l];n[l]={location:r.getUniformLocation(s,l),value:bu(h.type,h.size)}}return new _u(s,n)}var ZA=x(()=>{At();OA();LA();Gg();VA();zA();XA();qA()});var Tu,ml,QA=x(()=>{B();os();UA();ZA();Tu={textureCount:0,blockIndex:0},ml=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=nr()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Tu.textureCount=0,Tu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,Tu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Tu)}bindUniformBlock(t,e,i=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),h=s.freeLocationForBufferBase(l);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(l,h):s.bindBufferRange(l,h,u)}else s.getLastBindBaseLocation(l)!==h&&s.bindBufferBase(l,h);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[i]!==h&&(o.uniformBlockBindings[i]=h,this._renderer.gl.uniformBlockBinding(o.program,c,h))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=KA(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return GA(t,e)}resetState(){this._activeProgram=null}};ml.extension={type:[T.WebGLSystem],name:"shader"}});var JA,t1,e1=x(()=>{"use strict";JA={f32:`if (cv !== v) {
|
|
1000
1000
|
cu.value = v;
|
|
1001
1001
|
gl.uniform1f(location, v);
|
|
1002
1002
|
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
@@ -1068,30 +1068,30 @@ fn mainFragment(
|
|
|
1068
1068
|
cv[2] = v[2];
|
|
1069
1069
|
cv[3] = v[3];
|
|
1070
1070
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
1071
|
-
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},
|
|
1071
|
+
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},t1={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function r1(r,t){let e=[`
|
|
1072
1072
|
var v = null;
|
|
1073
1073
|
var cv = null;
|
|
1074
1074
|
var cu = null;
|
|
1075
1075
|
var t = 0;
|
|
1076
1076
|
var gl = renderer.gl;
|
|
1077
1077
|
var name = null;
|
|
1078
|
-
`];for(let i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof
|
|
1078
|
+
`];for(let i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof Ct?r.uniforms[i].ubo?e.push(`
|
|
1079
1079
|
renderer.shader.bindUniformBlock(uv.${i}, "${i}");
|
|
1080
1080
|
`):e.push(`
|
|
1081
1081
|
renderer.shader.updateUniformGroup(uv.${i});
|
|
1082
|
-
`):r.uniforms[i]instanceof
|
|
1082
|
+
`):r.uniforms[i]instanceof Oi&&e.push(`
|
|
1083
1083
|
renderer.shader.bindBufferResource(uv.${i}, "${i}");
|
|
1084
|
-
`);continue}let s=r.uniformStructures[i],o=!1;for(let n=0;n<
|
|
1084
|
+
`);continue}let s=r.uniformStructures[i],o=!1;for(let n=0;n<ui.length;n++){let a=ui[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${i}";`,ui[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?JA:t1)[s.type].replace("location",`ud["${i}"].location`);e.push(`
|
|
1085
1085
|
cu = ud["${i}"];
|
|
1086
1086
|
cv = cu.value;
|
|
1087
1087
|
v = uv["${i}"];
|
|
1088
1088
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1089
|
-
`))}var DA=x(()=>{ru();Fe();eg();OA()});var dl,NA=x(()=>{B();DA();dl=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return LA(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};dl.extension={type:[T.WebGLSystem],name:"uniformGroup"}});function HA(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var VA=x(()=>{Mt()});var VF,WF,zF,$F,jF,XF,WA,zA,$A=x(()=>{B();vr();VA();VF=0,WF=1,zF=2,$F=3,jF=4,XF=5,WA=class Tg{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[VF]=this.setBlend,this.map[WF]=this.setOffset,this.map[zF]=this.setCullFace,this.map[$F]=this.setDepthTest,this.map[jF]=this.setFrontFace,this.map[XF]=this.setDepthMask,this.checks=[],this.defaultState=qt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=HA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Tg._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Tg._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};WA.extension={type:[T.WebGLSystem],name:"state"};zA=WA});var xu,jA=x(()=>{fg();xu=class{constructor(t){this.target=dg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=gt.UNSIGNED_BYTE,this.internalFormat=cu.RGBA,this.format=cu.RGBA,this.samplerType=0}}});var XA,YA=x(()=>{"use strict";XA={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var YF,qA,KA=x(()=>{"use strict";YF={"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},qA={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!YF[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var yu,Sg=x(()=>{"use strict";yu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,h=r.resourceHeight;l<n||h<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var ZA,QA=x(()=>{Sg();ZA={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}yu.upload(r,t,e,i)}}});var Eg,JA,_u,t1,e1=x(()=>{"use strict";Eg={linear:9729,nearest:9728},JA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},_u={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},t1={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function wg(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let h=_u[n?"clamp-to-edge":r.addressModeU],c=_u[n?"clamp-to-edge":r.addressModeV],u=_u[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,h),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Eg[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let h=JA[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,h)}}else t[s](l,t.TEXTURE_MIN_FILTER,Eg[r.minFilter]);if(i&&r.maxAnisotropy>1){let h=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,t1[r.compare])}var r1=x(()=>{e1()});function i1(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 s1=x(()=>{"use strict"});function o1(r,t){let e={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var n1=x(()=>{Mt()});function a1(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 l1=x(()=>{"use strict"});var qF,fl,h1=x(()=>{Mt();B();bt();jA();YA();KA();Sg();QA();r1();s1();n1();l1();qF=4,fl=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:yu,buffer:XA,video:ZA,compressed:qA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=o1(t,this._renderer.context.extensions),this._mapFormatToType=a1(t),this._mapFormatToFormat=i1(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(R.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=R.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new xu(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,wg(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,wg(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:s}=this.getPixels(t),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(qF*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),h=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,h.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(R.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};fl.extension={type:[T.WebGLSystem],name:"texture"}});var f1={};yy(f1,{WebGLRenderer:()=>Ag});var KF,ZF,QF,c1,u1,d1,Ag,p1=x(()=>{B();Ww();zw();$w();_a();Qm();Dr();Yw();Zw();eA();sA();oA();nA();aA();fA();gA();kA();NA();$A();h1();KF=[...Jc,hl,iA,Kw,sl,fl,cl,ol,dl,ul,al,zA,ll,nl],ZF=[...tu],QF=[rl,el,tl],c1=[],u1=[],d1=[];U.handleByNamedList(T.WebGLSystem,c1);U.handleByNamedList(T.WebGLPipes,u1);U.handleByNamedList(T.WebGLPipesAdaptor,d1);U.add(...KF,...ZF,...QF);Ag=class extends ki{constructor(){let t={name:"webgl",type:re.WEBGL,systems:c1,renderPipes:u1,renderPipeAdaptors:d1};super(t)}}});var LP=Z((Pct,qg)=>{"use strict";var qk=Object.prototype.hasOwnProperty,Le="~";function Pl(){}Object.create&&(Pl.prototype=Object.create(null),new Pl().__proto__||(Le=!1));function Kk(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function OP(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Kk(e,i||r,s),n=Le?Le+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function td(r,t){--r._eventsCount===0?r._events=new Pl:delete r._events[t]}function Pe(){this._events=new Pl,this._eventsCount=0}Pe.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)qk.call(e,i)&&t.push(Le?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Pe.prototype.listeners=function(t){var e=Le?Le+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Pe.prototype.listenerCount=function(t){var e=Le?Le+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Pe.prototype.emit=function(t,e,i,s,o,n){var a=Le?Le+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Pe.prototype.on=function(t,e,i){return OP(this,t,e,i,!1)};Pe.prototype.once=function(t,e,i){return OP(this,t,e,i,!0)};Pe.prototype.removeListener=function(t,e,i,s){var o=Le?Le+t:t;if(!this._events[o])return this;if(!e)return td(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&td(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:td(this,o)}return this};Pe.prototype.removeAllListeners=function(t){var e;return t?(e=Le?Le+t:t,this._events[e]&&td(this,e)):(this._events=new Pl,this._eventsCount=0),this};Pe.prototype.off=Pe.prototype.removeListener;Pe.prototype.addListener=Pe.prototype.on;Pe.prefixed=Le;Pe.EventEmitter=Pe;typeof qg<"u"&&(qg.exports=Pe)});var DP=Z((Wo,zo)=>{(function(r){var t=typeof Wo=="object"&&Wo&&!Wo.nodeType&&Wo,e=typeof zo=="object"&&zo&&!zo.nodeType&&zo,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,h=38,c=700,u=72,d=128,f="-",g=/^xn--/,m=/[^\x20-\x7E]/,p=/[\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"},y=n-a,v=Math.floor,b=String.fromCharCode,E;function A(W){throw new RangeError(_[W])}function S(W,L){for(var z=W.length,rt=[];z--;)rt[z]=L(W[z]);return rt}function w(W,L){var z=W.split("@"),rt="";z.length>1&&(rt=z[0]+"@",W=z[1]),W=W.replace(p,".");var nt=W.split("."),Tt=S(nt,L).join(".");return rt+Tt}function P(W){for(var L=[],z=0,rt=W.length,nt,Tt;z<rt;)nt=W.charCodeAt(z++),nt>=55296&&nt<=56319&&z<rt?(Tt=W.charCodeAt(z++),(Tt&64512)==56320?L.push(((nt&1023)<<10)+(Tt&1023)+65536):(L.push(nt),z--)):L.push(nt);return L}function C(W){return S(W,function(L){var z="";return L>65535&&(L-=65536,z+=b(L>>>10&1023|55296),L=56320|L&1023),z+=b(L),z}).join("")}function M(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:n}function I(W,L){return W+22+75*(W<26)-((L!=0)<<5)}function k(W,L,z){var rt=0;for(W=z?v(W/c):W>>1,W+=v(W/L);W>y*l>>1;rt+=n)W=v(W/y);return v(rt+(y+1)*W/(W+h))}function G(W){var L=[],z=W.length,rt,nt=0,Tt=d,Ot=u,Ht,Qt,Ce,pt,lt,_t,kt,Jt,te;for(Ht=W.lastIndexOf(f),Ht<0&&(Ht=0),Qt=0;Qt<Ht;++Qt)W.charCodeAt(Qt)>=128&&A("not-basic"),L.push(W.charCodeAt(Qt));for(Ce=Ht>0?Ht+1:0;Ce<z;){for(pt=nt,lt=1,_t=n;Ce>=z&&A("invalid-input"),kt=M(W.charCodeAt(Ce++)),(kt>=n||kt>v((o-nt)/lt))&&A("overflow"),nt+=kt*lt,Jt=_t<=Ot?a:_t>=Ot+l?l:_t-Ot,!(kt<Jt);_t+=n)te=n-Jt,lt>v(o/te)&&A("overflow"),lt*=te;rt=L.length+1,Ot=k(nt-pt,rt,pt==0),v(nt/rt)>o-Tt&&A("overflow"),Tt+=v(nt/rt),nt%=rt,L.splice(nt++,0,Tt)}return C(L)}function ut(W){var L,z,rt,nt,Tt,Ot,Ht,Qt,Ce,pt,lt,_t=[],kt,Jt,te,De;for(W=P(W),kt=W.length,L=d,z=0,Tt=u,Ot=0;Ot<kt;++Ot)lt=W[Ot],lt<128&&_t.push(b(lt));for(rt=nt=_t.length,nt&&_t.push(f);rt<kt;){for(Ht=o,Ot=0;Ot<kt;++Ot)lt=W[Ot],lt>=L&<<Ht&&(Ht=lt);for(Jt=rt+1,Ht-L>v((o-z)/Jt)&&A("overflow"),z+=(Ht-L)*Jt,L=Ht,Ot=0;Ot<kt;++Ot)if(lt=W[Ot],lt<L&&++z>o&&A("overflow"),lt==L){for(Qt=z,Ce=n;pt=Ce<=Tt?a:Ce>=Tt+l?l:Ce-Tt,!(Qt<pt);Ce+=n)De=Qt-pt,te=n-pt,_t.push(b(I(pt+De%te,0))),Qt=v(De/te);_t.push(b(I(Qt,0))),Tt=k(z,Jt,rt==nt),z=0,++rt}++z,++L}return _t.join("")}function H(W){return w(W,function(L){return g.test(L)?G(L.slice(4).toLowerCase()):L})}function K(W){return w(W,function(L){return m.test(L)?"xn--"+ut(L):L})}if(s={version:"1.4.1",ucs2:{decode:P,encode:C},decode:G,encode:ut,toASCII:K,toUnicode:H},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(zo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(Wo)});var ms=Z((Cct,NP)=>{"use strict";NP.exports=TypeError});var HP=Z(()=>{});var Il=Z((Bct,aC)=>{var ox=typeof Map=="function"&&Map.prototype,Kg=Object.getOwnPropertyDescriptor&&ox?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,rd=ox&&Kg&&typeof Kg.get=="function"?Kg.get:null,VP=ox&&Map.prototype.forEach,nx=typeof Set=="function"&&Set.prototype,Zg=Object.getOwnPropertyDescriptor&&nx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,id=nx&&Zg&&typeof Zg.get=="function"?Zg.get:null,WP=nx&&Set.prototype.forEach,Zk=typeof WeakMap=="function"&&WeakMap.prototype,Rl=Zk?WeakMap.prototype.has:null,Qk=typeof WeakSet=="function"&&WeakSet.prototype,Ml=Qk?WeakSet.prototype.has:null,Jk=typeof WeakRef=="function"&&WeakRef.prototype,zP=Jk?WeakRef.prototype.deref:null,t2=Boolean.prototype.valueOf,e2=Object.prototype.toString,r2=Function.prototype.toString,i2=String.prototype.match,ax=String.prototype.slice,Di=String.prototype.replace,s2=String.prototype.toUpperCase,$P=String.prototype.toLowerCase,tC=RegExp.prototype.test,jP=Array.prototype.concat,zr=Array.prototype.join,o2=Array.prototype.slice,XP=Math.floor,tx=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Qg=Object.getOwnPropertySymbols,ex=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,$o=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Bl=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===$o||!0)?Symbol.toStringTag:null,eC=Object.prototype.propertyIsEnumerable,YP=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function qP(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||tC.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-XP(-r):XP(r);if(i!==r){var s=String(i),o=ax.call(t,s.length+1);return Di.call(s,e,"$&_")+"."+Di.call(Di.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Di.call(t,e,"$&_")}var rx=HP(),KP=rx.custom,ZP=sC(KP)?KP:null,rC={__proto__:null,double:'"',single:"'"},n2={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};aC.exports=function r(t,e,i,s){var o=e||{};if(ui(o,"quoteStyle")&&!ui(rC,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ui(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=ui(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(ui(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(ui(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return nC(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?qP(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?qP(t,h):h}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return ix(t)?"[Array]":"[Object]";var u=E2(o,i);if(typeof s>"u")s=[];else if(oC(s,t)>=0)return"[Circular]";function d(k,G,ut){if(G&&(s=o2.call(s),s.push(G)),ut){var H={depth:o.depth};return ui(o,"quoteStyle")&&(H.quoteStyle=o.quoteStyle),r(k,H,i+1,s)}return r(k,o,i+1,s)}if(typeof t=="function"&&!QP(t)){var f=m2(t),g=ed(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(g.length>0?" { "+zr.call(g,", ")+" }":"")}if(sC(t)){var m=$o?Di.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):ex.call(t);return typeof t=="object"&&!$o?Cl(m):m}if(v2(t)){for(var p="<"+$P.call(String(t.nodeName)),_=t.attributes||[],y=0;y<_.length;y++)p+=" "+_[y].name+"="+iC(a2(_[y].value),"double",o);return p+=">",t.childNodes&&t.childNodes.length&&(p+="..."),p+="</"+$P.call(String(t.nodeName))+">",p}if(ix(t)){if(t.length===0)return"[]";var v=ed(t,d);return u&&!S2(v)?"["+sx(v,u)+"]":"[ "+zr.call(v,", ")+" ]"}if(h2(t)){var b=ed(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!eC.call(t,"cause")?"{ ["+String(t)+"] "+zr.call(jP.call("[cause]: "+d(t.cause),b),", ")+" }":b.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+zr.call(b,", ")+" }"}if(typeof t=="object"&&n){if(ZP&&typeof t[ZP]=="function"&&rx)return rx(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(g2(t)){var E=[];return VP&&VP.call(t,function(k,G){E.push(d(G,t,!0)+" => "+d(k,t))}),JP("Map",rd.call(t),E,u)}if(_2(t)){var A=[];return WP&&WP.call(t,function(k){A.push(d(k,t))}),JP("Set",id.call(t),A,u)}if(x2(t))return Jg("WeakMap");if(b2(t))return Jg("WeakSet");if(y2(t))return Jg("WeakRef");if(u2(t))return Cl(d(Number(t)));if(f2(t))return Cl(d(tx.call(t)));if(d2(t))return Cl(t2.call(t));if(c2(t))return Cl(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!l2(t)&&!QP(t)){var S=ed(t,d),w=YP?YP(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",C=!w&&Bl&&Object(t)===t&&Bl in t?ax.call(Ni(t),8,-1):P?"Object":"",M=w||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=M+(C||P?"["+zr.call(jP.call([],C||[],P||[]),": ")+"] ":"");return S.length===0?I+"{}":u?I+"{"+sx(S,u)+"}":I+"{ "+zr.call(S,", ")+" }"}return String(t)};function iC(r,t,e){var i=e.quoteStyle||t,s=rC[i];return s+r+s}function a2(r){return Di.call(String(r),/"/g,""")}function gs(r){return!Bl||!(typeof r=="object"&&(Bl in r||typeof r[Bl]<"u"))}function ix(r){return Ni(r)==="[object Array]"&&gs(r)}function l2(r){return Ni(r)==="[object Date]"&&gs(r)}function QP(r){return Ni(r)==="[object RegExp]"&&gs(r)}function h2(r){return Ni(r)==="[object Error]"&&gs(r)}function c2(r){return Ni(r)==="[object String]"&&gs(r)}function u2(r){return Ni(r)==="[object Number]"&&gs(r)}function d2(r){return Ni(r)==="[object Boolean]"&&gs(r)}function sC(r){if($o)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!ex)return!1;try{return ex.call(r),!0}catch{}return!1}function f2(r){if(!r||typeof r!="object"||!tx)return!1;try{return tx.call(r),!0}catch{}return!1}var p2=Object.prototype.hasOwnProperty||function(r){return r in this};function ui(r,t){return p2.call(r,t)}function Ni(r){return e2.call(r)}function m2(r){if(r.name)return r.name;var t=i2.call(r2.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function oC(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function g2(r){if(!rd||!r||typeof r!="object")return!1;try{rd.call(r);try{id.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function x2(r){if(!Rl||!r||typeof r!="object")return!1;try{Rl.call(r,Rl);try{Ml.call(r,Ml)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function y2(r){if(!zP||!r||typeof r!="object")return!1;try{return zP.call(r),!0}catch{}return!1}function _2(r){if(!id||!r||typeof r!="object")return!1;try{id.call(r);try{rd.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function b2(r){if(!Ml||!r||typeof r!="object")return!1;try{Ml.call(r,Ml);try{Rl.call(r,Rl)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function v2(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function nC(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return nC(ax.call(r,0,t.maxStringLength),t)+i}var s=n2[t.quoteStyle||"single"];s.lastIndex=0;var o=Di.call(Di.call(r,s,"\\$1"),/[\x00-\x1f]/g,T2);return iC(o,"single",t)}function T2(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+s2.call(t.toString(16))}function Cl(r){return"Object("+r+")"}function Jg(r){return r+" { ? }"}function JP(r,t,e,i){var s=i?sx(e,i):zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function S2(r){for(var t=0;t<r.length;t++)if(oC(r[t],`
|
|
1090
|
-
`)>=0)return!1;return!0}function
|
|
1091
|
-
`+t.prev+t.base;return e
|
|
1092
|
-
`+t.prev}function ed(r,t){var e=ix(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=ui(r,s)?t(r[s],r):""}var o=typeof Qg=="function"?Qg(r):[],n;if($o){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)ui(r,l)&&(e&&String(Number(l))===l&&l<r.length||$o&&n["$"+l]instanceof Symbol||(tC.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof Qg=="function")for(var h=0;h<o.length;h++)eC.call(r,o[h])&&i.push("["+t(o[h])+"]: "+t(r[o[h]],r));return i}});var hC=Z((Ict,lC)=>{"use strict";var w2=Il(),A2=ms(),sd=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},P2=function(r,t){if(r){var e=sd(r,t);return e&&e.value}},C2=function(r,t,e){var i=sd(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},R2=function(r,t){return r?!!sd(r,t):!1},M2=function(r,t){if(r)return sd(r,t,!0)};lC.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new A2("Side channel does not contain "+w2(i))},delete:function(i){var s=t&&t.next,o=M2(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return P2(t,i)},has:function(i){return R2(t,i)},set:function(i,s){t||(t={next:void 0}),C2(t,i,s)}};return e}});var lx=Z((Fct,cC)=>{"use strict";cC.exports=Object});var dC=Z((kct,uC)=>{"use strict";uC.exports=Error});var pC=Z((Gct,fC)=>{"use strict";fC.exports=EvalError});var gC=Z((Uct,mC)=>{"use strict";mC.exports=RangeError});var yC=Z((Oct,xC)=>{"use strict";xC.exports=ReferenceError});var bC=Z((Lct,_C)=>{"use strict";_C.exports=SyntaxError});var TC=Z((Dct,vC)=>{"use strict";vC.exports=URIError});var EC=Z((Nct,SC)=>{"use strict";SC.exports=Math.abs});var AC=Z((Hct,wC)=>{"use strict";wC.exports=Math.floor});var CC=Z((Vct,PC)=>{"use strict";PC.exports=Math.max});var MC=Z((Wct,RC)=>{"use strict";RC.exports=Math.min});var IC=Z((zct,BC)=>{"use strict";BC.exports=Math.pow});var kC=Z(($ct,FC)=>{"use strict";FC.exports=Math.round});var UC=Z((jct,GC)=>{"use strict";GC.exports=Number.isNaN||function(t){return t!==t}});var LC=Z((Xct,OC)=>{"use strict";var B2=UC();OC.exports=function(t){return B2(t)||t===0?t:t<0?-1:1}});var NC=Z((Yct,DC)=>{"use strict";DC.exports=Object.getOwnPropertyDescriptor});var hx=Z((qct,HC)=>{"use strict";var od=NC();if(od)try{od([],"length")}catch{od=null}HC.exports=od});var WC=Z((Kct,VC)=>{"use strict";var nd=Object.defineProperty||!1;if(nd)try{nd({},"a",{value:1})}catch{nd=!1}VC.exports=nd});var $C=Z((Zct,zC)=>{"use strict";zC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var YC=Z((Qct,XC)=>{"use strict";var jC=typeof Symbol<"u"&&Symbol,I2=$C();XC.exports=function(){return typeof jC!="function"||typeof Symbol!="function"||typeof jC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:I2()}});var cx=Z((Jct,qC)=>{"use strict";qC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ux=Z((tut,KC)=>{"use strict";var F2=lx();KC.exports=F2.getPrototypeOf||null});var JC=Z((eut,QC)=>{"use strict";var k2="Function.prototype.bind called on incompatible ",G2=Object.prototype.toString,U2=Math.max,O2="[object Function]",ZC=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},L2=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},D2=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};QC.exports=function(t){var e=this;if(typeof e!="function"||G2.apply(e)!==O2)throw new TypeError(k2+e);for(var i=L2(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,ZC(i,arguments));return Object(c)===c?c:this}return e.apply(t,ZC(i,arguments))},n=U2(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+D2(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s}});var Fl=Z((rut,tR)=>{"use strict";var N2=JC();tR.exports=Function.prototype.bind||N2});var ad=Z((iut,eR)=>{"use strict";eR.exports=Function.prototype.call});var dx=Z((sut,rR)=>{"use strict";rR.exports=Function.prototype.apply});var sR=Z((out,iR)=>{"use strict";iR.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var nR=Z((nut,oR)=>{"use strict";var H2=Fl(),V2=dx(),W2=ad(),z2=sR();oR.exports=z2||H2.call(W2,V2)});var fx=Z((aut,aR)=>{"use strict";var $2=Fl(),j2=ms(),X2=ad(),Y2=nR();aR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new j2("a function is required");return Y2($2,X2,t)}});var fR=Z((lut,dR)=>{"use strict";var q2=fx(),lR=hx(),cR;try{cR=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var px=!!cR&&lR&&lR(Object.prototype,"__proto__"),uR=Object,hR=uR.getPrototypeOf;dR.exports=px&&typeof px.get=="function"?q2([px.get]):typeof hR=="function"?function(t){return hR(t==null?t:uR(t))}:!1});var yR=Z((hut,xR)=>{"use strict";var pR=cx(),mR=ux(),gR=fR();xR.exports=pR?function(t){return pR(t)}:mR?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return mR(t)}:gR?function(t){return gR(t)}:null});var bR=Z((cut,_R)=>{"use strict";var K2=Function.prototype.call,Z2=Object.prototype.hasOwnProperty,Q2=Fl();_R.exports=Q2.call(K2,Z2)});var cd=Z((uut,AR)=>{"use strict";var dt,J2=lx(),tG=dC(),eG=pC(),rG=gC(),iG=yC(),qo=bC(),Yo=ms(),sG=TC(),oG=EC(),nG=AC(),aG=CC(),lG=MC(),hG=IC(),cG=kC(),uG=LC(),ER=Function,mx=function(r){try{return ER('"use strict"; return ('+r+").constructor;")()}catch{}},kl=hx(),dG=WC(),gx=function(){throw new Yo},fG=kl?function(){try{return arguments.callee,gx}catch{try{return kl(arguments,"callee").get}catch{return gx}}}():gx,jo=YC()(),xe=yR(),pG=ux(),mG=cx(),wR=dx(),Gl=ad(),Xo={},gG=typeof Uint8Array>"u"||!xe?dt:xe(Uint8Array),xs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?dt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?dt:ArrayBuffer,"%ArrayIteratorPrototype%":jo&&xe?xe([][Symbol.iterator]()):dt,"%AsyncFromSyncIteratorPrototype%":dt,"%AsyncFunction%":Xo,"%AsyncGenerator%":Xo,"%AsyncGeneratorFunction%":Xo,"%AsyncIteratorPrototype%":Xo,"%Atomics%":typeof Atomics>"u"?dt:Atomics,"%BigInt%":typeof BigInt>"u"?dt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?dt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?dt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?dt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":tG,"%eval%":eval,"%EvalError%":eG,"%Float16Array%":typeof Float16Array>"u"?dt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?dt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?dt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?dt:FinalizationRegistry,"%Function%":ER,"%GeneratorFunction%":Xo,"%Int8Array%":typeof Int8Array>"u"?dt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?dt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?dt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jo&&xe?xe(xe([][Symbol.iterator]())):dt,"%JSON%":typeof JSON=="object"?JSON:dt,"%Map%":typeof Map>"u"?dt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jo||!xe?dt:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J2,"%Object.getOwnPropertyDescriptor%":kl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?dt:Promise,"%Proxy%":typeof Proxy>"u"?dt:Proxy,"%RangeError%":rG,"%ReferenceError%":iG,"%Reflect%":typeof Reflect>"u"?dt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?dt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jo||!xe?dt:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?dt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jo&&xe?xe(""[Symbol.iterator]()):dt,"%Symbol%":jo?Symbol:dt,"%SyntaxError%":qo,"%ThrowTypeError%":fG,"%TypedArray%":gG,"%TypeError%":Yo,"%Uint8Array%":typeof Uint8Array>"u"?dt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?dt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?dt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?dt:Uint32Array,"%URIError%":sG,"%WeakMap%":typeof WeakMap>"u"?dt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?dt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?dt:WeakSet,"%Function.prototype.call%":Gl,"%Function.prototype.apply%":wR,"%Object.defineProperty%":dG,"%Object.getPrototypeOf%":pG,"%Math.abs%":oG,"%Math.floor%":nG,"%Math.max%":aG,"%Math.min%":lG,"%Math.pow%":hG,"%Math.round%":cG,"%Math.sign%":uG,"%Reflect.getPrototypeOf%":mG};if(xe)try{null.error}catch(r){vR=xe(xe(r)),xs["%Error.prototype%"]=vR}var vR,xG=function r(t){var e;if(t==="%AsyncFunction%")e=mx("async function () {}");else if(t==="%GeneratorFunction%")e=mx("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=mx("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&xe&&(e=xe(s.prototype))}return xs[t]=e,e},TR={__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"]},Ul=Fl(),ld=bR(),yG=Ul.call(Gl,Array.prototype.concat),_G=Ul.call(wR,Array.prototype.splice),SR=Ul.call(Gl,String.prototype.replace),hd=Ul.call(Gl,String.prototype.slice),bG=Ul.call(Gl,RegExp.prototype.exec),vG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,TG=/\\(\\)?/g,SG=function(t){var e=hd(t,0,1),i=hd(t,-1);if(e==="%"&&i!=="%")throw new qo("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new qo("invalid intrinsic syntax, expected opening `%`");var s=[];return SR(t,vG,function(o,n,a,l){s[s.length]=a?SR(l,TG,"$1"):n||o}),s},EG=function(t,e){var i=t,s;if(ld(TR,i)&&(s=TR[i],i="%"+s[0]+"%"),ld(xs,i)){var o=xs[i];if(o===Xo&&(o=xG(i)),typeof o>"u"&&!e)throw new Yo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new qo("intrinsic "+t+" does not exist!")};AR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Yo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Yo('"allowMissing" argument must be a boolean');if(bG(/^%?[^%]*%?$/,t)===null)throw new qo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=SG(t),s=i.length>0?i[0]:"",o=EG("%"+s+"%",e),n=o.name,a=o.value,l=!1,h=o.alias;h&&(s=h[0],_G(i,yG([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=hd(d,0,1),g=hd(d,-1);if((f==='"'||f==="'"||f==="`"||g==='"'||g==="'"||g==="`")&&f!==g)throw new qo("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",ld(xs,n))a=xs[n];else if(a!=null){if(!(d in a)){if(!e)throw new Yo("base intrinsic for "+t+" exists, but the property is not available.");return}if(kl&&c+1>=i.length){var m=kl(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=ld(a,d),a=a[d];u&&!l&&(xs[n]=a)}}return a}});var xx=Z((dut,RR)=>{"use strict";var PR=cd(),CR=fx(),wG=CR([PR("%String.prototype.indexOf%")]);RR.exports=function(t,e){var i=PR(t,!!e);return typeof i=="function"&&wG(t,".prototype.")>-1?CR([i]):i}});var yx=Z((fut,BR)=>{"use strict";var AG=cd(),Ol=xx(),PG=Il(),CG=ms(),MR=AG("%Map%",!0),RG=Ol("Map.prototype.get",!0),MG=Ol("Map.prototype.set",!0),BG=Ol("Map.prototype.has",!0),IG=Ol("Map.prototype.delete",!0),FG=Ol("Map.prototype.size",!0);BR.exports=!!MR&&function(){var t,e={assert:function(i){if(!e.has(i))throw new CG("Side channel does not contain "+PG(i))},delete:function(i){if(t){var s=IG(t,i);return FG(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return RG(t,i)},has:function(i){return t?BG(t,i):!1},set:function(i,s){t||(t=new MR),MG(t,i,s)}};return e}});var FR=Z((put,IR)=>{"use strict";var kG=cd(),dd=xx(),GG=Il(),ud=yx(),UG=ms(),Ko=kG("%WeakMap%",!0),OG=dd("WeakMap.prototype.get",!0),LG=dd("WeakMap.prototype.set",!0),DG=dd("WeakMap.prototype.has",!0),NG=dd("WeakMap.prototype.delete",!0);IR.exports=Ko?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new UG("Side channel does not contain "+GG(s))},delete:function(s){if(Ko&&s&&(typeof s=="object"||typeof s=="function")){if(t)return NG(t,s)}else if(ud&&e)return e.delete(s);return!1},get:function(s){return Ko&&s&&(typeof s=="object"||typeof s=="function")&&t?OG(t,s):e&&e.get(s)},has:function(s){return Ko&&s&&(typeof s=="object"||typeof s=="function")&&t?DG(t,s):!!e&&e.has(s)},set:function(s,o){Ko&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Ko),LG(t,s,o)):ud&&(e||(e=ud()),e.set(s,o))}};return i}:ud});var GR=Z((mut,kR)=>{"use strict";var HG=ms(),VG=Il(),WG=hC(),zG=yx(),$G=FR(),jG=$G||zG||WG;kR.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new HG("Side channel does not contain "+VG(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=jG()),t.set(i,s)}};return e}});var fd=Z((gut,UR)=>{"use strict";var XG=String.prototype.replace,YG=/%20/g,_x={RFC1738:"RFC1738",RFC3986:"RFC3986"};UR.exports={default:_x.RFC3986,formatters:{RFC1738:function(r){return XG.call(r,YG,"+")},RFC3986:function(r){return String(r)}},RFC1738:_x.RFC1738,RFC3986:_x.RFC3986}});var Tx=Z((xut,LR)=>{"use strict";var qG=fd(),bx=Object.prototype.hasOwnProperty,ys=Array.isArray,$r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),KG=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(ys(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},OR=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},ZG=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ys(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!bx.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return ys(t)&&!ys(e)&&(s=OR(t,i)),ys(t)&&ys(e)?(e.forEach(function(o,n){if(bx.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return bx.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},QG=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},JG=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},vx=1024,tU=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=vx){for(var h=n.length>=vx?n.slice(l,l+vx):n,c=[],u=0;u<h.length;++u){var d=h.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===qG.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=$r[d];continue}if(d<2048){c[c.length]=$r[192|d>>6]+$r[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=$r[224|d>>12]+$r[128|d>>6&63]+$r[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=$r[240|d>>18]+$r[128|d>>12&63]+$r[128|d>>6&63]+$r[128|d&63]}a+=c.join("")}return a},eU=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var h=a[l],c=n[h];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:n,prop:h}),i.push(c))}return KG(e),t},rU=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},iU=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},sU=function(t,e){return[].concat(t,e)},oU=function(t,e){if(ys(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};LR.exports={arrayToObject:OR,assign:QG,combine:sU,compact:eU,decode:JG,encode:tU,isBuffer:iU,isRegExp:rU,maybeMap:oU,merge:ZG}});var zR=Z((yut,WR)=>{"use strict";var NR=GR(),pd=Tx(),Ll=fd(),nU=Object.prototype.hasOwnProperty,HR={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},jr=Array.isArray,aU=Array.prototype.push,VR=function(r,t){aU.apply(r,jr(t)?t:[t])},lU=Date.prototype.toISOString,DR=Ll.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:pd.encode,encodeValuesOnly:!1,filter:void 0,format:DR,formatter:Ll.formatters[DR],indices:!1,serializeDate:function(t){return lU.call(t)},skipNulls:!1,strictNullHandling:!1},hU=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Sx={},cU=function r(t,e,i,s,o,n,a,l,h,c,u,d,f,g,m,p,_,y){for(var v=t,b=y,E=0,A=!1;(b=b.get(Sx))!==void 0&&!A;){var S=b.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");A=!0}typeof b.get(Sx)>"u"&&(E=0)}if(typeof c=="function"?v=c(e,v):v instanceof Date?v=f(v):i==="comma"&&jr(v)&&(v=pd.maybeMap(v,function(z){return z instanceof Date?f(z):z})),v===null){if(n)return h&&!p?h(e,ue.encoder,_,"key",g):e;v=""}if(hU(v)||pd.isBuffer(v)){if(h){var w=p?e:h(e,ue.encoder,_,"key",g);return[m(w)+"="+m(h(v,ue.encoder,_,"value",g))]}return[m(e)+"="+m(String(v))]}var P=[];if(typeof v>"u")return P;var C;if(i==="comma"&&jr(v))p&&h&&(v=pd.maybeMap(v,h)),C=[{value:v.length>0?v.join(",")||null:void 0}];else if(jr(c))C=c;else{var M=Object.keys(v);C=u?M.sort(u):M}var I=l?String(e).replace(/\./g,"%2E"):String(e),k=s&&jr(v)&&v.length===1?I+"[]":I;if(o&&jr(v)&&v.length===0)return k+"[]";for(var G=0;G<C.length;++G){var ut=C[G],H=typeof ut=="object"&&ut&&typeof ut.value<"u"?ut.value:v[ut];if(!(a&&H===null)){var K=d&&l?String(ut).replace(/\./g,"%2E"):String(ut),W=jr(v)?typeof i=="function"?i(k,K):k:k+(d?"."+K:"["+K+"]");y.set(t,E);var L=NR();L.set(Sx,y),VR(P,r(H,W,i,s,o,n,a,l,i==="comma"&&p&&jr(v)?null:h,c,u,d,f,g,m,p,_,L))}}return P},uU=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Ll.default;if(typeof t.format<"u"){if(!nU.call(Ll.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Ll.formatters[i],o=ue.filter;(typeof t.filter=="function"||jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in HR?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}};WR.exports=function(r,t){var e=r,i=uU(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=HR[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=NR(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||VR(n,cU(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=n.join(i.delimiter),g=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),f.length>0?g+f:""}});var YR=Z((_ut,XR)=>{"use strict";var _s=Tx(),Ex=Object.prototype.hasOwnProperty,$R=Array.isArray,Yt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:_s.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},dU=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},jR=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},fU="utf8=%26%2310003%3B",pU="utf8=%E2%9C%93",mU=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===pU?h="utf-8":n[l]===fU&&(h="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var c=n[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,g;d===-1?(f=e.decoder(c,Yt.decoder,h,"key"),g=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Yt.decoder,h,"key"),g=_s.maybeMap(jR(c.slice(d+1),e,$R(i[f])?i[f].length:0),function(p){return e.decoder(p,Yt.decoder,h,"value")})),g&&e.interpretNumericEntities&&h==="iso-8859-1"&&(g=dU(String(g))),c.indexOf("[]=")>-1&&(g=$R(g)?[g]:g);var m=Ex.call(i,f);m&&e.duplicates==="combine"?i[f]=_s.combine(i[f],g):(!m||e.duplicates==="last")&&(i[f]=g)}return i},gU=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:jR(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:_s.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var c=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&h!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},xU=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),h=l?o.slice(0,l.index):o,c=[];if(h){if(!i.plainObjects&&Ex.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&Ex.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(l.index)+"]")}return gU(c,e,i,s)}},yU=function(t){if(!t)return Yt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Yt.charset:t.charset,i=typeof t.duplicates>"u"?Yt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Yt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Yt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Yt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Yt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Yt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Yt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Yt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Yt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Yt.decoder,delimiter:typeof t.delimiter=="string"||_s.isRegExp(t.delimiter)?t.delimiter:Yt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Yt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Yt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Yt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Yt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Yt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Yt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};XR.exports=function(r,t){var e=yU(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?mU(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=xU(a,i[a],e,typeof r=="string");s=_s.merge(s,l,e)}return e.allowSparse===!0?s:_s.compact(s)}});var KR=Z((but,qR)=>{"use strict";var _U=zR(),bU=YR(),vU=fd();qR.exports={formats:vU,parse:bU,stringify:_U}});var tM=Z(Qo=>{"use strict";var TU=DP();function pr(){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 SU=/^([a-z0-9.+-]+:)/i,EU=/:[0-9]*$/,wU=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,AU=["<",">",'"',"`"," ","\r",`
|
|
1093
|
-
`," "],PU=["{","}","|","\\","^","`"].concat(AU),wx=["'"].concat(PU),ZR=["%","/","?",";","#"].concat(wx),QR=["/","?","#"],CU=255,JR=/^[+a-z0-9A-Z_-]{0,63}$/,RU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,MU={javascript:!0,"javascript:":!0},Ax={javascript:!0,"javascript:":!0},Zo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Px=KR();function Dl(r,t,e){if(r&&typeof r=="object"&&r instanceof pr)return r;var i=new pr;return i.parse(r,t,e),i}pr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=wU.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=Px.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=SU.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&Ax[h])&&(a=a.substr(2),this.slashes=!0)}if(!Ax[h]&&(u||h&&!Zo[h])){for(var d=-1,f=0;f<QR.length;f++){var g=a.indexOf(QR[f]);g!==-1&&(d===-1||g<d)&&(d=g)}var m,p;d===-1?p=a.lastIndexOf("@"):p=a.lastIndexOf("@",d),p!==-1&&(m=a.slice(0,p),a=a.slice(p+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<ZR.length;f++){var g=a.indexOf(ZR[f]);g!==-1&&(d===-1||g<d)&&(d=g)}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 y=this.hostname.split(/\./),f=0,v=y.length;f<v;f++){var b=y[f];if(b&&!b.match(JR)){for(var E="",A=0,S=b.length;A<S;A++)b.charCodeAt(A)>127?E+="x":E+=b[A];if(!E.match(JR)){var w=y.slice(0,f),P=y.slice(f+1),C=b.match(RU);C&&(w.push(C[1]),P.unshift(C[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=w.join(".");break}}}this.hostname.length>CU?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=TU.toASCII(this.hostname));var M=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+M,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!MU[c])for(var f=0,v=wx.length;f<v;f++){var k=wx[f];if(a.indexOf(k)!==-1){var G=encodeURIComponent(k);G===k&&(G=escape(k)),a=a.split(k).join(G)}}var ut=a.indexOf("#");ut!==-1&&(this.hash=a.substr(ut),a=a.slice(0,ut));var H=a.indexOf("?");if(H!==-1?(this.search=a.substr(H),this.query=a.substr(H+1),t&&(this.query=Px.parse(this.query)),a=a.slice(0,H)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Zo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",K=this.search||"";this.path=M+K}return this.href=this.format(),this};function BU(r){return typeof r=="string"&&(r=Dl(r)),r instanceof pr?r.format():pr.prototype.format.call(r)}pr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Px.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Zo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function IU(r,t){return Dl(r,!1,!0).resolve(t)}pr.prototype.resolve=function(r){return this.resolveObject(Dl(r,!1,!0)).format()};function FU(r,t){return r?Dl(r,!1,!0).resolveObject(t):t}pr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new pr;t.parse(r,!1,!0),r=t}for(var e=new pr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return Zo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Zo[r.protocol]){for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Ax[r.protocol]){for(var v=(r.pathname||"").split("/");v.length&&!(r.host=v.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),v[0]!==""&&v.unshift(""),v.length<2&&v.unshift(""),e.pathname=v.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var g=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",p=m||g||e.host&&r.pathname,_=p,y=e.pathname&&e.pathname.split("/")||[],v=r.pathname&&r.pathname.split("/")||[],b=e.protocol&&!Zo[e.protocol];if(b&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(v[0]===""?v[0]=r.host:v.unshift(r.host)),r.host=null),p=p&&(v[0]===""||y[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,y=v;else if(v.length)y||(y=[]),y.pop(),y=y.concat(v),e.search=r.search,e.query=r.query;else if(r.search!=null){if(b){e.host=y.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var A=y.slice(-1)[0],S=(e.host||r.host||y.length>1)&&(A==="."||A==="..")||A==="",w=0,P=y.length;P>=0;P--)A=y[P],A==="."?y.splice(P,1):A===".."?(y.splice(P,1),w++):w&&(y.splice(P,1),w--);if(!p&&!_)for(;w--;w)y.unshift("..");p&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),S&&y.join("/").substr(-1)!=="/"&&y.push("");var C=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(b){e.hostname=C?"":y.length?y.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return p=p||e.host&&y.length,p&&!C&&y.unshift(""),y.length>0?e.pathname=y.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};pr.prototype.parseHost=function(){var r=this.host,t=EU.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};Qo.parse=Dl;Qo.resolve=IU;Qo.resolveObject=FU;Qo.format=BU;Qo.Url=pr});var cB=()=>{let r=new Map;return{load:async n=>{let a=[];for(let[l,h]of Object.entries(n))r.has(l)||a.push([l,h]);a.length>0&&await Promise.all(a.map(async([l,h])=>{let d={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type};r.set(l,d)}))},getBufferMap:()=>{let n={};for(let[a,l]of r.entries())n[a]=l;return n},clear:()=>r.clear(),size:()=>r.size,has:n=>r.has(n)}};B();var $S={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(zS(),yF))}};B();var XS={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(jS(),_F))}};B();B();Jh();Xh();B();Mt();_a();var Xc;function eE(r){return Xc!==void 0||(Xc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??ki.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Xc}Mt();var Yc;async function rE(r={}){return Yc!==void 0||(Yc=await(async()=>{let t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Yc}_a();var m1=["webgl","webgpu","canvas"];async function g1(r){let t=[];r.preference?(t.push(r.preference),m1.forEach(o=>{o!==r.preference&&t.push(o)})):t=m1.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await rE()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Vw(),Hw));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&eE(r.failIfMajorPerformanceCaveat??ki.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(p1(),f1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}yr();Dm();Vt();var x1=class Pg{constructor(...t){this.stage=new yt,t[0]!==void 0&&$(J,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await g1(t),Pg._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return $(J,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=Pg._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};x1._plugins=[];var pl=x1;U.handleByList(T.Application,pl._plugins);U.add(Ra);B();ii();Nf();Mt();B();ts();ne();bt();mm();bm();var ml=class extends _o{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],h=new et(n.x+a.x,n.y+a.y,n.width,n.height),c=new R({source:l,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ua.install(t)}static uninstall(t){ua.uninstall(t)}};var bu={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),g={};for(let m in f){let p=f[m].split("="),_=p[0],y=p[1].replace(/"/gm,""),v=parseFloat(y),b=isNaN(v)?y:v;g[_]=b}e[d].push(g)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let h=e.char;for(let u=0;u<h.length;u++){let d=h[u],f=parseInt(d.id,10),g=d.letter??d.char??String.fromCharCode(f);g==="space"&&(g=" "),l[f]=g,i.chars[g]={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 c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),g=parseInt(c[u].amount,10);i.chars[l[f]].kerning[l[d]]=g}return i}};Mt();var Cg={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)t.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let h=0;h<n.length;h++){let c=n[h],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<a.length;h++){let c=parseInt(a[h].getAttribute("first"),10),u=parseInt(a[h].getAttribute("second"),10),d=parseInt(a[h].getAttribute("amount"),10);t.chars[l[u]].kerning[l[c]]=d}return t}};var Rg={test(r){return typeof r=="string"&&r.includes("<font>")?Cg.test(j.get().parseXML(r)):!1},parse(r){return Cg.parse(j.get().parseXML(r))}};var JF=[".xml",".fnt"],y1={extension:{type:T.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ml,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},_1={extension:{type:T.LoadParser,priority:pe.Normal},name:"loadBitmapFont",test(r){return JF.includes(le.extname(r).toLowerCase())},async testParse(r){return bu.test(r)||Rg.test(r)},async parse(r,t,e){let i=bu.test(r)?bu.parse(r):Rg.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=le.join(le.dirname(s),d);f=Ln(f,s),n.push({src:f,data:a})}let l=await e.load(n),h=n.map(u=>l[u.src]);return new ml({data:i,textures:h},s)},async load(r,t){return await(await j.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};At();var vu=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ai();B();bt();var b1={extension:{type:T.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof R),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};B();async function Tu(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var v1={extension:{type:T.DetectionParser,priority:1},test:async()=>Tu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};B();var T1=["png","jpg","jpeg"],S1={extension:{type:T.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...T1],remove:async r=>r.filter(t=>!T1.includes(t))};B();var tk="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Fo(r){return tk?!1:document.createElement("video").canPlayType(r)!==""}var E1={extension:{type:T.DetectionParser,priority:0},test:async()=>Fo("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};B();var w1={extension:{type:T.DetectionParser,priority:0},test:async()=>Fo("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};B();var A1={extension:{type:T.DetectionParser,priority:0},test:async()=>Fo("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};B();var P1={extension:{type:T.DetectionParser,priority:0},test:async()=>Tu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};At();ts();On();jh();var Su=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||D(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return D(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=es(t),n=Ie(t,h=>({alias:[h],src:h,data:{}})),a=n.length,l=n.map(async h=>{let c=le.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
-
${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=
|
|
1089
|
+
`))}var i1=x(()=>{lu();ke();xg();e1()});var gl,s1=x(()=>{B();i1();gl=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return r1(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};gl.extension={type:[T.WebGLSystem],name:"uniformGroup"}});function o1(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof X.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var n1=x(()=>{Ft()});var bk,vk,Tk,Sk,wk,Ek,a1,l1,h1=x(()=>{B();Tr();n1();bk=0,vk=1,Tk=2,Sk=3,wk=4,Ek=5,a1=class Lg{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[bk]=this.setBlend,this.map[vk]=this.setOffset,this.map[Tk]=this.setCullFace,this.map[Sk]=this.setDepthTest,this.map[wk]=this.setFrontFace,this.map[Ek]=this.setDepthMask,this.checks=[],this.defaultState=Zt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=o1(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Lg._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Lg._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};a1.extension={type:[T.WebGLSystem],name:"state"};l1=a1});var Su,c1=x(()=>{Rg();Su=class{constructor(t){this.target=Cg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=xt.UNSIGNED_BYTE,this.internalFormat=gu.RGBA,this.format=gu.RGBA,this.samplerType=0}}});var u1,d1=x(()=>{"use strict";u1={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var Ak,f1,p1=x(()=>{"use strict";Ak={"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},f1={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!Ak[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var wu,Dg=x(()=>{"use strict";wu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,h=r.resourceHeight;l<n||h<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var m1,g1=x(()=>{Dg();m1={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}wu.upload(r,t,e,i)}}});var Ng,x1,Eu,y1,_1=x(()=>{"use strict";Ng={linear:9729,nearest:9728},x1={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Eu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},y1={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Hg(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let h=Eu[n?"clamp-to-edge":r.addressModeU],c=Eu[n?"clamp-to-edge":r.addressModeV],u=Eu[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,h),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Ng[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let h=x1[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,h)}}else t[s](l,t.TEXTURE_MIN_FILTER,Ng[r.minFilter]);if(i&&r.maxAnisotropy>1){let h=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,y1[r.compare])}var b1=x(()=>{_1()});function v1(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 T1=x(()=>{"use strict"});function S1(r,t){let e={},i=r.RGBA;return r instanceof X.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var w1=x(()=>{Ft()});function E1(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 A1=x(()=>{"use strict"});var Pk,xl,P1=x(()=>{Ft();B();_t();c1();d1();p1();Dg();g1();b1();T1();w1();A1();Pk=4,xl=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:wu,buffer:u1,video:m1,compressed:f1},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=S1(t,this._renderer.context.extensions),this._mapFormatToType=E1(t),this._mapFormatToFormat=v1(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(R.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=R.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new Su(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Hg(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Hg(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:s}=this.getPixels(t),o=X.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(Pk*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),h=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,h.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(R.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};xl.extension={type:[T.WebGLSystem],name:"texture"}});var I1={};Oy(I1,{WebGLRenderer:()=>Vg});var Ck,Rk,Mk,C1,R1,M1,Vg,B1=x(()=>{B();aA();lA();hA();Sa();pg();Nr();dA();mA();_A();TA();SA();wA();EA();IA();kA();QA();s1();h1();P1();Ck=[...ou,fl,vA,pA,ll,xl,pl,hl,gl,ml,ul,l1,dl,cl],Rk=[...nu],Mk=[nl,ol,sl],C1=[],R1=[],M1=[];U.handleByNamedList(T.WebGLSystem,C1);U.handleByNamedList(T.WebGLPipes,R1);U.handleByNamedList(T.WebGLPipesAdaptor,M1);U.add(...Ck,...Rk,...Mk);Vg=class extends Ui{constructor(){let t={name:"webgl",type:re.WEBGL,systems:C1,renderPipes:R1,renderPipeAdaptors:M1};super(t)}}});var lC=Q((hdt,fx)=>{"use strict";var z2=Object.prototype.hasOwnProperty,De="~";function kl(){}Object.create&&(kl.prototype=Object.create(null),new kl().__proto__||(De=!1));function $2(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function aC(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new $2(e,i||r,s),n=De?De+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function fd(r,t){--r._eventsCount===0?r._events=new kl:delete r._events[t]}function Re(){this._events=new kl,this._eventsCount=0}Re.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)z2.call(e,i)&&t.push(De?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Re.prototype.listeners=function(t){var e=De?De+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Re.prototype.listenerCount=function(t){var e=De?De+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Re.prototype.emit=function(t,e,i,s,o,n){var a=De?De+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Re.prototype.on=function(t,e,i){return aC(this,t,e,i,!1)};Re.prototype.once=function(t,e,i){return aC(this,t,e,i,!0)};Re.prototype.removeListener=function(t,e,i,s){var o=De?De+t:t;if(!this._events[o])return this;if(!e)return fd(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&fd(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:fd(this,o)}return this};Re.prototype.removeAllListeners=function(t){var e;return t?(e=De?De+t:t,this._events[e]&&fd(this,e)):(this._events=new kl,this._eventsCount=0),this};Re.prototype.off=Re.prototype.removeListener;Re.prototype.addListener=Re.prototype.on;Re.prefixed=De;Re.EventEmitter=Re;typeof fx<"u"&&(fx.exports=Re)});var hC=Q((jo,Yo)=>{(function(r){var t=typeof jo=="object"&&jo&&!jo.nodeType&&jo,e=typeof Yo=="object"&&Yo&&!Yo.nodeType&&Yo,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,h=38,c=700,u=72,d=128,f="-",m=/^xn--/,g=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,_=Math.floor,w=String.fromCharCode,E;function b(V){throw new RangeError(v[V])}function S(V,O){for(var W=V.length,st=[];W--;)st[W]=O(V[W]);return st}function P(V,O){var W=V.split("@"),st="";W.length>1&&(st=W[0]+"@",V=W[1]),V=V.replace(p,".");var lt=V.split("."),vt=S(lt,O).join(".");return st+vt}function A(V){for(var O=[],W=0,st=V.length,lt,vt;W<st;)lt=V.charCodeAt(W++),lt>=55296&<<=56319&&W<st?(vt=V.charCodeAt(W++),(vt&64512)==56320?O.push(((lt&1023)<<10)+(vt&1023)+65536):(O.push(lt),W--)):O.push(lt);return O}function C(V){return S(V,function(O){var W="";return O>65535&&(O-=65536,W+=w(O>>>10&1023|55296),O=56320|O&1023),W+=w(O),W}).join("")}function M(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:n}function I(V,O){return V+22+75*(V<26)-((O!=0)<<5)}function k(V,O,W){var st=0;for(V=W?_(V/c):V>>1,V+=_(V/O);V>y*l>>1;st+=n)V=_(V/y);return _(st+(y+1)*V/(V+h))}function G(V){var O=[],W=V.length,st,lt=0,vt=d,Lt=u,Vt,te,Tt,It,pt,Bt,ne,Kt,pe;for(Vt=V.lastIndexOf(f),Vt<0&&(Vt=0),te=0;te<Vt;++te)V.charCodeAt(te)>=128&&b("not-basic"),O.push(V.charCodeAt(te));for(Tt=Vt>0?Vt+1:0;Tt<W;){for(It=lt,pt=1,Bt=n;Tt>=W&&b("invalid-input"),ne=M(V.charCodeAt(Tt++)),(ne>=n||ne>_((o-lt)/pt))&&b("overflow"),lt+=ne*pt,Kt=Bt<=Lt?a:Bt>=Lt+l?l:Bt-Lt,!(ne<Kt);Bt+=n)pe=n-Kt,pt>_(o/pe)&&b("overflow"),pt*=pe;st=O.length+1,Lt=k(lt-It,st,It==0),_(lt/st)>o-vt&&b("overflow"),vt+=_(lt/st),lt%=st,O.splice(lt++,0,vt)}return C(O)}function J(V){var O,W,st,lt,vt,Lt,Vt,te,Tt,It,pt,Bt=[],ne,Kt,pe,yr;for(V=A(V),ne=V.length,O=d,W=0,vt=u,Lt=0;Lt<ne;++Lt)pt=V[Lt],pt<128&&Bt.push(w(pt));for(st=lt=Bt.length,lt&&Bt.push(f);st<ne;){for(Vt=o,Lt=0;Lt<ne;++Lt)pt=V[Lt],pt>=O&&pt<Vt&&(Vt=pt);for(Kt=st+1,Vt-O>_((o-W)/Kt)&&b("overflow"),W+=(Vt-O)*Kt,O=Vt,Lt=0;Lt<ne;++Lt)if(pt=V[Lt],pt<O&&++W>o&&b("overflow"),pt==O){for(te=W,Tt=n;It=Tt<=vt?a:Tt>=vt+l?l:Tt-vt,!(te<It);Tt+=n)yr=te-It,pe=n-It,Bt.push(w(I(It+yr%pe,0))),te=_(yr/pe);Bt.push(w(I(te,0))),vt=k(W,Kt,st==lt),W=0,++st}++W,++O}return Bt.join("")}function H(V){return P(V,function(O){return m.test(O)?G(O.slice(4).toLowerCase()):O})}function j(V){return P(V,function(O){return g.test(O)?"xn--"+J(O):O})}if(s={version:"1.4.1",ucs2:{decode:A,encode:C},decode:G,encode:J,toASCII:j,toUnicode:H},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Yo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(jo)});var ys=Q((cdt,cC)=>{"use strict";cC.exports=TypeError});var uC=Q(()=>{});var Dl=Q((fdt,IC)=>{var Sx=typeof Map=="function"&&Map.prototype,px=Object.getOwnPropertyDescriptor&&Sx?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,md=Sx&&px&&typeof px.get=="function"?px.get:null,dC=Sx&&Map.prototype.forEach,wx=typeof Set=="function"&&Set.prototype,mx=Object.getOwnPropertyDescriptor&&wx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,gd=wx&&mx&&typeof mx.get=="function"?mx.get:null,fC=wx&&Set.prototype.forEach,X2=typeof WeakMap=="function"&&WeakMap.prototype,Ul=X2?WeakMap.prototype.has:null,j2=typeof WeakSet=="function"&&WeakSet.prototype,Ol=j2?WeakSet.prototype.has:null,Y2=typeof WeakRef=="function"&&WeakRef.prototype,pC=Y2?WeakRef.prototype.deref:null,q2=Boolean.prototype.valueOf,K2=Object.prototype.toString,Z2=Function.prototype.toString,Q2=String.prototype.match,Ex=String.prototype.slice,Hi=String.prototype.replace,J2=String.prototype.toUpperCase,mC=String.prototype.toLowerCase,wC=RegExp.prototype.test,gC=Array.prototype.concat,$r=Array.prototype.join,tG=Array.prototype.slice,xC=Math.floor,yx=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gx=Object.getOwnPropertySymbols,_x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ll=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qo||!0)?Symbol.toStringTag:null,EC=Object.prototype.propertyIsEnumerable,yC=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function _C(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||wC.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-xC(-r):xC(r);if(i!==r){var s=String(i),o=Ex.call(t,s.length+1);return Hi.call(s,e,"$&_")+"."+Hi.call(Hi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Hi.call(t,e,"$&_")}var bx=uC(),bC=bx.custom,vC=CC(bC)?bC:null,AC={__proto__:null,double:'"',single:"'"},eG={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};IC.exports=function r(t,e,i,s){var o=e||{};if(fi(o,"quoteStyle")&&!fi(AC,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fi(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=fi(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(fi(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(fi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return MC(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?_C(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?_C(t,h):h}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return vx(t)?"[Array]":"[Object]";var u=_G(o,i);if(typeof s>"u")s=[];else if(RC(s,t)>=0)return"[Circular]";function d(k,G,J){if(G&&(s=tG.call(s),s.push(G)),J){var H={depth:o.depth};return fi(o,"quoteStyle")&&(H.quoteStyle=o.quoteStyle),r(k,H,i+1,s)}return r(k,o,i+1,s)}if(typeof t=="function"&&!TC(t)){var f=cG(t),m=pd(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+$r.call(m,", ")+" }":"")}if(CC(t)){var g=qo?Hi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):_x.call(t);return typeof t=="object"&&!qo?Gl(g):g}if(gG(t)){for(var p="<"+mC.call(String(t.nodeName)),v=t.attributes||[],y=0;y<v.length;y++)p+=" "+v[y].name+"="+PC(rG(v[y].value),"double",o);return p+=">",t.childNodes&&t.childNodes.length&&(p+="..."),p+="</"+mC.call(String(t.nodeName))+">",p}if(vx(t)){if(t.length===0)return"[]";var _=pd(t,d);return u&&!yG(_)?"["+Tx(_,u)+"]":"[ "+$r.call(_,", ")+" ]"}if(sG(t)){var w=pd(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!EC.call(t,"cause")?"{ ["+String(t)+"] "+$r.call(gC.call("[cause]: "+d(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$r.call(w,", ")+" }"}if(typeof t=="object"&&n){if(vC&&typeof t[vC]=="function"&&bx)return bx(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(uG(t)){var E=[];return dC&&dC.call(t,function(k,G){E.push(d(G,t,!0)+" => "+d(k,t))}),SC("Map",md.call(t),E,u)}if(pG(t)){var b=[];return fC&&fC.call(t,function(k){b.push(d(k,t))}),SC("Set",gd.call(t),b,u)}if(dG(t))return xx("WeakMap");if(mG(t))return xx("WeakSet");if(fG(t))return xx("WeakRef");if(nG(t))return Gl(d(Number(t)));if(lG(t))return Gl(d(yx.call(t)));if(aG(t))return Gl(q2.call(t));if(oG(t))return Gl(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!iG(t)&&!TC(t)){var S=pd(t,d),P=yC?yC(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",C=!P&&Ll&&Object(t)===t&&Ll in t?Ex.call(Vi(t),8,-1):A?"Object":"",M=P||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=M+(C||A?"["+$r.call(gC.call([],C||[],A||[]),": ")+"] ":"");return S.length===0?I+"{}":u?I+"{"+Tx(S,u)+"}":I+"{ "+$r.call(S,", ")+" }"}return String(t)};function PC(r,t,e){var i=e.quoteStyle||t,s=AC[i];return s+r+s}function rG(r){return Hi.call(String(r),/"/g,""")}function _s(r){return!Ll||!(typeof r=="object"&&(Ll in r||typeof r[Ll]<"u"))}function vx(r){return Vi(r)==="[object Array]"&&_s(r)}function iG(r){return Vi(r)==="[object Date]"&&_s(r)}function TC(r){return Vi(r)==="[object RegExp]"&&_s(r)}function sG(r){return Vi(r)==="[object Error]"&&_s(r)}function oG(r){return Vi(r)==="[object String]"&&_s(r)}function nG(r){return Vi(r)==="[object Number]"&&_s(r)}function aG(r){return Vi(r)==="[object Boolean]"&&_s(r)}function CC(r){if(qo)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!_x)return!1;try{return _x.call(r),!0}catch{}return!1}function lG(r){if(!r||typeof r!="object"||!yx)return!1;try{return yx.call(r),!0}catch{}return!1}var hG=Object.prototype.hasOwnProperty||function(r){return r in this};function fi(r,t){return hG.call(r,t)}function Vi(r){return K2.call(r)}function cG(r){if(r.name)return r.name;var t=Q2.call(Z2.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function RC(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function uG(r){if(!md||!r||typeof r!="object")return!1;try{md.call(r);try{gd.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function dG(r){if(!Ul||!r||typeof r!="object")return!1;try{Ul.call(r,Ul);try{Ol.call(r,Ol)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function fG(r){if(!pC||!r||typeof r!="object")return!1;try{return pC.call(r),!0}catch{}return!1}function pG(r){if(!gd||!r||typeof r!="object")return!1;try{gd.call(r);try{md.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function mG(r){if(!Ol||!r||typeof r!="object")return!1;try{Ol.call(r,Ol);try{Ul.call(r,Ul)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function gG(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function MC(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return MC(Ex.call(r,0,t.maxStringLength),t)+i}var s=eG[t.quoteStyle||"single"];s.lastIndex=0;var o=Hi.call(Hi.call(r,s,"\\$1"),/[\x00-\x1f]/g,xG);return PC(o,"single",t)}function xG(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+J2.call(t.toString(16))}function Gl(r){return"Object("+r+")"}function xx(r){return r+" { ? }"}function SC(r,t,e,i){var s=i?Tx(e,i):$r.call(e,", ");return r+" ("+t+") {"+s+"}"}function yG(r){for(var t=0;t<r.length;t++)if(RC(r[t],`
|
|
1090
|
+
`)>=0)return!1;return!0}function _G(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=$r.call(Array(r.indent+1)," ");else return null;return{base:e,prev:$r.call(Array(t+1),e)}}function Tx(r,t){if(r.length===0)return"";var e=`
|
|
1091
|
+
`+t.prev+t.base;return e+$r.call(r,","+e)+`
|
|
1092
|
+
`+t.prev}function pd(r,t){var e=vx(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=fi(r,s)?t(r[s],r):""}var o=typeof gx=="function"?gx(r):[],n;if(qo){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)fi(r,l)&&(e&&String(Number(l))===l&&l<r.length||qo&&n["$"+l]instanceof Symbol||(wC.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof gx=="function")for(var h=0;h<o.length;h++)EC.call(r,o[h])&&i.push("["+t(o[h])+"]: "+t(r[o[h]],r));return i}});var FC=Q((pdt,BC)=>{"use strict";var bG=Dl(),vG=ys(),xd=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},TG=function(r,t){if(r){var e=xd(r,t);return e&&e.value}},SG=function(r,t,e){var i=xd(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},wG=function(r,t){return r?!!xd(r,t):!1},EG=function(r,t){if(r)return xd(r,t,!0)};BC.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new vG("Side channel does not contain "+bG(i))},delete:function(i){var s=t&&t.next,o=EG(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return TG(t,i)},has:function(i){return wG(t,i)},set:function(i,s){t||(t={next:void 0}),SG(t,i,s)}};return e}});var Ax=Q((mdt,kC)=>{"use strict";kC.exports=Object});var UC=Q((gdt,GC)=>{"use strict";GC.exports=Error});var LC=Q((xdt,OC)=>{"use strict";OC.exports=EvalError});var NC=Q((ydt,DC)=>{"use strict";DC.exports=RangeError});var VC=Q((_dt,HC)=>{"use strict";HC.exports=ReferenceError});var zC=Q((bdt,WC)=>{"use strict";WC.exports=SyntaxError});var XC=Q((vdt,$C)=>{"use strict";$C.exports=URIError});var YC=Q((Tdt,jC)=>{"use strict";jC.exports=Math.abs});var KC=Q((Sdt,qC)=>{"use strict";qC.exports=Math.floor});var QC=Q((wdt,ZC)=>{"use strict";ZC.exports=Math.max});var tR=Q((Edt,JC)=>{"use strict";JC.exports=Math.min});var rR=Q((Adt,eR)=>{"use strict";eR.exports=Math.pow});var sR=Q((Pdt,iR)=>{"use strict";iR.exports=Math.round});var nR=Q((Cdt,oR)=>{"use strict";oR.exports=Number.isNaN||function(t){return t!==t}});var lR=Q((Rdt,aR)=>{"use strict";var AG=nR();aR.exports=function(t){return AG(t)||t===0?t:t<0?-1:1}});var cR=Q((Mdt,hR)=>{"use strict";hR.exports=Object.getOwnPropertyDescriptor});var Px=Q((Idt,uR)=>{"use strict";var yd=cR();if(yd)try{yd([],"length")}catch{yd=null}uR.exports=yd});var fR=Q((Bdt,dR)=>{"use strict";var _d=Object.defineProperty||!1;if(_d)try{_d({},"a",{value:1})}catch{_d=!1}dR.exports=_d});var mR=Q((Fdt,pR)=>{"use strict";pR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var yR=Q((kdt,xR)=>{"use strict";var gR=typeof Symbol<"u"&&Symbol,PG=mR();xR.exports=function(){return typeof gR!="function"||typeof Symbol!="function"||typeof gR("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:PG()}});var Cx=Q((Gdt,_R)=>{"use strict";_R.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Rx=Q((Udt,bR)=>{"use strict";var CG=Ax();bR.exports=CG.getPrototypeOf||null});var SR=Q((Odt,TR)=>{"use strict";var RG="Function.prototype.bind called on incompatible ",MG=Object.prototype.toString,IG=Math.max,BG="[object Function]",vR=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},FG=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},kG=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};TR.exports=function(t){var e=this;if(typeof e!="function"||MG.apply(e)!==BG)throw new TypeError(RG+e);for(var i=FG(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,vR(i,arguments));return Object(c)===c?c:this}return e.apply(t,vR(i,arguments))},n=IG(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+kG(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s}});var Nl=Q((Ldt,wR)=>{"use strict";var GG=SR();wR.exports=Function.prototype.bind||GG});var bd=Q((Ddt,ER)=>{"use strict";ER.exports=Function.prototype.call});var Mx=Q((Ndt,AR)=>{"use strict";AR.exports=Function.prototype.apply});var CR=Q((Hdt,PR)=>{"use strict";PR.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var MR=Q((Vdt,RR)=>{"use strict";var UG=Nl(),OG=Mx(),LG=bd(),DG=CR();RR.exports=DG||UG.call(LG,OG)});var Ix=Q((Wdt,IR)=>{"use strict";var NG=Nl(),HG=ys(),VG=bd(),WG=MR();IR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new HG("a function is required");return WG(NG,VG,t)}});var OR=Q((zdt,UR)=>{"use strict";var zG=Ix(),BR=Px(),kR;try{kR=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Bx=!!kR&&BR&&BR(Object.prototype,"__proto__"),GR=Object,FR=GR.getPrototypeOf;UR.exports=Bx&&typeof Bx.get=="function"?zG([Bx.get]):typeof FR=="function"?function(t){return FR(t==null?t:GR(t))}:!1});var VR=Q(($dt,HR)=>{"use strict";var LR=Cx(),DR=Rx(),NR=OR();HR.exports=LR?function(t){return LR(t)}:DR?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return DR(t)}:NR?function(t){return NR(t)}:null});var zR=Q((Xdt,WR)=>{"use strict";var $G=Function.prototype.call,XG=Object.prototype.hasOwnProperty,jG=Nl();WR.exports=jG.call($G,XG)});var Sd=Q((jdt,KR)=>{"use strict";var ft,YG=Ax(),qG=UC(),KG=LC(),ZG=NC(),QG=VC(),Jo=zC(),Qo=ys(),JG=XC(),tU=YC(),eU=KC(),rU=QC(),iU=tR(),sU=rR(),oU=sR(),nU=lR(),YR=Function,Fx=function(r){try{return YR('"use strict"; return ('+r+").constructor;")()}catch{}},Hl=Px(),aU=fR(),kx=function(){throw new Qo},lU=Hl?function(){try{return arguments.callee,kx}catch{try{return Hl(arguments,"callee").get}catch{return kx}}}():kx,Ko=yR()(),_e=VR(),hU=Rx(),cU=Cx(),qR=Mx(),Vl=bd(),Zo={},uU=typeof Uint8Array>"u"||!_e?ft:_e(Uint8Array),bs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ft:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ft:ArrayBuffer,"%ArrayIteratorPrototype%":Ko&&_e?_e([][Symbol.iterator]()):ft,"%AsyncFromSyncIteratorPrototype%":ft,"%AsyncFunction%":Zo,"%AsyncGenerator%":Zo,"%AsyncGeneratorFunction%":Zo,"%AsyncIteratorPrototype%":Zo,"%Atomics%":typeof Atomics>"u"?ft:Atomics,"%BigInt%":typeof BigInt>"u"?ft:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ft:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ft:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ft:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qG,"%eval%":eval,"%EvalError%":KG,"%Float16Array%":typeof Float16Array>"u"?ft:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ft:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ft:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ft:FinalizationRegistry,"%Function%":YR,"%GeneratorFunction%":Zo,"%Int8Array%":typeof Int8Array>"u"?ft:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ft:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ft:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ko&&_e?_e(_e([][Symbol.iterator]())):ft,"%JSON%":typeof JSON=="object"?JSON:ft,"%Map%":typeof Map>"u"?ft:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ko||!_e?ft:_e(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":YG,"%Object.getOwnPropertyDescriptor%":Hl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ft:Promise,"%Proxy%":typeof Proxy>"u"?ft:Proxy,"%RangeError%":ZG,"%ReferenceError%":QG,"%Reflect%":typeof Reflect>"u"?ft:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ft:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ko||!_e?ft:_e(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ft:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ko&&_e?_e(""[Symbol.iterator]()):ft,"%Symbol%":Ko?Symbol:ft,"%SyntaxError%":Jo,"%ThrowTypeError%":lU,"%TypedArray%":uU,"%TypeError%":Qo,"%Uint8Array%":typeof Uint8Array>"u"?ft:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ft:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ft:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ft:Uint32Array,"%URIError%":JG,"%WeakMap%":typeof WeakMap>"u"?ft:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ft:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ft:WeakSet,"%Function.prototype.call%":Vl,"%Function.prototype.apply%":qR,"%Object.defineProperty%":aU,"%Object.getPrototypeOf%":hU,"%Math.abs%":tU,"%Math.floor%":eU,"%Math.max%":rU,"%Math.min%":iU,"%Math.pow%":sU,"%Math.round%":oU,"%Math.sign%":nU,"%Reflect.getPrototypeOf%":cU};if(_e)try{null.error}catch(r){$R=_e(_e(r)),bs["%Error.prototype%"]=$R}var $R,dU=function r(t){var e;if(t==="%AsyncFunction%")e=Fx("async function () {}");else if(t==="%GeneratorFunction%")e=Fx("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Fx("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&_e&&(e=_e(s.prototype))}return bs[t]=e,e},XR={__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"]},Wl=Nl(),vd=zR(),fU=Wl.call(Vl,Array.prototype.concat),pU=Wl.call(qR,Array.prototype.splice),jR=Wl.call(Vl,String.prototype.replace),Td=Wl.call(Vl,String.prototype.slice),mU=Wl.call(Vl,RegExp.prototype.exec),gU=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xU=/\\(\\)?/g,yU=function(t){var e=Td(t,0,1),i=Td(t,-1);if(e==="%"&&i!=="%")throw new Jo("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Jo("invalid intrinsic syntax, expected opening `%`");var s=[];return jR(t,gU,function(o,n,a,l){s[s.length]=a?jR(l,xU,"$1"):n||o}),s},_U=function(t,e){var i=t,s;if(vd(XR,i)&&(s=XR[i],i="%"+s[0]+"%"),vd(bs,i)){var o=bs[i];if(o===Zo&&(o=dU(i)),typeof o>"u"&&!e)throw new Qo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Jo("intrinsic "+t+" does not exist!")};KR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Qo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qo('"allowMissing" argument must be a boolean');if(mU(/^%?[^%]*%?$/,t)===null)throw new Jo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=yU(t),s=i.length>0?i[0]:"",o=_U("%"+s+"%",e),n=o.name,a=o.value,l=!1,h=o.alias;h&&(s=h[0],pU(i,fU([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Td(d,0,1),m=Td(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new Jo("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",vd(bs,n))a=bs[n];else if(a!=null){if(!(d in a)){if(!e)throw new Qo("base intrinsic for "+t+" exists, but the property is not available.");return}if(Hl&&c+1>=i.length){var g=Hl(a,d);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else u=vd(a,d),a=a[d];u&&!l&&(bs[n]=a)}}return a}});var Gx=Q((Ydt,JR)=>{"use strict";var ZR=Sd(),QR=Ix(),bU=QR([ZR("%String.prototype.indexOf%")]);JR.exports=function(t,e){var i=ZR(t,!!e);return typeof i=="function"&&bU(t,".prototype.")>-1?QR([i]):i}});var Ux=Q((qdt,eM)=>{"use strict";var vU=Sd(),zl=Gx(),TU=Dl(),SU=ys(),tM=vU("%Map%",!0),wU=zl("Map.prototype.get",!0),EU=zl("Map.prototype.set",!0),AU=zl("Map.prototype.has",!0),PU=zl("Map.prototype.delete",!0),CU=zl("Map.prototype.size",!0);eM.exports=!!tM&&function(){var t,e={assert:function(i){if(!e.has(i))throw new SU("Side channel does not contain "+TU(i))},delete:function(i){if(t){var s=PU(t,i);return CU(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return wU(t,i)},has:function(i){return t?AU(t,i):!1},set:function(i,s){t||(t=new tM),EU(t,i,s)}};return e}});var iM=Q((Kdt,rM)=>{"use strict";var RU=Sd(),Ed=Gx(),MU=Dl(),wd=Ux(),IU=ys(),tn=RU("%WeakMap%",!0),BU=Ed("WeakMap.prototype.get",!0),FU=Ed("WeakMap.prototype.set",!0),kU=Ed("WeakMap.prototype.has",!0),GU=Ed("WeakMap.prototype.delete",!0);rM.exports=tn?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new IU("Side channel does not contain "+MU(s))},delete:function(s){if(tn&&s&&(typeof s=="object"||typeof s=="function")){if(t)return GU(t,s)}else if(wd&&e)return e.delete(s);return!1},get:function(s){return tn&&s&&(typeof s=="object"||typeof s=="function")&&t?BU(t,s):e&&e.get(s)},has:function(s){return tn&&s&&(typeof s=="object"||typeof s=="function")&&t?kU(t,s):!!e&&e.has(s)},set:function(s,o){tn&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new tn),FU(t,s,o)):wd&&(e||(e=wd()),e.set(s,o))}};return i}:wd});var oM=Q((Zdt,sM)=>{"use strict";var UU=ys(),OU=Dl(),LU=FC(),DU=Ux(),NU=iM(),HU=NU||DU||LU;sM.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new UU("Side channel does not contain "+OU(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=HU()),t.set(i,s)}};return e}});var Ad=Q((Qdt,nM)=>{"use strict";var VU=String.prototype.replace,WU=/%20/g,Ox={RFC1738:"RFC1738",RFC3986:"RFC3986"};nM.exports={default:Ox.RFC3986,formatters:{RFC1738:function(r){return VU.call(r,WU,"+")},RFC3986:function(r){return String(r)}},RFC1738:Ox.RFC1738,RFC3986:Ox.RFC3986}});var Nx=Q((Jdt,lM)=>{"use strict";var zU=Ad(),Lx=Object.prototype.hasOwnProperty,vs=Array.isArray,Xr=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),$U=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(vs(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},aM=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},XU=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(vs(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Lx.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return vs(t)&&!vs(e)&&(s=aM(t,i)),vs(t)&&vs(e)?(e.forEach(function(o,n){if(Lx.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return Lx.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},jU=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},YU=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Dx=1024,qU=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=Dx){for(var h=n.length>=Dx?n.slice(l,l+Dx):n,c=[],u=0;u<h.length;++u){var d=h.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===zU.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=Xr[d];continue}if(d<2048){c[c.length]=Xr[192|d>>6]+Xr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Xr[224|d>>12]+Xr[128|d>>6&63]+Xr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=Xr[240|d>>18]+Xr[128|d>>12&63]+Xr[128|d>>6&63]+Xr[128|d&63]}a+=c.join("")}return a},KU=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var h=a[l],c=n[h];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:n,prop:h}),i.push(c))}return $U(e),t},ZU=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},QU=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},JU=function(t,e){return[].concat(t,e)},tO=function(t,e){if(vs(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};lM.exports={arrayToObject:aM,assign:jU,combine:JU,compact:KU,decode:YU,encode:qU,isBuffer:QU,isRegExp:ZU,maybeMap:tO,merge:XU}});var pM=Q((tft,fM)=>{"use strict";var cM=oM(),Pd=Nx(),$l=Ad(),eO=Object.prototype.hasOwnProperty,uM={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},jr=Array.isArray,rO=Array.prototype.push,dM=function(r,t){rO.apply(r,jr(t)?t:[t])},iO=Date.prototype.toISOString,hM=$l.default,de={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Pd.encode,encodeValuesOnly:!1,filter:void 0,format:hM,formatter:$l.formatters[hM],indices:!1,serializeDate:function(t){return iO.call(t)},skipNulls:!1,strictNullHandling:!1},sO=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Hx={},oO=function r(t,e,i,s,o,n,a,l,h,c,u,d,f,m,g,p,v,y){for(var _=t,w=y,E=0,b=!1;(w=w.get(Hx))!==void 0&&!b;){var S=w.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");b=!0}typeof w.get(Hx)>"u"&&(E=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):i==="comma"&&jr(_)&&(_=Pd.maybeMap(_,function(W){return W instanceof Date?f(W):W})),_===null){if(n)return h&&!p?h(e,de.encoder,v,"key",m):e;_=""}if(sO(_)||Pd.isBuffer(_)){if(h){var P=p?e:h(e,de.encoder,v,"key",m);return[g(P)+"="+g(h(_,de.encoder,v,"value",m))]}return[g(e)+"="+g(String(_))]}var A=[];if(typeof _>"u")return A;var C;if(i==="comma"&&jr(_))p&&h&&(_=Pd.maybeMap(_,h)),C=[{value:_.length>0?_.join(",")||null:void 0}];else if(jr(c))C=c;else{var M=Object.keys(_);C=u?M.sort(u):M}var I=l?String(e).replace(/\./g,"%2E"):String(e),k=s&&jr(_)&&_.length===1?I+"[]":I;if(o&&jr(_)&&_.length===0)return k+"[]";for(var G=0;G<C.length;++G){var J=C[G],H=typeof J=="object"&&J&&typeof J.value<"u"?J.value:_[J];if(!(a&&H===null)){var j=d&&l?String(J).replace(/\./g,"%2E"):String(J),V=jr(_)?typeof i=="function"?i(k,j):k:k+(d?"."+j:"["+j+"]");y.set(t,E);var O=cM();O.set(Hx,y),dM(A,r(H,V,i,s,o,n,a,l,i==="comma"&&p&&jr(_)?null:h,c,u,d,f,m,g,p,v,O))}}return A},nO=function(t){if(!t)return de;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||de.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=$l.default;if(typeof t.format<"u"){if(!eO.call($l.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=$l.formatters[i],o=de.filter;(typeof t.filter=="function"||jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in uM?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=de.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:de.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:de.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:de.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:de.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?de.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:de.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:de.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:de.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:de.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:de.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:de.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:de.strictNullHandling}};fM.exports=function(r,t){var e=r,i=nO(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=uM[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=cM(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||dM(n,oO(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=n.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),f.length>0?m+f:""}});var yM=Q((eft,xM)=>{"use strict";var Ts=Nx(),Vx=Object.prototype.hasOwnProperty,mM=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ts.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},aO=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},gM=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},lO="utf8=%26%2310003%3B",hO="utf8=%E2%9C%93",cO=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===hO?h="utf-8":n[l]===lO&&(h="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var c=n[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,m;d===-1?(f=e.decoder(c,qt.decoder,h,"key"),m=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),qt.decoder,h,"key"),m=Ts.maybeMap(gM(c.slice(d+1),e,mM(i[f])?i[f].length:0),function(p){return e.decoder(p,qt.decoder,h,"value")})),m&&e.interpretNumericEntities&&h==="iso-8859-1"&&(m=aO(String(m))),c.indexOf("[]=")>-1&&(m=mM(m)?[m]:m);var g=Vx.call(i,f);g&&e.duplicates==="combine"?i[f]=Ts.combine(i[f],m):(!g||e.duplicates==="last")&&(i[f]=m)}return i},uO=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:gM(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Ts.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var c=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&h!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},dO=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),h=l?o.slice(0,l.index):o,c=[];if(h){if(!i.plainObjects&&Vx.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&Vx.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(l.index)+"]")}return uO(c,e,i,s)}},fO=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,i=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||Ts.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};xM.exports=function(r,t){var e=fO(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?cO(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=dO(a,i[a],e,typeof r=="string");s=Ts.merge(s,l,e)}return e.allowSparse===!0?s:Ts.compact(s)}});var bM=Q((rft,_M)=>{"use strict";var pO=pM(),mO=yM(),gO=Ad();_M.exports={formats:gO,parse:mO,stringify:pO}});var wM=Q(rn=>{"use strict";var xO=hC();function pr(){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 yO=/^([a-z0-9.+-]+:)/i,_O=/:[0-9]*$/,bO=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,vO=["<",">",'"',"`"," ","\r",`
|
|
1093
|
+
`," "],TO=["{","}","|","\\","^","`"].concat(vO),Wx=["'"].concat(TO),vM=["%","/","?",";","#"].concat(Wx),TM=["/","?","#"],SO=255,SM=/^[+a-z0-9A-Z_-]{0,63}$/,wO=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,EO={javascript:!0,"javascript:":!0},zx={javascript:!0,"javascript:":!0},en={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},$x=bM();function Xl(r,t,e){if(r&&typeof r=="object"&&r instanceof pr)return r;var i=new pr;return i.parse(r,t,e),i}pr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=bO.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=$x.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=yO.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&zx[h])&&(a=a.substr(2),this.slashes=!0)}if(!zx[h]&&(u||h&&!en[h])){for(var d=-1,f=0;f<TM.length;f++){var m=a.indexOf(TM[f]);m!==-1&&(d===-1||m<d)&&(d=m)}var g,p;d===-1?p=a.lastIndexOf("@"):p=a.lastIndexOf("@",d),p!==-1&&(g=a.slice(0,p),a=a.slice(p+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<vM.length;f++){var m=a.indexOf(vM[f]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var y=this.hostname.split(/\./),f=0,_=y.length;f<_;f++){var w=y[f];if(w&&!w.match(SM)){for(var E="",b=0,S=w.length;b<S;b++)w.charCodeAt(b)>127?E+="x":E+=w[b];if(!E.match(SM)){var P=y.slice(0,f),A=y.slice(f+1),C=w.match(wO);C&&(P.push(C[1]),A.unshift(C[2])),A.length&&(a="/"+A.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>SO?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=xO.toASCII(this.hostname));var M=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+M,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!EO[c])for(var f=0,_=Wx.length;f<_;f++){var k=Wx[f];if(a.indexOf(k)!==-1){var G=encodeURIComponent(k);G===k&&(G=escape(k)),a=a.split(k).join(G)}}var J=a.indexOf("#");J!==-1&&(this.hash=a.substr(J),a=a.slice(0,J));var H=a.indexOf("?");if(H!==-1?(this.search=a.substr(H),this.query=a.substr(H+1),t&&(this.query=$x.parse(this.query)),a=a.slice(0,H)):t&&(this.search="",this.query={}),a&&(this.pathname=a),en[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",j=this.search||"";this.path=M+j}return this.href=this.format(),this};function AO(r){return typeof r=="string"&&(r=Xl(r)),r instanceof pr?r.format():pr.prototype.format.call(r)}pr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=$x.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||en[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function PO(r,t){return Xl(r,!1,!0).resolve(t)}pr.prototype.resolve=function(r){return this.resolveObject(Xl(r,!1,!0)).format()};function CO(r,t){return r?Xl(r,!1,!0).resolveObject(t):t}pr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new pr;t.parse(r,!1,!0),r=t}for(var e=new pr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return en[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!en[r.protocol]){for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!zx[r.protocol]){for(var _=(r.pathname||"").split("/");_.length&&!(r.host=_.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),e.pathname=_.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",g=r.host||r.pathname&&r.pathname.charAt(0)==="/",p=g||m||e.host&&r.pathname,v=p,y=e.pathname&&e.pathname.split("/")||[],_=r.pathname&&r.pathname.split("/")||[],w=e.protocol&&!en[e.protocol];if(w&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(_[0]===""?_[0]=r.host:_.unshift(r.host)),r.host=null),p=p&&(_[0]===""||y[0]==="")),g)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,y=_;else if(_.length)y||(y=[]),y.pop(),y=y.concat(_),e.search=r.search,e.query=r.query;else if(r.search!=null){if(w){e.host=y.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var b=y.slice(-1)[0],S=(e.host||r.host||y.length>1)&&(b==="."||b==="..")||b==="",P=0,A=y.length;A>=0;A--)b=y[A],b==="."?y.splice(A,1):b===".."?(y.splice(A,1),P++):P&&(y.splice(A,1),P--);if(!p&&!v)for(;P--;P)y.unshift("..");p&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),S&&y.join("/").substr(-1)!=="/"&&y.push("");var C=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(w){e.hostname=C?"":y.length?y.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return p=p||e.host&&y.length,p&&!C&&y.unshift(""),y.length>0?e.pathname=y.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};pr.prototype.parseHost=function(){var r=this.host,t=_O.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};rn.parse=Xl;rn.resolve=PO;rn.resolveObject=CO;rn.format=AO;rn.Url=pr});var VI=()=>{let r=new Map;return{load:async n=>{let a=[];for(let[l,h]of Object.entries(n))r.has(l)||a.push([l,h]);a.length>0&&await Promise.all(a.map(async([l,h])=>{let d={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type};r.set(l,d)}))},getBufferMap:()=>{let n={};for(let[a,l]of r.entries())n[a]=l;return n},clear:()=>r.clear(),size:()=>r.size,has:n=>r.has(n)}};B();var cw={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(hw(),KF))}};B();var dw={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uw(),ZF))}};B();B();nc();tc();B();Ft();Sa();var tu;function bw(r){return tu!==void 0||(tu=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Ui.defaultOptions.failIfMajorPerformanceCaveat};try{if(!X.get().getWebGLRenderingContext())return!1;let i=X.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),tu}Ft();var eu;async function vw(r={}){return eu!==void 0||(eu=await(async()=>{let t=X.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),eu}Sa();var F1=["webgl","webgpu","canvas"];async function k1(r){let t=[];r.preference?(t.push(r.preference),F1.forEach(o=>{o!==r.preference&&t.push(o)})):t=F1.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await vw()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(nA(),oA));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&bw(r.failIfMajorPerformanceCaveat??Ui.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(B1(),I1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}_r();tg();Wt();var G1=class Wg{constructor(...t){this.stage=new ht,t[0]!==void 0&&$(et,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await k1(t),Wg._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return $(et,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=Wg._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};G1._plugins=[];var yl=G1;U.handleByList(T.Application,yl._plugins);U.add(Fa);B();si();ep();Ft();B();is();ae();_t();Mm();Gm();var _l=class extends So{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],h=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new R({source:l,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ma.install(t)}static uninstall(t){ma.uninstall(t)}};var Au={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let g in f){let p=f[g].split("="),v=p[0],y=p[1].replace(/"/gm,""),_=parseFloat(y),w=isNaN(_)?y:_;m[v]=w}e[d].push(m)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let h=e.char;for(let u=0;u<h.length;u++){let d=h[u],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),l[f]=m,i.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),m=parseInt(c[u].amount,10);i.chars[l[f]].kerning[l[d]]=m}return i}};Ft();var zg={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)t.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let h=0;h<n.length;h++){let c=n[h],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<a.length;h++){let c=parseInt(a[h].getAttribute("first"),10),u=parseInt(a[h].getAttribute("second"),10),d=parseInt(a[h].getAttribute("amount"),10);t.chars[l[u]].kerning[l[c]]=d}return t}};var $g={test(r){return typeof r=="string"&&r.includes("<font>")?zg.test(X.get().parseXML(r)):!1},parse(r){return zg.parse(X.get().parseXML(r))}};var Ik=[".xml",".fnt"],U1={extension:{type:T.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof _l,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},O1={extension:{type:T.LoadParser,priority:ge.Normal},name:"loadBitmapFont",test(r){return Ik.includes(he.extname(r).toLowerCase())},async testParse(r){return Au.test(r)||$g.test(r)},async parse(r,t,e){let i=Au.test(r)?Au.parse(r):$g.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=he.join(he.dirname(s),d);f=Vn(f,s),n.push({src:f,data:a})}let l=await e.load(n),h=n.map(u=>l[u.src]);return new _l({data:i,textures:h},s)},async load(r,t){return await(await X.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};At();var Pu=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ci();B();_t();var L1={extension:{type:T.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof R),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};B();async function Cu(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var D1={extension:{type:T.DetectionParser,priority:1},test:async()=>Cu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};B();var N1=["png","jpg","jpeg"],H1={extension:{type:T.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...N1],remove:async r=>r.filter(t=>!N1.includes(t))};B();var Bk="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Oo(r){return Bk?!1:document.createElement("video").canPlayType(r)!==""}var V1={extension:{type:T.DetectionParser,priority:0},test:async()=>Oo("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};B();var W1={extension:{type:T.DetectionParser,priority:0},test:async()=>Oo("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};B();var z1={extension:{type:T.DetectionParser,priority:0},test:async()=>Oo("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};B();var $1={extension:{type:T.DetectionParser,priority:0},test:async()=>Cu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};At();is();Hn();Jh();var Ru=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||D(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return D(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=ss(t),n=Fe(t,h=>({alias:[h],src:h,data:{}})),a=n.length,l=n.map(async h=>{let c=he.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
+
${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Fe(t,s=>({alias:[s],src:s})).map(async s=>{let o=he.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&D(`[Assets] loadParser name conflict "${e.name}"`):D("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Ft();B();function cr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}is();function ur(r,t){let e=r.split("?")[0],i=he.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}si();var Fk=".json",kk="application/json",X1={extension:{type:T.LoadParser,priority:ge.Low},name:"loadJson",test(r){return cr(r,kk)||ur(r,Fk)},async load(r){return await(await X.get().fetch(r)).json()}};Ft();B();si();var Gk=".txt",Uk="text/plain",j1={name:"loadTxt",extension:{type:T.LoadParser,priority:ge.Low,name:"loadTxt"},test(r){return cr(r,Uk)||ur(r,Gk)},async load(r){return await(await X.get().fetch(r)).text()}};Ft();B();At();is();Ci();si();var Ok=["normal","bold","100","200","300","400","500","600","700","800","900"],Lk=[".ttf",".otf",".woff",".woff2"],Dk=["font/ttf","font/otf","font/woff","font/woff2"],Nk=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Hk(r){let t=he.extname(r),s=he.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(Nk)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Vk=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Wk(r){return Vk.test(r)?r:encodeURI(r)}var Y1={extension:{type:T.LoadParser,priority:ge.Low},name:"loadWebFont",test(r){return cr(r,Dk)||ur(r,Lk)},async load(r,t){let e=X.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??Hk(r),o=t.data?.weights?.filter(a=>Ok.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let l=o[a],h=new FontFace(s,`url(${Wk(r)})`,{...n,weight:l});await h.load(),e.add(h),i.push(h)}return bt.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return D("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{bt.remove(`${t.family}-and-url`),X.get().getFontFaceSet().delete(t)})}};Ft();B();Qs();Dc();Ks();function Lo(r,t=1){let e=Ke.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}si();_t();At();Ci();function Do(r,t,e){r.label=e,r._sourceOrigin=e;let i=new R({source:r,label:e}),s=()=>{delete t.promiseCache[e],bt.has(e)&&bt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(D("[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||(D("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var zk=".svg",$k="image/svg+xml",q1={extension:{type:T.LoadParser,priority:ge.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return cr(r,$k)||ur(r,zk)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?jk(r):Xk(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function Xk(r,t,e,i){let o=await(await X.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"),h=l.getContext("2d"),c=t.data?.resolution||Lo(r),u=t.data?.width??a.width,d=t.data?.height??a.height;l.width=u*c,l.height=d*c,h.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...m}=t.data??{},g=new Ve({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:c,...m});return Do(g,e,r)}async function jk(r){let e=await(await X.get().fetch(r)).text(),i=new Ge;return i.svg(e),i}Ft();B();Qs();var Yk=`(function () {
|
|
1095
1095
|
'use strict';
|
|
1096
1096
|
|
|
1097
1097
|
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
@@ -1112,7 +1112,7 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ie(t
|
|
|
1112
1112
|
});
|
|
1113
1113
|
|
|
1114
1114
|
})();
|
|
1115
|
-
`,
|
|
1115
|
+
`,No=null,Ho=class{constructor(){No||(No=URL.createObjectURL(new Blob([Yk],{type:"application/javascript"}))),this.worker=new Worker(No)}};Ho.revokeObjectURL=function(){No&&(URL.revokeObjectURL(No),No=null)};var qk=`(function () {
|
|
1116
1116
|
'use strict';
|
|
1117
1117
|
|
|
1118
1118
|
async function loadImageBitmap(url, alphaMode) {
|
|
@@ -1141,20 +1141,20 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ie(t
|
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
1143
|
})();
|
|
1144
|
-
`,Lo=null,gl=class{constructor(){Lo||(Lo=URL.createObjectURL(new Blob([xk],{type:"application/javascript"}))),this.worker=new Worker(Lo)}};gl.revokeObjectURL=function(){Lo&&(URL.revokeObjectURL(Lo),Lo=null)};var I1=0,Mg,Bg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Oo;e.addEventListener("message",i=>{e.terminate(),Oo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Mg===void 0&&(Mg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Mg&&(this._createdWorkers++,t=new gl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[I1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:I1++,id:i})}},Ig=new Bg;ii();var yk=[".jpeg",".jpg",".png",".webp",".avif"],_k=["image/jpeg","image/png","image/webp","image/avif"];async function bk(r,t){let e=await j.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Eu={name:"loadTextures",extension:{type:T.LoadParser,priority:pe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return cr(r,_k)||ur(r,yk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Ig.isImageBitmapSupported()?i=await Ig.loadImageBitmap(r,t):i=await bk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||ko(r),...t.data});return Go(s,e,r)},unload(r){r.destroy(!0)}};B();Xf();jf();var F1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],vk=F1.map(r=>`video/${r.substring(1)}`);function Tk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Ek(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Sk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function Ek(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var k1={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=cr(r,vk),e=ur(r,F1);return t||e},async load(r,t,e){let i={...qs.defaultOptions,resolution:t.data?.resolution||ko(r),alphaMode:t.data?.alphaMode||await Zh(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),Tk(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=qs.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new qs({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await Sk(s),l(Go(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};B();js();B();js();var wu={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Eu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var G1={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:wu.parse};js();On();jh();var Au=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new Su,this.cache=vt,this._backgroundLoader=new vu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){D("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=es(t),s=Ie(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return vt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=vt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),vt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Ie(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ie(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{vt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},Sr=new Au;U.handleByList(T.LoadParser,Sr.loader.parsers).handleByList(T.ResolveParser,Sr.resolver.parsers).handleByList(T.CacheParser,Sr.cache.parsers).handleByList(T.DetectionParser,Sr.detections);U.add(b1,S1,v1,P1,E1,w1,A1,C1,R1,M1,B1,Eu,k1,_1,y1,wu,G1);var U1={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};U.handle(T.Asset,r=>{let t=r.ref;Object.entries(U1).filter(([e])=>!!t[e]).forEach(([e,i])=>U.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(U1).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});bt();In();$s();Nn();var xl=class r extends Gt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof R?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ae.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ae.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof R)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ae.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ae.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Ph();Vt();$h();var Pu=class extends Ei{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new _e({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function O1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&($(J,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ha();cs();var Er=class extends Pu{constructor(...t){let e=O1(t,"Text");super(e,Bt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Kt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();ne();bt();Kf();yr();dm();Nn();ha();cs();Hf();Se();var wk=$i(pc(),1);U.add($S,XS);var Ak=new(window.AudioContext||window.webkitAudioContext),Fg={},Pk=async(r,t)=>{if(!Fg[r]&&t.byteLength!==0)try{let e=await Ak.decodeAudioData(t);Fg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},Ck=r=>Fg[r],Do={load:Pk,getAsset:Ck};var ce=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var kg=({type:r})=>({type:r});var Gg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var L1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Ug={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var fs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ue={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Ue.fill,fontFamily:t?.fontFamily??Ue.fontFamily,fontSize:t?.fontSize??Ue.fontSize,align:t?.align??Ue.align,lineHeight:t?.lineHeight??Ue.lineHeight,wordWrap:t?.wordWrap??Ue.wordWrap,breakWords:t?.breakWords??Ue.breakWords,strokeColor:t?.strokeColor??Ue.strokeColor,strokeWidth:t?.strokeWidth??Ue.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ue.wordWrapWidth};r.style=e};var D1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=new Er({label:e.id});l.zIndex=a,l.text=e.content,dr(l,e.textStyle),l.alpha=e.alpha,l.x=e.x,l.y=e.y;let h=e?.hover,c=e?.click,u=e?.rightClick,d={isHovering:!1,isPressed:!1,isRightPressed:!1},f=({isHovering:m,isPressed:p,isRightPressed:_})=>{_&&u?.textStyle?dr(l,u.textStyle):p&&c?.textStyle?dr(l,c.textStyle):m&&h?.textStyle?dr(l,h.textStyle):dr(l,e.textStyle)};if(h){let{cursor:m,soundSrc:p,actionPayload:_}=h;l.eventMode="static";let y=()=>{d.isHovering=!0,_&&s&&s("hover",{_event:{id:l.label},..._}),m&&(l.cursor=m),p&&r.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),f(d)},v=()=>{d.isHovering=!1,l.cursor="auto",f(d)};l.on("pointerover",y),l.on("pointerout",v)}if(c){let{soundSrc:m,soundVolume:p,actionPayload:_}=c;l.eventMode="static";let y=()=>{d.isPressed=!0,f(d)},v=()=>{d.isPressed=!1,f(d),_&&s&&s("click",{_event:{id:l.label},..._}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(p??1e3)/1e3})},b=()=>{d.isPressed=!1,f(d)};l.on("pointerdown",y),l.on("pointerup",v),l.on("pointerupoutside",b)}if(u){let{soundSrc:m,actionPayload:p}=u;l.eventMode="static";let _=()=>{d.isRightPressed=!0,f(d)},y=()=>{d.isRightPressed=!1,f(d),p&&s&&s("rightclick",{_event:{id:l.label},...p}),m&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:m,loop:!1})},v=()=>{d.isRightPressed=!1,f(d)};l.on("rightdown",_),l.on("rightup",y),l.on("rightupoutside",v)}t.addChild(l);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:l,properties:m.properties,targetState:{x:e.x,y:e.y,alpha:e.alpha},onComplete:()=>{n.complete(p)}}})}};var Rk=Object.prototype.hasOwnProperty,Et=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!Et(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!Rk.call(t,n)||!Et(r[n],t[n]))return!1;return!0};var N1=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,alpha:d}=i,f=()=>{if(!Et(e,i)){h.text=i.content,dr(h,i.textStyle),h.x=c,h.y=u,h.alpha=d,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let m=i?.hover,p=i?.click,_=i?.rightClick,y={isHovering:!1,isPressed:!1,isRightPressed:!1},v=({isHovering:b,isPressed:E,isRightPressed:A})=>{A&&_?.textStyle?dr(h,_.textStyle):E&&p?.textStyle?dr(h,p.textStyle):b&&m?.textStyle?dr(h,m.textStyle):dr(h,i.textStyle)};if(m){let{cursor:b,soundSrc:E,actionPayload:A}=m;h.eventMode="static";let S=()=>{y.isHovering=!0,A&&s&&s("hover",{_event:{id:h.label},...A}),b&&(h.cursor=b),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1}),v(y)},w=()=>{y.isHovering=!1,h.cursor="auto",v(y)};h.on("pointerover",S),h.on("pointerout",w)}if(p){let{soundSrc:b,soundVolume:E,actionPayload:A}=p;h.eventMode="static";let S=()=>{y.isPressed=!0,v(y)},w=()=>{y.isPressed=!1,v(y),A&&s&&s("click",{_event:{id:h.label},...A}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1,volume:(E??1e3)/1e3})},P=()=>{y.isPressed=!1,v(y)};h.on("pointerdown",S),h.on("pointerup",w),h.on("pointerupoutside",P)}if(_){let{soundSrc:b,actionPayload:E}=_;h.eventMode="static";let A=()=>{y.isRightPressed=!0,v(y)},S=()=>{y.isRightPressed=!1,v(y),E&&s&&s("rightclick",{_event:{id:h.label},...E}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},w=()=>{y.isRightPressed=!1,v(y)};h.on("rightdown",A),h.on("rightup",S),h.on("rightupoutside",w)}}},g=o?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=a.getVersion();a.track(p),n.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:c,y:u,alpha:d},onComplete:()=>{a.complete(p),f()}}})}else f()};var H1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var V1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var we=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===fs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=V1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var W1=({state:r})=>{let t={...Ue,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Kt.measureText(e,new Bt(t)),o=Math.round(i),n=Math.round(s);return{...we({...r,width:o,height:n}),content:e,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var Mk=ce({type:"text",add:D1,update:N1,delete:H1,parse:W1});var z1=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a})=>{let{id:l,x:h,y:c,width:u,height:d,fill:f,border:g,alpha:m}=e,p=new he;p.label=l,p.zIndex=n,(()=>{p.clear(),p.rect(0,0,Math.round(u),Math.round(d)).fill(f),p.x=Math.round(h),p.y=Math.round(c),p.alpha=m,g&&p.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let y=e?.hover,v=e?.click,b=e?.rightClick,E=e?.scroll,A=e?.drag;if(y){let{cursor:w,soundSrc:P,actionPayload:C}=y;p.eventMode="static";let M=()=>{C&&o&&o("hover",{_event:{id:p.label},...C}),w&&(p.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{p.cursor="auto"};p.on("pointerover",M),p.on("pointerout",I)}if(v){let{soundSrc:w,soundVolume:P,actionPayload:C}=v;p.eventMode="static";let M=()=>{C&&o&&o("click",{_event:{id:p.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};p.on("pointerup",M)}if(b){let{soundSrc:w,actionPayload:P}=b;p.eventMode="static";let C=()=>{P&&o&&o("rightclick",{_event:{id:p.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};p.on("rightclick",C)}if(E){p.eventMode="static";let w=P=>{if(P.deltaY<0&&E.up){let{actionPayload:C}=E.up;C&&o&&o("scrollup",{_event:{id:p.label},...C})}else if(P.deltaY>0&&E.down){let{actionPayload:C}=E.down;C&&o&&o("scrolldown",{_event:{id:p.label},...C})}};p.on("wheel",w)}if(A){let{start:w,end:P,move:C}=A;p.eventMode="static";let M=()=>{p._isDragging=!0,w&&o&&o("drag-start",{_event:{id:p.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{p._isDragging=!1,P&&o&&o("drag-end",{_event:{id:p.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},k=G=>{C&&o&&p._isDragging&&o("drag-move",{_event:{id:p.label,x:G.global.x,y:G.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};p.on("pointerdown",M),p.on("pointerup",I),p.on("globalpointermove",k),p.on("pointerupoutside",I)}t.addChild(p);let S=i?.filter(w=>w.targetId===l)||[];for(let w of S){let P=a.getVersion();a.track(P),s.dispatch({type:"START",payload:{id:w.id,element:p,properties:w.properties,targetState:{x:h,y:c,alpha:m},onComplete:()=>{a.complete(P)}}})}};var $1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:g,border:m,alpha:p}=i,_=()=>{if(!Et(e,i)){h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(g),h.x=Math.round(c),h.y=Math.round(u),h.alpha=p,m&&h.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let v=i?.hover,b=i?.click,E=i?.rightClick,A=i?.scroll,S=i?.drag;if(v){let{cursor:w,soundSrc:P,actionPayload:C}=v;h.eventMode="static";let M=()=>{C&&n&&n("hover",{_event:{id:h.label},...C}),w&&(h.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{h.cursor="auto"};h.on("pointerover",M),h.on("pointerout",I)}if(b){let{soundSrc:w,soundVolume:P,actionPayload:C}=b;h.eventMode="static";let M=()=>{C&&n&&n("click",{_event:{id:h.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};h.on("pointerup",M)}if(E){let{soundSrc:w,actionPayload:P}=E;h.eventMode="static";let C=()=>{P&&n&&n("rightclick",{_event:{id:h.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};h.on("rightclick",C)}if(A){h.eventMode="static";let w=P=>{if(P.deltaY<0&&A.up){let{actionPayload:C}=A.up;C&&n&&n("scrollup",{_event:{id:h.label},...C})}else if(P.deltaY>0&&A.down){let{actionPayload:C}=A.down;C&&n&&n("scrolldown",{_event:{id:h.label},...C})}};h.on("wheel",w)}if(S){let{start:w,end:P,move:C}=S;h.eventMode="static";let M=()=>{h._isDragging=!0,w&&n&&n("drag-start",{_event:{id:h.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{h._isDragging=!1,P&&n&&n("drag-end",{_event:{id:h.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},k=G=>{C&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:G.global.x,y:G.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};h.on("pointerdown",M),h.on("pointerup",I),h.on("globalpointermove",k),h.on("pointerupoutside",I)}}},y=s?.filter(v=>v.targetId===e.id)||[];if(y.length>0)for(let v of y){let b=l.getVersion();l.track(b),o.dispatch({type:"START",payload:{id:v.id,element:h,properties:v.properties,targetState:{x:c,y:u,alpha:p},onComplete:()=>{l.complete(b),_()}}})}else _()};var j1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var X1=({state:r})=>{let t=we(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Bk=ce({type:"rect",add:z1,update:$1,delete:j1,parse:X1});var Y1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,alpha:g}=e,m=f?R.from(f):R.EMPTY,p=new Gt(m);p.label=l,p.zIndex=a,p.x=Math.round(h),p.y=Math.round(c),p.width=Math.round(u),p.height=Math.round(d),p.alpha=g;let _=e?.hover,y=e?.click,v=e?.rightClick,b={isHovering:!1,isPressed:!1,isRightPressed:!1},E=({isHovering:S,isPressed:w,isRightPressed:P})=>{if(P&&v?.src){let C=R.from(v.src);p.texture=C}else if(w&&y?.src){let C=R.from(y.src);p.texture=C}else if(S&&_?.src){let C=R.from(_.src);p.texture=C}else p.texture=m};if(_){let{cursor:S,soundSrc:w,actionPayload:P}=_;p.eventMode="static";let C=()=>{b.isHovering=!0,P&&s&&s("hover",{_event:{id:p.label},...P}),S&&(p.cursor=S),w&&r.audioStage.add({id:`hover-${Date.now()}`,url:w,loop:!1}),E(b)},M=()=>{b.isHovering=!1,p.cursor="auto",E(b)};p.on("pointerover",C),p.on("pointerout",M)}if(y){let{soundSrc:S,soundVolume:w,actionPayload:P}=y;p.eventMode="static";let C=()=>{b.isPressed=!0,E(b)},M=()=>{b.isPressed=!1,E(b),P&&s&&s("click",{_event:{id:p.label},...P}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(w??1e3)/1e3})},I=()=>{b.isPressed=!1,E(b)};p.on("pointerdown",C),p.on("pointerup",M),p.on("pointerupoutside",I)}if(v){let{soundSrc:S,actionPayload:w}=v;p.eventMode="static";let P=()=>{b.isRightPressed=!0,E(b)},C=()=>{b.isRightPressed=!1,E(b),w&&s&&s("rightclick",{_event:{id:p.label},...w}),S&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:S,loop:!1})},M=()=>{b.isRightPressed=!1,E(b)};p.on("rightdown",P),p.on("rightup",C),p.on("rightupoutside",M)}t.addChild(p);let A=i?.filter(S=>S.targetId===l)||[];for(let S of A){let w=n.getVersion();n.track(w),o.dispatch({type:"START",payload:{id:S.id,element:p,properties:S.properties,targetState:{x:h,y:c,width:u,height:d,alpha:g},onComplete:()=>{n.complete(w)}}})}};var q1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:g,src:m,alpha:p}=i,_=()=>{if(!Et(e,i)){let v=m?R.from(m):R.EMPTY;h.texture=v,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(g),h.alpha=p,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let b=i?.hover,E=i?.click,A=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:P,isPressed:C,isRightPressed:M})=>{if(M&&A?.src){let I=R.from(A.src);h.texture=I}else if(C&&E?.src){let I=R.from(E.src);h.texture=I}else if(P&&b?.src){let I=R.from(b.src);h.texture=I}else h.texture=v};if(b){let{cursor:P,soundSrc:C,actionPayload:M}=b;h.eventMode="static";let I=()=>{S.isHovering=!0,M&&a&&a("hover",{_event:{id:h.label},...M}),P&&(h.cursor=P),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1}),w(S)},k=()=>{S.isHovering=!1,h.cursor="auto",w(S)};h.on("pointerover",I),h.on("pointerout",k)}if(E){let{soundSrc:P,soundVolume:C,actionPayload:M}=E;h.eventMode="static";let I=()=>{S.isPressed=!0,w(S)},k=()=>{S.isPressed=!1,w(S),M&&a&&a("click",{_event:{id:h.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(C??1e3)/1e3})},G=()=>{S.isPressed=!1,w(S)};h.on("pointerdown",I),h.on("pointerup",k),h.on("pointerupoutside",G)}if(A){let{soundSrc:P,actionPayload:C}=A;h.eventMode="static";let M=()=>{S.isRightPressed=!0,w(S)},I=()=>{S.isRightPressed=!1,w(S),C&&a&&a("rightclick",{_event:{id:h.label},...C}),P&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:P,loop:!1})},k=()=>{S.isRightPressed=!1,w(S)};h.on("rightdown",M),h.on("rightup",I),h.on("rightupoutside",k)}}},y=s?.filter(v=>v.targetId===e.id)||[];if(y.length>0)for(let v of y){let b=n.getVersion();n.track(b),o.dispatch({type:"START",payload:{id:v.id,element:h,properties:v.properties,targetState:{x:u,y:d,width:f,height:g,alpha:p},onComplete:()=>{n.complete(b),_()}}})}else _()};var K1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var Z1=({state:r})=>({...we(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Ik=ce({type:"sprite",add:Y1,update:q1,delete:K1,parse:Z1});var Q1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,volume:g,loop:m,alpha:p}=e,_=R.from(f),y=_.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=g/1e3,y.muted=!1;let v=null;(m??!1)||(v=n.getVersion(),n.track(v));let b=()=>{v!==null&&n.complete(v)};y.addEventListener("ended",b),y.play();let E=new Gt(_);E.label=l,E.zIndex=a,E._videoEndedListener=b,E._playbackStateVersion=v,E.x=Math.round(h),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=p??1,t.addChild(E);let A=i?.filter(S=>S.targetId===l)||[];for(let S of A){let w=n.getVersion();n.track(w),o.dispatch({type:"START",payload:{id:S.id,element:E,properties:S.properties,targetState:{x:h,y:c,width:u,height:d,alpha:p??1},onComplete:()=>{n.complete(w)}}})}};var J1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,width:d,height:f,alpha:g}=i,m=()=>{if(!Et(e,i)){if(h.x=Math.round(c),h.y=Math.round(u),h.width=Math.round(d),h.height=Math.round(f),h.alpha=g??1,e.src!==i.src){let _=h.texture.source.resource;_&&(h._videoEndedListener&&_.removeEventListener("ended",h._videoEndedListener),_.pause());let y=R.from(i.src);h.texture=y;let v=y.source.resource,b=null;(i.loop??!1)||(b=a.getVersion(),a.track(b));let E=()=>{b!==null&&a.complete(b)};v.addEventListener("ended",E),h._videoEndedListener=E,h._playbackStateVersion=b,v.muted=!1,v.pause(),v.currentTime=0,v.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},p=s?.filter(_=>_.targetId===e.id)||[];if(p.length>0)for(let _ of p){let y=a.getVersion();a.track(y),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:c,y:u,width:d,height:f,alpha:g??1},onComplete:()=>{a.complete(y),m()}}})}else m()};var tP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(l=>l.label===e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){n._playbackStateVersion!==null&&o.complete(n._playbackStateVersion);let l=n.texture.source.resource;l&&(n._videoEndedListener&&l.removeEventListener("ended",n._videoEndedListener),l.pause()),t.removeChild(n),n.destroy();return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{if(o.complete(h),n&&!n.destroyed){n._playbackStateVersion!==null&&o.complete(n._playbackStateVersion);let c=n.texture.source.resource;c&&(n._videoEndedListener&&c.removeEventListener("ended",n._videoEndedListener),c.pause()),t.removeChild(n),n.destroy()}}}})}};var eP=({state:r})=>({...we(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Fk=ce({type:"video",add:Q1,update:J1,delete:tP,parse:eP});var rP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,alpha:f,thumbSrc:g,barSrc:m,direction:p,min:_,max:y,step:v,initialValue:b,originX:E,originY:A,hover:S,change:w}=e,P=new yt;P.label=l,P.zIndex=a,P.x=h,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let C=0,M=m?R.from(m):R.EMPTY,I=new Gt(M);I.label=`${l}-bar`,I.eventMode="static";let k=g?R.from(g):R.EMPTY,G=new Gt(k);G.label=`${l}-thumb`,G.eventMode="static";let ut=b??_,H=y-_,K=pt=>{let lt=(pt-_)/H;p==="horizontal"?(G.x=lt*(I.width-G.width),G.y=(I.height-G.height)/2):(G.x=(I.width-G.width)/2,G.y=lt*(I.height-G.height))};(()=>{I.width=u,I.height=d;let pt=p==="horizontal"?d-C*2:u-C*2,lt=g?R.from(g):R.EMPTY,_t=lt.width,kt=lt.height,Jt=pt/_t,te=pt/kt,De=Math.min(Jt,te);G.width=_t*De,G.height=kt*De,K(ut)})();let L=k,z=M,rt=!1,nt=pt=>{let lt;if(p==="horizontal"){let kt=pt.x-G.width/2;lt=Math.max(0,Math.min(1,kt/(I.width-G.width)))}else{let kt=pt.y-G.height/2;lt=Math.max(0,Math.min(1,kt/(I.height-G.height)))}let _t=_+lt*H;return v>0&&(_t=Math.round((_t-_)/v)*v+_,_t=Math.max(_,Math.min(y,_t))),_t},Tt=pt=>{let lt=P.toLocal(pt.global),_t=nt(lt);_t!==ut&&(ut=_t,K(ut),w?.actionPayload&&n&&n("change",{_event:{id:l,value:ut},...w.actionPayload}))},Ot=pt=>{rt=!0,Tt(pt)},Ht=pt=>{rt&&Tt(pt)},Qt=()=>{rt&&(rt=!1)};if(P.on("pointerdown",Ot),P.on("globalpointermove",Ht),P.on("pointerup",Qt),P.on("pointerupoutside",Qt),S){let{cursor:pt,soundSrc:lt,thumbSrc:_t,barSrc:kt}=S,Jt=()=>{pt&&(I.cursor=pt,G.cursor=pt),lt&&r.audioStage.add({id:`hover-${Date.now()}`,url:lt,loop:!1}),_t&&(G.texture=R.from(_t)),kt&&(I.texture=R.from(kt))},te=()=>{rt||(I.cursor="auto",G.cursor="auto",G.texture=L,I.texture=z)};P.on("pointerover",Jt),P.on("pointerout",te),P.on("pointerupoutside",te)}P.addChild(I),P.addChild(G),t.addChild(P);let Ce=i?.filter(pt=>pt.targetId===l)||[];for(let pt of Ce){let lt=o.getVersion();o.track(lt),s.dispatch({type:"START",payload:{id:pt.id,element:P,properties:pt.properties,targetState:{x:h,y:c,alpha:f},onComplete:()=>{o.complete(lt)}}})}};var iP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(!Et(e,i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let m=h.getChildByLabel(`${i.id}-bar`),p=h.getChildByLabel(`${i.id}-thumb`),_=!Et(e.hover,i.hover)||!Et(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(m&&p){m.width=i.width,m.height=i.height;let y=0,v=i.direction==="horizontal"?i.height-y*2:i.width-y*2,b=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY,E=b.width||16,A=b.height||16,S=v/E,w=v/A,P=Math.min(S,w);if(p.width=E*P,p.height=A*P,e.barSrc!==i.barSrc){let I=i.barSrc?R.from(i.barSrc):R.EMPTY;m.texture=I}if(e.thumbSrc!==i.thumbSrc){let I=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY;p.texture=I}let C=i.max-i.min,M=(i.initialValue-i.min)/C;i.direction==="horizontal"?(p.x=M*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=M*(m.height-p.height))}if(_&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),_){let{hover:y,change:v,min:b,max:E,step:A,direction:S,initialValue:w}=i,P=w??b,C=E-b;h.eventMode="static";let M=z=>{let rt=(z-b)/C;S==="horizontal"?(p.x=rt*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=rt*(m.height-p.height))},I=z=>{let rt;if(S==="horizontal"){let Tt=z.x-p.width/2;rt=Math.max(0,Math.min(1,Tt/(m.width-p.width)))}else{let Tt=z.y-p.height/2;rt=Math.max(0,Math.min(1,Tt/(m.height-p.height)))}let nt=b+rt*C;return A>0&&(nt=Math.round((nt-b)/A)*A+b,nt=Math.max(b,Math.min(E,nt))),nt},k=p.texture,G=m.texture,ut=!1,H=z=>{let rt=h.toLocal(z.global),nt=I(rt);nt!==P&&(P=nt,M(P),v?.actionPayload&&a&&a("change",{_event:{id:i.id,value:P},...v.actionPayload}))},K=z=>{ut=!0,H(z)},W=z=>{ut&&H(z)},L=()=>{ut&&(ut=!1)};if(h.on("pointerdown",K),h.on("globalpointermove",W),h.on("pointerup",L),h.on("pointerupoutside",L),y){let{cursor:z,soundSrc:rt,thumbSrc:nt,barSrc:Tt}=y,Ot=()=>{z&&(h.cursor=z,p.cursor=z),rt&&r.audioStage.add({id:`hover-${Date.now()}`,url:rt,loop:!1}),nt&&(p.texture=R.from(nt)),Tt&&(m.texture=R.from(Tt))},Ht=()=>{ut||(h.cursor="auto",p.cursor="auto",p.texture=k,m.texture=G)};h.on("pointerover",Ot),h.on("pointerout",Ht),h.on("pointerupoutside",Ht)}}}},{x:u,y:d,alpha:f}=i,g=s?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:u,y:d,alpha:f},onComplete:()=>{n.complete(p),c()}}})}else c()};var sP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){n.destroy({children:!0});return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{o.complete(h),n&&!n.destroyed&&n.destroy({children:!0})}}})}};var oP=({state:r})=>{let t=we(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var kk=ce({type:"slider",add:rP,update:iP,delete:sP,parse:oP});var yl=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(h=>{s=Math.max(h.width+h.x,s),o=Math.max(h.height+h.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let h=new yt({label:`${r.label}-content`});[...r.children].forEach(p=>{h.addChild(p)}),r.addChild(h);let u=new he({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),h.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),g=t.anchorToBottom&&n?d:0,m=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(h.y=g,h.x=m),e&&(r.eventMode="static",r.hitArea=new et(0,0,t.width||s,t.height||o),r.on("wheel",p=>{if(p.preventDefault(),n&&p.deltaY!==0){let _=g-p.deltaY;_>0?g=0:_<d?g=d:g=_,h.y=g}if(a&&(p.deltaX!==0||p.shiftKey&&p.deltaY!==0)){let _=p.deltaX!==0?p.deltaX:p.deltaY,y=m-_;y>0?m=0:y<f?m=f:m=y,h.x=m}}))}},Og=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var nP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,zIndex:a,completionTracker:l,signal:h})=>{let{id:c,x:u,y:d,children:f,scroll:g,alpha:m}=e,p=new yt;if(p.label=c,p.zIndex=a,p.x=Math.round(u),p.y=Math.round(d),p.alpha=m,t.addChild(p),f&&f.length>0)for(let A of f){let S=n.find(w=>w.type===A.type);if(!S)throw new Error(`No plugin found for child element type: ${A.type}`);S.add({app:r,parent:p,element:A,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,completionTracker:l,signal:h})}(g||e.anchorToBottom)&&yl({container:p,element:e,interactive:!!g,allowViewportWithoutScroll:!!e.anchorToBottom});let y=e?.hover,v=e?.click,b=e?.rightClick;if(y){let{cursor:A,soundSrc:S,actionPayload:w}=y;p.eventMode="static";let P=()=>{w&&s&&s("hover",{_event:{id:p.label},...w}),A&&(p.cursor=A),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1})},C=()=>{p.cursor="auto"};p.on("pointerover",P),p.on("pointerout",C)}if(v){let{soundSrc:A,soundVolume:S,actionPayload:w}=v;p.eventMode="static";let P=()=>{w&&s&&s("click",{_event:{id:p.label},...w}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(S??1e3)/1e3})};p.on("pointerup",P)}if(b){let{soundSrc:A,actionPayload:S}=b;p.eventMode="static";let w=()=>{S&&s&&s("rightclick",{_event:{id:p.label},...S}),A&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:A,loop:!1})};p.on("rightclick",w)}let E=i?.filter(A=>A.targetId===c)||[];for(let A of E){let S=l.getVersion();l.track(S),o.dispatch({type:"START",payload:{id:A.id,element:p,properties:A.properties,targetState:{x:u,y:d,alpha:m},onComplete:()=>{l.complete(S)}}})}};var _l=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of _l(e))t.add(i);return t};var aP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=_l(u),f=e.find(g=>d.has(g.targetId));(!Et(c,u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var bl=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})=>{t.sortableChildren=!0;let c=new Map(l.map(m=>[m.type,m])),u=new Map;for(let m=0;m<i.length;m++)u.set(i[m].id,m);let{toAddElement:d,toDeleteElement:f,toUpdateElement:g}=aP(e,i,s);for(let m of t.children){let p=u.get(m.label);p!==void 0&&(m.zIndex=p)}for(let m of f){let p=c.get(m.type);if(!p)throw new Error(`No plugin found for element type: ${m.type}`);p.delete({app:r,parent:t,element:m,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})}for(let m of d){let p=c.get(m.type);if(!p)throw new Error(`No plugin found for element type: ${m.type}`);let _=u.get(m.id)??-1;p.add({app:r,parent:t,element:m,animations:s,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,zIndex:_,signal:h})}for(let{prev:m,next:p}of g){let _=c.get(p.type);if(!_)throw new Error(`No plugin found for element type: ${p.type}`);let y=u.get(p.id)??-1;_.update({app:r,parent:t,prevElement:m,nextElement:p,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,zIndex:y,signal:h})}};var lP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,zIndex:l,completionTracker:h,signal:c})=>{let u=t.children.find(_=>_.label===e.id);if(!u)return;u.zIndex=l;let{x:d,y:f,alpha:g}=i,m=()=>{if(!Et(e,i)){u.x=Math.round(d),u.y=Math.round(f),u.label=i.id,u.alpha=g,u.removeAllListeners("pointerover"),u.removeAllListeners("pointerout"),u.removeAllListeners("pointerup"),u.removeAllListeners("rightclick");let b=i?.hover,E=i?.click,A=i?.rightClick;if(b){let{cursor:P,soundSrc:C,actionPayload:M}=b;u.eventMode="static";let I=()=>{M&&s&&s("hover",{_event:{id:u.label},...M}),P&&(u.cursor=P),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},k=()=>{u.cursor="auto"};u.on("pointerover",I),u.on("pointerout",k)}if(E){let{soundSrc:P,soundVolume:C,actionPayload:M}=E;u.eventMode="static";let I=()=>{M&&s&&s("click",{_event:{id:u.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(C??1e3)/1e3})};u.on("pointerup",I)}if(A){let{soundSrc:P,actionPayload:C}=A;u.eventMode="static";let M=()=>{C&&s&&s("rightclick",{_event:{id:u.label},...C}),P&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:P,loop:!1})};u.on("rightclick",M)}let S=e.scroll||e.anchorToBottom,w=i.scroll||i.anchorToBottom;S!==w?w?yl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):Og({container:u}):w&&(Og({container:u}),yl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}))}let _=!Et(e.children,i.children),y=_l({children:i.children}),v=o?.some(b=>y.has(b.targetId));if(_||v){let E=u.children.find(A=>A.label===`${i.id}-content`)||u;bl({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,signal:c})}},p=o?.filter(_=>_.targetId===e.id)||[];if(p.length>0)for(let _ of p){let y=h.getVersion();h.track(y),n.dispatch({type:"START",payload:{id:_.id,element:u,properties:_.properties,targetState:{x:d,y:f,alpha:g},onComplete:()=>{h.complete(y),m()}}})}else m()};var hP=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=s?.filter(c=>c.targetId===e.id)||[],h=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};if(l.length===0){h();return}for(let c of l){let u=n.getVersion();n.track(u),i.dispatch({type:"START",payload:{id:c.id,element:a,properties:c.properties,targetState:null,onComplete:()=>{n.complete(u),h()}}})}};var cP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,g=0,m=0,p=0;for(let v=0;v<o.length;v++){let b=v<o.length-1?s:0,E=o[v];v>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=g,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let A=t.find(S=>S.type===E.type);if(A){let S=(E.scaleX??1)*(r.scaleX??1),w=(E.scaleY??1)*(r.scaleY??1);E=A.parse({state:{...E,scaleX:S,scaleY:w},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+m>r.width&&!i&&!r.anchorToBottom?(h=0,m=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+b,m=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+p>r.height&&!i&&!r.anchorToBottom?(c=0,p=0,g+=d+s,d=E.width,E.x=g,E.y=0):d=Math.max(d,E.width),c+=E.height+b,p=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let y={...we({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(y.rightClick=r.rightClick),y};var Gk=ce({type:"container",add:nP,update:lP,delete:hP,parse:cP});function No(r,t){let e=r.text.substring(0,t),s=Kt.measureText(e,r.style).width;return r.x+s}var Uk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),Ho=Uk;var uP=async({parent:r,element:t,completionTracker:e,zIndex:i,signal:s})=>{if(s?.aborted)return;let o=e.getVersion();e.track(o);let n=t.speed??50,a=t.revealEffect??"typewriter",l=t?.indicator?.offset??12,h=a==="none",c=h?0:Math.max(1,Math.floor(1e3/n)),u=h?0:Math.max(1,Math.floor(4e3/n)),d=new yt;d.label=t.id,d.zIndex=i;let f=new Gt(R.EMPTY);if(t?.indicator?.revealing?.src){let g=t.indicator.revealing.src?R.from(t.indicator.revealing.src):R.EMPTY;f=new Gt(g),f.width=t.indicator.revealing.width??g.width,f.height=t.indicator.revealing.height??g.height}d.addChild(f),t.x!==void 0&&(d.x=Math.round(t.x)),t.y!==void 0&&(d.y=Math.round(t.y)),t.alpha!==void 0&&(d.alpha=t.alpha),r.addChild(d);try{for(let g=0;g<t.content.length;g++){if(s?.aborted||d.destroyed)return;let m=t.content[g];f.x=l,f.y=m.y+(m.lineMaxHeight-f.height);for(let p=0;p<m.lineParts.length;p++){if(s?.aborted||d.destroyed)return;let _=m.lineParts[p],y=new Bt(_.textStyle),v=new Er({text:"",style:y,x:Math.round(_.x),y:Math.round(_.y)}),b=null;if(_.furigana){let S=new Bt(_.furigana.textStyle);b=new Er({text:"",style:S,x:Math.round(_.furigana.x),y:Math.round(_.furigana.y)}),d.addChild(b)}d.addChild(v);let E=_.text,A=_.furigana?.text||"";if(h)v.text=E,f.x=No(v,E.length-1)+l,b&&(b.text=A);else{let S=A.length;for(let w=0;w<E.length;w++){if(s?.aborted||d.destroyed)return;v.text=E.substring(0,w+1),f.x=No(v,w)+l;let P=Math.round((w+1)/E.length*S);b&&(b.text=A.substring(0,P)),w<E.length-1&&await Ho(c,s)}}}g<t.content.length-1&&await Ho(u,s)}if(s?.aborted||d.destroyed)return;if(t?.indicator?.complete?.src){let g=t.indicator.complete.src?R.from(t.indicator.complete.src):R.EMPTY;f.texture=g,f.width=t.indicator.complete.width??g.width,f.height=t.indicator.complete.height??g.height}e.complete(o)}catch(g){if(g?.name!=="AbortError"&&!s?.aborted)throw g}};var dP=async r=>{let{parent:t,nextElement:e,completionTracker:i,zIndex:s,signal:o}=r;if(o?.aborted)return;let n=e.speed??50,a=e.revealEffect??"typewriter",l=e?.indicator?.offset??12,h=a==="none",c=h?0:Math.max(1,Math.floor(1e3/n)),u=h?0:Math.max(1,Math.floor(4e3/n)),d=t.children.find(g=>g.label===e.id);if(!d)return;let f=i.getVersion();i.track(f);try{d.zIndex=s,d.removeChildren();let g=new Gt(R.EMPTY);if(e?.indicator?.revealing?.src){let m=e.indicator.revealing.src?R.from(e.indicator.revealing.src):R.EMPTY;g=new Gt(m),g.width=e.indicator.revealing.width??m.width,g.height=e.indicator.revealing.height??m.height}d.addChild(g),e.x!==void 0&&(d.x=e.x),e.y!==void 0&&(d.y=e.y),e.alpha!==void 0&&(d.alpha=e.alpha);for(let m=0;m<e.content.length;m++){if(o?.aborted||d.destroyed)return;let p=e.content[m];g.x=l,g.y=p.y+(p.lineMaxHeight-g.height);for(let _=0;_<p.lineParts.length;_++){if(o?.aborted||d.destroyed)return;let y=p.lineParts[_],v=new Bt(y.textStyle),b=new Er({text:"",style:v,x:y.x,y:y.y}),E=null;if(y.furigana){let w=new Bt(y.furigana.textStyle);E=new Er({text:"",style:w,x:y.furigana.x,y:y.furigana.y}),d.addChild(E)}d.addChild(b);let A=y.text,S=y.furigana?.text||"";if(h)b.text=A,g.x=No(b,A.length-1)+l,E&&(E.text=S);else{let w=S.length;for(let P=0;P<A.length;P++){if(o?.aborted||d.destroyed)return;b.text=A.substring(0,P+1),g.x=No(b,P)+l;let C=Math.round((P+1)/A.length*w);E&&(E.text=S.substring(0,C)),P<A.length-1&&await Ho(c,o)}}}m<e.content.length-1&&await Ho(u,o)}if(o?.aborted||d.destroyed)return;if(e?.indicator?.complete?.src){let m=e.indicator.complete.src?R.from(e.indicator.complete.src):R.EMPTY;g.texture=m,g.width=e.indicator.complete.width??m.width,g.height=e.indicator.complete.height??m.height}i.complete(f)}catch(g){if(g?.name!=="AbortError"&&!o?.aborted)throw g}};var fP=({parent:r,element:t})=>{let e=r.getChildByLabel(t.id);e&&!e.destroyed&&e.destroy({children:!0})};var Ok=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},g=Kt.measureText(u.text,new Bt(f));if(g.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=g.lines[0];g.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let p=Kt.measureText(m,new Bt({...u.textStyle,wordWrap:!1,breakWords:!1})),_={text:m,textStyle:f,height:p.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let v=Kt.measureText(u.furigana.text,new Bt(u.furigana.textStyle)),b=-v.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(g.lineWidths[0]-v.width)/2),y:b};_.furigana=E}i.push(_),n=Math.max(n,p.height),s+=Math.round(g.lineWidths[0]),a=Math.max(a,s);let y=g.lines.slice(1).join(" ");y&&y.length>0?u.text=y:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let g=f.height;f.height&&delete f.height;let m=f.y+(d-g),p=f.furigana;return p&&(p.y=p.y-f.y+m),{...f,...p&&{furigana:p},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},pP=({state:r})=>{let t={...Ue,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let g={...t,...c.furigana.textStyle||{}};g.lineHeight=Math.round(g.lineHeight*g.fontSize),r.width&&(g.wordWrapWidth=r.width,g.wordWrap=!0),d={text:String(c.furigana.text),textStyle:g}}return{text:String(c.text).replace(/ +$/,g=>"\xA0".repeat(g.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Ok(e,i),a=r.width||o,h=we({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Lk=ce({type:"text-revealing",add:uP,update:dP,delete:fP,parse:pP});var Cu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Ru=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var mP=async({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let{id:l,x:h,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:g,animation:m,alpha:p}=e,_=g,y=Object.keys(_.frames),v=new wi(R.from(f),_);if(await v.parse(),a?.aborted||t.destroyed)return;let b=m.frames.map(S=>v.textures[y[S]]),E=new xl(b);E.label=l,E.zIndex=n,E.animationSpeed=m.animationSpeed??.5,E.loop=m.loop??!0,r.debug?Cu(E,l,r.debug):E.play(),E.x=Math.round(h),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=p,t.addChild(E);let A=i?.filter(S=>S.targetId===l)||[];for(let S of A){let w=o.getVersion();o.track(w),s.dispatch({type:"START",payload:{id:S.id,element:E,properties:S.properties,targetState:{x:h,y:c,width:u,height:d,alpha:p},onComplete:()=>{o.complete(w)}}})}};var gP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let c=async()=>{if(!(l?.aborted||h.destroyed)&&!Et(e,i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,!Et(e.animation,i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let _=i.spritesheetData,y=Object.keys(_.frames),v=new wi(R.from(i.spritesheetSrc),_);if(await v.parse(),l?.aborted||h.destroyed)return;let b=i.animation.frames.map(E=>v.textures[y[E]]);h.textures=b,r.debug?e.id!==i.id&&(Ru(h),Cu(h,i.id,r.debug)):h.play()}},{x:u,y:d,width:f,height:g,alpha:m}=i,p=s?.filter(_=>_.targetId===e.id)||[];if(p.length>0)for(let _ of p){let y=n.getVersion();n.track(y),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:u,y:d,width:f,height:g,alpha:m},onComplete:async()=>{n.complete(y),await c()}}})}else await c()};var xP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&Ru(n),n&&!n.destroyed&&(n.stop(),n.destroy())},l=i?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),s.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var yP=({state:r})=>({...we(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Dk=ce({type:"animated-sprite",add:mP,update:gP,delete:xP,parse:yP});var Nk=kg({type:"tween"});var ps=new Map,Hk=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),_P=r=>ps.has(r),vl=r=>{let t=ps.get(r);t!==void 0&&(clearTimeout(t),ps.delete(r))},Lg=({app:r,element:t})=>{let e=Hk(t);if(vl(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{ps.delete(e.id),r.audioStage.add(e)},t.delay);ps.set(e.id,i);return}r.audioStage.add(e)},Dg=()=>{for(let r of ps.values())clearTimeout(r);ps.clear()},bP=({app:r,element:t})=>{Lg({app:r,element:t})};var vP=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),Lg({app:r,element:e});return}if(_P(i)){vl(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var TP=({app:r,element:t})=>{vl(t.id),r.audioStage.remove(t.id)};var Vk=Gg({type:"sound",add:bP,update:vP,delete:TP});var Tl=class extends Gt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ng(r){let t=new he;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Hg(r){let t=new he;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Vg(r){let t=new he;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Sl(r,t,e){return r+(t-r)*e}function Bu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function SP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(Sl(i,n,e)),c=Math.round(Sl(s,a,e)),u=Math.round(Sl(o,l,e));return h<<16|c<<8|u}var Mu=class r{constructor(t,e,i=!1){this.value=i?Bu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},wr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Mu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?SP(e.value,e.next.value,i):Sl(e.value,e.next.value,i)}};var Iu=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Fu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var ku=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Gu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Wk=Math.PI/180,Uu=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Ou=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Lu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Wk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Tht=Math.PI/180,Du=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Nu=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Oi=Math.PI/180,Hu=class{static type="rotation";constructor(t){this.minStart=t.minStart*Oi,this.maxStart=t.maxStart*Oi,this.minSpeed=t.minSpeed*Oi,this.maxSpeed=t.maxSpeed*Oi,this.accel=(t.accel??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Vu=class{static type="rotationStatic";constructor(t){this.min=t.min*Oi,this.max=t.max*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Wu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var zu=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},$u=class{static type="colorStatic";constructor(t){this.color=Bu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var ju=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},Xu=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Wg=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},zg=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},zk={rect:ju,rectangle:ju,torus:Xu,circle:Xu,point:Wg,line:zg};var Yu=class{static type="spawnShape";constructor(t){let e=zk[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},qu=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var EP=new Map,wP=new Map;function $g(r,t){EP.set(r,t)}function Ae(r){wP.set(r.type,r)}function AP(r,t){let e=EP.get(r);return e?e(t):null}function PP(r){return wP.get(r)}$g("circle",Vg);$g("snowflake",Ng);$g("raindrop",Hg);Ae(Iu);Ae(Fu);Ae(ku);Ae(Gu);Ae(Uu);Ae(Ou);Ae(Lu);Ae(Du);Ae(Nu);Ae(Hu);Ae(Vu);Ae(Wu);Ae(zu);Ae($u);Ae(Yu);Ae(qu);var Ku=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var El=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new Ku(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=PP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new Tl(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function $k(r,t){let e=new he,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var wl=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let a=new yt;a.label=e.id,a.zIndex=n,t.addChild(a);let l=e.width,h=e.height;a.x=e.x??0,a.y=e.y??0;let c={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},u;if(typeof e.texture=="object"&&e.texture.shape)u=$k(r,e.texture);else{let m=e.texture??"circle";if(u=AP(m,r),!u)try{u=R.from(m)}catch{console.warn(`Failed to load particle texture: ${m}`);return}}c.texture=u;let d=new El(a,c);if(a.emitter=d,c.recycleOnBounds){let m=Math.min(e.count??100,c.maxParticles);d.spawn(m);let p=d._activeFirst;for(;p;)p.y=d.random()*h,p.age=d.random()*p.maxLife*.8,p=p.next}let f=m=>{if(d.destroyed){r.ticker.remove(f);return}d.update(m.deltaTime/60)};if(a.tickerCallback=f,r?.debug){let m=p=>{if(d.destroyed){window.removeEventListener("snapShotKeyFrame",m);return}p?.detail?.deltaMS&&d.update(Number(p.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",m),a.customTickerHandler=m}else r.ticker.add(f);e.alpha!==void 0&&(a.alpha=e.alpha);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=o.getVersion();o.track(p),s.dispatch({type:"START",payload:{id:m.id,element:a,properties:m.properties,targetState:{x:e.x??0,y:e.y??0,alpha:e.alpha},onComplete:()=>{o.complete(p)}}})}};var Zu=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))},l=s?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),i.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var CP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){wl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}l.zIndex=a,jk(e,i)?(Zu({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),wl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})):(i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y))};function jk(r,t){return r.count!==t.count||!Et(r.texture,t.texture)||!Et(r.behaviors,t.behaviors)||!Et(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function RP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).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 MP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function BP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function IP(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 FP(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 kP(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 GP=({state:r})=>{RP(r),MP(r),BP(r),IP(r),FP(r),kP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var Xk=ce({type:"particles",add:wl,update:CP,delete:Zu,parse:GP});var UP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var jg=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=UP(t,e);for(let a of o){let l=i.find(h=>h.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(h=>h.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 h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),Xg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Xg||{}),Qu=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Qu||{}),Q=(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))(Q||{}),Vo=(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))(Vo||{}),O=(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))(O||{}),ci=(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))(ci||{}),st=(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))(st||{}),N=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(N||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Al=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Al||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),Qe=(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))(Qe||{}),Li=(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))(Li||{}),Ju=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ju||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),ie=(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))(ie||{});var Ct=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Ct||{}),je=(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))(je||{});var Yg={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:Yg,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Mf();var Yk=Si.default??Si,Pr=Yk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var vs=$i(LP(),1),DU=$i(pc(),1);var Cx=$i(tM(),1);var eM={};function ct(r,t,e=3){if(eM[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1144
|
+
`,Vo=null,bl=class{constructor(){Vo||(Vo=URL.createObjectURL(new Blob([qk],{type:"application/javascript"}))),this.worker=new Worker(Vo)}};bl.revokeObjectURL=function(){Vo&&(URL.revokeObjectURL(Vo),Vo=null)};var K1=0,Xg,jg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Ho;e.addEventListener("message",i=>{e.terminate(),Ho.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Xg===void 0&&(Xg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Xg&&(this._createdWorkers++,t=new bl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[K1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:K1++,id:i})}},Yg=new jg;si();var Kk=[".jpeg",".jpg",".png",".webp",".avif"],Zk=["image/jpeg","image/png","image/webp","image/avif"];async function Qk(r,t){let e=await X.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Mu={name:"loadTextures",extension:{type:T.LoadParser,priority:ge.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return cr(r,Zk)||ur(r,Kk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Yg.isImageBitmapSupported()?i=await Yg.loadImageBitmap(r,t):i=await Qk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Lo(r),...t.data});return Do(s,e,r)},unload(r){r.destroy(!0)}};B();lp();ap();var Z1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Jk=Z1.map(r=>`video/${r.substring(1)}`);function t2(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=r2(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function e2(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function r2(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Q1={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=cr(r,Jk),e=ur(r,Z1);return t||e},async load(r,t,e){let i={...Js.defaultOptions,resolution:t.data?.resolution||Lo(r),alphaMode:t.data?.alphaMode||await sc(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),t2(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=Js.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new Js({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await e2(s),l(Do(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};B();Ks();B();Ks();var Iu={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Mu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var J1={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Iu.parse};Ks();Hn();Jh();var Bu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new Ru,this.cache=bt,this._backgroundLoader=new Pu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){D("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ss(t),s=Fe(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),bt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Fe(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Fe(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},wr=new Bu;U.handleByList(T.LoadParser,wr.loader.parsers).handleByList(T.ResolveParser,wr.resolver.parsers).handleByList(T.CacheParser,wr.cache.parsers).handleByList(T.DetectionParser,wr.detections);U.add(L1,H1,D1,$1,V1,W1,z1,X1,j1,Y1,q1,Mu,Q1,O1,U1,Iu,J1);var tP={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};U.handle(T.Asset,r=>{let t=r.ref;Object.entries(tP).filter(([e])=>!!t[e]).forEach(([e,i])=>U.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(tP).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});_t();Un();qs();zn();var vl=class r extends Pt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof R?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(le.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof R)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(le.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(le.shared.add(this.update,this),this._isConnectedToTicker=!0))}};kh();Wt();Qh();var Fu=class extends Ai{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new ve({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function eP(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&($(et,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}fa();fs();var Er=class extends Fu{constructor(...t){let e=eP(t,"Text");super(e,kt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};si();mt();ae();lg();_t();up();_r();Pm();zn();fa();fs();rp();Ee();var i2=Yi(vc(),1);U.add(cw,dw);var s2=new(window.AudioContext||window.webkitAudioContext),qg={},o2=async(r,t)=>{if(!qg[r]&&t.byteLength!==0)try{let e=await s2.decodeAudioData(t);qg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},n2=r=>qg[r],Wo={load:o2,getAsset:n2};var ue=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Kg=({type:r})=>({type:r});var Zg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var rP={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var iP={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var gs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Oe={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Oe.fill,fontFamily:t?.fontFamily??Oe.fontFamily,fontSize:t?.fontSize??Oe.fontSize,align:t?.align??Oe.align,lineHeight:t?.lineHeight??Oe.lineHeight,wordWrap:t?.wordWrap??Oe.wordWrap,breakWords:t?.breakWords??Oe.breakWords,strokeColor:t?.strokeColor??Oe.strokeColor,strokeWidth:t?.strokeWidth??Oe.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Oe.wordWrapWidth};r.style=e};var sP=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},ku=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),a2=(r,t)=>ku(r,t).filter(e=>e.type==="live"),Gu=(r,t)=>ku(r,t).find(e=>e.type==="replace")??null,Z=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n})=>{let a=a2(r,t);if(a.length===0)return!1;for(let l of a){let h=i.getVersion();i.track(h),e.dispatch({type:"START",payload:{id:l.id,element:s,properties:l.tween,targetState:o,onComplete:()=>{i.complete(h),n?.(l)}}})}return!0};var oP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=new Er({label:e.id});l.zIndex=a,l.text=e.content,dr(l,e.textStyle),l.alpha=e.alpha,l.x=e.x,l.y=e.y;let h=e?.hover,c=e?.click,u=e?.rightClick,d={isHovering:!1,isPressed:!1,isRightPressed:!1},f=({isHovering:m,isPressed:g,isRightPressed:p})=>{p&&u?.textStyle?dr(l,u.textStyle):g&&c?.textStyle?dr(l,c.textStyle):m&&h?.textStyle?dr(l,h.textStyle):dr(l,e.textStyle)};if(h){let{cursor:m,soundSrc:g,actionPayload:p}=h;l.eventMode="static";let v=()=>{d.isHovering=!0,p&&s&&s("hover",{_event:{id:l.label},...p}),m&&(l.cursor=m),g&&r.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1}),f(d)},y=()=>{d.isHovering=!1,l.cursor="auto",f(d)};l.on("pointerover",v),l.on("pointerout",y)}if(c){let{soundSrc:m,soundVolume:g,actionPayload:p}=c;l.eventMode="static";let v=()=>{d.isPressed=!0,f(d)},y=()=>{d.isPressed=!1,f(d),p&&s&&s("click",{_event:{id:l.label},...p}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(g??1e3)/1e3})},_=()=>{d.isPressed=!1,f(d)};l.on("pointerdown",v),l.on("pointerup",y),l.on("pointerupoutside",_)}if(u){let{soundSrc:m,actionPayload:g}=u;l.eventMode="static";let p=()=>{d.isRightPressed=!0,f(d)},v=()=>{d.isRightPressed=!1,f(d),g&&s&&s("rightclick",{_event:{id:l.label},...g}),m&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:m,loop:!1})},y=()=>{d.isRightPressed=!1,f(d)};l.on("rightdown",p),l.on("rightup",v),l.on("rightupoutside",y)}t.addChild(l),Z({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:e.x,y:e.y,alpha:e.alpha}})};var l2=Object.prototype.hasOwnProperty,wt=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!wt(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!l2.call(t,n)||!wt(r[n],t[n]))return!1;return!0};var nP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(g=>g.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,alpha:d}=i,f=()=>{if(!wt(e,i)){h.text=i.content,dr(h,i.textStyle),h.x=c,h.y=u,h.alpha=d,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let g=i?.hover,p=i?.click,v=i?.rightClick,y={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:w,isPressed:E,isRightPressed:b})=>{b&&v?.textStyle?dr(h,v.textStyle):E&&p?.textStyle?dr(h,p.textStyle):w&&g?.textStyle?dr(h,g.textStyle):dr(h,i.textStyle)};if(g){let{cursor:w,soundSrc:E,actionPayload:b}=g;h.eventMode="static";let S=()=>{y.isHovering=!0,b&&s&&s("hover",{_event:{id:h.label},...b}),w&&(h.cursor=w),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1}),_(y)},P=()=>{y.isHovering=!1,h.cursor="auto",_(y)};h.on("pointerover",S),h.on("pointerout",P)}if(p){let{soundSrc:w,soundVolume:E,actionPayload:b}=p;h.eventMode="static";let S=()=>{y.isPressed=!0,_(y)},P=()=>{y.isPressed=!1,_(y),b&&s&&s("click",{_event:{id:h.label},...b}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(E??1e3)/1e3})},A=()=>{y.isPressed=!1,_(y)};h.on("pointerdown",S),h.on("pointerup",P),h.on("pointerupoutside",A)}if(v){let{soundSrc:w,actionPayload:E}=v;h.eventMode="static";let b=()=>{y.isRightPressed=!0,_(y)},S=()=>{y.isRightPressed=!1,_(y),E&&s&&s("rightclick",{_event:{id:h.label},...E}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})},P=()=>{y.isRightPressed=!1,_(y)};h.on("rightdown",b),h.on("rightup",S),h.on("rightupoutside",P)}}};Z({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:h,targetState:{x:c,y:u,alpha:d},onComplete:()=>{f()}})||f()};var aP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;Z({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var lP=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Pe=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(gs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(gs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===gs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=lP({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var hP=({state:r})=>{let t={...Oe,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Qt.measureText(e,new kt(t)),o=Math.round(i),n=Math.round(s);return{...Pe({...r,width:o,height:n}),content:e,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var h2=ue({type:"text",add:oP,update:nP,delete:aP,parse:hP});var cP=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a})=>{let{id:l,x:h,y:c,width:u,height:d,fill:f,border:m,alpha:g}=e,p=new ce;p.label=l,p.zIndex=n,(()=>{p.clear(),p.rect(0,0,Math.round(u),Math.round(d)).fill(f),p.x=Math.round(h),p.y=Math.round(c),p.alpha=g,m&&p.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let y=e?.hover,_=e?.click,w=e?.rightClick,E=e?.scroll,b=e?.drag;if(y){let{cursor:S,soundSrc:P,actionPayload:A}=y;p.eventMode="static";let C=()=>{A&&o&&o("hover",{_event:{id:p.label},...A}),S&&(p.cursor=S),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},M=()=>{p.cursor="auto"};p.on("pointerover",C),p.on("pointerout",M)}if(_){let{soundSrc:S,soundVolume:P,actionPayload:A}=_;p.eventMode="static";let C=()=>{A&&o&&o("click",{_event:{id:p.label},...A}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(P??1e3)/1e3})};p.on("pointerup",C)}if(w){let{soundSrc:S,actionPayload:P}=w;p.eventMode="static";let A=()=>{P&&o&&o("rightclick",{_event:{id:p.label},...P}),S&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:S,loop:!1})};p.on("rightclick",A)}if(E){p.eventMode="static";let S=P=>{if(P.deltaY<0&&E.up){let{actionPayload:A}=E.up;A&&o&&o("scrollup",{_event:{id:p.label},...A})}else if(P.deltaY>0&&E.down){let{actionPayload:A}=E.down;A&&o&&o("scrolldown",{_event:{id:p.label},...A})}};p.on("wheel",S)}if(b){let{start:S,end:P,move:A}=b;p.eventMode="static";let C=()=>{p._isDragging=!0,S&&o&&o("drag-start",{_event:{id:p.label},...typeof S?.actionPayload=="object"?S.actionPayload:{}})},M=()=>{p._isDragging=!1,P&&o&&o("drag-end",{_event:{id:p.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},I=k=>{A&&o&&p._isDragging&&o("drag-move",{_event:{id:p.label,x:k.global.x,y:k.global.y},...typeof A?.actionPayload=="object"?A.actionPayload:{}})};p.on("pointerdown",C),p.on("pointerup",M),p.on("globalpointermove",I),p.on("pointerupoutside",M)}t.addChild(p),Z({animations:i,targetId:l,animationBus:s,completionTracker:a,element:p,targetState:{x:h,y:c,alpha:g}})};var uP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:m,border:g,alpha:p}=i,v=()=>{if(!wt(e,i)){h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(m),h.x=Math.round(c),h.y=Math.round(u),h.alpha=p,g&&h.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let _=i?.hover,w=i?.click,E=i?.rightClick,b=i?.scroll,S=i?.drag;if(_){let{cursor:P,soundSrc:A,actionPayload:C}=_;h.eventMode="static";let M=()=>{C&&n&&n("hover",{_event:{id:h.label},...C}),P&&(h.cursor=P),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},I=()=>{h.cursor="auto"};h.on("pointerover",M),h.on("pointerout",I)}if(w){let{soundSrc:P,soundVolume:A,actionPayload:C}=w;h.eventMode="static";let M=()=>{C&&n&&n("click",{_event:{id:h.label},...C}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(A??1e3)/1e3})};h.on("pointerup",M)}if(E){let{soundSrc:P,actionPayload:A}=E;h.eventMode="static";let C=()=>{A&&n&&n("rightclick",{_event:{id:h.label},...A}),P&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:P,loop:!1})};h.on("rightclick",C)}if(b){h.eventMode="static";let P=A=>{if(A.deltaY<0&&b.up){let{actionPayload:C}=b.up;C&&n&&n("scrollup",{_event:{id:h.label},...C})}else if(A.deltaY>0&&b.down){let{actionPayload:C}=b.down;C&&n&&n("scrolldown",{_event:{id:h.label},...C})}};h.on("wheel",P)}if(S){let{start:P,end:A,move:C}=S;h.eventMode="static";let M=()=>{h._isDragging=!0,P&&n&&n("drag-start",{_event:{id:h.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},I=()=>{h._isDragging=!1,A&&n&&n("drag-end",{_event:{id:h.label},...typeof A?.actionPayload=="object"?A.actionPayload:{}})},k=G=>{C&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:G.global.x,y:G.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};h.on("pointerdown",M),h.on("pointerup",I),h.on("globalpointermove",k),h.on("pointerupoutside",I)}}};Z({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:h,targetState:{x:c,y:u,alpha:p},onComplete:()=>{v()}})||v()};var dP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;Z({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var fP=({state:r})=>{let t=Pe(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var c2=ue({type:"rect",add:cP,update:uP,delete:dP,parse:fP});var pP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,alpha:m}=e,g=f?R.from(f):R.EMPTY,p=new Pt(g);p.label=l,p.zIndex=a,p.x=Math.round(h),p.y=Math.round(c),p.width=Math.round(u),p.height=Math.round(d),p.alpha=m;let v=e?.hover,y=e?.click,_=e?.rightClick,w={isHovering:!1,isPressed:!1,isRightPressed:!1},E=({isHovering:b,isPressed:S,isRightPressed:P})=>{if(P&&_?.src){let A=R.from(_.src);p.texture=A}else if(S&&y?.src){let A=R.from(y.src);p.texture=A}else if(b&&v?.src){let A=R.from(v.src);p.texture=A}else p.texture=g};if(v){let{cursor:b,soundSrc:S,actionPayload:P}=v;p.eventMode="static";let A=()=>{w.isHovering=!0,P&&s&&s("hover",{_event:{id:p.label},...P}),b&&(p.cursor=b),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1}),E(w)},C=()=>{w.isHovering=!1,p.cursor="auto",E(w)};p.on("pointerover",A),p.on("pointerout",C)}if(y){let{soundSrc:b,soundVolume:S,actionPayload:P}=y;p.eventMode="static";let A=()=>{w.isPressed=!0,E(w)},C=()=>{w.isPressed=!1,E(w),P&&s&&s("click",{_event:{id:p.label},...P}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1,volume:(S??1e3)/1e3})},M=()=>{w.isPressed=!1,E(w)};p.on("pointerdown",A),p.on("pointerup",C),p.on("pointerupoutside",M)}if(_){let{soundSrc:b,actionPayload:S}=_;p.eventMode="static";let P=()=>{w.isRightPressed=!0,E(w)},A=()=>{w.isRightPressed=!1,E(w),S&&s&&s("rightclick",{_event:{id:p.label},...S}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},C=()=>{w.isRightPressed=!1,E(w)};p.on("rightdown",P),p.on("rightup",A),p.on("rightupoutside",C)}t.addChild(p),Z({animations:i,targetId:l,animationBus:o,completionTracker:n,element:p,targetState:{x:h,y:c,width:u,height:d,alpha:m}})};var mP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:m,src:g,alpha:p}=i,v=()=>{if(!wt(e,i)){let _=g?R.from(g):R.EMPTY;h.texture=_,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(m),h.alpha=p,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let w=i?.hover,E=i?.click,b=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},P=({isHovering:A,isPressed:C,isRightPressed:M})=>{if(M&&b?.src){let I=R.from(b.src);h.texture=I}else if(C&&E?.src){let I=R.from(E.src);h.texture=I}else if(A&&w?.src){let I=R.from(w.src);h.texture=I}else h.texture=_};if(w){let{cursor:A,soundSrc:C,actionPayload:M}=w;h.eventMode="static";let I=()=>{S.isHovering=!0,M&&a&&a("hover",{_event:{id:h.label},...M}),A&&(h.cursor=A),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1}),P(S)},k=()=>{S.isHovering=!1,h.cursor="auto",P(S)};h.on("pointerover",I),h.on("pointerout",k)}if(E){let{soundSrc:A,soundVolume:C,actionPayload:M}=E;h.eventMode="static";let I=()=>{S.isPressed=!0,P(S)},k=()=>{S.isPressed=!1,P(S),M&&a&&a("click",{_event:{id:h.label},...M}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(C??1e3)/1e3})},G=()=>{S.isPressed=!1,P(S)};h.on("pointerdown",I),h.on("pointerup",k),h.on("pointerupoutside",G)}if(b){let{soundSrc:A,actionPayload:C}=b;h.eventMode="static";let M=()=>{S.isRightPressed=!0,P(S)},I=()=>{S.isRightPressed=!1,P(S),C&&a&&a("rightclick",{_event:{id:h.label},...C}),A&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:A,loop:!1})},k=()=>{S.isRightPressed=!1,P(S)};h.on("rightdown",M),h.on("rightup",I),h.on("rightupoutside",k)}}};Z({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:m,alpha:p},onComplete:()=>{v()}})||v()};var gP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;Z({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var xP=({state:r})=>({...Pe(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var u2=ue({type:"sprite",add:pP,update:mP,delete:gP,parse:xP});var d2=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Qg=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Uu=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(Qg({videoElement:r,video:t}),(e??!1)||d2(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var yP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,volume:m,loop:g,alpha:p}=e,v=R.from(f),y=v.source.resource;y.pause(),y.currentTime=0,y.loop=g??!1,y.volume=m/1e3,y.muted=!1;let _=new Pt(v);_.label=l,_.zIndex=a,_._videoEndedListener=void 0,_._playbackStateVersion=null,_.x=Math.round(h),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=p??1,Uu({videoElement:_,video:y,loop:g,completionTracker:n}),y.play(),t.addChild(_),Z({animations:i,targetId:l,animationBus:o,completionTracker:n,element:_,targetState:{x:h,y:c,width:u,height:d,alpha:p??1}})};var _P=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,width:d,height:f,alpha:m}=i,g=()=>{if(!wt(e,i)){h.x=Math.round(c),h.y=Math.round(u),h.width=Math.round(d),h.height=Math.round(f),h.alpha=m??1;let v=h.texture.source.resource;if(e.src!==i.src){let y=v;Qg({videoElement:h,video:y}),y&&y.pause();let _=R.from(i.src);h.texture=_,v=_.source.resource,v.muted=!1,v.pause(),v.currentTime=0}Uu({videoElement:h,video:v,loop:i.loop,completionTracker:a}),v.volume=i.volume/1e3,v.loop=i.loop??!1,e.src!==i.src&&v.play()}};Z({animations:s,targetId:e.id,animationBus:o,completionTracker:a,element:h,targetState:{x:c,y:u,width:d,height:f,alpha:m??1},onComplete:g})||g()};var bP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{if(n&&!n.destroyed){n._playbackStateVersion!==null&&o.complete(n._playbackStateVersion);let h=n.texture.source.resource;h&&(n._videoEndedListener&&h.removeEventListener("ended",n._videoEndedListener),h.pause()),t.removeChild(n),n.destroy()}};Z({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var vP=({state:r})=>({...Pe(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var f2=ue({type:"video",add:yP,update:_P,delete:bP,parse:vP});var TP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,alpha:f,thumbSrc:m,barSrc:g,direction:p,min:v,max:y,step:_,initialValue:w,originX:E,originY:b,hover:S,change:P}=e,A=new ht;A.label=l,A.zIndex=a,A.x=h,A.y=c,A.alpha=f,A.sortableChildren=!0,A.eventMode="static";let C=0,M=g?R.from(g):R.EMPTY,I=new Pt(M);I.label=`${l}-bar`,I.eventMode="static";let k=m?R.from(m):R.EMPTY,G=new Pt(k);G.label=`${l}-thumb`,G.eventMode="static";let J=w??v,H=y-v,j=Tt=>{let It=(Tt-v)/H;p==="horizontal"?(G.x=It*(I.width-G.width),G.y=(I.height-G.height)/2):(G.x=(I.width-G.width)/2,G.y=It*(I.height-G.height))};(()=>{I.width=u,I.height=d;let Tt=p==="horizontal"?d-C*2:u-C*2,It=m?R.from(m):R.EMPTY,pt=It.width,Bt=It.height,ne=Tt/pt,Kt=Tt/Bt,pe=Math.min(ne,Kt);G.width=pt*pe,G.height=Bt*pe,j(J)})();let O=k,W=M,st=!1,lt=Tt=>{let It;if(p==="horizontal"){let Bt=Tt.x-G.width/2;It=Math.max(0,Math.min(1,Bt/(I.width-G.width)))}else{let Bt=Tt.y-G.height/2;It=Math.max(0,Math.min(1,Bt/(I.height-G.height)))}let pt=v+It*H;return _>0&&(pt=Math.round((pt-v)/_)*_+v,pt=Math.max(v,Math.min(y,pt))),pt},vt=Tt=>{let It=A.toLocal(Tt.global),pt=lt(It);pt!==J&&(J=pt,j(J),P?.actionPayload&&n&&n("change",{_event:{id:l,value:J},...P.actionPayload}))},Lt=Tt=>{st=!0,vt(Tt)},Vt=Tt=>{st&&vt(Tt)},te=()=>{st&&(st=!1)};if(A.on("pointerdown",Lt),A.on("globalpointermove",Vt),A.on("pointerup",te),A.on("pointerupoutside",te),S){let{cursor:Tt,soundSrc:It,thumbSrc:pt,barSrc:Bt}=S,ne=()=>{Tt&&(I.cursor=Tt,G.cursor=Tt),It&&r.audioStage.add({id:`hover-${Date.now()}`,url:It,loop:!1}),pt&&(G.texture=R.from(pt)),Bt&&(I.texture=R.from(Bt))},Kt=()=>{st||(I.cursor="auto",G.cursor="auto",G.texture=O,I.texture=W)};A.on("pointerover",ne),A.on("pointerout",Kt),A.on("pointerupoutside",Kt)}A.addChild(I),A.addChild(G),t.addChild(A),Z({animations:i,targetId:l,animationBus:s,completionTracker:o,element:A,targetState:{x:h,y:c,alpha:f}})};var SP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(g=>g.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(!wt(e,i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let g=h.getChildByLabel(`${i.id}-bar`),p=h.getChildByLabel(`${i.id}-thumb`),v=!wt(e.hover,i.hover)||!wt(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(g&&p){g.width=i.width,g.height=i.height;let y=0,_=i.direction==="horizontal"?i.height-y*2:i.width-y*2,w=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY,E=w.width||16,b=w.height||16,S=_/E,P=_/b,A=Math.min(S,P);if(p.width=E*A,p.height=b*A,e.barSrc!==i.barSrc){let I=i.barSrc?R.from(i.barSrc):R.EMPTY;g.texture=I}if(e.thumbSrc!==i.thumbSrc){let I=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY;p.texture=I}let C=i.max-i.min,M=(i.initialValue-i.min)/C;i.direction==="horizontal"?(p.x=M*(g.width-p.width),p.y=(g.height-p.height)/2):(p.x=(g.width-p.width)/2,p.y=M*(g.height-p.height))}if(v&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),v){let{hover:y,change:_,min:w,max:E,step:b,direction:S,initialValue:P}=i,A=P??w,C=E-w;h.eventMode="static";let M=W=>{let st=(W-w)/C;S==="horizontal"?(p.x=st*(g.width-p.width),p.y=(g.height-p.height)/2):(p.x=(g.width-p.width)/2,p.y=st*(g.height-p.height))},I=W=>{let st;if(S==="horizontal"){let vt=W.x-p.width/2;st=Math.max(0,Math.min(1,vt/(g.width-p.width)))}else{let vt=W.y-p.height/2;st=Math.max(0,Math.min(1,vt/(g.height-p.height)))}let lt=w+st*C;return b>0&&(lt=Math.round((lt-w)/b)*b+w,lt=Math.max(w,Math.min(E,lt))),lt},k=p.texture,G=g.texture,J=!1,H=W=>{let st=h.toLocal(W.global),lt=I(st);lt!==A&&(A=lt,M(A),_?.actionPayload&&a&&a("change",{_event:{id:i.id,value:A},..._.actionPayload}))},j=W=>{J=!0,H(W)},V=W=>{J&&H(W)},O=()=>{J&&(J=!1)};if(h.on("pointerdown",j),h.on("globalpointermove",V),h.on("pointerup",O),h.on("pointerupoutside",O),y){let{cursor:W,soundSrc:st,thumbSrc:lt,barSrc:vt}=y,Lt=()=>{W&&(h.cursor=W,p.cursor=W),st&&r.audioStage.add({id:`hover-${Date.now()}`,url:st,loop:!1}),lt&&(p.texture=R.from(lt)),vt&&(g.texture=R.from(vt))},Vt=()=>{J||(h.cursor="auto",p.cursor="auto",p.texture=k,g.texture=G)};h.on("pointerover",Lt),h.on("pointerout",Vt),h.on("pointerupoutside",Vt)}}}},{x:u,y:d,alpha:f}=i;Z({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,alpha:f},onComplete:c})||c()};var wP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};Z({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var EP=({state:r})=>{let t=Pe(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var p2=ue({type:"slider",add:TP,update:SP,delete:wP,parse:EP});var Tl=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(h=>{s=Math.max(h.width+h.x,s),o=Math.max(h.height+h.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let h=new ht({label:`${r.label}-content`});[...r.children].forEach(p=>{h.addChild(p)}),r.addChild(h);let u=new ce({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),h.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),m=t.anchorToBottom&&n?d:0,g=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(h.y=m,h.x=g),e&&(r.eventMode="static",r.hitArea=new it(0,0,t.width||s,t.height||o),r.on("wheel",p=>{if(p.preventDefault(),n&&p.deltaY!==0){let v=m-p.deltaY;v>0?m=0:v<d?m=d:m=v,h.y=m}if(a&&(p.deltaX!==0||p.shiftKey&&p.deltaY!==0)){let v=p.deltaX!==0?p.deltaX:p.deltaY,y=g-v;y>0?g=0:y<f?g=f:g=y,h.x=g}}))}},Jg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var AP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,zIndex:a,completionTracker:l,signal:h})=>{let{id:c,x:u,y:d,children:f,scroll:m,alpha:g}=e,p=new ht;if(p.label=c,p.zIndex=a,p.x=Math.round(u),p.y=Math.round(d),p.alpha=g,t.addChild(p),f&&f.length>0)for(let E of f){let b=n.find(S=>S.type===E.type);if(!b)throw new Error(`No plugin found for child element type: ${E.type}`);b.add({app:r,parent:p,element:E,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,completionTracker:l,signal:h})}(m||e.anchorToBottom)&&Tl({container:p,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom});let y=e?.hover,_=e?.click,w=e?.rightClick;if(y){let{cursor:E,soundSrc:b,actionPayload:S}=y;p.eventMode="static";let P=()=>{S&&s&&s("hover",{_event:{id:p.label},...S}),E&&(p.cursor=E),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},A=()=>{p.cursor="auto"};p.on("pointerover",P),p.on("pointerout",A)}if(_){let{soundSrc:E,soundVolume:b,actionPayload:S}=_;p.eventMode="static";let P=()=>{S&&s&&s("click",{_event:{id:p.label},...S}),E&&r.audioStage.add({id:`click-${Date.now()}`,url:E,loop:!1,volume:(b??1e3)/1e3})};p.on("pointerup",P)}if(w){let{soundSrc:E,actionPayload:b}=w;p.eventMode="static";let S=()=>{b&&s&&s("rightclick",{_event:{id:p.label},...b}),E&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:E,loop:!1})};p.on("rightclick",S)}Z({animations:i,targetId:c,animationBus:o,completionTracker:l,element:p,targetState:{x:u,y:d,alpha:g}})};var Sl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of Sl(e))t.add(i);return t};var PP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=Sl(u),f=e instanceof Map?Array.from(e.keys()).some(m=>d.has(m)):e.find(m=>d.has(m.targetId));(!wt(c,u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var m2={linear:r=>r,easeIn:r=>r*r,easeOut:r=>1-(1-r)*(1-r),easeInOut:r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2},g2=(r="linear")=>{let t=m2[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},wl=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},El=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},Al=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*g2(o)(l)}}return r[r.length-1].value};var x2=new Set(["animated-sprite","text-revealing"]),y2={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},ex=r=>Math.min(1,Math.max(0,r)),Ou=(r,t,e)=>{if(r===t)return e<r?0:1;let i=ex((e-r)/(t-r));return i*i*(3-2*i)},MP=r=>r.getLocalBounds().rectangle.clone(),IP=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),CP=(r,t)=>{let e=IP(MP(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new Pt(i);s.x=e.x,s.y=e.y;let o=new ht;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},_2=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:wl([{value:e.initialValue??y2[t]??0},...e.keyframes])})),Lu=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=_2(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:El(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=Al(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},b2=r=>wl([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),v2=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},T2=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},tx=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new Pt(R.from(t));a.width=e,a.height=i;let l=new ht;l.addChild(a);let h=ci.create({width:e,height:i});r.renderer.render({container:l,target:h,clear:!0});let c=r.renderer.extract.pixels(h).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=T2(c,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),h.destroy(!0),n},S2=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=tx({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(e*i)},w2=(r,t,e,i)=>{let s=b2(t),o=El([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=tx({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(h,c)=>Ou(h-n,h+n,l[c]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(h=>tx({app:r,texture:h,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(h,c)=>{let u=ex(h)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),m=Math.min(l.length-1,f+1),g=u-f,p=(l[f][c]*(1-g)+l[m][c]*g)/255;return Ou(h-n,h+n,p)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Ou(h-n,h+n,l[d][c]/255)},destroy:()=>{}}}let a=S2(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,h)=>Ou(l-n,l+n,a[h]/255),destroy:()=>{}}},E2=r=>{let t=new ht;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return IP(MP(t))},RP=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new F(1,0,0,1,-i.x,-i.y)})},Du=r=>{r?.texture?.destroy(!0)},A2=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new ht;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Lu(e?.wrapper??null,t.prev?.tween,r),a=Lu(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Du(e),Du(i)}}},P2=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=E2([e,i]),n=new ht,a=new ht;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=ci.create({width:o.width,height:o.height}),h=ci.create({width:o.width,height:o.height}),{canvas:c,context:u}=v2(o.width,o.height),d=u.createImageData(o.width,o.height),f=R.from(c),m=new ht;m.zIndex=s;let g=new Pt(f);g.x=o.x,g.y=o.y,m.addChild(g);let p=w2(r,t.mask,o.width,o.height),v=Lu(e?.wrapper??null,t.prev?.tween,r),y=Lu(i?.wrapper??null,t.next?.tween,r),_=new Uint8ClampedArray(o.width*o.height*4);return{overlay:m,duration:Math.max(v.duration,y.duration,p.duration),apply:w=>{v.apply(w),y.apply(w);let E=_,b=_;e?.wrapper&&(RP({app:r,container:n,target:l,frame:o}),E=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(RP({app:r,container:a,target:h,frame:o}),b=r.renderer.extract.pixels(h).pixels);let S=ex(Al(p.progressTimeline,w)),P=d.data;for(let A=0,C=0;A<P.length;A+=4,C+=1){let M=p.sample(S,C),I=1-M;P[A]=Math.round(E[A]*I+b[A]*M),P[A+1]=Math.round(E[A+1]*I+b[A+1]*M),P[A+2]=Math.round(E[A+2]*I+b[A+2]*M),P[A+3]=Math.round(E[A+3]*I+b[A+3]*M)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{m.removeFromParent(),m.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),h.destroy(!0),f.destroy(!0),Du(e),Du(i),p.destroy()}}},C2=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?P2({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):A2({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),R2=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,zIndex:h,signal:c})=>{if(!e)return null;let u=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,zIndex:h,signal:c});if(u&&typeof u.then=="function")throw new Error(`Replace animations do not support async add pipelines for "${e.type}" yet.`);return t.children.find(d=>d.label===e.id)??null},Nu=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,plugin:c,zIndex:u,signal:d})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(i&&x2.has(i.type))throw new Error(`Replace animations are not supported for element type "${i.type}" yet.`);let f=e?t.children.find(E=>E.label===e.id)??null:null;if(e&&!f)throw new Error(`Replace animation "${s.id}" could not find the previous live element "${e.id}".`);let m=f?CP(r,f):null;f&&c.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,signal:d});let g=i?R2({app:r,parent:t,nextElement:i,plugin:c,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:h,zIndex:u,signal:d}):null;if(i&&!g)throw new Error(`Replace animation "${s.id}" could not create the next live element "${i.id}".`);let p=g?CP(r,g):null;g&&(g.visible=!1);let v=C2({app:r,animation:s,prevSubject:m,nextSubject:p,zIndex:u});t.addChild(v.overlay);let y=a.getVersion();a.track(y);let _=!1,w=()=>{_||(_=!0,g&&!g.destroyed&&(g.visible=!0),v.destroy())};n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:v.duration,applyFrame:v.apply,applyTargetState:w,onComplete:()=>{a.complete(y),w()},onCancel:()=>{a.complete(y),w()},isValid:()=>!!v.overlay&&!v.overlay.destroyed&&(!g||!g.destroyed)}})};var Pl=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})=>{t.sortableChildren=!0;let c=new Map(l.map(y=>[y.type,y])),u=sP(s),d=new Map;for(let y=0;y<i.length;y++)d.set(i[y].id,y);let{toAddElement:f,toDeleteElement:m,toUpdateElement:g}=PP(e,i,s),p=y=>{let _=c.get(y);if(!_)throw new Error(`No plugin found for element type: ${y}`);return _},v=y=>t.children.find(_=>_.label===y)?.zIndex??-1;for(let y of t.children){let _=d.get(y.label);_!==void 0&&(y.zIndex=_)}for(let y of m){let _=Gu(u,y.id),w=p(y.type);if(_){Nu({app:r,parent:t,prevElement:y,nextElement:null,animation:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:w,zIndex:v(y.id),signal:h});continue}w.delete({app:r,parent:t,element:y,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})}for(let y of f){let _=Gu(u,y.id),w=p(y.type),E=d.get(y.id)??-1;if(_){Nu({app:r,parent:t,prevElement:null,nextElement:y,animation:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:w,zIndex:E,signal:h});continue}w.add({app:r,parent:t,element:y,animations:u,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,zIndex:E,signal:h})}for(let{prev:y,next:_}of g){let w=p(_.type),E=d.get(_.id)??-1,b=Gu(u,_.id);if(b){Nu({app:r,parent:t,prevElement:y,nextElement:_,animation:b,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:w,zIndex:E,signal:h});continue}w.update({app:r,parent:t,prevElement:y,nextElement:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,zIndex:E,signal:h})}};var BP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,zIndex:l,completionTracker:h,signal:c})=>{let u=t.children.find(v=>v.label===e.id);if(!u)return;u.zIndex=l;let{x:d,y:f,alpha:m}=i,g=()=>{if(!wt(e,i)){u.x=Math.round(d),u.y=Math.round(f),u.label=i.id,u.alpha=m,u.removeAllListeners("pointerover"),u.removeAllListeners("pointerout"),u.removeAllListeners("pointerup"),u.removeAllListeners("rightclick"),u.eventMode="auto",u.cursor="auto";let w=i?.hover,E=i?.click,b=i?.rightClick,S=!!(w||E||b);if(w){let{cursor:C,soundSrc:M,actionPayload:I}=w;u.eventMode="static";let k=()=>{I&&s&&s("hover",{_event:{id:u.label},...I}),C&&(u.cursor=C),M&&r.audioStage.add({id:`hover-${Date.now()}`,url:M,loop:!1})},G=()=>{u.cursor="auto"};u.on("pointerover",k),u.on("pointerout",G)}if(E){let{soundSrc:C,soundVolume:M,actionPayload:I}=E;u.eventMode="static";let k=()=>{I&&s&&s("click",{_event:{id:u.label},...I}),C&&r.audioStage.add({id:`click-${Date.now()}`,url:C,loop:!1,volume:(M??1e3)/1e3})};u.on("pointerup",k)}if(b){let{soundSrc:C,actionPayload:M}=b;u.eventMode="static";let I=()=>{M&&s&&s("rightclick",{_event:{id:u.label},...M}),C&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:C,loop:!1})};u.on("rightclick",I)}let P=e.scroll||e.anchorToBottom,A=i.scroll||i.anchorToBottom;P!==A?A?Tl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):Jg({container:u}):A&&(Jg({container:u}),Tl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),!i.scroll&&S&&(u.eventMode="static")}let v=!wt(e.children,i.children),y=Sl({children:i.children}),_=Array.from(y).some(w=>ku(o,w).length>0);if(v||_){let E=u.children.find(b=>b.label===`${i.id}-content`)||u;Pl({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,signal:c})}};Z({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:u,targetState:{x:d,y:f,alpha:m},onComplete:()=>{g()}})||g()};var FP=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};Z({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var kP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,m=0,g=0,p=0;for(let _=0;_<o.length;_++){let w=_<o.length-1?s:0,E=o[_];_>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=m,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let b=t.find(S=>S.type===E.type);if(b){let S=(E.scaleX??1)*(r.scaleX??1),P=(E.scaleY??1)*(r.scaleY??1);E=b.parse({state:{...E,scaleX:S,scaleY:P},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+g>r.width&&!i&&!r.anchorToBottom?(h=0,g=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+w,g=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+p>r.height&&!i&&!r.anchorToBottom?(c=0,p=0,m+=d+s,d=E.width,E.x=m,E.y=0):d=Math.max(d,E.width),c+=E.height+w,p=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let y={...Pe({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(y.rightClick=r.rightClick),y};var M2=ue({type:"container",add:AP,update:BP,delete:FP,parse:kP});function zo(r,t){let e=r.text.substring(0,t),s=Qt.measureText(e,r.style).width;return r.x+s}var I2=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),$o=I2;var GP=async({parent:r,element:t,animations:e,animationBus:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=s.getVersion();s.track(a);let l=t.speed??50,h=t.revealEffect??"typewriter",c=t?.indicator?.offset??12,u=h==="none",d=u?0:Math.max(1,Math.floor(1e3/l)),f=u?0:Math.max(1,Math.floor(4e3/l)),m=new ht;m.label=t.id,m.zIndex=o;let g=new Pt(R.EMPTY);if(t?.indicator?.revealing?.src){let p=t.indicator.revealing.src?R.from(t.indicator.revealing.src):R.EMPTY;g=new Pt(p),g.width=t.indicator.revealing.width??p.width,g.height=t.indicator.revealing.height??p.height}m.addChild(g),t.x!==void 0&&(m.x=Math.round(t.x)),t.y!==void 0&&(m.y=Math.round(t.y)),t.alpha!==void 0&&(m.alpha=t.alpha),r.addChild(m),Z({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:m,targetState:{x:t.x??0,y:t.y??0,alpha:t.alpha??1}});try{for(let p=0;p<t.content.length;p++){if(n?.aborted||m.destroyed)return;let v=t.content[p];g.x=c,g.y=v.y+(v.lineMaxHeight-g.height);for(let y=0;y<v.lineParts.length;y++){if(n?.aborted||m.destroyed)return;let _=v.lineParts[y],w=new kt(_.textStyle),E=new Er({text:"",style:w,x:Math.round(_.x),y:Math.round(_.y)}),b=null;if(_.furigana){let A=new kt(_.furigana.textStyle);b=new Er({text:"",style:A,x:Math.round(_.furigana.x),y:Math.round(_.furigana.y)}),m.addChild(b)}m.addChild(E);let S=_.text,P=_.furigana?.text||"";if(u)E.text=S,g.x=zo(E,S.length-1)+c,b&&(b.text=P);else{let A=P.length;for(let C=0;C<S.length;C++){if(n?.aborted||m.destroyed)return;E.text=S.substring(0,C+1),g.x=zo(E,C)+c;let M=Math.round((C+1)/S.length*A);b&&(b.text=P.substring(0,M)),C<S.length-1&&await $o(d,n)}}}p<t.content.length-1&&await $o(f,n)}if(n?.aborted||m.destroyed)return;if(t?.indicator?.complete?.src){let p=t.indicator.complete.src?R.from(t.indicator.complete.src):R.EMPTY;g.texture=p,g.width=t.indicator.complete.width??p.width,g.height=t.indicator.complete.height??p.height}s.complete(a)}catch(p){if(p?.name!=="AbortError"&&!n?.aborted)throw p}};var UP=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let l=e.speed??50,h=e.revealEffect??"typewriter",c=e?.indicator?.offset??12,u=h==="none",d=u?0:Math.max(1,Math.floor(1e3/l)),f=u?0:Math.max(1,Math.floor(4e3/l)),m=r.children.find(v=>v.label===t.id);if(!m)return;let g=async()=>{let v=o.getVersion();o.track(v);try{m.zIndex=n,m.removeChildren();let y=new Pt(R.EMPTY);if(e?.indicator?.revealing?.src){let _=e.indicator.revealing.src?R.from(e.indicator.revealing.src):R.EMPTY;y=new Pt(_),y.width=e.indicator.revealing.width??_.width,y.height=e.indicator.revealing.height??_.height}m.addChild(y),e.x!==void 0&&(m.x=e.x),e.y!==void 0&&(m.y=e.y),e.alpha!==void 0&&(m.alpha=e.alpha);for(let _=0;_<e.content.length;_++){if(a?.aborted||m.destroyed)return;let w=e.content[_];y.x=c,y.y=w.y+(w.lineMaxHeight-y.height);for(let E=0;E<w.lineParts.length;E++){if(a?.aborted||m.destroyed)return;let b=w.lineParts[E],S=new kt(b.textStyle),P=new Er({text:"",style:S,x:b.x,y:b.y}),A=null;if(b.furigana){let I=new kt(b.furigana.textStyle);A=new Er({text:"",style:I,x:b.furigana.x,y:b.furigana.y}),m.addChild(A)}m.addChild(P);let C=b.text,M=b.furigana?.text||"";if(u)P.text=C,y.x=zo(P,C.length-1)+c,A&&(A.text=M);else{let I=M.length;for(let k=0;k<C.length;k++){if(a?.aborted||m.destroyed)return;P.text=C.substring(0,k+1),y.x=zo(P,k)+c;let G=Math.round((k+1)/C.length*I);A&&(A.text=M.substring(0,G)),k<C.length-1&&await $o(d,a)}}}_<e.content.length-1&&await $o(f,a)}if(a?.aborted||m.destroyed)return;if(e?.indicator?.complete?.src){let _=e.indicator.complete.src?R.from(e.indicator.complete.src):R.EMPTY;y.texture=_,y.width=e.indicator.complete.width??_.width,y.height=e.indicator.complete.height??_.height}o.complete(v)}catch(y){if(y?.name!=="AbortError"&&!a?.aborted)throw y}};Z({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:m,targetState:{x:e.x??m.x,y:e.y??m.y,alpha:e.alpha??m.alpha},onComplete:()=>{g()}})||await g()};var OP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&o.destroy({children:!0})};Z({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var B2=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},m=Qt.measureText(u.text,new kt(f));if(m.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let g=m.lines[0];m.lines.length===1&&u.text.endsWith(" ")&&!g.endsWith(" ")&&(g+=" ");let p=Qt.measureText(g,new kt({...u.textStyle,wordWrap:!1,breakWords:!1})),v={text:g,textStyle:f,height:p.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let _=Qt.measureText(u.furigana.text,new kt(u.furigana.textStyle)),w=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(m.lineWidths[0]-_.width)/2),y:w};v.furigana=E}i.push(v),n=Math.max(n,p.height),s+=Math.round(m.lineWidths[0]),a=Math.max(a,s);let y=m.lines.slice(1).join(" ");y&&y.length>0?u.text=y:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let m=f.height;f.height&&delete f.height;let g=f.y+(d-m),p=f.furigana;return p&&(p.y=p.y-f.y+g),{...f,...p&&{furigana:p},y:g}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},LP=({state:r})=>{let t={...Oe,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let m={...t,...c.furigana.textStyle||{}};m.lineHeight=Math.round(m.lineHeight*m.fontSize),r.width&&(m.wordWrapWidth=r.width,m.wordWrap=!0),d={text:String(c.furigana.text),textStyle:m}}return{text:String(c.text).replace(/ +$/,m=>"\xA0".repeat(m.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=B2(e,i),a=r.width||o,h=Pe({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var F2=ue({type:"text-revealing",add:GP,update:UP,delete:OP,parse:LP});var Hu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Vu=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var DP=async({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let{id:l,x:h,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:m,animation:g,alpha:p}=e,v=m,y=Object.keys(v.frames),_=new Pi(R.from(f),v);if(await _.parse(),a?.aborted||t.destroyed)return;let w=g.frames.map(b=>_.textures[y[b]]),E=new vl(w);E.label=l,E.zIndex=n,E.animationSpeed=g.animationSpeed??.5,E.loop=g.loop??!0,r.debug?Hu(E,l,r.debug):E.play(),E.x=Math.round(h),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=p,t.addChild(E),Z({animations:i,targetId:l,animationBus:s,completionTracker:o,element:E,targetState:{x:h,y:c,width:u,height:d,alpha:p}})};var NP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=a;let c=async()=>{if(!(l?.aborted||h.destroyed)&&!wt(e,i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,!wt(e.animation,i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let v=i.spritesheetData,y=Object.keys(v.frames),_=new Pi(R.from(i.spritesheetSrc),v);if(await _.parse(),l?.aborted||h.destroyed)return;let w=i.animation.frames.map(E=>_.textures[y[E]]);h.textures=w,r.debug?e.id!==i.id&&(Vu(h),Hu(h,i.id,r.debug)):h.play()}},{x:u,y:d,width:f,height:m,alpha:g}=i;Z({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:m,alpha:g},onComplete:()=>{c()}})||await c()};var HP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&Vu(n),n&&!n.destroyed&&(n.stop(),n.destroy())};Z({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var VP=({state:r})=>({...Pe(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var k2=ue({type:"animated-sprite",add:DP,update:NP,delete:HP,parse:VP});var G2=Kg({type:"tween"});var xs=new Map,U2=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),WP=r=>xs.has(r),Cl=r=>{let t=xs.get(r);t!==void 0&&(clearTimeout(t),xs.delete(r))},rx=({app:r,element:t})=>{let e=U2(t);if(Cl(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{xs.delete(e.id),r.audioStage.add(e)},t.delay);xs.set(e.id,i);return}r.audioStage.add(e)},ix=()=>{for(let r of xs.values())clearTimeout(r);xs.clear()},zP=({app:r,element:t})=>{rx({app:r,element:t})};var $P=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),rx({app:r,element:e});return}if(WP(i)){Cl(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var XP=({app:r,element:t})=>{Cl(t.id),r.audioStage.remove(t.id)};var O2=Zg({type:"sound",add:zP,update:$P,delete:XP});var Rl=class extends Pt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function sx(r){let t=new ce;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function ox(r){let t=new ce;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function nx(r){let t=new ce;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Ml(r,t,e){return r+(t-r)*e}function zu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function jP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(Ml(i,n,e)),c=Math.round(Ml(s,a,e)),u=Math.round(Ml(o,l,e));return h<<16|c<<8|u}var Wu=class r{constructor(t,e,i=!1){this.value=i?zu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Ar=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Wu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?jP(e.value,e.next.value,i):Ml(e.value,e.next.value,i)}};var $u=class{static type="alpha";constructor(t){this.list=new Ar(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Xu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var ju=class{static type="scale";constructor(t){this.list=new Ar(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Yu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var L2=Math.PI/180,qu=class{static type="speed";constructor(t){this.list=new Ar(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Ku=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Zu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*L2}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var eut=Math.PI/180,Qu=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Ju=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Di=Math.PI/180,td=class{static type="rotation";constructor(t){this.minStart=t.minStart*Di,this.maxStart=t.maxStart*Di,this.minSpeed=t.minSpeed*Di,this.maxSpeed=t.maxSpeed*Di,this.accel=(t.accel??0)*Di}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},ed=class{static type="rotationStatic";constructor(t){this.min=t.min*Di,this.max=t.max*Di}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},rd=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Di}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var id=class{static type="color";constructor(t){this.list=new Ar(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},sd=class{static type="colorStatic";constructor(t){this.color=zu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var od=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},nd=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},ax=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},lx=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},D2={rect:od,rectangle:od,torus:nd,circle:nd,point:ax,line:lx};var ad=class{static type="spawnShape";constructor(t){let e=D2[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},ld=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var YP=new Map,qP=new Map;function hx(r,t){YP.set(r,t)}function Ce(r){qP.set(r.type,r)}function KP(r,t){let e=YP.get(r);return e?e(t):null}function ZP(r){return qP.get(r)}hx("circle",nx);hx("snowflake",sx);hx("raindrop",ox);Ce($u);Ce(Xu);Ce(ju);Ce(Yu);Ce(qu);Ce(Ku);Ce(Zu);Ce(Qu);Ce(Ju);Ce(td);Ce(ed);Ce(rd);Ce(id);Ce(sd);Ce(ad);Ce(ld);var hd=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var Il=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new hd(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=ZP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new Rl(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function N2(r,t){let e=new ce,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Bl=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let a=new ht;a.label=e.id,a.zIndex=n,t.addChild(a);let l=e.width,h=e.height;a.x=e.x??0,a.y=e.y??0;let c={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},u;if(typeof e.texture=="object"&&e.texture.shape)u=N2(r,e.texture);else{let m=e.texture??"circle";if(u=KP(m,r),!u)try{u=R.from(m)}catch{console.warn(`Failed to load particle texture: ${m}`);return}}c.texture=u;let d=new Il(a,c);if(a.emitter=d,c.recycleOnBounds){let m=Math.min(e.count??100,c.maxParticles);d.spawn(m);let g=d._activeFirst;for(;g;)g.y=d.random()*h,g.age=d.random()*g.maxLife*.8,g=g.next}let f=m=>{if(d.destroyed){r.ticker.remove(f);return}d.update(m.deltaTime/60)};if(a.tickerCallback=f,r?.debug){let m=g=>{if(d.destroyed){window.removeEventListener("snapShotKeyFrame",m);return}g?.detail?.deltaMS&&d.update(Number(g.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",m),a.customTickerHandler=m}else r.ticker.add(f);e.alpha!==void 0&&(a.alpha=e.alpha),Z({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:a,targetState:{x:e.x??0,y:e.y??0,alpha:e.alpha}})};var cd=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};Z({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var QP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){Bl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,H2(e,i))cd({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),Bl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let c=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};Z({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:c})||c()}};function H2(r,t){return r.count!==t.count||!wt(r.texture,t.texture)||!wt(r.behaviors,t.behaviors)||!wt(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function JP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(gs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(gs).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 tC(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function eC(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function rC(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 iC(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 sC(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 oC=({state:r})=>{JP(r),tC(r),eC(r),rC(r),iC(r),sC(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var V2=ue({type:"particles",add:Bl,update:QP,delete:cd,parse:oC});var nC=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var cx=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=nC(t,e);for(let a of o){let l=i.find(h=>h.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(h=>h.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 h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),ux=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(ux||{}),ud=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(ud||{}),tt=(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))(tt||{}),Xo=(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))(Xo||{}),L=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(L||{}),di=(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))(di||{}),nt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(nt||{}),N=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(N||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Fl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Fl||{}),Pr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Pr||{}),Qe=(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))(Qe||{}),Ni=(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))(Ni||{}),dd=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(dd||{}),Le=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Le||{}),ie=(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))(ie||{});var Rt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Rt||{}),Xe=(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))(Xe||{});var dx={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var q={ADAPTER:dx,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};$f();var W2=Ei.default??Ei,Cr=W2(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/;q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ws=Yi(lC(),1),kO=Yi(vc(),1);var Xx=Yi(wM(),1);var EM={};function dt(r,t,e=3){if(EM[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1145
1145
|
Deprecated since v${r}`):(i=i.split(`
|
|
1146
1146
|
`).splice(e).join(`
|
|
1147
1147
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
1148
1148
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1149
|
-
Deprecated since v${r}`),console.warn(i))),
|
|
1150
|
-
`);function
|
|
1151
|
-
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function bd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=NU.replace(/%forloop%/gi,HU(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Gx=0,Ux=1,Ox=2,Lx=3,Dx=4,Nx=5,Yr=class r{constructor(){this.data=0,this.blendMode=Q.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Gx)}set blend(t){!!(this.data&1<<Gx)!==t&&(this.data^=1<<Gx)}get offsets(){return!!(this.data&1<<Ux)}set offsets(t){!!(this.data&1<<Ux)!==t&&(this.data^=1<<Ux)}get culling(){return!!(this.data&1<<Ox)}set culling(t){!!(this.data&1<<Ox)!==t&&(this.data^=1<<Ox)}get depthTest(){return!!(this.data&1<<Lx)}set depthTest(t){!!(this.data&1<<Lx)!==t&&(this.data^=1<<Lx)}get depthMask(){return!!(this.data&1<<Nx)}set depthMask(t){!!(this.data&1<<Nx)!==t&&(this.data^=1<<Nx)}get clockwiseFrontFace(){return!!(this.data&1<<Dx)}set clockwiseFrontFace(t){!!(this.data&1<<Dx)!==t&&(this.data^=1<<Dx)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Q.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};Yr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Hl=[];function en(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Hl.length-1;i>=0;--i){let s=Hl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Zt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Zt.prototype,{dispatch:{value:Zt.prototype.emit},run:{value:Zt.prototype.emit}});var tr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Zt("setRealSize"),this.onUpdate=new Zt("update"),this.onError=new Zt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Ts=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var VU={scaleMode:fr.NEAREST,alphaMode:Qe.NPM},Hx=class rn extends vs.default{constructor(t=null,e=null){super(),e=Object.assign({},rn.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:g}=e;t&&!(t instanceof tr)&&(t=en(t,g),t.internal=!0),this.resolution=f||Y.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=h,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=di(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=gd(this.realWidth)&&gd(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Xr[this.cacheId],delete Je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),rn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${di()}`}o=t._pixiId}let n=Xr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new rn(t,e),n.cacheId=o,rn.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Ts(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=O.RGBA,a=st.FLOAT):t instanceof Int32Array?(n=O.RGBA_INTEGER,a=st.INT):t instanceof Uint32Array?(n=O.RGBA_INTEGER,a=st.UNSIGNED_INT):t instanceof Int16Array?(n=O.RGBA_INTEGER,a=st.SHORT):t instanceof Uint16Array?(n=O.RGBA_INTEGER,a=st.UNSIGNED_SHORT):t instanceof Int8Array?(n=O.RGBA,a=st.BYTE):(n=O.RGBA,a=st.UNSIGNED_BYTE),o.internal=!0,new rn(o,Object.assign({},VU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Xr[e]&&Xr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Xr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Xr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Xr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Xr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Hx.defaultOptions={mipmap:Ar.POW2,anisotropicLevel:0,scaleMode:fr.LINEAR,wrapMode:Al.CLAMP,alphaMode:Qe.UNPACK,target:ci.TEXTURE_2D,format:O.RGBA,type:st.UNSIGNED_BYTE},Hx._globalBatch=0;var ft=Hx;var Vl=class{constructor(){this.texArray=null,this.blend=0,this.type=Vo.TRIANGLES,this.start=0,this.size=0,this.data=null}};var WU=0,se=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=WU++,this.disposeRunner=new Zt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?je.ELEMENT_ARRAY_BUFFER:je.ARRAY_BUFFER}get index(){return this.type===je.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var sn=class r{constructor(t,e=0,i=!1,s=st.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var zU={Float32Array,Uint32Array,Int32Array,Uint8Array};function oM(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let h=t[l],c=r[l],u=tn(c);s[u]||(s[u]=new zU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/h|0)*i+a,g=d%h;n[f+g]=c[d]}a+=h}return new Float32Array(o)}var nM={5126:4,5123:2,5121:1},$U=0,jU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},fi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=$U++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Zt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof se||(e instanceof Array&&(e=new Float32Array(e)),e=new se(e));let h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,i,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new sn(c,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof se||(t instanceof Array&&(t=new Uint16Array(t)),t=new se(t)),t.type=je.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new se,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*nM[o.type]/4),o.buffer=0}for(i.data=oM(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new se(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new sn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=je.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new jU[tn(n.buffers[a].data)](s[a]),e.buffers[a]=new se(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=je.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(l+=d.size*nM[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}};var Wl=class extends fi{constructor(t=!1){super(),this._buffer=new se(null,t,!1),this._indexBuffer=new se(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,st.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,st.FLOAT).addAttribute("aColor",this._buffer,4,!0,st.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,st.FLOAT).addIndex(this._indexBuffer)}};var Vx=Math.PI*2,XU=180/Math.PI,YU=Math.PI/180,mr=(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))(mr||{});var oe=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};oe.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var vd=[new oe,new oe,new oe,new oe],xt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=mr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let w=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=w)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=vd[0].set(t.left,t.top),l=vd[1].set(t.left,t.bottom),h=vd[2].set(t.right,t.top),c=vd[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),g=d*i+f*o,m=d*s+f*o,p=d*i+f*n,_=d*s+f*n;if(Math.max(g,m,p,_)<=d*a.x+f*a.y||Math.min(g,m,p,_)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),v=u*(h.x-a.x),b=y*i+v*o,E=y*s+v*o,A=y*i+v*n,S=y*s+v*n;return!(Math.max(b,E,A,S)<=y*a.x+v*a.y||Math.min(b,E,A,S)>=y*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};xt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Td=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=mr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new xt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Td.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Sd=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=mr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new xt(this.x-this.width,this.y-this.height,this.width,this.height)}};Sd.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Ed=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=mr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}};Ed.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var wd=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=mr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};wd.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var It=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new oe;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new oe;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(Vx-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};It.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 Ss=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Es=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ws=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],As=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Wx=[],aM=[],Ad=Math.sign;function qU(){for(let r=0;r<16;r++){let t=[];Wx.push(t);for(let e=0;e<16;e++){let i=Ad(Ss[r]*Ss[e]+ws[r]*Es[e]),s=Ad(Es[r]*Ss[e]+As[r]*Es[e]),o=Ad(Ss[r]*ws[e]+ws[r]*As[e]),n=Ad(Es[r]*ws[e]+As[r]*As[e]);for(let a=0;a<16;a++)if(Ss[a]===i&&Es[a]===s&&ws[a]===o&&As[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new It;t.set(Ss[r],Es[r],ws[r],As[r],0,0),aM.push(t)}}qU();var Ut={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ss[r],uY:r=>Es[r],vX:r=>ws[r],vY:r=>As[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Wx[r][t],sub:(r,t)=>Wx[r][Ut.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ut.E:Ut.W:t>0?r>0?Ut.SE:Ut.SW:r>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=aM[Ut.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var pi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};pi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var zx=class{constructor(){this.worldTransform=new It,this.localTransform=new It,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 t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};zx.IDENTITY=new zx;var Pd=zx;Pd.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 lM=`varying vec2 vTextureCoord;
|
|
1149
|
+
Deprecated since v${r}`),console.warn(i))),EM[t]=!0}var jx;function Yx(){return typeof jx>"u"&&(jx=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;let t=q.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),jx}xf();yf();Bh([Fh]);var sn=class Cd{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Cd)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Cd.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Cd.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};sn.shared=new sn,sn.temp=new sn,sn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Rr=sn;function RO(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[tt.NORMAL_NPM]=tt.NORMAL,r[tt.ADD_NPM]=tt.ADD,r[tt.SCREEN_NPM]=tt.SCREEN,t[tt.NORMAL]=tt.NORMAL_NPM,t[tt.ADD]=tt.ADD_NPM,t[tt.SCREEN]=tt.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var qx=RO();function on(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 Ss(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 Rd(r){return!(r&r-1)&&!!r}function Md(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Kx(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var MO=0;function pi(){return++MO}var AM=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};AM.EMPTY=new AM(0,0,0,0);var Id={},Je=Object.create(null),Yr=Object.create(null);function Zx(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Bd(r,t=1){let e=q.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var z=(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))(z||{}),Qx=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},CM=(r,t)=>Qx(r).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Qx).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Qx).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>CM(o,e)-CM(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var jl=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var GO=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
1150
|
+
`);function UO(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
1151
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Fd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=GO.replace(/%forloop%/gi,UO(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Jx=0,ty=1,ey=2,ry=3,iy=4,sy=5,qr=class r{constructor(){this.data=0,this.blendMode=tt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Jx)}set blend(t){!!(this.data&1<<Jx)!==t&&(this.data^=1<<Jx)}get offsets(){return!!(this.data&1<<ty)}set offsets(t){!!(this.data&1<<ty)!==t&&(this.data^=1<<ty)}get culling(){return!!(this.data&1<<ey)}set culling(t){!!(this.data&1<<ey)!==t&&(this.data^=1<<ey)}get depthTest(){return!!(this.data&1<<ry)}set depthTest(t){!!(this.data&1<<ry)!==t&&(this.data^=1<<ry)}get depthMask(){return!!(this.data&1<<sy)}set depthMask(t){!!(this.data&1<<sy)!==t&&(this.data^=1<<sy)}get clockwiseFrontFace(){return!!(this.data&1<<iy)}set clockwiseFrontFace(t){!!(this.data&1<<iy)!==t&&(this.data^=1<<iy)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==tt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};qr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Yl=[];function nn(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Yl.length-1;i>=0;--i){let s=Yl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Jt.prototype,{dispatch:{value:Jt.prototype.emit},run:{value:Jt.prototype.emit}});var tr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Jt("setRealSize"),this.onUpdate=new Jt("update"),this.onError=new Jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Es=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var OO={scaleMode:fr.NEAREST,alphaMode:Qe.NPM},oy=class an extends ws.default{constructor(t=null,e=null){super(),e=Object.assign({},an.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof tr)&&(t=nn(t,m),t.internal=!0),this.resolution=f||q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=h,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=pi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Rd(this.realWidth)&&Rd(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Yr[this.cacheId],delete Je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),an.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=Yr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new an(t,e),n.cacheId=o,an.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Es(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=L.RGBA,a=nt.FLOAT):t instanceof Int32Array?(n=L.RGBA_INTEGER,a=nt.INT):t instanceof Uint32Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_INT):t instanceof Int16Array?(n=L.RGBA_INTEGER,a=nt.SHORT):t instanceof Uint16Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_SHORT):t instanceof Int8Array?(n=L.RGBA,a=nt.BYTE):(n=L.RGBA,a=nt.UNSIGNED_BYTE),o.internal=!0,new an(o,Object.assign({},OO,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Yr[e]&&Yr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Yr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Yr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Yr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Yr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};oy.defaultOptions={mipmap:Pr.POW2,anisotropicLevel:0,scaleMode:fr.LINEAR,wrapMode:Fl.CLAMP,alphaMode:Qe.UNPACK,target:di.TEXTURE_2D,format:L.RGBA,type:nt.UNSIGNED_BYTE},oy._globalBatch=0;var gt=oy;var ql=class{constructor(){this.texArray=null,this.blend=0,this.type=Xo.TRIANGLES,this.start=0,this.size=0,this.data=null}};var LO=0,se=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=LO++,this.disposeRunner=new Jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Xe.ELEMENT_ARRAY_BUFFER:Xe.ARRAY_BUFFER}get index(){return this.type===Xe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var ln=class r{constructor(t,e=0,i=!1,s=nt.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var DO={Float32Array,Uint32Array,Int32Array,Uint8Array};function RM(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let h=t[l],c=r[l],u=on(c);s[u]||(s[u]=new DO[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/h|0)*i+a,m=d%h;n[f+m]=c[d]}a+=h}return new Float32Array(o)}var MM={5126:4,5123:2,5121:1},NO=0,HO={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},mi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=NO++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof se||(e instanceof Array&&(e=new Float32Array(e)),e=new se(e));let h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,i,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new ln(c,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof se||(t instanceof Array&&(t=new Uint16Array(t)),t=new se(t)),t.type=Xe.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new se,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*MM[o.type]/4),o.buffer=0}for(i.data=RM(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new se(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new ln(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Xe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new HO[on(n.buffers[a].data)](s[a]),e.buffers[a]=new se(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Xe.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(l+=d.size*MM[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}};var Kl=class extends mi{constructor(t=!1){super(),this._buffer=new se(null,t,!1),this._indexBuffer=new se(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,nt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,nt.FLOAT).addAttribute("aColor",this._buffer,4,!0,nt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,nt.FLOAT).addIndex(this._indexBuffer)}};var ny=Math.PI*2,VO=180/Math.PI,WO=Math.PI/180,mr=(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))(mr||{});var oe=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};oe.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var kd=[new oe,new oe,new oe,new oe],yt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=mr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=kd[0].set(t.left,t.top),l=kd[1].set(t.left,t.bottom),h=kd[2].set(t.right,t.top),c=kd[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),m=d*i+f*o,g=d*s+f*o,p=d*i+f*n,v=d*s+f*n;if(Math.max(m,g,p,v)<=d*a.x+f*a.y||Math.min(m,g,p,v)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),_=u*(h.x-a.x),w=y*i+_*o,E=y*s+_*o,b=y*i+_*n,S=y*s+_*n;return!(Math.max(w,E,b,S)<=y*a.x+_*a.y||Math.min(w,E,b,S)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};yt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Gd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=mr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new yt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Gd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Ud=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=mr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new yt(this.x-this.width,this.y-this.height,this.width,this.height)}};Ud.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Od=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=mr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}};Od.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var Ld=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=mr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};Ld.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Gt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new oe;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new oe;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(ny-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Gt.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 As=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ps=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Cs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Rs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ay=[],IM=[],Dd=Math.sign;function zO(){for(let r=0;r<16;r++){let t=[];ay.push(t);for(let e=0;e<16;e++){let i=Dd(As[r]*As[e]+Cs[r]*Ps[e]),s=Dd(Ps[r]*As[e]+Rs[r]*Ps[e]),o=Dd(As[r]*Cs[e]+Cs[r]*Rs[e]),n=Dd(Ps[r]*Cs[e]+Rs[r]*Rs[e]);for(let a=0;a<16;a++)if(As[a]===i&&Ps[a]===s&&Cs[a]===o&&Rs[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Gt;t.set(As[r],Ps[r],Cs[r],Rs[r],0,0),IM.push(t)}}zO();var Ot={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>As[r],uY:r=>Ps[r],vX:r=>Cs[r],vY:r=>Rs[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>ay[r][t],sub:(r,t)=>ay[r][Ot.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ot.S:Ot.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ot.E:Ot.W:t>0?r>0?Ot.SE:Ot.SW:r>0?Ot.NE:Ot.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=IM[Ot.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var gi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};gi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var ly=class{constructor(){this.worldTransform=new Gt,this.localTransform=new Gt,this.position=new gi(this.onChange,this,0,0),this.scale=new gi(this.onChange,this,1,1),this.pivot=new gi(this.onChange,this,0,0),this.skew=new gi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};ly.IDENTITY=new ly;var Nd=ly;Nd.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 BM=`varying vec2 vTextureCoord;
|
|
1152
1152
|
|
|
1153
1153
|
uniform sampler2D uSampler;
|
|
1154
1154
|
|
|
1155
1155
|
void main(void){
|
|
1156
1156
|
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
1157
|
-
}`;var
|
|
1157
|
+
}`;var FM=`attribute vec2 aVertexPosition;
|
|
1158
1158
|
attribute vec2 aTextureCoord;
|
|
1159
1159
|
|
|
1160
1160
|
uniform mat3 projectionMatrix;
|
|
@@ -1165,7 +1165,7 @@ void main(void){
|
|
|
1165
1165
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1166
1166
|
vTextureCoord = aTextureCoord;
|
|
1167
1167
|
}
|
|
1168
|
-
`;function
|
|
1168
|
+
`;function Hd(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function hy(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Zl(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return hy(2*t);case"bvec3":return hy(3*t);case"bvec4":return hy(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Kr=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
|
|
1169
1169
|
if(uv["${r}"] !== ud["${r}"].value)
|
|
1170
1170
|
{
|
|
1171
1171
|
ud["${r}"].value = uv["${r}"]
|
|
@@ -1285,7 +1285,7 @@ void main(void){
|
|
|
1285
1285
|
cv[3] = v[3];
|
|
1286
1286
|
|
|
1287
1287
|
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
1288
|
-
}`}];var
|
|
1288
|
+
}`}];var $O={float:`
|
|
1289
1289
|
if (cv !== v)
|
|
1290
1290
|
{
|
|
1291
1291
|
cu.value = v;
|
|
@@ -1421,7 +1421,7 @@ void main(void){
|
|
|
1421
1421
|
cu.value = v;
|
|
1422
1422
|
|
|
1423
1423
|
gl.uniform1i(location, v);
|
|
1424
|
-
}`},
|
|
1424
|
+
}`},XO={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 cy(r,t){let e=[`
|
|
1425
1425
|
var v = null;
|
|
1426
1426
|
var cv = null;
|
|
1427
1427
|
var cu = null;
|
|
@@ -1431,18 +1431,18 @@ void main(void){
|
|
|
1431
1431
|
renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
|
|
1432
1432
|
`):e.push(`
|
|
1433
1433
|
renderer.shader.syncUniformGroup(uv.${i}, syncData);
|
|
1434
|
-
`));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<
|
|
1434
|
+
`));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<Kr.length;a++)if(Kr[a].test(s,o)){e.push(Kr[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?$O:XO)[s.type].replace("location",`ud["${i}"].location`);e.push(`
|
|
1435
1435
|
cu = ud["${i}"];
|
|
1436
1436
|
cv = cu.value;
|
|
1437
1437
|
v = uv["${i}"];
|
|
1438
1438
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1439
|
-
`))}var
|
|
1439
|
+
`))}var kM={},Vd=kM;function Wd(){if(Vd===kM||Vd?.isContextLost()){let r=q.ADAPTER.createCanvas(),t;q.PREFER_ENV>=Ze.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Vd=t}return Vd}var zd;function uy(){if(!zd){zd=Le.MEDIUM;let r=Wd();if(r&&r.getShaderPrecisionFormat){let t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(zd=t.precision?Le.HIGH:Le.MEDIUM)}}return zd}function GM(r,t){let e=r.getShaderSource(t).split(`
|
|
1440
1440
|
`).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
1441
1441
|
`),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
|
|
1442
|
-
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
1443
|
-
${r}`}else if(e!==
|
|
1442
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function dy(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||GM(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||GM(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var jO={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 Ql(r){return jO[r]}var $d=null,UM={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 Jl(r,t){if(!$d){let e=Object.keys(UM);$d={};for(let i=0;i<e.length;++i){let s=e[i];$d[r[s]]=UM[s]}}return $d[t]}function Xd(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Le.HIGH&&e!==Le.HIGH&&(i=Le.MEDIUM),`precision ${i} float;
|
|
1443
|
+
${r}`}else if(e!==Le.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var th;function jd(){if(typeof th=="boolean")return th;try{th=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{th=!1}return th}var YO=0,Yd={},fy=class hn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=YO++,this.vertexSrc=t||hn.defaultVertexSrc,this.fragmentSrc=e||hn.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,"-"),Yd[i]?(Yd[i]++,i+=`-${Yd[i]}`):Yd[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
1444
1444
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
1445
|
-
${this.fragmentSrc}`,this.vertexSrc=
|
|
1445
|
+
${this.fragmentSrc}`,this.vertexSrc=Xd(this.vertexSrc,hn.defaultVertexPrecision,Le.HIGH),this.fragmentSrc=Xd(this.fragmentSrc,hn.defaultFragmentPrecision,uy())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return FM}static get defaultFragmentSrc(){return BM}static from(t,e,i){let s=t+e,o=Id[s];return o||(Id[s]=o=new hn(t,e,i)),o}};fy.defaultVertexPrecision=Le.HIGH,fy.defaultFragmentPrecision=Cr.apple.device?Le.HIGH:Le.MEDIUM;var gr=fy;var qO=0,er=class r{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=qO++,this.static=!!e,this.ubo=!!i,t instanceof se?(this.buffer=t,this.buffer.type=Xe.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new se(new Float32Array(1)),this.buffer.type=Xe.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new r(t,e,i)}static uboFrom(t,e){return new r(t,e??!0,!0)}};var Ms=class r{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof er?this.uniformGroup=e:this.uniformGroup=new er(e):this.uniformGroup=new er({}),this.disposeRunner=new Jt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let s=gr.from(t,e);return new r(s,i)}};var eh=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let i=new Int32Array(t);for(let o=0;o<t;o++)i[o]=o;this.defaultGroupCache[t]=er.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new gr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Gt,default:this.defaultGroupCache[t]};return new Ms(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
1446
1446
|
`,e+=`
|
|
1447
1447
|
`;for(let i=0;i<t;i++)i>0&&(e+=`
|
|
1448
1448
|
else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
@@ -1450,7 +1450,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
|
1450
1450
|
color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
|
|
1451
1451
|
}`;return e+=`
|
|
1452
1452
|
`,e+=`
|
|
1453
|
-
`,e}};var
|
|
1453
|
+
`,e}};var rh=class{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}};function OM(){return!Cr.apple.device}function LM(r){let t=!0,e=q.ADAPTER.getNavigator();if(Cr.tablet||Cr.phone){if(Cr.apple.device){let i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Cr.android.device){let i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}var Is=class{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}};var DM=`varying vec2 vTextureCoord;
|
|
1454
1454
|
varying vec4 vColor;
|
|
1455
1455
|
varying float vTextureId;
|
|
1456
1456
|
uniform sampler2D uSamplers[%count%];
|
|
@@ -1460,7 +1460,7 @@ void main(void){
|
|
|
1460
1460
|
%forloop%
|
|
1461
1461
|
gl_FragColor = color * vColor;
|
|
1462
1462
|
}
|
|
1463
|
-
`;var
|
|
1463
|
+
`;var NM=`precision highp float;
|
|
1464
1464
|
attribute vec2 aVertexPosition;
|
|
1465
1465
|
attribute vec2 aTextureCoord;
|
|
1466
1466
|
attribute vec4 aColor;
|
|
@@ -1481,14 +1481,14 @@ void main(void){
|
|
|
1481
1481
|
vTextureId = aTextureId;
|
|
1482
1482
|
vColor = aColor * tint;
|
|
1483
1483
|
}
|
|
1484
|
-
`;var
|
|
1484
|
+
`;var ih=class Mr extends Is{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Kl,this.vertexSize=6,this.state=qr.for2d(),this.size=Mr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??LM(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??OM(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return dt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return NM}static get defaultFragmentTemplate(){return DM}setShaderGenerator({vertex:t=Mr.defaultVertexSrc,fragment:e=Mr.defaultFragmentTemplate}={}){this.shaderGenerator=new eh(t,e)}contextChange(){let t=this.renderer.gl;q.PREFER_ENV===Ze.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Mr.defaultMaxTextures),this.maxTextures=Fd(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=Mr,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new ql);for(;e.length<s;)e.push(new rh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,i=Mr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++gt._globalBatch,l=0,h=i[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,u),c=u,h=i[++l],++a),d._batchEnabled=a,d.touched=n,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u<o.length;u++)o[u]=null;gt._globalBatch=a}buildDrawCalls(t,e,i){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,l=Mr._drawCallPool,h=this._dcIndex,c=this._aIndex,u=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){let m=s[f],g=m._texture.baseTexture,p=qx[g.alphaMode?1:0][m.blendMode];s[f]=null,e<f&&d.blend!==p&&(d.size=u-d.start,e=f,d=l[++h],d.texArray=t,d.start=u),this.packInterleavedGeometry(m,o,n,c,u),c+=m.vertexData.length/2*a,u+=m.indices.length,d.blend=p}e<i&&(d.size=u-d.start,++h),this._dcIndex=h,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;Mr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:i}=this.renderer,s=Mr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:l,size:h,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Mr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=Ss(Math.ceil(t/8)),i=Md(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new jl(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=Ss(Math.ceil(t/12)),i=Md(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._iBuffers[i];return o||(this._iBuffers[i]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,i,s,o){let{uint32View:n,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),m=Rr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let g=0;g<u.length;g+=2)a[s++]=u[g],a[s++]=u[g+1],a[s++]=h[g],a[s++]=h[g+1],n[s++]=m,a[s++]=d;for(let g=0;g<c.length;g++)i[o++]=l+c[g]}};ih.defaultBatchSize=4096,ih.extension={name:"batch",type:z.RendererPlugin},ih._drawCallPool=[],ih._textureArrayPool=[];var xi=ih;K.add(xi);var HM=`varying vec2 vTextureCoord;
|
|
1485
1485
|
|
|
1486
1486
|
uniform sampler2D uSampler;
|
|
1487
1487
|
|
|
1488
1488
|
void main(void){
|
|
1489
1489
|
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
1490
1490
|
}
|
|
1491
|
-
`;var
|
|
1491
|
+
`;var VM=`attribute vec2 aVertexPosition;
|
|
1492
1492
|
|
|
1493
1493
|
uniform mat3 projectionMatrix;
|
|
1494
1494
|
|
|
@@ -1514,7 +1514,7 @@ void main(void)
|
|
|
1514
1514
|
gl_Position = filterVertexPosition();
|
|
1515
1515
|
vTextureCoord = filterTextureCoord();
|
|
1516
1516
|
}
|
|
1517
|
-
`;var Kx=class Zl extends Ps{constructor(t,e,i){let s=gr.from(t||Zl.defaultVertexSrc,e||Zl.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Zl.defaultResolution,this.multisample=Zl.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Yr}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return yM}static get defaultFragmentSrc(){return xM}};Kx.defaultResolution=1,Kx.defaultMultisample=Ct.NONE;var Kr=Kx;var gi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Cr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};gi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},gi.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(gi);var nn=class{constructor(t){this.renderer=t,this.emptyRenderer=new Cs(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let h=0;h<a;h++){let c=o[h],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[h]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"batch"};q.add(nn);var _M=0,xi=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=_M++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=_M++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(Y.PREFER_ENV>=Ze.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};xi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},xi.extension={type:V.RendererSystem,name:"context"};q.add(xi);var Hi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Zt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ft(null,{scaleMode:fr.NEAREST,resolution:1,mipmap:Ar.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ft(null,{scaleMode:fr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ar.OFF,format:O.DEPTH_COMPONENT,type:st.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Rs=class extends ft{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ct.NONE),super(null,t),this.mipmap=Ar.OFF,this.valid=!0,this._clear=new Cr([0,0,0,0]),this.framebuffer=new Hi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var de=class extends tr{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=Fx(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Ms=class extends de{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;de.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Y.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Bs=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,h=t.y/o+a;i=Ut.add(i,Ut.NW),this.x0=l+n*Ut.uX(i),this.y0=h+a*Ut.uY(i),i=Ut.add(i,2),this.x1=l+n*Ut.uX(i),this.y1=h+a*Ut.uY(i),i=Ut.add(i,2),this.x2=l+n*Ut.uX(i),this.y2=h+a*Ut.uY(i),i=Ut.add(i,2),this.x3=l+n*Ut.uX(i),this.y3=h+a*Ut.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Bs.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 bM=new Bs;function Ud(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var Ql=class r extends vs.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new xt(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=bM,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new oe(n.x,n.y):new oe(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&Je[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===bM&&(this._uvs=new Bs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ft){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${di()}`,ft.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${di()}`}o=t._pixiId}let n=Je[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ft)?(e.resolution||(e.resolution=_d(t)),n=new r(new ft(t,e)),n.baseTexture.cacheId=o,ft.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof ft&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(ft.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new ft(t,Object.assign({scaleMode:ft.defaultOptions.scaleMode,resolution:_d(e)},s)),{resource:n}=o;n instanceof Ms&&(n.url=e);let a=new r(o);return i||(i=e),ft.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(ft.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Je[e]&&Je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Je[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Je[t.textureCacheIds[e]]===t&&delete Je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new ft),Ud(r._EMPTY),Ud(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=Y.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(ft.from(t)),Ud(r._WHITE),Ud(r._WHITE.baseTexture)}return r._WHITE}};var Is=class r extends Ql{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Rs(t))}};var an=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Ct.NONE){let s=new Rs(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Is(s)}getOptimalTexture(t,e,i=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=bs(t),e=bs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};an.SCREEN_KEY=-1;var Jl=class extends fi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var th=class extends fi{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 se(this.vertices),this.uvBuffer=new se(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var eh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new xt,this.destinationFrame=new xt,this.bindingSourceFrame=new xt,this.bindingDestinationFrame=new xt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Od=[new oe,new oe,new oe,new oe],Zx=new It,ln=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new an,this.statePool=[],this.quad=new Jl,this.quadUv=new th,this.tempRect=new xt,this.activeState={},this.globalUniforms=new er({outputFrame:new xt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new eh,n=i.renderTexture,a,l;if(n.current){let p=n.current;a=p.resolution,l=p.multisample}else a=i.resolution,l=i.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let p=1;p<e.length;p++){let _=e[p];h=Math.min(h,_.resolution||a),c=Math.min(c,_.multisample??l),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=h,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let g=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(Zx.copyFrom(i.projection.transform).invert(),g),d?(o.sourceFrame.fit(g),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(g)||(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,h,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=i.projection.transform,i.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let h=s.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,Li.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Li.CLEAR,e);let d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Li.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Li.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Li.CLEAR||e===Li.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Vo.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Vo.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(It.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=Od[0],s=Od[1],o=Od[2],n=Od[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),h=Math.max(i.x,s.x,o.x,n.x),c=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:h}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}o=o?Zx.copyFrom(o):Zx.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};ln.extension={type:V.RendererSystem,name:"filter"};q.add(ln);var rh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ct.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var eO=new xt,hn=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Hi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new xt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===Ze.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=Qu.COLOR|Qu.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new rh(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let h=o[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=Ct.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Ct.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new Hi(s.width,s.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=eO,e.width=s.width,e.height=s.height),i||(i=e);let h=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new xt}destroy(){this.renderer=null}};hn.extension={type:V.RendererSystem,name:"framebuffer"};q.add(hn);var Qx={5126:4,5123:2,5121:1},cn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===Ze.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],c=h[l];if(c)return h[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},g={};for(let m in u)f[m]=0,g[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*Qx[d[m].type];for(let m in d){let p=d[m],_=p.size;p.stride===void 0&&(f[p.buffer]===_*Qx[p.type]?p.stride=0:p.stride=f[p.buffer]),p.start===void 0&&(p.start=g[p.buffer],g[p.buffer]+=_*Qx[p.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let p=u[m];n.bind(p),i&&p._glBuffers[o].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),n.unbind(je.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let h in a){let c=a[h],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[h]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};cn.extension={type:V.RendererSystem,name:"geometry"};q.add(cn);var vM=new It,ih=class{constructor(t,e){this._texture=t,this.mapCoord=new It,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&(vM.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(vM));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/n.width,a[1]=(e._frame.y+l+h)/n.height,a[2]=(e._frame.x+e._frame.width-l+h)/n.width,a[3]=(e._frame.y+e._frame.height-l+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var TM=`varying vec2 vMaskCoord;
|
|
1517
|
+
`;var py=class sh extends Ms{constructor(t,e,i){let s=gr.from(t||sh.defaultVertexSrc,e||sh.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=sh.defaultResolution,this.multisample=sh.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new qr}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return VM}static get defaultFragmentSrc(){return HM}};py.defaultResolution=1,py.defaultMultisample=Rt.NONE;var Zr=py;var yi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Rr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};yi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},yi.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"background"};K.add(yi);var cn=class{constructor(t){this.renderer=t,this.emptyRenderer=new Is(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let h=0;h<a;h++){let c=o[h],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[h]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}};cn.extension={type:z.RendererSystem,name:"batch"};K.add(cn);var WM=0,_i=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=WM++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=WM++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(q.PREFER_ENV>=Ze.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};_i.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_i.extension={type:z.RendererSystem,name:"context"};K.add(_i);var Wi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Jt("disposeFramebuffer"),this.multisample=Rt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new gt(null,{scaleMode:fr.NEAREST,resolution:1,mipmap:Pr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new gt(null,{scaleMode:fr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Pr.OFF,format:L.DEPTH_COMPONENT,type:nt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Bs=class extends gt{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Rt.NONE),super(null,t),this.mipmap=Pr.OFF,this.valid=!0,this._clear=new Rr([0,0,0,0]),this.framebuffer=new Wi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var fe=class extends tr{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=Zx(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Fs=class extends fe{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;fe.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var ks=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,h=t.y/o+a;i=Ot.add(i,Ot.NW),this.x0=l+n*Ot.uX(i),this.y0=h+a*Ot.uY(i),i=Ot.add(i,2),this.x1=l+n*Ot.uX(i),this.y1=h+a*Ot.uY(i),i=Ot.add(i,2),this.x2=l+n*Ot.uX(i),this.y2=h+a*Ot.uY(i),i=Ot.add(i,2),this.x3=l+n*Ot.uX(i),this.y3=h+a*Ot.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};ks.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 zM=new ks;function qd(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var oh=class r extends ws.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new yt(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=zM,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new oe(n.x,n.y):new oe(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&Je[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===zM&&(this._uvs=new ks),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof gt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${pi()}`,gt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=Je[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof gt)?(e.resolution||(e.resolution=Bd(t)),n=new r(new gt(t,e)),n.baseTexture.cacheId=o,gt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof gt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(gt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new gt(t,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:Bd(e)},s)),{resource:n}=o;n instanceof Fs&&(n.url=e);let a=new r(o);return i||(i=e),gt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(gt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Je[e]&&Je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Je[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Je[t.textureCacheIds[e]]===t&&delete Je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new gt),qd(r._EMPTY),qd(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(gt.from(t)),qd(r._WHITE),qd(r._WHITE.baseTexture)}return r._WHITE}};var Gs=class r extends oh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Bs(t))}};var un=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Rt.NONE){let s=new Bs(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Gs(s)}getOptimalTexture(t,e,i=1,s=Rt.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Ss(t),e=Ss(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};un.SCREEN_KEY=-1;var nh=class extends mi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var ah=class extends mi{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 se(this.vertices),this.uvBuffer=new se(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var lh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Rt.NONE,this.sourceFrame=new yt,this.destinationFrame=new yt,this.bindingSourceFrame=new yt,this.bindingDestinationFrame=new yt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Kd=[new oe,new oe,new oe,new oe],my=new Gt,dn=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new un,this.statePool=[],this.quad=new nh,this.quadUv=new ah,this.tempRect=new yt,this.activeState={},this.globalUniforms=new er({outputFrame:new yt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new lh,n=i.renderTexture,a,l;if(n.current){let p=n.current;a=p.resolution,l=p.multisample}else a=i.resolution,l=i.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let p=1;p<e.length;p++){let v=e[p];h=Math.min(h,v.resolution||a),c=Math.min(c,v.multisample??l),u=this.useMaxPadding?Math.max(u,v.padding):u+v.padding,d=d&&v.autoFit,f=f||(v.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=h,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let m=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(my.copyFrom(i.projection.transform).invert(),m),d?(o.sourceFrame.fit(m),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(m)||(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,h,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let g=this.tempRect;g.x=0,g.y=0,g.width=o.sourceFrame.width,g.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,g),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let h=s.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,Ni.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Ni.CLEAR,e);let d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Ni.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ni.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ni.CLEAR||e===Ni.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Xo.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Xo.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Gt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Rt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=Kd[0],s=Kd[1],o=Kd[2],n=Kd[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),h=Math.max(i.x,s.x,o.x,n.x),c=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:h}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}o=o?my.copyFrom(o):my.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};dn.extension={type:z.RendererSystem,name:"filter"};K.add(dn);var hh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Rt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var KO=new yt,fn=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Wi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new yt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===Ze.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=ud.COLOR|ud.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new hh(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let h=o[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=Rt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Rt.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new Wi(s.width,s.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=KO,e.width=s.width,e.height=s.height),i||(i=e);let h=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new yt}destroy(){this.renderer=null}};fn.extension={type:z.RendererSystem,name:"framebuffer"};K.add(fn);var gy={5126:4,5123:2,5121:1},pn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;q.PREFER_ENV===Ze.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],c=h[l];if(c)return h[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},m={};for(let g in u)f[g]=0,m[g]=0;for(let g in d)!d[g].size&&a.attributeData[g]?d[g].size=a.attributeData[g].size:d[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[g].buffer]+=d[g].size*gy[d[g].type];for(let g in d){let p=d[g],v=p.size;p.stride===void 0&&(f[p.buffer]===v*gy[p.type]?p.stride=0:p.stride=f[p.buffer]),p.start===void 0&&(p.start=m[p.buffer],m[p.buffer]+=v*gy[p.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let g=0;g<u.length;g++){let p=u[g];n.bind(p),i&&p._glBuffers[o].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),n.unbind(Xe.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let h in a){let c=a[h],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[h]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};pn.extension={type:z.RendererSystem,name:"geometry"};K.add(pn);var $M=new Gt,ch=class{constructor(t,e){this._texture=t,this.mapCoord=new Gt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&($M.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append($M));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/n.width,a[1]=(e._frame.y+l+h)/n.height,a[2]=(e._frame.x+e._frame.width-l+h)/n.width,a[3]=(e._frame.y+e._frame.height-l+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var XM=`varying vec2 vMaskCoord;
|
|
1518
1518
|
varying vec2 vTextureCoord;
|
|
1519
1519
|
|
|
1520
1520
|
uniform sampler2D uSampler;
|
|
@@ -1539,7 +1539,7 @@ void main(void)
|
|
|
1539
1539
|
|
|
1540
1540
|
gl_FragColor = original;
|
|
1541
1541
|
}
|
|
1542
|
-
`;var
|
|
1542
|
+
`;var jM=`attribute vec2 aVertexPosition;
|
|
1543
1543
|
attribute vec2 aTextureCoord;
|
|
1544
1544
|
|
|
1545
1545
|
uniform mat3 projectionMatrix;
|
|
@@ -1555,7 +1555,7 @@ void main(void)
|
|
|
1555
1555
|
vTextureCoord = aTextureCoord;
|
|
1556
1556
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
1557
1557
|
}
|
|
1558
|
-
`;var sh=class extends Kr{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||SM,e||TM,i),this.maskSprite=s,this.maskMatrix=new It}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new ih(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var oh=class{constructor(t=null){this.type=ie.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Kr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ie.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var un=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new oh;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==ie.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ie.SCISSOR:this.renderer.scissor.push(i);break;case ie.STENCIL:this.renderer.stencil.push(i);break;case ie.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ie.COLOR:this.pushColorMask(i);break;default:break}i.type===ie.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ie.SCISSOR:this.renderer.scissor.pop(e);break;case ie.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ie.SPRITE:this.popSpriteMask(e);break;case ie.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===ie.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=ie.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ie.SCISSOR:t.type=ie.STENCIL:t.type=ie.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new sh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};un.extension={type:V.RendererSystem,name:"mask"};q.add(un);var dn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var EM=new It,wM=[],AM=class Ld extends dn{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,wM.pop()??new xt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Ld.isMatrixRotated(e.worldTransform)||Ld.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){Ld.isMatrixRotated(o)||(o=o?EM.copyFrom(o):EM.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&wM.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};AM.extension={type:V.RendererSystem,name:"scissor"};var Jx=AM;q.add(Jx);var fn=class extends dn{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};fn.extension={type:V.RendererSystem,name:"stencil"};q.add(fn);var pn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ct("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ct("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ct("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};pn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_plugin"};q.add(pn);var mn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new It,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};mn.extension={type:V.RendererSystem,name:"projection"};q.add(mn);var rO=new Pd,PM=new xt,gn=class{constructor(t){this.renderer=t,this._tempMatrix=new It}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(PM)||t.getLocalBounds(PM,!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=Is.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=rO,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};gn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"textureGenerator"};q.add(gn);var Fs=new xt,nh=new xt,xn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new xt,this.destinationFrame=new xt,this.viewportFrame=new xt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(Fs.width=t.frame.width,Fs.height=t.frame.height,e=Fs),i||(nh.x=t.frame.x,nh.y=t.frame.y,nh.width=e.width,nh.height=e.height,i=nh),n=o.framebuffer):(a=s.resolution,e||(Fs.width=s._view.screen.width,Fs.height=s._view.screen.height,e=Fs),i||(i=Fs,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Cr.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};xn.extension={type:V.RendererSystem,name:"renderTexture"};q.add(xn);var ah=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function CM(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=jl(t,o.type),a={type:n,name:o.name,size:$l(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function RM(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=jl(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:zl(l,o.size)}}return e}function ty(r,t){let e=Cd(r,r.VERTEX_SHADER,t.vertexSrc),i=Cd(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||Yx(r,s,e,i),t.attributeData=CM(s,r),t.uniformData=RM(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,h)=>l>h?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:zl(l.type,l.size)}}return new ah(s,n)}function iO(r,t,e,i,s){e.buffer.update(s)}var sO={float:`
|
|
1558
|
+
`;var uh=class extends Zr{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||jM,e||XM,i),this.maskSprite=s,this.maskMatrix=new Gt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new ch(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var dh=class{constructor(t=null){this.type=ie.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Zr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ie.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var mn=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new dh;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==ie.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ie.SCISSOR:this.renderer.scissor.push(i);break;case ie.STENCIL:this.renderer.stencil.push(i);break;case ie.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ie.COLOR:this.pushColorMask(i);break;default:break}i.type===ie.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ie.SCISSOR:this.renderer.scissor.pop(e);break;case ie.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ie.SPRITE:this.popSpriteMask(e);break;case ie.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===ie.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=ie.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ie.SCISSOR:t.type=ie.STENCIL:t.type=ie.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new uh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};mn.extension={type:z.RendererSystem,name:"mask"};K.add(mn);var gn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var YM=new Gt,qM=[],KM=class Zd extends gn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,qM.pop()??new yt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Zd.isMatrixRotated(e.worldTransform)||Zd.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){Zd.isMatrixRotated(o)||(o=o?YM.copyFrom(o):YM.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&qM.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};KM.extension={type:z.RendererSystem,name:"scissor"};var xy=KM;K.add(xy);var xn=class extends gn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};xn.extension={type:z.RendererSystem,name:"stencil"};K.add(xn);var yn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return dt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return dt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return dt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};yn.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_plugin"};K.add(yn);var _n=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Gt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};_n.extension={type:z.RendererSystem,name:"projection"};K.add(_n);var ZO=new Nd,ZM=new yt,bn=class{constructor(t){this.renderer=t,this._tempMatrix=new Gt}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(ZM)||t.getLocalBounds(ZM,!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=Gs.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=ZO,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};bn.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"textureGenerator"};K.add(bn);var Us=new yt,fh=new yt,vn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new yt,this.destinationFrame=new yt,this.viewportFrame=new yt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(Us.width=t.frame.width,Us.height=t.frame.height,e=Us),i||(fh.x=t.frame.x,fh.y=t.frame.y,fh.width=e.width,fh.height=e.height,i=fh),n=o.framebuffer):(a=s.resolution,e||(Us.width=s._view.screen.width,Us.height=s._view.screen.height,e=Us),i||(i=Us,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Rr.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};vn.extension={type:z.RendererSystem,name:"renderTexture"};K.add(vn);var ph=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function QM(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=Jl(t,o.type),a={type:n,name:o.name,size:Ql(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function JM(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Jl(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Zl(l,o.size)}}return e}function yy(r,t){let e=Hd(r,r.VERTEX_SHADER,t.vertexSrc),i=Hd(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||dy(r,s,e,i),t.attributeData=QM(s,r),t.uniformData=JM(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,h)=>l>h?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:Zl(l.type,l.size)}}return new ph(s,n)}function QO(r,t,e,i,s){e.buffer.update(s)}var JO={float:`
|
|
1559
1559
|
data[offset] = v;
|
|
1560
1560
|
`,vec2:`
|
|
1561
1561
|
data[offset] = v[0];
|
|
@@ -1593,7 +1593,7 @@ void main(void)
|
|
|
1593
1593
|
{
|
|
1594
1594
|
data[offset + i] = v[i];
|
|
1595
1595
|
}
|
|
1596
|
-
`},
|
|
1596
|
+
`},tI={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 eI(r){let t=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=tI[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function rI(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function _y(r,t){if(!r.autoManage)return{size:0,syncFunc:QO};let e=rI(r.uniforms,t),{uboElements:i,size:s}=eI(e),o=[`
|
|
1597
1597
|
var v = null;
|
|
1598
1598
|
var v2 = null;
|
|
1599
1599
|
var cv = null;
|
|
@@ -1601,7 +1601,7 @@ void main(void)
|
|
|
1601
1601
|
var gl = renderer.gl
|
|
1602
1602
|
var index = 0;
|
|
1603
1603
|
var data = buffer.data;
|
|
1604
|
-
`];for(let n=0;n<i.length;n++){let a=i[n],l=r.uniforms[a.data.name],h=a.data.name,c=!1;for(let u=0;u<
|
|
1604
|
+
`];for(let n=0;n<i.length;n++){let a=i[n],l=r.uniforms[a.data.name],h=a.data.name,c=!1;for(let u=0;u<Kr.length;u++){let d=Kr[u];if(d.codeUbo&&d.test(a.data,l)){o.push(`offset = ${a.offset/4};`,Kr[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){let u=Ql(a.data.type),d=Math.max(tI[a.data.type]/16,1),f=u/d,m=(4-f%4)%4;o.push(`
|
|
1605
1605
|
cv = ud.${h}.value;
|
|
1606
1606
|
v = uv.${h};
|
|
1607
1607
|
offset = ${a.offset/4};
|
|
@@ -1614,10 +1614,10 @@ void main(void)
|
|
|
1614
1614
|
{
|
|
1615
1615
|
data[offset++] = v[t++];
|
|
1616
1616
|
}
|
|
1617
|
-
offset += ${
|
|
1617
|
+
offset += ${m};
|
|
1618
1618
|
}
|
|
1619
1619
|
|
|
1620
|
-
`)}else{let u=
|
|
1620
|
+
`)}else{let u=JO[a.data.type];o.push(`
|
|
1621
1621
|
cv = ud.${h}.value;
|
|
1622
1622
|
v = uv.${h};
|
|
1623
1623
|
offset = ${a.offset/4};
|
|
@@ -1625,7 +1625,7 @@ void main(void)
|
|
|
1625
1625
|
`)}}return o.push(`
|
|
1626
1626
|
renderer.buffer.update(buffer);
|
|
1627
1627
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
|
|
1628
|
-
`))}}var oO=0,Dd={textureCount:0,uboCount:0},Vi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=oO++}systemCheck(){if(!kd())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Dd.textureCount=0,Dd.uboCount=0,this.syncUniformGroup(t.uniformGroup,Dd)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=jx(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Dd,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=ey(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=ty(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Vi.extension={type:V.RendererSystem,name:"shader"};q.add(Vi);var yi=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};yi.defaultOptions={hello:!1},yi.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(yi);function FM(r,t=[]){return t[Q.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.ADD]=[r.ONE,r.ONE],t[Q.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.NONE]=[0,0],t[Q.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[Q.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[Q.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[Q.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Q.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[Q.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[Q.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[Q.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[Q.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Q.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var nO=0,aO=1,lO=2,hO=3,cO=4,uO=5,kM=class ry{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Q.NONE,this._blendEq=!1,this.map=[],this.map[nO]=this.setBlend,this.map[aO]=this.setOffset,this.map[lO]=this.setCullFace,this.map[hO]=this.setDepthTest,this.map[cO]=this.setFrontFace,this.map[uO]=this.setDepthMask,this.checks=[],this.defaultState=new Yr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=FM(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(ry.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(ry.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};kM.extension={type:V.RendererSystem,name:"state"};var iy=kM;q.add(iy);var yn=class extends vs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Zt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var lh=class Nd{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Nd.defaultMaxIdle,this.checkCountMax=Nd.defaultCheckCountMax,this.mode=Nd.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ju.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};lh.defaultMode=Ju.AUTO,lh.defaultMaxIdle=60*60,lh.defaultCheckCountMax=60*10,lh.extension={type:V.RendererSystem,name:"textureGC"};var Zr=lh;q.add(Zr);var ks=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=st.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}};function GM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.R8]:N.FLOAT,[r.R8_SNORM]:N.FLOAT,[r.RG8]:N.FLOAT,[r.RG8_SNORM]:N.FLOAT,[r.RGB8]:N.FLOAT,[r.RGB8_SNORM]:N.FLOAT,[r.RGB565]:N.FLOAT,[r.RGBA4]:N.FLOAT,[r.RGB5_A1]:N.FLOAT,[r.RGBA8]:N.FLOAT,[r.RGBA8_SNORM]:N.FLOAT,[r.RGB10_A2]:N.FLOAT,[r.RGB10_A2UI]:N.FLOAT,[r.SRGB8]:N.FLOAT,[r.SRGB8_ALPHA8]:N.FLOAT,[r.R16F]:N.FLOAT,[r.RG16F]:N.FLOAT,[r.RGB16F]:N.FLOAT,[r.RGBA16F]:N.FLOAT,[r.R32F]:N.FLOAT,[r.RG32F]:N.FLOAT,[r.RGB32F]:N.FLOAT,[r.RGBA32F]:N.FLOAT,[r.R11F_G11F_B10F]:N.FLOAT,[r.RGB9_E5]:N.FLOAT,[r.R8I]:N.INT,[r.R8UI]:N.UINT,[r.R16I]:N.INT,[r.R16UI]:N.UINT,[r.R32I]:N.INT,[r.R32UI]:N.UINT,[r.RG8I]:N.INT,[r.RG8UI]:N.UINT,[r.RG16I]:N.INT,[r.RG16UI]:N.UINT,[r.RG32I]:N.INT,[r.RG32UI]:N.UINT,[r.RGB8I]:N.INT,[r.RGB8UI]:N.UINT,[r.RGB16I]:N.INT,[r.RGB16UI]:N.UINT,[r.RGB32I]:N.INT,[r.RGB32UI]:N.UINT,[r.RGBA8I]:N.INT,[r.RGBA8UI]:N.UINT,[r.RGBA16I]:N.INT,[r.RGBA16UI]:N.UINT,[r.RGBA32I]:N.INT,[r.RGBA32UI]:N.UINT,[r.DEPTH_COMPONENT16]:N.FLOAT,[r.DEPTH_COMPONENT24]:N.FLOAT,[r.DEPTH_COMPONENT32F]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT,[r.DEPTH24_STENCIL8]:N.FLOAT,[r.DEPTH32F_STENCIL8]:N.FLOAT}:t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT},t}function UM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[st.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA8,[O.RGB]:r.RGB8,[O.RG]:r.RG8,[O.RED]:r.R8,[O.RGBA_INTEGER]:r.RGBA8UI,[O.RGB_INTEGER]:r.RGB8UI,[O.RG_INTEGER]:r.RG8UI,[O.RED_INTEGER]:r.R8UI,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[st.BYTE]:{[O.RGBA]:r.RGBA8_SNORM,[O.RGB]:r.RGB8_SNORM,[O.RG]:r.RG8_SNORM,[O.RED]:r.R8_SNORM,[O.RGBA_INTEGER]:r.RGBA8I,[O.RGB_INTEGER]:r.RGB8I,[O.RG_INTEGER]:r.RG8I,[O.RED_INTEGER]:r.R8I},[st.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:r.RGBA16UI,[O.RGB_INTEGER]:r.RGB16UI,[O.RG_INTEGER]:r.RG16UI,[O.RED_INTEGER]:r.R16UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[st.SHORT]:{[O.RGBA_INTEGER]:r.RGBA16I,[O.RGB_INTEGER]:r.RGB16I,[O.RG_INTEGER]:r.RG16I,[O.RED_INTEGER]:r.R16I},[st.UNSIGNED_INT]:{[O.RGBA_INTEGER]:r.RGBA32UI,[O.RGB_INTEGER]:r.RGB32UI,[O.RG_INTEGER]:r.RG32UI,[O.RED_INTEGER]:r.R32UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[st.INT]:{[O.RGBA_INTEGER]:r.RGBA32I,[O.RGB_INTEGER]:r.RGB32I,[O.RG_INTEGER]:r.RG32I,[O.RED_INTEGER]:r.R32I},[st.FLOAT]:{[O.RGBA]:r.RGBA32F,[O.RGB]:r.RGB32F,[O.RG]:r.RG32F,[O.RED]:r.R32F,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[st.HALF_FLOAT]:{[O.RGBA]:r.RGBA16F,[O.RGB]:r.RGB16F,[O.RG]:r.RG16F,[O.RED]:r.R16F},[st.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB565},[st.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA4},[st.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGB5_A1},[st.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:r.RGB10_A2,[O.RGBA_INTEGER]:r.RGB10_A2UI},[st.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:r.R11F_G11F_B10F},[st.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:r.RGB9_E5},[st.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[st.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[st.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA,[O.RGB]:r.RGB,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[st.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB},[st.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA},[st.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGBA}},t}var _n=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ft,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=UM(t),this.samplerTypes=GM(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new ks(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new ks(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==N.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new ks(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??N.FLOAT,this.webGLVersion===2&&t.type===st.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==N.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Ix(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ar.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Al.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Ar.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===fr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};_n.extension={type:V.RendererSystem,name:"texture"};q.add(_n);var bn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};bn.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(bn);var _i=class{constructor(t){this.renderer=t}init(t){this.screen=new xt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};_i.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},_i.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(_i);Y.PREFER_ENV=Ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...xi.defaultOptions,...gi.defaultOptions,..._i.defaultOptions,...yi.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ft.defaultOptions.wrapMode},set(r){ct("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ft.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return ft.defaultOptions.scaleMode},set(r){ct("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ft.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return ft.defaultOptions.mipmap},set(r){ct("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ft.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return ft.defaultOptions.anisotropicLevel},set(r){ct("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ft.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ct("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Kr.defaultResolution},set(r){Kr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ct("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Kr.defaultMultisample},set(r){Kr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return mi.defaultMaxTextures},set(r){ct("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),mi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return mi.defaultBatchSize},set(r){ct("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),mi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return mi.canUploadSameBuffer},set(r){ct("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),mi.canUploadSameBuffer=r}},GC_MODE:{get(){return Zr.defaultMode},set(r){ct("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Zr.defaultMode=r}},GC_MAX_IDLE:{get(){return Zr.defaultMaxIdle},set(r){ct("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Zr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Zr.defaultCheckCountMax},set(r){ct("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Zr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return gr.defaultVertexPrecision},set(r){ct("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),gr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return gr.defaultFragmentPrecision},set(r){ct("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),gr.defaultFragmentPrecision=r}}});var Gs=(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))(Gs||{});var vn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var OM=class rr{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 vn(null,null,1/0),this.deltaMS=1/rr.targetFPMS,this.elapsedMS=1/rr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Gs.NORMAL){return this._addListener(new vn(t,e,i))}addOnce(t,e,i=Gs.NORMAL){return this._addListener(new vn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*rr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,rr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!rr._shared){let t=rr._shared=new rr;t.autoStart=!0,t._protected=!0}return rr._shared}static get system(){if(!rr._system){let t=rr._system=new rr;t.autoStart=!0,t._protected=!0}return rr._system}};OM.targetFPMS=.06;var xr=OM;Object.defineProperties(Y,{TARGET_FPMS:{get(){return xr.targetFPMS},set(r){ct("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),xr.targetFPMS=r}}});var hh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Gs.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xr.shared:new xr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};hh.extension=V.Application;q.add(hh);var dO=[];q.handleByList(V.Renderer,dO);var ch=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};ch.extension={type:V.RendererSystem,name:"_multisample"};q.add(ch);var Hd=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var uh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Hd(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};uh.extension={type:V.RendererSystem,name:"buffer"};q.add(uh);var dh=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};dh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(dh);var Vd=class sy extends yn{constructor(t){super(),this.type=Xg.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new er({projectionMatrix:new It},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:sy.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ct("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=sy.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Mx()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ct("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ct("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ct("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ct("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ct("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ct("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ct("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ct("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Vd.extension={type:V.Renderer,priority:1},Vd.__plugins={},Vd.__systems={};var Wd=Vd;q.handleByMap(V.RendererPlugin,Wd.__plugins);q.handleByMap(V.RendererSystem,Wd.__systems);q.add(Wd);var Wi=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ft;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof tr?this.addResourceAt(t[i],i):this.addResourceAt(en(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var fh=class extends Wi{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ci.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let h=n[l];o[l]<h.dirtyId&&(o[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}};var ph=class extends de{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var LM=class mh extends Wi{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==mh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<mh.SIDES;a++)this.items[a].target=ci.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ci.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ci.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<mh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===mh.SIDES}};LM.SIDES=6;var oy=LM;var gh=class r extends de{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await Y.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===Qe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??Y.ADAPTER.createCanvas(0,0),r._EMPTY}};var ny=class zd extends de{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},zd.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;de.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${di()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=zd.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&zd.SVG_XML.test(t)}};ny.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ny.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ay=ny;var $d=class extends de{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var ly=class hy extends de{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];de.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||hy.MIME_TYPES[c]||`video/${c}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=xr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(xr.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||(xr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||hy.TYPES.includes(e)}};ly.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],ly.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var cy=ly;Hl.push(gh,Ms,ph,cy,$d,ay,Ts,oy,fh);var fO={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},pO={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function DM(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let h in r.uniforms){let c=t[h],u=i[h],d=e[h],f=r.uniforms[h];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?fO:pO)[c.type].call(null,l,d.location,d.value,u)}}function mO(){Object.assign(Vi.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;DM(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}mO();var xh=new(window.AudioContext||window.webkitAudioContext),gO=(r,t)=>{let e,i=xh.createGain();i.gain.value=t.volume??1,i.connect(xh.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Do.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=xh.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,xh.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(xh.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}},NM=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let h=r.find(c=>c.id===l.id);if(!h){let c=gO(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(c),c.play();continue}(h.url!==l.url||h.loop!==l.loop)&&(h.stop(),h.setUrl(l.url),h.setLoop(l.loop??!1),h.play()),h.getVolume()!==(l.volume??1)&&h.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(h=>h.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var xO=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var uy=xO;var HM=({type:r,parse:t})=>({type:r,parse:t});var dy=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function fy(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function yh(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function zM(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function $M(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function yO(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function jM(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var vh={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,"-":dy?173:189,"=":dy?61:187,";":dy?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Mr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},_h={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},ve={16:!1,18:!1,17:!1,91:!1},$t={};for(let r=1;r<20;r++)vh[`f${r}`]=111+r;var Nt=[],bh=null,XM="all",bi=new Map,Tn=r=>vh[r.toLowerCase()]||Mr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),_O=r=>Object.keys(vh).find(t=>vh[t]===r),bO=r=>Object.keys(Mr).find(t=>Mr[t]===r),YM=r=>{XM=r||"all"},Th=()=>XM||"all",vO=()=>Nt.slice(0),TO=()=>Nt.map(r=>_O(r)||bO(r)||String.fromCharCode(r)),SO=()=>{let r=[];return Object.keys($t).forEach(t=>{$t[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Tn(n))})})}),r},qM=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},EO=r=>(typeof r=="string"&&(r=Tn(r)),Nt.indexOf(r)!==-1),wO=(r,t)=>{let e,i;r||(r=Th());for(let s in $t)if(Object.prototype.hasOwnProperty.call($t,s))for(e=$t[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>my(o)):i++;Th()===r&&YM(t||"all")};function AO(r){let t=jM(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Tn(r.key));let e=Nt.indexOf(t);if(e>=0&&Nt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Nt.splice(0,Nt.length),(t===93||t===224)&&(t=91),t in ve){ve[t]=!1;for(let i in Mr)Mr[i]===t&&(ir[i]=!1)}}var KM=(r,...t)=>{if(typeof r>"u")Object.keys($t).forEach(e=>{Array.isArray($t[e])&&$t[e].forEach(i=>jd(i)),delete $t[e]}),my(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&jd(e)});else if(typeof r=="object")r.key&&jd(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),jd({key:r,scope:e,method:i,splitKey:"+"})}},jd=({key:r,scope:t,method:e,splitKey:i="+"})=>{$M(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Tn(a);if(!$t[l])return;t||(t=Th());let h=n>1?zM(Mr,o):[],c=[];$t[l]=$t[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&yO(u.mods,h);return d&&c.push(u.element),!d}),c.forEach(u=>my(u))})};function VM(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in ve)Object.prototype.hasOwnProperty.call(ve,o)&&(!ve[o]&&t.mods.indexOf(+o)>-1||ve[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!ve[16]&&!ve[18]&&!ve[17]&&!ve[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Nt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function WM(r,t){let e=$t["*"],i=jM(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ir.filter||qM).call(this,r))return;if((i===93||i===224)&&(i=91),Nt.indexOf(i)===-1&&i!==229&&Nt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=_h[a];r[a]&&Nt.indexOf(l)===-1?Nt.push(l):!r[a]&&Nt.indexOf(l)>-1?Nt.splice(Nt.indexOf(l),1):a==="metaKey"&&r[a]&&(Nt=Nt.filter(h=>h in _h||h===i))}),i in ve){ve[i]=!0;for(let a in Mr)if(Object.prototype.hasOwnProperty.call(Mr,a)){let l=_h[Mr[a]];ir[a]=r[l]}if(!e)return}for(let a in ve)Object.prototype.hasOwnProperty.call(ve,a)&&(ve[a]=r[_h[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Nt.indexOf(17)===-1&&Nt.push(17),Nt.indexOf(18)===-1&&Nt.push(18),ve[17]=!0,ve[18]=!0);let s=Th();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&VM(r,e[a],s,t);if(!(i in $t))return;let o=$t[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:h}=l,c=l.key.split(h),u=[];for(let d=0;d<c.length;d++)u.push(Tn(c[d]));u.sort().join("")===Nt.sort().join("")&&VM(r,l,s,t)}}var ir=function(r,t,e){Nt=[];let i=$M(r),s=[],o="all",n=document,a=0,l=!1,h=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(h=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&KM(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=zM(Mr,f));let g=f[f.length-1];g=g==="*"?"*":Tn(g),g in $t||($t[g]=[]),$t[g].push({keyup:l,keydown:h,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!bi.has(n)){let f=(m=window.event)=>WM(m,n),g=(m=window.event)=>{WM(m,n),AO(m)};bi.set(n,{keydownListener:f,keyupListenr:g,capture:u}),fy(n,"keydown",f,u),fy(n,"keyup",g,u)}if(!bh){let f=()=>{Nt=[]};bh={listener:f,capture:u},fy(window,"focus",f,u)}}};function PO(r,t="all"){Object.keys($t).forEach(e=>{$t[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function my(r){let t=Object.values($t).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=bi.get(r)||{};e&&i&&(yh(r,"keyup",i,s),yh(r,"keydown",e,s),bi.delete(r))}if((t.length<=0||bi.size<=0)&&(Array.from(bi.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=bi.get(e)||{};i&&s&&(yh(e,"keyup",s,o),yh(e,"keydown",i,o),bi.delete(e))}),bi.clear(),Object.keys($t).forEach(e=>delete $t[e]),bh)){let{listener:e,capture:i}=bh;yh(window,"focus",e,i),bh=null}}var py={getPressedKeyString:TO,setScope:YM,getScope:Th,deleteScope:wO,getPressedKeyCodes:vO,getAllKeyCodes:SO,isPressed:EO,filter:qM,trigger:PO,unbind:KM,keyMap:vh,modifier:Mr,modifierMap:_h};for(let r in py){let t=r;Object.prototype.hasOwnProperty.call(py,t)&&(ir[t]=py[t])}if(typeof window<"u"){let r=window.hotkeys;ir.noConflict=t=>(t&&window.hotkeys===ir&&(window.hotkeys=r),ir),window.hotkeys=ir}var CO=Object.prototype.hasOwnProperty,ZM=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let h=t.get(l);h?Et(h.payload,s[l].actionPayload)||(n.push(l),ir.unbind(l)):o.push(l)}),t.forEach((l,h)=>{CO.call(s,h)||a.push(h)}),a.forEach(l=>{ir.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let c=s[l].actionPayload??{};ir(l,()=>{r&&r("keydown",{_event:{key:l},...c})}),t.set(l,{value:l,payload:c})})},destroy:()=>{for(let s of t.keys())ir.unbind(s);t.clear()}}};var RO={linear:r=>r},MO=(r,t,e)=>{if(typeof t=="string"){let s=Ug[t];if(s)t=s;else{let o=r[t];return o===void 0?e:o}}let i=r;for(let s of t){if(i==null)return e;i=i[s]}return i===void 0?e:i},QM=(r,t,e)=>{if(typeof t=="string"){let s=Ug[t];if(s)t=s;else return r[t]=e,r}let i=r;for(let s=0;s<t.length-1;s++){let o=t[s];o in i||(i[o]={}),i=i[o]}return i[t[t.length-1]]=e,r},BO=(r,t,e,i)=>r+(t-r)*RO[i](e),IO=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{l===0?(i=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?i=i+s:i=s,t.push({time:e,value:i,easing:n}))}),t},FO=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return BO(s,a,l,o)}}return r[r.length-1].value},JM=()=>{let r=[],t=new Map,e=new Map,i=0,s=S=>{r.push(S)},o=()=>{let S=r.splice(0);for(let w of S)n(w)},n=S=>{switch(S.type){case"START":a(S.payload);break;case"CANCEL":c(S.id);break}},a=S=>{let{id:w,element:P,properties:C,targetState:M,onComplete:I}=S,k=l(P,C),G=h(k),ut={id:w,element:P,timelines:k,duration:G,currentTime:0,stateVersion:i,targetState:M,onComplete:I};g(ut,0),t.set(w,ut),y("started",{id:w})},l=(S,w)=>Object.entries(w).map(([P,C])=>{if(!L1[P])throw new Error(`${P} is not a supported property for transition.`);let M=MO(S,P),k=[{value:C.initialValue??M},...C.keyframes],G=IO(k);return{property:P,timeline:G}}),h=S=>{let w=0;for(let{timeline:P}of S){let C=P[P.length-1];C&&C.time>w&&(w=C.time)}return w},c=S=>{let w=t.get(S);w&&(d(w),t.delete(S),y("cancelled",{id:S}))},u=()=>{for(let[S,w]of t)d(w),y("cancelled",{id:S});t.clear(),i++},d=S=>{let{element:w,targetState:P}=S;if(!(!w||w.destroyed)){if(P===null){w.destroy();return}if(P)for(let[C,M]of Object.entries(P))try{QM(w,C,M)}catch{}}},f=S=>{o();let w=[];for(let[P,C]of t){if(C.stateVersion!==i){w.push(P);continue}if(!C.element||C.element.destroyed){w.push(P);continue}if(C.currentTime+=S,C.currentTime>=C.duration){g(C,C.duration),m(C),w.push(P);continue}g(C,C.currentTime)}for(let P of w)t.delete(P)},g=(S,w)=>{let{element:P,timelines:C}=S;for(let{property:M,timeline:I}of C){let k=FO(I,w);try{QM(P,M,k)}catch{}}},m=S=>{let{id:w,onComplete:P}=S;if(y("completed",{id:w}),P)try{P()}catch{}},p=(S,w)=>(e.has(S)||e.set(S,new Set),e.get(S).add(w),()=>_(S,w)),_=(S,w)=>{e.get(S)?.delete(w)},y=(S,w)=>{e.get(S)?.forEach(P=>{try{P(w)}catch{}})};return{dispatch:s,cancelAll:u,flush:()=>{o()},tick:f,on:p,off:_,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([S,w])=>({id:S,currentTime:w.currentTime,duration:w.duration,progress:w.duration>0?w.currentTime/w.duration:0}))}),isAnimating:S=>t.has(S),destroy:()=>{u(),e.clear()}}};var tB=r=>{let t=0,e=0,i=null;return{reset:h=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=h},track:h=>{h===e&&t++},complete:h=>{h===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var gy=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t};var kO=r=>r.split("/").pop(),GO=r=>({name:"advancedBufferLoader",priority:2,bufferMap:r,load:async t=>{let e=t.startsWith("file:")?t:kO(t),i=r[e];if(!i)throw new Error(`Buffer not found for key: ${e}`);return{data:i.buffer,type:i.type,metadata:null,alias:e}},test:async t=>!t.startsWith("blob:"),testParse:async t=>!0,parse:async t=>{if(t instanceof R)return t;let e=new Blob([t.data],{type:t.type}),i=await createImageBitmap(e);return R.from(i)},unload:async t=>t.destroy(!0)}),UO=()=>{let r,t=NM(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,h=!1,c,u,d,f=new Set,g=b=>b?b.startsWith("audio/")?"audio":b.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(b)?"font":b.startsWith("video/")?"video":"texture":"texture",m=b=>{f.add(b)},p=()=>{for(let b of f)URL.revokeObjectURL(b);f.clear()},_=(b,E,A)=>{o&&o.registerHotkeys(A?.keyboard??{}),b.renderer.events.cursorStyles||(b.renderer.events.cursorStyles={}),b.renderer.events.cursorStyles.default||(b.renderer.events.cursorStyles.default="default"),b.renderer.events.cursorStyles.hover||(b.renderer.events.cursorStyles.hover="pointer");let S=E?.cursorStyles,w=A?.cursorStyles;Et(S,w)||(w?(w.default&&(b.renderer.events.cursorStyles.default=w.default,b.canvas.style.cursor=w.default),w.hover&&(b.renderer.events.cursorStyles.hover=w.hover)):S&&(b.renderer.events.cursorStyles.default="default",b.renderer.events.cursorStyles.hover="pointer"))},y=(b,E,A,S)=>{u&&u.abort(),u=new AbortController;let w=u.signal;a.reset(A.id),_(b,e.global,A.global),n.cancelAll(),bl({app:b,parent:E,prevComputedTree:e.elements,nextComputedTree:A.elements,animations:A.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:S,signal:w}),n.flush(),jg({app:b,prevAudioTree:e.audio,nextAudioTree:A.audio,audioPlugins:s.audio}),e=A,a.completeIfEmpty(),h||(h=!0,l&&l())},v={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:b=>{if(r.stage.children&&r.stage.children.length>0)for(let E of r.stage.children){let A=findElementByLabel(E,b);if(A)return A}return null},extractBase64:async b=>{let E=new et(0,0,r.renderer.width,r.renderer.height);if(!b)return await r.renderer.extract.base64({target:r.stage,frame:E});let A=r.stage.getChildByLabel(b,!0);if(!A)throw new Error(`Element with label '${b}' not found`);return await r.renderer.extract.base64({target:A,frame:E})},assignStageEvent:(b,E)=>{r.stage.eventMode="static",r.stage.on(b,E)},init:async b=>{let{eventHandler:E,plugins:A,width:S,height:w,backgroundColor:P,debug:C=!1,onFirstRender:M}=b;l=M;let I=[];A?.elements?.forEach(G=>{G?.parse&&I.push(HM({type:G.type,parse:G.parse}))}),s={animations:A?.animations??[],elements:A?.elements??[],audio:A?.audio??[],parsers:I},i=E,o=ZM(E),a=tB(E),r=new pl,r.audioStage=t,await r.init({width:S,height:w,backgroundColor:P,preference:"webgl"}),r.debug=C;let k=new he;return k.rect(0,0,S,w),k.fill(P||0),r.stage.addChild(k),r.stage.width=S,r.stage.height=w,r.ticker.add(r.audioStage.tick),n=JM(),C?(d=G=>{G?.detail?.deltaMS&&n.tick(Number(G.detail.deltaMS))},window.addEventListener("snapShotKeyFrame",d)):r.ticker.add(G=>n.tick(G.deltaMS)),v},destroy:()=>{u&&(u.abort(),u=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),o?.destroy(),Dg(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let b=E=>{for(let A of E.children){let S=A.texture?.source?.resource;S instanceof HTMLVideoElement&&S.pause(),A.children&&b(A)}};r?.stage&&b(r.stage),r&&r.destroy(),c&&(U.remove(c),c=void 0),p()},loadAssets:async b=>{if(!b)throw new Error("assetBufferMap is required");let E={audio:{},font:{},video:{},texture:{}};for(let[P,C]of Object.entries(b)){let M=g(C.type);E[M][P]=C}await Promise.all(Object.entries(E.audio).map(([P,C])=>Do.load(P,C.buffer))),await Promise.all(Object.entries(E.font).map(async([P,C])=>{let M=new Blob([C.buffer],{type:C.type}),I=URL.createObjectURL(M),k=new FontFace(P,`url(${I})`);try{await k.load(),document.fonts.add(k)}catch(G){console.error(`Failed to load font ${P}:`,G)}finally{URL.revokeObjectURL(I)}})),c?Object.assign(c.bufferMap,E.texture):(c=GO(E.texture),U.add({name:"advanced-buffer-loader",extension:T.Asset,priority:pe.High,loader:c}),typeof Sr.registerPlugin=="function"&&Sr.registerPlugin(c));let A=Object.entries(E.video).map(([P,C])=>{let M=new Blob([C.buffer],{type:C.type}),I=URL.createObjectURL(M);return m(I),Sr.load({alias:P,src:I,loadParser:"loadVideo"}).catch(k=>{throw f.delete(I),URL.revokeObjectURL(I),k})}),w=Object.keys(E.texture).map(P=>Sr.load(P));return Promise.all([...w,...A])},loadAudioAssets:async b=>Promise.all(b.map(async E=>{let S=await(await fetch(E)).arrayBuffer();return Do.load(E,S)})),updatedBackgroundColor:b=>{r.renderer.background.color=b},render:b=>{let E=gy(b),A=uy({JSONObject:E.elements,parserPlugins:s.parsers}),S={...E,elements:A};y(r,r.stage,S,i)},parse:b=>{let E=gy(b),A=uy({JSONObject:E.elements,parserPlugins:s.parsers});return{...E,elements:A}}};return v},eB=UO;var ASt=eB;export{pl as Application,Sr as Assets,Do as AudioAsset,Dk as animatedSpritePlugin,Gk as containerPlugin,kg as createAnimationPlugin,cB as createAssetBufferManager,Gg as createAudioPlugin,ce as createElementPlugin,ASt as default,Xk as particlesPlugin,Bk as rectPlugin,jg as renderAudio,bl as renderElements,kk as sliderPlugin,Vk as soundPlugin,Ik as spritePlugin,Mk as textPlugin,Lk as textRevealingPlugin,Nk as tweenPlugin,Fk as videoPlugin};
|
|
1628
|
+
`))}}var tL=0,Qd={textureCount:0,uboCount:0},zi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=tL++}systemCheck(){if(!jd())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Qd.textureCount=0,Qd.uboCount=0,this.syncUniformGroup(t.uniformGroup,Qd)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=cy(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Qd,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=_y(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=yy(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};zi.extension={type:z.RendererSystem,name:"shader"};K.add(zi);var bi=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};bi.defaultOptions={hello:!1},bi.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"startup"};K.add(bi);function iI(r,t=[]){return t[tt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.ADD]=[r.ONE,r.ONE],t[tt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.NONE]=[0,0],t[tt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[tt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[tt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[tt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[tt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[tt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[tt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[tt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[tt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[tt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[tt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var eL=0,rL=1,iL=2,sL=3,oL=4,nL=5,sI=class by{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=tt.NONE,this._blendEq=!1,this.map=[],this.map[eL]=this.setBlend,this.map[rL]=this.setOffset,this.map[iL]=this.setCullFace,this.map[sL]=this.setDepthTest,this.map[oL]=this.setFrontFace,this.map[nL]=this.setDepthMask,this.checks=[],this.defaultState=new qr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=iI(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(by.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(by.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};sI.extension={type:z.RendererSystem,name:"state"};var vy=sI;K.add(vy);var Tn=class extends ws.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Jt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var mh=class Jd{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Jd.defaultMaxIdle,this.checkCountMax=Jd.defaultCheckCountMax,this.mode=Jd.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==dd.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};mh.defaultMode=dd.AUTO,mh.defaultMaxIdle=60*60,mh.defaultCheckCountMax=60*10,mh.extension={type:z.RendererSystem,name:"textureGC"};var Qr=mh;K.add(Qr);var Os=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=nt.UNSIGNED_BYTE,this.internalFormat=L.RGBA,this.samplerType=0}};function oI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.R8]:N.FLOAT,[r.R8_SNORM]:N.FLOAT,[r.RG8]:N.FLOAT,[r.RG8_SNORM]:N.FLOAT,[r.RGB8]:N.FLOAT,[r.RGB8_SNORM]:N.FLOAT,[r.RGB565]:N.FLOAT,[r.RGBA4]:N.FLOAT,[r.RGB5_A1]:N.FLOAT,[r.RGBA8]:N.FLOAT,[r.RGBA8_SNORM]:N.FLOAT,[r.RGB10_A2]:N.FLOAT,[r.RGB10_A2UI]:N.FLOAT,[r.SRGB8]:N.FLOAT,[r.SRGB8_ALPHA8]:N.FLOAT,[r.R16F]:N.FLOAT,[r.RG16F]:N.FLOAT,[r.RGB16F]:N.FLOAT,[r.RGBA16F]:N.FLOAT,[r.R32F]:N.FLOAT,[r.RG32F]:N.FLOAT,[r.RGB32F]:N.FLOAT,[r.RGBA32F]:N.FLOAT,[r.R11F_G11F_B10F]:N.FLOAT,[r.RGB9_E5]:N.FLOAT,[r.R8I]:N.INT,[r.R8UI]:N.UINT,[r.R16I]:N.INT,[r.R16UI]:N.UINT,[r.R32I]:N.INT,[r.R32UI]:N.UINT,[r.RG8I]:N.INT,[r.RG8UI]:N.UINT,[r.RG16I]:N.INT,[r.RG16UI]:N.UINT,[r.RG32I]:N.INT,[r.RG32UI]:N.UINT,[r.RGB8I]:N.INT,[r.RGB8UI]:N.UINT,[r.RGB16I]:N.INT,[r.RGB16UI]:N.UINT,[r.RGB32I]:N.INT,[r.RGB32UI]:N.UINT,[r.RGBA8I]:N.INT,[r.RGBA8UI]:N.UINT,[r.RGBA16I]:N.INT,[r.RGBA16UI]:N.UINT,[r.RGBA32I]:N.INT,[r.RGBA32UI]:N.UINT,[r.DEPTH_COMPONENT16]:N.FLOAT,[r.DEPTH_COMPONENT24]:N.FLOAT,[r.DEPTH_COMPONENT32F]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT,[r.DEPTH24_STENCIL8]:N.FLOAT,[r.DEPTH32F_STENCIL8]:N.FLOAT}:t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT},t}function nI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA8,[L.RGB]:r.RGB8,[L.RG]:r.RG8,[L.RED]:r.R8,[L.RGBA_INTEGER]:r.RGBA8UI,[L.RGB_INTEGER]:r.RGB8UI,[L.RG_INTEGER]:r.RG8UI,[L.RED_INTEGER]:r.R8UI,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.BYTE]:{[L.RGBA]:r.RGBA8_SNORM,[L.RGB]:r.RGB8_SNORM,[L.RG]:r.RG8_SNORM,[L.RED]:r.R8_SNORM,[L.RGBA_INTEGER]:r.RGBA8I,[L.RGB_INTEGER]:r.RGB8I,[L.RG_INTEGER]:r.RG8I,[L.RED_INTEGER]:r.R8I},[nt.UNSIGNED_SHORT]:{[L.RGBA_INTEGER]:r.RGBA16UI,[L.RGB_INTEGER]:r.RGB16UI,[L.RG_INTEGER]:r.RG16UI,[L.RED_INTEGER]:r.R16UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[nt.SHORT]:{[L.RGBA_INTEGER]:r.RGBA16I,[L.RGB_INTEGER]:r.RGB16I,[L.RG_INTEGER]:r.RG16I,[L.RED_INTEGER]:r.R16I},[nt.UNSIGNED_INT]:{[L.RGBA_INTEGER]:r.RGBA32UI,[L.RGB_INTEGER]:r.RGB32UI,[L.RG_INTEGER]:r.RG32UI,[L.RED_INTEGER]:r.R32UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[nt.INT]:{[L.RGBA_INTEGER]:r.RGBA32I,[L.RGB_INTEGER]:r.RGB32I,[L.RG_INTEGER]:r.RG32I,[L.RED_INTEGER]:r.R32I},[nt.FLOAT]:{[L.RGBA]:r.RGBA32F,[L.RGB]:r.RGB32F,[L.RG]:r.RG32F,[L.RED]:r.R32F,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[nt.HALF_FLOAT]:{[L.RGBA]:r.RGBA16F,[L.RGB]:r.RGB16F,[L.RG]:r.RG16F,[L.RED]:r.R16F},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB565},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA4},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGB5_A1},[nt.UNSIGNED_INT_2_10_10_10_REV]:{[L.RGBA]:r.RGB10_A2,[L.RGBA_INTEGER]:r.RGB10_A2UI},[nt.UNSIGNED_INT_10F_11F_11F_REV]:{[L.RGB]:r.R11F_G11F_B10F},[nt.UNSIGNED_INT_5_9_9_9_REV]:{[L.RGB]:r.RGB9_E5},[nt.UNSIGNED_INT_24_8]:{[L.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[nt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[L.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA,[L.RGB]:r.RGB,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGBA}},t}var Sn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=nI(t),this.samplerTypes=oI(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new Os(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Os(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==N.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Os(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??N.FLOAT,this.webGLVersion===2&&t.type===nt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==N.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Kx(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Pr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fl.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Pr.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===fr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};Sn.extension={type:z.RendererSystem,name:"texture"};K.add(Sn);var wn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};wn.extension={type:z.RendererSystem,name:"transformFeedback"};K.add(wn);var vi=class{constructor(t){this.renderer=t}init(t){this.screen=new yt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};vi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},vi.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_view"};K.add(vi);q.PREFER_ENV=Ze.WEBGL2;q.STRICT_TEXTURE_CACHE=!1;q.RENDER_OPTIONS={..._i.defaultOptions,...yi.defaultOptions,...vi.defaultOptions,...bi.defaultOptions};Object.defineProperties(q,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(r){dt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(r){dt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(r){dt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(r){dt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return dt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Zr.defaultResolution},set(r){Zr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return dt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Zr.defaultMultisample},set(r){Zr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return xi.defaultMaxTextures},set(r){dt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),xi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return xi.defaultBatchSize},set(r){dt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),xi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return xi.canUploadSameBuffer},set(r){dt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),xi.canUploadSameBuffer=r}},GC_MODE:{get(){return Qr.defaultMode},set(r){dt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Qr.defaultMode=r}},GC_MAX_IDLE:{get(){return Qr.defaultMaxIdle},set(r){dt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Qr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Qr.defaultCheckCountMax},set(r){dt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Qr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return gr.defaultVertexPrecision},set(r){dt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),gr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return gr.defaultFragmentPrecision},set(r){dt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),gr.defaultFragmentPrecision=r}}});var Ls=(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))(Ls||{});var En=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var aI=class rr{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 En(null,null,1/0),this.deltaMS=1/rr.targetFPMS,this.elapsedMS=1/rr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Ls.NORMAL){return this._addListener(new En(t,e,i))}addOnce(t,e,i=Ls.NORMAL){return this._addListener(new En(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*rr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,rr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!rr._shared){let t=rr._shared=new rr;t.autoStart=!0,t._protected=!0}return rr._shared}static get system(){if(!rr._system){let t=rr._system=new rr;t.autoStart=!0,t._protected=!0}return rr._system}};aI.targetFPMS=.06;var xr=aI;Object.defineProperties(q,{TARGET_FPMS:{get(){return xr.targetFPMS},set(r){dt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),xr.targetFPMS=r}}});var gh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ls.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xr.shared:new xr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};gh.extension=z.Application;K.add(gh);var aL=[];K.handleByList(z.Renderer,aL);var xh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Rt.HIGH?this.multisample=Rt.HIGH:e>=Rt.MEDIUM?this.multisample=Rt.MEDIUM:e>=Rt.LOW?this.multisample=Rt.LOW:this.multisample=Rt.NONE}destroy(){}};xh.extension={type:z.RendererSystem,name:"_multisample"};K.add(xh);var tf=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var yh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new tf(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};yh.extension={type:z.RendererSystem,name:"buffer"};K.add(yh);var _h=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};_h.extension={type:z.RendererSystem,name:"objectRenderer"};K.add(_h);var ef=class Ty extends Tn{constructor(t){super(),this.type=ux.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new er({projectionMatrix:new Gt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ty.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(dt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Ty.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Yx()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return dt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return dt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return dt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return dt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){dt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return dt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){dt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return dt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ef.extension={type:z.Renderer,priority:1},ef.__plugins={},ef.__systems={};var rf=ef;K.handleByMap(z.RendererPlugin,rf.__plugins);K.handleByMap(z.RendererSystem,rf.__systems);K.add(rf);var $i=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new gt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof tr?this.addResourceAt(t[i],i):this.addResourceAt(nn(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var bh=class extends $i{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=di.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let h=n[l];o[l]<h.dirtyId&&(o[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}};var vh=class extends fe{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var lI=class Th extends $i{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Th.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Th.SIDES;a++)this.items[a].target=di.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=di.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=di.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<Th.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Th.SIDES}};lI.SIDES=6;var Sy=lI;var Sh=class r extends fe{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??q.ADAPTER.createCanvas(0,0),r._EMPTY}};var wy=class sf extends fe{constructor(t,e){e=e||{},super(q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},sf.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;fe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${pi()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=sf.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&sf.SVG_XML.test(t)}};wy.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,wy.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Ey=wy;var of=class extends fe{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Ay=class Py extends fe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];fe.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||Py.MIME_TYPES[c]||`video/${c}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=xr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(xr.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||(xr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Py.TYPES.includes(e)}};Ay.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ay.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Cy=Ay;Yl.push(Sh,Fs,vh,Cy,of,Ey,Es,Sy,bh);var lL={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},hL={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function hI(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let h in r.uniforms){let c=t[h],u=i[h],d=e[h],f=r.uniforms[h];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?lL:hL)[c.type].call(null,l,d.location,d.value,u)}}function cL(){Object.assign(zi.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;hI(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}cL();var wh=new(window.AudioContext||window.webkitAudioContext),uL=(r,t)=>{let e,i=wh.createGain();i.gain.value=t.volume??1,i.connect(wh.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let g=Wo.getAsset(s.url);if(!g){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=wh.createBufferSource(),e.buffer=g,e.loop=s.loop,i.gain.setValueAtTime(s.volume,wh.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(wh.destination))},update:g=>{s={...s,...g}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:g=>{s.url=g},setLoop:g=>{s.loop=g},setVolume:g=>{s.volume=g,i.gain.value=g},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},cI=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let h=r.find(c=>c.id===l.id);if(!h){let c=uL(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(c),c.play();continue}(h.url!==l.url||h.loop!==l.loop)&&(h.stop(),h.setUrl(l.url),h.setLoop(l.loop??!1),h.play()),h.getVolume()!==(l.volume??1)&&h.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(h=>h.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var dL=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Ry=dL;var uI=({type:r,parse:t})=>({type:r,parse:t});var My=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Iy(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function Eh(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function pI(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function mI(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function fL(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function gI(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var Ch={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,"-":My?173:189,"=":My?61:187,";":My?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Ir={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},Ah={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Se={16:!1,18:!1,17:!1,91:!1},Xt={};for(let r=1;r<20;r++)Ch[`f${r}`]=111+r;var Ht=[],Ph=null,xI="all",Ti=new Map,An=r=>Ch[r.toLowerCase()]||Ir[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),pL=r=>Object.keys(Ch).find(t=>Ch[t]===r),mL=r=>Object.keys(Ir).find(t=>Ir[t]===r),yI=r=>{xI=r||"all"},Rh=()=>xI||"all",gL=()=>Ht.slice(0),xL=()=>Ht.map(r=>pL(r)||mL(r)||String.fromCharCode(r)),yL=()=>{let r=[];return Object.keys(Xt).forEach(t=>{Xt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>An(n))})})}),r},_I=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},_L=r=>(typeof r=="string"&&(r=An(r)),Ht.indexOf(r)!==-1),bL=(r,t)=>{let e,i;r||(r=Rh());for(let s in Xt)if(Object.prototype.hasOwnProperty.call(Xt,s))for(e=Xt[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>Fy(o)):i++;Rh()===r&&yI(t||"all")};function vL(r){let t=gI(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=An(r.key));let e=Ht.indexOf(t);if(e>=0&&Ht.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Ht.splice(0,Ht.length),(t===93||t===224)&&(t=91),t in Se){Se[t]=!1;for(let i in Ir)Ir[i]===t&&(ir[i]=!1)}}var bI=(r,...t)=>{if(typeof r>"u")Object.keys(Xt).forEach(e=>{Array.isArray(Xt[e])&&Xt[e].forEach(i=>nf(i)),delete Xt[e]}),Fy(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&nf(e)});else if(typeof r=="object")r.key&&nf(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),nf({key:r,scope:e,method:i,splitKey:"+"})}},nf=({key:r,scope:t,method:e,splitKey:i="+"})=>{mI(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":An(a);if(!Xt[l])return;t||(t=Rh());let h=n>1?pI(Ir,o):[],c=[];Xt[l]=Xt[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&fL(u.mods,h);return d&&c.push(u.element),!d}),c.forEach(u=>Fy(u))})};function dI(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in Se)Object.prototype.hasOwnProperty.call(Se,o)&&(!Se[o]&&t.mods.indexOf(+o)>-1||Se[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!Se[16]&&!Se[18]&&!Se[17]&&!Se[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Ht),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function fI(r,t){let e=Xt["*"],i=gI(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ir.filter||_I).call(this,r))return;if((i===93||i===224)&&(i=91),Ht.indexOf(i)===-1&&i!==229&&Ht.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Ah[a];r[a]&&Ht.indexOf(l)===-1?Ht.push(l):!r[a]&&Ht.indexOf(l)>-1?Ht.splice(Ht.indexOf(l),1):a==="metaKey"&&r[a]&&(Ht=Ht.filter(h=>h in Ah||h===i))}),i in Se){Se[i]=!0;for(let a in Ir)if(Object.prototype.hasOwnProperty.call(Ir,a)){let l=Ah[Ir[a]];ir[a]=r[l]}if(!e)return}for(let a in Se)Object.prototype.hasOwnProperty.call(Se,a)&&(Se[a]=r[Ah[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Ht.indexOf(17)===-1&&Ht.push(17),Ht.indexOf(18)===-1&&Ht.push(18),Se[17]=!0,Se[18]=!0);let s=Rh();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&dI(r,e[a],s,t);if(!(i in Xt))return;let o=Xt[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:h}=l,c=l.key.split(h),u=[];for(let d=0;d<c.length;d++)u.push(An(c[d]));u.sort().join("")===Ht.sort().join("")&&dI(r,l,s,t)}}var ir=function(r,t,e){Ht=[];let i=mI(r),s=[],o="all",n=document,a=0,l=!1,h=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(h=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&bI(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=pI(Ir,f));let m=f[f.length-1];m=m==="*"?"*":An(m),m in Xt||(Xt[m]=[]),Xt[m].push({keyup:l,keydown:h,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ti.has(n)){let f=(g=window.event)=>fI(g,n),m=(g=window.event)=>{fI(g,n),vL(g)};Ti.set(n,{keydownListener:f,keyupListenr:m,capture:u}),Iy(n,"keydown",f,u),Iy(n,"keyup",m,u)}if(!Ph){let f=()=>{Ht=[]};Ph={listener:f,capture:u},Iy(window,"focus",f,u)}}};function TL(r,t="all"){Object.keys(Xt).forEach(e=>{Xt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Fy(r){let t=Object.values(Xt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ti.get(r)||{};e&&i&&(Eh(r,"keyup",i,s),Eh(r,"keydown",e,s),Ti.delete(r))}if((t.length<=0||Ti.size<=0)&&(Array.from(Ti.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ti.get(e)||{};i&&s&&(Eh(e,"keyup",s,o),Eh(e,"keydown",i,o),Ti.delete(e))}),Ti.clear(),Object.keys(Xt).forEach(e=>delete Xt[e]),Ph)){let{listener:e,capture:i}=Ph;Eh(window,"focus",e,i),Ph=null}}var By={getPressedKeyString:xL,setScope:yI,getScope:Rh,deleteScope:bL,getPressedKeyCodes:gL,getAllKeyCodes:yL,isPressed:_L,filter:_I,trigger:TL,unbind:bI,keyMap:Ch,modifier:Ir,modifierMap:Ah};for(let r in By){let t=r;Object.prototype.hasOwnProperty.call(By,t)&&(ir[t]=By[t])}if(typeof window<"u"){let r=window.hotkeys;ir.noConflict=t=>(t&&window.hotkeys===ir&&(window.hotkeys=r),ir),window.hotkeys=ir}var SL=Object.prototype.hasOwnProperty,vI=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let h=t.get(l);h?wt(h.payload,s[l].actionPayload)||(n.push(l),ir.unbind(l)):o.push(l)}),t.forEach((l,h)=>{SL.call(s,h)||a.push(h)}),a.forEach(l=>{ir.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let c=s[l].actionPayload??{};ir(l,()=>{r&&r("keydown",{_event:{key:l},...c})}),t.set(l,{value:l,payload:c})})},destroy:()=>{for(let s of t.keys())ir.unbind(s);t.clear()}}};var SI=(r,t)=>typeof t!="string"?t:r[t]??t,wL=(r,t,e,i)=>{let s=SI(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},TI=(r,t,e,i)=>{let s=SI(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},EL=(r,t,e)=>Object.entries(t).map(([i,s])=>{if(!rP[i])throw new Error(`${i} is not a supported property for animation.`);let o=wL(r,i,e,0),n=s.initialValue??o,a=wl([{value:n},...s.keyframes]);return{property:i,timeline:a}}),wI=()=>{let r=[],t=new Map,e=new Map,i=0,s=(b,S)=>{e.get(b)?.forEach(P=>{try{P(S)}catch{}})},o=b=>{if(s("completed",{id:b.id}),b.onComplete)try{b.onComplete()}catch{}},n=b=>{let{id:S,element:P,properties:A,targetState:C,onComplete:M,onCancel:I,propertyPathMap:k=iP}=b,G=EL(P,A,k),J={id:S,kind:"property",element:P,timelines:G,duration:El(G),currentTime:0,stateVersion:i,targetState:C,onComplete:M,onCancel:I,applyFrame:H=>{for(let{property:j,timeline:V}of G){let O=Al(V,H);try{TI(P,j,k,O)}catch{}}},applyTargetState:()=>{if(!(!P||P.destroyed)){if(C===null){P.destroy();return}if(C)for(let[H,j]of Object.entries(C))try{TI(P,H,k,j)}catch{}}},isValid:()=>!!P&&!P.destroyed};J.applyFrame(0),t.set(S,J),s("started",{id:S})},a=b=>{let S={id:b.id,kind:"custom",duration:b.duration??0,currentTime:0,stateVersion:i,onComplete:b.onComplete,onCancel:b.onCancel,applyFrame:b.applyFrame??(()=>{}),applyTargetState:b.applyTargetState??(()=>{}),isValid:b.isValid??(()=>!0)};S.applyFrame(0),t.set(S.id,S),s("started",{id:S.id})},l=b=>{if(b.driver==="custom"){a(b);return}n(b)},h=b=>{try{b.applyTargetState?.()}catch{}if(b.onCancel)try{b.onCancel()}catch{}},c=b=>{switch(b.type){case"START":l(b.payload);break;case"CANCEL":d(b.id);break}},u=()=>{let b=r.splice(0);for(let S of b)c(S)},d=b=>{let S=t.get(b);S&&(h(S),t.delete(b),s("cancelled",{id:b}))},f=b=>{r.push(b)},m=()=>{for(let[b,S]of t)h(S),s("cancelled",{id:b});t.clear(),i++},g=b=>{u();let S=[];for(let[P,A]of t){if(A.stateVersion!==i){S.push(P);continue}if(!A.isValid()){S.push(P);continue}if(A.currentTime+=b,A.currentTime>=A.duration){A.applyFrame(A.duration),o(A),S.push(P);continue}A.applyFrame(A.currentTime)}for(let P of S)t.delete(P)},p=()=>{u()},v=(b,S)=>(e.has(b)||e.set(b,new Set),e.get(b).add(S),()=>y(b,S)),y=(b,S)=>{e.get(b)?.delete(S)};return{dispatch:f,cancelAll:m,flush:p,tick:g,on:v,off:y,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([b,S])=>({id:b,currentTime:S.currentTime,duration:S.duration,progress:S.duration>0?S.currentTime/S.duration:0}))}),isAnimating:b=>t.has(b),destroy:()=>{m(),e.clear()}}};var EI=r=>{let t=0,e=0,i=null;return{reset:h=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=h},track:h=>{h===e&&t++},complete:h=>{h===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var AI=new Set(["live","replace"]),AL=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),PL=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),PI=new Set(["single","sequence","composite"]),lf=new Set(["red","green","blue","alpha"]),CI=new Set(["max","min","multiply","add"]),Xi=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},Ds=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},af=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},MI=(r,t)=>{Xi(r,t);let e={};if(r.initialValue!==void 0&&(af(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(Xi(i,o),af(i.value,`${o}.value`),af(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},II=(r,t,e)=>{Xi(r,t);let i=Object.entries(r).map(([s,o])=>{if(!e.has(s))throw new Error(`${t}.${s} is not a supported animation property.`);return[s,MI(o,`${t}.${s}`)]});if(i.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(i)},CL=(r,t)=>{if(Xi(r,t),Ds(r.texture,`${t}.texture`),r.channel!==void 0&&!lf.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(lf).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},RL=(r,t)=>{if(Xi(r,t),!PI.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(PI).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!lf.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(lf).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(af(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=MI(r.progress,`${t}.progress`)),r.kind==="single"&&(Ds(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>(Ds(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&(Ds(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!CI.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(CI).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>CL(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},RI=(r,t)=>{if(Xi(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=II(r.tween,`${t}.tween`,PL)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},ML=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=RI(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=RI(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=RL(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},ky=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},BI=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(Xi(i,o),Ds(i.id,`${o}.id`),Ds(i.targetId,`${o}.targetId`),Ds(i.type,`${o}.type`),!AI.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(AI).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(Xi(i.complete,`${o}.complete`),n.complete=i.complete),ky(i.operation,`${o}.operation`,"is no longer supported. Use `type: live | replace` instead."),ky(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),ky(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="live"){if(n.tween=II(i.tween,`${o}.tween`,AL),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 replace animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for replace animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for replace 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 replace 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=ML(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("replace")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix live and replace types in the same state.`);return t};var Gy=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=BI(t.animations),t};var IL=r=>r.split("/").pop(),BL=r=>({name:"advancedBufferLoader",priority:2,bufferMap:r,load:async t=>{let e=t.startsWith("file:")?t:IL(t),i=r[e];if(!i)throw new Error(`Buffer not found for key: ${e}`);return{data:i.buffer,type:i.type,metadata:null,alias:e}},test:async t=>!t.startsWith("blob:"),testParse:async t=>!0,parse:async t=>{if(t instanceof R)return t;let e=new Blob([t.data],{type:t.type}),i=await createImageBitmap(e);return R.from(i)},unload:async t=>t.destroy(!0)}),FL=()=>{let r,t=cI(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,h=!1,c,u,d,f=new Set,m,g=(b,S,P,A)=>{b.clear(),b.rect(0,0,S,P),b.fill(A??0)},p=b=>b?b.startsWith("audio/")?"audio":b.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(b)?"font":b.startsWith("video/")?"video":"texture":"texture",v=b=>{f.add(b)},y=()=>{for(let b of f)URL.revokeObjectURL(b);f.clear()},_=(b,S,P)=>{o&&o.registerHotkeys(P?.keyboard??{}),b.renderer.events.cursorStyles||(b.renderer.events.cursorStyles={}),b.renderer.events.cursorStyles.default||(b.renderer.events.cursorStyles.default="default"),b.renderer.events.cursorStyles.hover||(b.renderer.events.cursorStyles.hover="pointer");let A=S?.cursorStyles,C=P?.cursorStyles;wt(A,C)||(C?(C.default&&(b.renderer.events.cursorStyles.default=C.default,b.canvas.style.cursor=C.default),C.hover&&(b.renderer.events.cursorStyles.hover=C.hover)):A&&(b.renderer.events.cursorStyles.default="default",b.renderer.events.cursorStyles.hover="pointer"))},w=(b,S,P,A)=>{u&&u.abort(),u=new AbortController;let C=u.signal;a.reset(P.id),_(b,e.global,P.global),n.cancelAll(),Pl({app:b,parent:S,prevComputedTree:e.elements,nextComputedTree:P.elements,animations:P.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:A,signal:C}),n.flush(),cx({app:b,prevAudioTree:e.audio,nextAudioTree:P.audio,audioPlugins:s.audio}),e=P,a.completeIfEmpty(),h||(h=!0,l&&l())},E={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:b=>r.stage.getChildByLabel(b,!0)??null,extractBase64:async b=>{let S=new it(0,0,r.renderer.width,r.renderer.height);if(!b)return await r.renderer.extract.base64({target:r.stage,frame:S});let P=r.stage.getChildByLabel(b,!0);if(!P)throw new Error(`Element with label '${b}' not found`);return await r.renderer.extract.base64({target:P,frame:S})},assignStageEvent:(b,S)=>{r.stage.eventMode="static",r.stage.on(b,S)},init:async b=>{let{eventHandler:S,plugins:P,width:A,height:C,backgroundColor:M,debug:I=!1,onFirstRender:k}=b;l=k;let G=[];return P?.elements?.forEach(J=>{J?.parse&&G.push(uI({type:J.type,parse:J.parse}))}),s={animations:P?.animations??[],elements:P?.elements??[],audio:P?.audio??[],parsers:G},i=S,o=vI(S),a=EI(S),r=new yl,r.audioStage=t,await r.init({width:A,height:C,backgroundColor:M,preference:"webgl"}),r.debug=I,m=new ce,m.label="__route_graphics_background__",g(m,A,C,M),r.stage.addChild(m),r.stage.width=A,r.stage.height=C,r.ticker.add(r.audioStage.tick),n=wI(),I?(d=J=>{J?.detail?.deltaMS&&n.tick(Number(J.detail.deltaMS))},window.addEventListener("snapShotKeyFrame",d)):r.ticker.add(J=>n.tick(J.deltaMS)),E},destroy:()=>{u&&(u.abort(),u=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),o?.destroy(),ix(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let b=S=>{for(let P of S.children){let A=P.texture?.source?.resource;A instanceof HTMLVideoElement&&A.pause(),P.children&&b(P)}};r?.stage&&b(r.stage),r&&r.destroy(),m=void 0,c&&(U.remove(c),c=void 0),y()},loadAssets:async b=>{if(!b)throw new Error("assetBufferMap is required");let S={audio:{},font:{},video:{},texture:{}};for(let[M,I]of Object.entries(b)){let k=p(I.type);S[k][M]=I}await Promise.all(Object.entries(S.audio).map(([M,I])=>Wo.load(M,I.buffer))),await Promise.all(Object.entries(S.font).map(async([M,I])=>{let k=new Blob([I.buffer],{type:I.type}),G=URL.createObjectURL(k),J=new FontFace(M,`url(${G})`);try{await J.load(),document.fonts.add(J)}catch(H){console.error(`Failed to load font ${M}:`,H)}finally{URL.revokeObjectURL(G)}})),c?Object.assign(c.bufferMap,S.texture):(c=BL(S.texture),U.add({name:"advanced-buffer-loader",extension:T.Asset,priority:ge.High,loader:c}),typeof wr.registerPlugin=="function"&&wr.registerPlugin(c));let P=Object.entries(S.video).map(([M,I])=>{let k=new Blob([I.buffer],{type:I.type}),G=URL.createObjectURL(k);return v(G),wr.load({alias:M,src:G,loadParser:"loadVideo"}).catch(J=>{throw f.delete(G),URL.revokeObjectURL(G),J})}),C=Object.keys(S.texture).map(M=>wr.load(M));return Promise.all([...C,...P])},loadAudioAssets:async b=>Promise.all(b.map(async S=>{let A=await(await fetch(S)).arrayBuffer();return Wo.load(S,A)})),updatedBackgroundColor:b=>{r.renderer.background.color=b,m&&g(m,r.renderer.width,r.renderer.height,b)},render:b=>{let S=Gy(b),P=Ry({JSONObject:S.elements,parserPlugins:s.parsers}),A={...S,elements:P};w(r,r.stage,A,i)},parse:b=>{let S=Gy(b),P=Ry({JSONObject:S.elements,parserPlugins:s.parsers});return{...S,elements:P}}};return E},FI=FL;var uEt=FI;export{yl as Application,wr as Assets,Wo as AudioAsset,k2 as animatedSpritePlugin,M2 as containerPlugin,Kg as createAnimationPlugin,VI as createAssetBufferManager,Zg as createAudioPlugin,ue as createElementPlugin,uEt as default,V2 as particlesPlugin,c2 as rectPlugin,cx as renderAudio,Pl as renderElements,p2 as sliderPlugin,O2 as soundPlugin,u2 as spritePlugin,h2 as textPlugin,F2 as textRevealingPlugin,G2 as tweenPlugin,f2 as videoPlugin};
|
|
1629
1629
|
/*! Bundled license information:
|
|
1630
1630
|
|
|
1631
1631
|
punycode/punycode.js:
|