route-graphics 0.0.5 → 0.0.7
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 +6 -2
- package/dist/RouteGraphics.js +106 -106
- package/package.json +13 -4
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var hR=Object.create;var id=Object.defineProperty;var lR=Object.getOwnPropertyDescriptor;var cR=Object.getOwnPropertyNames;var uR=Object.getPrototypeOf,dR=Object.prototype.hasOwnProperty;var m=(i,t)=>()=>(i&&(t=i(i=0)),t);var Q=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Tx=(i,t)=>{for(var e in t)id(i,e,{get:t[e],enumerable:!0})},fR=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cR(t))!dR.call(i,s)&&s!==e&&id(i,s,{get:()=>t[s],enumerable:!(r=lR(t,s))||r.enumerable});return i};var Gi=(i,t,e)=>(e=i!=null?hR(uR(i)):{},fR(t||!i||!i.__esModule?id(e,"default",{value:i,enumerable:!0}):e,i));var b,sd,an,D,R=m(()=>{"use strict";b=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(b||{}),sd=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},an=(i,t)=>sd(i).priority??t,D={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(sd).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(sd).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>an(n.value,e)-an(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>an(o,e)-an(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var wx=Q((hU,od)=>{"use strict";var pR=Object.prototype.hasOwnProperty,ve="~";function hn(){}Object.create&&(hn.prototype=Object.create(null),new hn().__proto__||(ve=!1));function mR(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Sx(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new mR(e,r||i,s),n=ve?ve+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Yh(i,t){--i._eventsCount===0?i._events=new hn:delete i._events[t]}function me(){this._events=new hn,this._eventsCount=0}me.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)pR.call(e,r)&&t.push(ve?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};me.prototype.listeners=function(t){var e=ve?ve+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};me.prototype.listenerCount=function(t){var e=ve?ve+t:t,r=this._events[e];return r?r.fn?1:r.length:0};me.prototype.emit=function(t,e,r,s,o,n){var a=ve?ve+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};me.prototype.on=function(t,e,r){return Sx(this,t,e,r,!1)};me.prototype.once=function(t,e,r){return Sx(this,t,e,r,!0)};me.prototype.removeListener=function(t,e,r,s){var o=ve?ve+t:t;if(!this._events[o])return this;if(!e)return Yh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Yh(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Yh(this,o)}return this};me.prototype.removeAllListeners=function(t){var e;return t?(e=ve?ve+t:t,this._events[e]&&Yh(this,e)):(this._events=new hn,this._eventsCount=0),this};me.prototype.off=me.prototype.removeListener;me.prototype.addListener=me.prototype.on;me.prefixed=ve;me.EventEmitter=me;typeof od<"u"&&(od.exports=me)});var Ex,Et,ge=m(()=>{Ex=Gi(wx(),1),Et=Ex.default});var gR,Hr,ie,Ke,Fx,Ax,nd,xR,qh,Gx,Ux,Cx,Px,Rx,ln,_R,yR,bR,vR,ld,Mx,TR,ad,hd,Bx,cd,De,Ix,Kh,ud=m(()=>{gR={grad:.9,turn:360,rad:360/(2*Math.PI)},Hr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ie=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ke=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Fx=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Ax=function(i){return{r:Ke(i.r,0,255),g:Ke(i.g,0,255),b:Ke(i.b,0,255),a:Ke(i.a)}},nd=function(i){return{r:ie(i.r),g:ie(i.g),b:ie(i.b),a:ie(i.a,3)}},xR=/^#([0-9a-f]{3,8})$/i,qh=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Gx=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Ux=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},Cx=function(i){return{h:Fx(i.h),s:Ke(i.s,0,100),l:Ke(i.l,0,100),a:Ke(i.a)}},Px=function(i){return{h:ie(i.h),s:ie(i.s),l:ie(i.l),a:ie(i.a,3)}},Rx=function(i){return Ux((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},ln=function(i){return{h:(t=Gx(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},_R=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ld={string:[[function(i){var t=xR.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ie(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ie(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=bR.exec(i)||vR.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ax({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=_R.exec(i)||yR.exec(i);if(!t)return null;var e,r,s=Cx({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(gR[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Rx(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Hr(t)&&Hr(e)&&Hr(r)?Ax({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Hr(t)||!Hr(e)||!Hr(r))return null;var n=Cx({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Rx(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Hr(t)||!Hr(e)||!Hr(r))return null;var n=function(a){return{h:Fx(a.h),s:Ke(a.s,0,100),v:Ke(a.v,0,100),a:Ke(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Ux(n)},"hsv"]]},Mx=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},TR=function(i){return typeof i=="string"?Mx(i.trim(),ld.string):typeof i=="object"&&i!==null?Mx(i,ld.object):[null,void 0]},ad=function(i,t){var e=ln(i);return{h:e.h,s:Ke(e.s+100*t,0,100),l:e.l,a:e.a}},hd=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},Bx=function(i,t){var e=ln(i);return{h:e.h,s:e.s,l:Ke(e.l+100*t,0,100),a:e.a}},cd=function(){function i(t){this.parsed=TR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ie(hd(this.rgba),2)},i.prototype.isDark=function(){return hd(this.rgba)<.5},i.prototype.isLight=function(){return hd(this.rgba)>=.5},i.prototype.toHex=function(){return t=nd(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?qh(ie(255*o)):"","#"+qh(e)+qh(r)+qh(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return nd(this.rgba)},i.prototype.toRgbString=function(){return t=nd(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return Px(ln(this.rgba))},i.prototype.toHslString=function(){return t=Px(ln(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Gx(this.rgba),{h:ie(t.h),s:ie(t.s),v:ie(t.v),a:ie(t.a,3)};var t},i.prototype.invert=function(){return De({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),De(ad(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),De(ad(this.rgba,-t))},i.prototype.grayscale=function(){return De(ad(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),De(Bx(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),De(Bx(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?De({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ie(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=ln(this.rgba);return typeof t=="number"?De({h:t,s:e.s,l:e.l,a:e.a}):ie(e.h)},i.prototype.isEqual=function(t){return this.toHex()===De(t).toHex()},i}(),De=function(i){return i instanceof cd?i:new cd(i)},Ix=[],Kh=function(i){i.forEach(function(t){Ix.indexOf(t)<0&&(t(cd,ld),Ix.push(t))})}});function Zh(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var g=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<u&&(u=g,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"])}var dd=m(()=>{});var ws,it,ue=m(()=>{ud();dd();Kh([Zh]);ws=class cn{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 cn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=cn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=cn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=De(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof cn||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}};ws.shared=new ws;ws._temp=new ws;ws.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;it=ws});var kx,Ox=m(()=>{"use strict";kx={cullArea:null,cullable:!1,cullableChildren:!0}});var Nx,Dx,Lx,fd=m(()=>{"use strict";Nx=Math.PI*2,Dx=180/Math.PI,Lx=Math.PI/180});var at,pd,Ze=m(()=>{"use strict";at=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return pd.x=0,pd.y=0,pd}},pd=new at});var U,SR,wR,dt=m(()=>{fd();Ze();U=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new at;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new at;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-h*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*c+s*d,this.c=o*l+n*u,this.d=o*c+n*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Nx-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return wR.identity()}static get shared(){return SR.identity()}},SR=new U,wR=new U});var de,Qh=m(()=>{"use strict";de=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function nt(i="default"){return md[i]===void 0&&(md[i]=-1),++md[i]}var md,fe=m(()=>{"use strict";md={default:-1}});function X(i,t,e=3){if(Hx[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1
|
+
var pR=Object.create;var Ku=Object.defineProperty;var mR=Object.getOwnPropertyDescriptor;var gR=Object.getOwnPropertyNames;var xR=Object.getPrototypeOf,_R=Object.prototype.hasOwnProperty;var g=(i,t)=>()=>(i&&(t=i(i=0)),t);var K=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),nx=(i,t)=>{for(var e in t)Ku(i,e,{get:t[e],enumerable:!0})},yR=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of gR(t))!_R.call(i,s)&&s!==e&&Ku(i,s,{get:()=>t[s],enumerable:!(r=mR(t,s))||r.enumerable});return i};var Ui=(i,t,e)=>(e=i!=null?pR(xR(i)):{},yR(t||!i||!i.__esModule?Ku(e,"default",{value:i,enumerable:!0}):e,i));var _,Qu,ln,G,C=g(()=>{"use strict";_=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(_||{}),Qu=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},ln=(i,t)=>Qu(i).priority??t,G={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>ln(n.value,e)-ln(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>ln(o,e)-ln(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var fx=K((XU,Ju)=>{"use strict";var vR=Object.prototype.hasOwnProperty,ve="~";function cn(){}Object.create&&(cn.prototype=Object.create(null),new cn().__proto__||(ve=!1));function TR(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function dx(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new TR(e,r||i,s),n=ve?ve+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function qh(i,t){--i._eventsCount===0?i._events=new cn:delete i._events[t]}function xe(){this._events=new cn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)vR.call(e,r)&&t.push(ve?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xe.prototype.listeners=function(t){var e=ve?ve+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};xe.prototype.listenerCount=function(t){var e=ve?ve+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xe.prototype.emit=function(t,e,r,s,o,n){var a=ve?ve+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};xe.prototype.on=function(t,e,r){return dx(this,t,e,r,!1)};xe.prototype.once=function(t,e,r){return dx(this,t,e,r,!0)};xe.prototype.removeListener=function(t,e,r,s){var o=ve?ve+t:t;if(!this._events[o])return this;if(!e)return qh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&qh(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:qh(this,o)}return this};xe.prototype.removeAllListeners=function(t){var e;return t?(e=ve?ve+t:t,this._events[e]&&qh(this,e)):(this._events=new cn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=ve;xe.EventEmitter=xe;typeof Ju<"u"&&(Ju.exports=xe)});var px,Pt,_e=g(()=>{px=Ui(fx(),1),Pt=px.default});var SR,zr,he,Ze,Tx,mx,td,ER,Kh,Sx,Ex,gx,xx,_x,un,AR,wR,CR,PR,id,yx,RR,ed,rd,bx,sd,De,vx,Zh,od=g(()=>{SR={grad:.9,turn:360,rad:360/(2*Math.PI)},zr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},he=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ze=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Tx=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},mx=function(i){return{r:Ze(i.r,0,255),g:Ze(i.g,0,255),b:Ze(i.b,0,255),a:Ze(i.a)}},td=function(i){return{r:he(i.r),g:he(i.g),b:he(i.b),a:he(i.a,3)}},ER=/^#([0-9a-f]{3,8})$/i,Kh=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Sx=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Ex=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},gx=function(i){return{h:Tx(i.h),s:Ze(i.s,0,100),l:Ze(i.l,0,100),a:Ze(i.a)}},xx=function(i){return{h:he(i.h),s:he(i.s),l:he(i.l),a:he(i.a,3)}},_x=function(i){return Ex((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},un=function(i){return{h:(t=Sx(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},AR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,CR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,PR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,id={string:[[function(i){var t=ER.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?he(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?he(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=CR.exec(i)||PR.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:mx({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=AR.exec(i)||wR.exec(i);if(!t)return null;var e,r,s=gx({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(SR[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return _x(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return zr(t)&&zr(e)&&zr(r)?mx({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!zr(t)||!zr(e)||!zr(r))return null;var n=gx({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return _x(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!zr(t)||!zr(e)||!zr(r))return null;var n=function(a){return{h:Tx(a.h),s:Ze(a.s,0,100),v:Ze(a.v,0,100),a:Ze(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Ex(n)},"hsv"]]},yx=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},RR=function(i){return typeof i=="string"?yx(i.trim(),id.string):typeof i=="object"&&i!==null?yx(i,id.object):[null,void 0]},ed=function(i,t){var e=un(i);return{h:e.h,s:Ze(e.s+100*t,0,100),l:e.l,a:e.a}},rd=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},bx=function(i,t){var e=un(i);return{h:e.h,s:e.s,l:Ze(e.l+100*t,0,100),a:e.a}},sd=function(){function i(t){this.parsed=RR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return he(rd(this.rgba),2)},i.prototype.isDark=function(){return rd(this.rgba)<.5},i.prototype.isLight=function(){return rd(this.rgba)>=.5},i.prototype.toHex=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Kh(he(255*o)):"","#"+Kh(e)+Kh(r)+Kh(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return td(this.rgba)},i.prototype.toRgbString=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return xx(un(this.rgba))},i.prototype.toHslString=function(){return t=xx(un(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Sx(this.rgba),{h:he(t.h),s:he(t.s),v:he(t.v),a:he(t.a,3)};var t},i.prototype.invert=function(){return De({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),De(ed(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),De(ed(this.rgba,-t))},i.prototype.grayscale=function(){return De(ed(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),De(bx(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),De(bx(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?De({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):he(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=un(this.rgba);return typeof t=="number"?De({h:t,s:e.s,l:e.l,a:e.a}):he(e.h)},i.prototype.isEqual=function(t){return this.toHex()===De(t).toHex()},i}(),De=function(i){return i instanceof sd?i:new sd(i)},vx=[],Zh=function(i){i.forEach(function(t){vx.indexOf(t)<0&&(t(sd,id),vx.push(t))})}});function Qh(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var m=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"])}var nd=g(()=>{});var As,et,pe=g(()=>{od();nd();Zh([Qh]);As=class dn{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 dn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=dn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=dn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=De(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof dn||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}};As.shared=new As;As._temp=new As;As.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;et=As});var Ax,wx=g(()=>{"use strict";Ax={cullArea:null,cullable:!1,cullableChildren:!0}});var Cx,Px,Rx,ad=g(()=>{"use strict";Cx=Math.PI*2,Px=180/Math.PI,Rx=Math.PI/180});var ht,hd,Qe=g(()=>{"use strict";ht=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return hd.x=0,hd.y=0,hd}},hd=new ht});var M,MR,BR,ft=g(()=>{ad();Qe();M=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ht;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ht;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-h*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*c+s*d,this.c=o*l+n*u,this.d=o*c+n*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Cx-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return BR.identity()}static get shared(){return MR.identity()}},MR=new M,BR=new M});var me,Jh=g(()=>{"use strict";me=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ot(i="default"){return ld[i]===void 0&&(ld[i]=-1),++ld[i]}var ld,ge=g(()=>{"use strict";ld={default:-1}});function z(i,t,e=3){if(Mx[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
2
2
|
Deprecated since v${i}`):(r=r.split(`
|
|
3
3
|
`).splice(e).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
5
5
|
Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${i}`),console.warn(r))),Hx[t]=!0}var Hx,tt,Vx,Ft=m(()=>{"use strict";Hx={},tt="8.0.0",Vx="8.3.4"});var Ui,gd=m(()=>{"use strict";Ui=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 xd,et,Te=m(()=>{gd();xd=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 Ui(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},et=new xd});var Wx,zx=m(()=>{Ft();Wx={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Jh(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var _d=m(()=>{"use strict"});var $x,Xx=m(()=>{_d();Ft();$x={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Jh(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||X(tt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var jx,Yx=m(()=>{"use strict";jx={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Vr,tl=m(()=>{"use strict";Vr=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 yd,el,qx=m(()=>{R();Te();yd=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return et.get(r.maskClass,t)}return t}returnMaskEffect(t){et.return(t)}},el=new yd;D.handleByList(b.MaskEffect,el._effectClasses)});var Kx,Zx=m(()=>{tl();qx();Kx={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),el.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=el.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Vr);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Vr),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Qx,Jx=m(()=>{Ft();Qx={label:null,get name(){return X(tt,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){X(tt,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var rl,rt,qt=m(()=>{Ze();rl=[new at,new at,new at,new at],rt=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=r*(1-s),c=r-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,g=a+c,x=a+o-c,v=h+c,_=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>g&&t<x&&e>v&&e<_)}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=rl[0].set(t.left,t.top),h=rl[1].set(t.left,t.bottom),l=rl[2].set(t.right,t.top),c=rl[3].set(t.right,t.bottom);if(l.x<=a.x||h.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(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,g=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,g,x,v)<=d*a.x+f*a.y||Math.min(p,g,x,v)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),y=u*(l.x-a.x),T=_*r+y*o,E=_*s+y*o,w=_*r+y*n,C=_*s+y*n;return!(Math.max(T,E,w,C)<=_*a.x+y*a.y||Math.min(T,E,w,C)>=_*c.x+y*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),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var t_,vt,Me=m(()=>{dt();qt();t_=new U,vt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=t_,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new rt);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=t_,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,x=n*t+h*e+c,v=a*t+l*e+u;x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*r+h*e+c,v=a*r+l*e+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*t+h*s+c,v=a*t+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*r+h*s+c,v=a*r+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),this.minX=d,this.minY=f,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:c,ty:u}=t,d=n*e+h*r+c,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*r+c,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+h*o+c,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+h*o+c,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let g=e;g<r;g+=2){let x=t[g],v=t[g+1],_=l*x+u*v+f,y=c*x+d*v+p;o=_<o?_:o,n=y<n?y:n,a=_>a?_:a,h=y>h?y:h}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h}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 zt,Le,ki=m(()=>{dt();gd();Me();zt=new Ui(U),Le=new Ui(vt)});var ER,e_,r_=m(()=>{dt();Me();ki();ER=new U,e_={getFastGlobalBounds(i,t){t||(t=new vt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Le.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(ER).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Le.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Le.return(r))}}});function Es(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=zt.get().identity(),r=il(i,s)):r=U.IDENTITY,i_(i,e,r,t),s&&zt.return(s),e.isValid||e.set(0,0,0,0),e}function i_(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=zt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Le.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)i_(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,U.IDENTITY),Le.return(t)}r||zt.return(s)}function il(i,t){let e=i.parent;return e&&(il(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var un=m(()=>{dt();ki()});function sl(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var bd=m(()=>{"use strict"});function As(i,t){return i===s_?t:t===s_?i:sl(i,t)}var s_,vd=m(()=>{bd();s_=16777215});function dn(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var o_,n_=m(()=>{un();ki();vd();o_={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=il(this,zt.get().identity());return i.appendFrom(this.localTransform,e),zt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?dn(this.renderGroup.worldColor):this.parentRenderGroup?dn(As(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=As(t,e.localColor),e=e.parent;return dn(t)}}});function H(...i){Td!==a_&&(Td++,Td===a_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Td,a_,Tt=m(()=>{"use strict";Td=0,a_=500});function Cs(i,t,e){return t.clear(),e||(e=U.IDENTITY),h_(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function h_(i,t,e,r,s){let o;if(s)o=zt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=zt.get(),o.appendFrom(h,e)}let n=t,a=!!i.effects.length;if(a&&(t=Le.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)h_(h[l],t,o,r,!1)}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,U.IDENTITY),Le.return(t)}zt.return(o)}var ol=m(()=>{dt();ki()});function Sd(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Sd(s,t)}return t.didChange}var l_=m(()=>{"use strict"});var AR,c_,u_=m(()=>{dt();Me();un();ol();l_();AR=new U,c_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new vt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),Sd(this,i),i.didChange&&Cs(this,i.localBounds,AR),i.localBounds},getBounds(i,t){return Es(this,i,t||new vt)}}});var d_,f_=m(()=>{"use strict";d_={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function CR(i,t){return i._zIndex-t._zIndex}var p_,m_=m(()=>{"use strict";p_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(CR))}}});var g_,x_=m(()=>{Ze();ki();g_={getGlobalPosition(i=new at,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(zt.get(),e);return t=r.apply(i,t),zt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(zt.get(),r);return e=s.applyInverse(i,e),zt.return(s),e}}});var Ps,wd=m(()=>{fe();Ps=class{constructor(){this.uid=nt("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 Wr(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Ed(i){return!(i&i-1)&&!!i}var fn=m(()=>{"use strict"});function nl(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Ad=m(()=>{"use strict"});function PR(i){let t=__[i];return t===void 0&&(__[i]=nt("resource")),t}var __,y_,al,Cd=m(()=>{ge();fe();Ft();__=Object.create(null);y_=class b_ extends Et{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...b_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){X(tt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=PR(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};y_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};al=y_});var v_,xt,Be=m(()=>{ge();fn();Ad();fe();Cd();v_=class T_ extends Et{constructor(t={}){super(),this.options=t,this.uid=nt("textureSource"),this._resourceType="textureSource",this._resourceId=nt("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={...T_.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 al(nl(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=nt("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=nt("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=Ed(this.pixelWidth)&&Ed(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};v_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};xt=v_});function RR(){for(let i=0;i<16;i++){let t=[];Pd.push(t);for(let e=0;e<16;e++){let r=hl(Oi[i]*Oi[e]+Di[i]*Ni[e]),s=hl(Ni[i]*Oi[e]+Li[i]*Ni[e]),o=hl(Oi[i]*Di[e]+Di[i]*Li[e]),n=hl(Ni[i]*Di[e]+Li[i]*Li[e]);for(let a=0;a<16;a++)if(Oi[a]===r&&Ni[a]===s&&Di[a]===o&&Li[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new U;t.set(Oi[i],Ni[i],Di[i],Li[i],0,0),S_.push(t)}}var Oi,Ni,Di,Li,Pd,S_,hl,Mt,w_=m(()=>{dt();Oi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ni=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Di=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Li=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Pd=[],S_=[],hl=Math.sign;RR();Mt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>Oi[i],uY:i=>Ni[i],vX:i=>Di[i],vY:i=>Li[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Pd[i][t],sub:(i,t)=>Pd[i][Mt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Mt.S:Mt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Mt.E:Mt.W:t>0?i>0?Mt.SE:Mt.SW:i>0?Mt.NE:Mt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=S_[Mt.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var Rd,E_=m(()=>{"use strict";Rd=()=>{}});var Hi,Md=m(()=>{R();Be();Hi=class extends xt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Hi.extension=b.TextureSource});var A_,Rs,Bd=m(()=>{dt();A_=new U,Rs=class{constructor(t,e){this.mapCoord=new U,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(A_.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(A_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/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 I,_t=m(()=>{ge();w_();qt();fe();Ft();E_();Md();Be();Bd();I=class extends Et{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=nt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new rt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new xt,this.noFrame=!r,r)this.frame.copyFrom(r);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=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Rs(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Mt.add(l,Mt.NW),t.x0=d+c*Mt.uX(l),t.y0=f+u*Mt.uY(l),l=Mt.add(l,2),t.x1=d+c*Mt.uX(l),t.y1=f+u*Mt.uY(l),l=Mt.add(l,2),t.x2=d+c*Mt.uX(l),t.y2=f+u*Mt.uY(l),l=Mt.add(l,2),t.x3=d+c*Mt.uX(l),t.y3=f+u*Mt.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(tt,"Texture.baseTexture is now Texture.source"),this._source}};I.EMPTY=new I({label:"EMPTY",source:new xt({label:"EMPTY"})});I.EMPTY.destroy=Rd;I.WHITE=new I({source:new Hi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});I.WHITE.destroy=Rd});var MR,Id,Gt,li=m(()=>{fn();Be();_t();MR=0,Id=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new xt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new I({source:s,label:`texturePool_${MR++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Wr(o),n=Wr(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},Gt=new Id});var ll,C_=m(()=>{dt();wd();li();ll=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new U,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Ps,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Gt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new U),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new U),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new U),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function P_(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var R_=m(()=>{"use strict"});var Fd,Gd,Ud,Ms,pn,Vi,yt,ur=m(()=>{ge();ue();Ox();R();dt();fd();Qh();fe();Ft();Te();zx();Xx();Yx();Zx();Jx();r_();n_();u_();f_();m_();x_();C_();R_();Fd=new de(null),Gd=new de(null),Ud=new de(null,1,1),Ms=1,pn=2,Vi=4,yt=class i extends Et{constructor(t={}){super(),this.uid=nt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new U,this.relativeGroupTransform=new U,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new de(this,0,0),this._scale=Ud,this._pivot=Gd,this._skew=Fd,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=[],P_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),D.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||X(tt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=et.get(ll,this),this.groupTransform=U.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),et.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new U),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Dx}set angle(t){this.rotation=t*Lx}get pivot(){return this._pivot===Gd&&(this._pivot=new de(this,0,0)),this._pivot}set pivot(t){this._pivot===Gd&&(this._pivot=new de(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Fd&&(this._skew=new de(this,0,0)),this._skew}set skew(t){this._skew===Fd&&(this._skew=new de(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ud&&(this._scale=new de(this,1,1)),this._scale}set scale(t){this._scale===Ud&&(this._scale=new de(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Ms,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=it.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Ms,this._onUpdate())}get tint(){return dn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=pn,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|=Vi,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|=Vi,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|=Vi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};D.mixin(yt,$x,e_,g_,d_,c_,Kx,Qx,p_,kx,Wx,o_,jx)});var ci,cl=m(()=>{Ze();ci=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function BR(i){return function(t){return t.test(i)}}function ui(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=BR(e),o={apple:{phone:s(kd)&&!s(zr),ipod:s(M_),tablet:!s(kd)&&(s(B_)||L_(t))&&!s(zr),universal:s(I_),device:(s(kd)||s(M_)||s(B_)||s(I_)||L_(t))&&!s(zr)},amazon:{phone:s(Bs),tablet:!s(Bs)&&s(ul),device:s(Bs)||s(ul)},android:{phone:!s(zr)&&s(Bs)||!s(zr)&&s(Od),tablet:!s(zr)&&!s(Bs)&&!s(Od)&&(s(ul)||s(F_)),device:!s(zr)&&(s(Bs)||s(ul)||s(Od)||s(F_))||s(/\bokhttp\b/i)},windows:{phone:s(zr),tablet:s(G_),device:s(zr)||s(G_)},other:{blackberry:s(U_),blackberry10:s(k_),opera:s(O_),firefox:s(D_),chrome:s(N_),device:s(U_)||s(k_)||s(O_)||s(D_)||s(N_)},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 kd,M_,B_,I_,Od,F_,Bs,ul,zr,G_,U_,k_,O_,N_,D_,L_,Nd=m(()=>{kd=/iPhone/i,M_=/iPod/i,B_=/iPad/i,I_=/\biOS-universal(?:.+)Mac\b/i,Od=/\bAndroid(?:.+)Mobile\b/i,F_=/Android/i,Bs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ul=/Silk/i,zr=/Windows Phone/i,G_=/\bWindows(?:.+)ARM\b/i,U_=/BlackBerry/i,k_=/BB10/i,O_=/Opera Mini/i,N_=/\b(CriOS|Chrome)(?:.+)Mobile/i,D_=/Mobile(?:.+)Firefox\b/i,L_=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Dd=m(()=>{Nd();Nd()});var IR,H_,V_=m(()=>{Dd();IR=ui.default??ui,H_=IR(globalThis.navigator)});var FR,dl,GR,UR,W_,z_,kR,OR,NR,Ld,X_,j_=m(()=>{cl();R();V_();_d();FR=9,dl=100,GR=0,UR=0,W_=2,z_=1,kR=-1e3,OR=-1e3,NR=2,Ld=class $_{constructor(t,e=H_){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=`${z_}px`,t.style.height=`${z_}px`,t.style.position="absolute",t.style.top=`${kR}px`,t.style.left=`${OR}px`,t.style.zIndex=NR.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=`${dl}px`,this._div.style.height=`${dl}px`,this._div.style.position="absolute",this._div.style.top=`${GR}px`,this._div.style.left=`${UR}px`,this._div.style.zIndex=W_.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...$_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Jh(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
6
|
+
Deprecated since v${i}`),console.warn(r))),Mx[t]=!0}var Mx,Q,Bx,Lt=g(()=>{"use strict";Mx={},Q="8.0.0",Bx="8.3.4"});var ki,cd=g(()=>{"use strict";ki=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 ud,J,Te=g(()=>{cd();ud=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 ki(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},J=new ud});var Ix,Fx=g(()=>{Lt();Ix={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){z("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function tl(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var dd=g(()=>{"use strict"});var Gx,Ux=g(()=>{dd();Lt();Gx={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}tl(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||z(Q,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var kx,Ox=g(()=>{"use strict";kx={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var $r,el=g(()=>{"use strict";$r=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 fd,rl,Lx=g(()=>{C();Te();fd=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return J.get(r.maskClass,t)}return t}returnMaskEffect(t){J.return(t)}},rl=new fd;G.handleByList(_.MaskEffect,rl._effectClasses)});var Dx,Nx=g(()=>{el();Lx();Dx={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),rl.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=rl.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new $r);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new $r),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Hx,Vx=g(()=>{Lt();Hx={label:null,get name(){return z(Q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){z(Q,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var il,it,le=g(()=>{Qe();il=[new ht,new ht,new ht,new ht],it=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=r*(1-s),c=r-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,m=a+c,x=a+o-c,v=h+c,y=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<x&&e>v&&e<y)}intersects(t,e){if(!e){let R=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=R)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=il[0].set(t.left,t.top),h=il[1].set(t.left,t.bottom),l=il[2].set(t.right,t.top),c=il[3].set(t.right,t.bottom);if(l.x<=a.x||h.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(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),b=u*(l.x-a.x),T=y*r+b*o,w=y*s+b*o,S=y*r+b*n,A=y*s+b*n;return!(Math.max(T,w,S,A)<=y*a.x+b*a.y||Math.min(T,w,S,A)>=y*c.x+b*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),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Wx,Et,Me=g(()=>{ft();le();Wx=new M,Et=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Wx,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new 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=Wx,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,x=n*t+h*e+c,v=a*t+l*e+u;x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*r+h*e+c,v=a*r+l*e+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*t+h*s+c,v=a*t+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*r+h*s+c,v=a*r+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:c,ty:u}=t,d=n*e+h*r+c,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*r+c,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+h*o+c,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+h*o+c,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<r;m+=2){let x=t[m],v=t[m+1],y=l*x+u*v+f,b=c*x+d*v+p;o=y<o?y:o,n=b<n?b:n,a=y>a?y:a,h=b>h?b:h}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h}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 Zt,Ne,Oi=g(()=>{ft();cd();Me();Zt=new ki(M),Ne=new ki(Et)});var IR,zx,$x=g(()=>{ft();Me();Oi();IR=new M,zx={getFastGlobalBounds(i,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Ne.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(IR).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Ne.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Ne.return(r))}}});function ws(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Zt.get().identity(),r=sl(i,s)):r=M.IDENTITY,Xx(i,e,r,t),s&&Zt.return(s),e.isValid||e.set(0,0,0,0),e}function Xx(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Zt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Ne.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Xx(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,M.IDENTITY),Ne.return(t)}r||Zt.return(s)}function sl(i,t){let e=i.parent;return e&&(sl(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var fn=g(()=>{ft();Oi()});function ol(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var pd=g(()=>{"use strict"});function Cs(i,t){return i===jx?t:t===jx?i:ol(i,t)}var jx,md=g(()=>{pd();jx=16777215});function pn(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var Yx,qx=g(()=>{fn();Oi();md();Yx={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=sl(this,Zt.get().identity());return i.appendFrom(this.localTransform,e),Zt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?pn(this.renderGroup.worldColor):this.parentRenderGroup?pn(Cs(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Cs(t,e.localColor),e=e.parent;return pn(t)}}});function O(...i){gd!==Kx&&(gd++,gd===Kx?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var gd,Kx,At=g(()=>{"use strict";gd=0,Kx=500});function Ps(i,t,e){return t.clear(),e||(e=M.IDENTITY),Zx(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Zx(i,t,e,r,s){let o;if(s)o=Zt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=Zt.get(),o.appendFrom(h,e)}let n=t,a=!!i.effects.length;if(a&&(t=Ne.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)Zx(h[l],t,o,r,!1)}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,M.IDENTITY),Ne.return(t)}Zt.return(o)}var nl=g(()=>{ft();Oi()});function xd(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&xd(s,t)}return t.didChange}var Qx=g(()=>{"use strict"});var FR,Jx,t_=g(()=>{ft();Me();fn();nl();Qx();FR=new M,Jx={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),xd(this,i),i.didChange&&Ps(this,i.localBounds,FR),i.localBounds},getBounds(i,t){return ws(this,i,t||new Et)}}});var e_,r_=g(()=>{"use strict";e_={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function GR(i,t){return i._zIndex-t._zIndex}var i_,s_=g(()=>{"use strict";i_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(GR))}}});var o_,n_=g(()=>{Qe();Oi();o_={getGlobalPosition(i=new ht,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(Zt.get(),e);return t=r.apply(i,t),Zt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Zt.get(),r);return e=s.applyInverse(i,e),Zt.return(s),e}}});var Rs,_d=g(()=>{ge();Rs=class{constructor(){this.uid=ot("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 Xr(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function yd(i){return!(i&i-1)&&!!i}var mn=g(()=>{"use strict"});function al(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var bd=g(()=>{"use strict"});function UR(i){let t=a_[i];return t===void 0&&(a_[i]=ot("resource")),t}var a_,h_,hl,vd=g(()=>{_e();ge();Lt();a_=Object.create(null);h_=class l_ extends Pt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...l_.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){z(Q,"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=UR(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};h_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};hl=h_});var c_,yt,Be=g(()=>{_e();mn();bd();ge();vd();c_=class u_ extends Pt{constructor(t={}){super(),this.options=t,this.uid=ot("textureSource"),this._resourceType="textureSource",this._resourceId=ot("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={...u_.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 hl(al(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=ot("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=ot("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=yd(this.pixelWidth)&&yd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};c_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};yt=c_});function kR(){for(let i=0;i<16;i++){let t=[];Td.push(t);for(let e=0;e<16;e++){let r=ll(Li[i]*Li[e]+Ni[i]*Di[e]),s=ll(Di[i]*Li[e]+Hi[i]*Di[e]),o=ll(Li[i]*Ni[e]+Ni[i]*Hi[e]),n=ll(Di[i]*Ni[e]+Hi[i]*Hi[e]);for(let a=0;a<16;a++)if(Li[a]===r&&Di[a]===s&&Ni[a]===o&&Hi[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new M;t.set(Li[i],Di[i],Ni[i],Hi[i],0,0),d_.push(t)}}var Li,Di,Ni,Hi,Td,d_,ll,kt,f_=g(()=>{ft();Li=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Di=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ni=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Hi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Td=[],d_=[],ll=Math.sign;kR();kt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>Li[i],uY:i=>Di[i],vX:i=>Ni[i],vY:i=>Hi[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Td[i][t],sub:(i,t)=>Td[i][kt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(i)?i>0?kt.E:kt.W:t>0?i>0?kt.SE:kt.SW:i>0?kt.NE:kt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=d_[kt.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var Sd,p_=g(()=>{"use strict";Sd=()=>{}});var Vi,Ed=g(()=>{C();Be();Vi=class extends yt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Vi.extension=_.TextureSource});var m_,Ms,Ad=g(()=>{ft();m_=new M,Ms=class{constructor(t,e){this.mapCoord=new M,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(m_.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(m_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/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 E,bt=g(()=>{_e();f_();le();ge();Lt();p_();Ed();Be();Ad();E=class extends Pt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=ot("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 yt,this.noFrame=!r,r)this.frame.copyFrom(r);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=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Ms(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=kt.add(l,kt.NW),t.x0=d+c*kt.uX(l),t.y0=f+u*kt.uY(l),l=kt.add(l,2),t.x1=d+c*kt.uX(l),t.y1=f+u*kt.uY(l),l=kt.add(l,2),t.x2=d+c*kt.uX(l),t.y2=f+u*kt.uY(l),l=kt.add(l,2),t.x3=d+c*kt.uX(l),t.y3=f+u*kt.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h}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 z(Q,"Texture.baseTexture is now Texture.source"),this._source}};E.EMPTY=new E({label:"EMPTY",source:new yt({label:"EMPTY"})});E.EMPTY.destroy=Sd;E.WHITE=new E({source:new Vi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});E.WHITE.destroy=Sd});var OR,wd,Dt,di=g(()=>{mn();Be();bt();OR=0,wd=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new yt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new E({source:s,label:`texturePool_${OR++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Xr(o),n=Xr(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},Dt=new wd});var cl,g_=g(()=>{ft();_d();di();cl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new M,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 Rs,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Dt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new M),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new M),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 M),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 x_(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var __=g(()=>{"use strict"});var Cd,Pd,Rd,Bs,gn,Wi,vt,fr=g(()=>{_e();pe();wx();C();ft();ad();Jh();ge();Lt();Te();Fx();Ux();Ox();Nx();Vx();$x();qx();t_();r_();s_();n_();g_();__();Cd=new me(null),Pd=new me(null),Rd=new me(null,1,1),Bs=1,gn=2,Wi=4,vt=class i extends Pt{constructor(t={}){super(),this.uid=ot("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 M,this.relativeGroupTransform=new M,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new me(this,0,0),this._scale=Rd,this._pivot=Pd,this._skew=Cd,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=[],x_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){z("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),G.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||z(Q,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=J.get(cl,this),this.groupTransform=M.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),J.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 M),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*Px}set angle(t){this.rotation=t*Rx}get pivot(){return this._pivot===Pd&&(this._pivot=new me(this,0,0)),this._pivot}set pivot(t){this._pivot===Pd&&(this._pivot=new me(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Cd&&(this._skew=new me(this,0,0)),this._skew}set skew(t){this._skew===Cd&&(this._skew=new me(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Rd&&(this._scale=new me(this,1,1)),this._scale}set scale(t){this._scale===Rd&&(this._scale=new me(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Bs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=et.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Bs,this._onUpdate())}get tint(){return pn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=gn,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|=Wi,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|=Wi,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|=Wi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};G.mixin(vt,Gx,zx,o_,e_,Jx,Dx,Hx,i_,Ax,Ix,Yx,kx)});var fi,ul=g(()=>{Qe();fi=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new 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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function LR(i){return function(t){return t.test(i)}}function pi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=LR(e),o={apple:{phone:s(Md)&&!s(jr),ipod:s(y_),tablet:!s(Md)&&(s(b_)||R_(t))&&!s(jr),universal:s(v_),device:(s(Md)||s(y_)||s(b_)||s(v_)||R_(t))&&!s(jr)},amazon:{phone:s(Is),tablet:!s(Is)&&s(dl),device:s(Is)||s(dl)},android:{phone:!s(jr)&&s(Is)||!s(jr)&&s(Bd),tablet:!s(jr)&&!s(Is)&&!s(Bd)&&(s(dl)||s(T_)),device:!s(jr)&&(s(Is)||s(dl)||s(Bd)||s(T_))||s(/\bokhttp\b/i)},windows:{phone:s(jr),tablet:s(S_),device:s(jr)||s(S_)},other:{blackberry:s(E_),blackberry10:s(A_),opera:s(w_),firefox:s(P_),chrome:s(C_),device:s(E_)||s(A_)||s(w_)||s(P_)||s(C_)},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 Md,y_,b_,v_,Bd,T_,Is,dl,jr,S_,E_,A_,w_,C_,P_,R_,Id=g(()=>{Md=/iPhone/i,y_=/iPod/i,b_=/iPad/i,v_=/\biOS-universal(?:.+)Mac\b/i,Bd=/\bAndroid(?:.+)Mobile\b/i,T_=/Android/i,Is=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,dl=/Silk/i,jr=/Windows Phone/i,S_=/\bWindows(?:.+)ARM\b/i,E_=/BlackBerry/i,A_=/BB10/i,w_=/Opera Mini/i,C_=/\b(CriOS|Chrome)(?:.+)Mobile/i,P_=/Mobile(?:.+)Firefox\b/i,R_=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Fd=g(()=>{Id();Id()});var DR,M_,B_=g(()=>{Fd();DR=pi.default??pi,M_=DR(globalThis.navigator)});var NR,fl,HR,VR,I_,F_,WR,zR,$R,Gd,U_,k_=g(()=>{ul();C();B_();dd();NR=9,fl=100,HR=0,VR=0,I_=2,F_=1,WR=-1e3,zR=-1e3,$R=2,Gd=class G_{constructor(t,e=M_){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=`${F_}px`,t.style.height=`${F_}px`,t.style.position="absolute",t.style.top=`${WR}px`,t.style.left=`${zR}px`,t.style.zIndex=$R.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=`${fl}px`,this._div.style.height=`${fl}px`,this._div.style.position="absolute",this._div.style.top=`${HR}px`,this._div.style.left=`${VR}px`,this._div.style.zIndex=I_.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...G_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,tl(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),Hx[t]=!0}var Hx,tt,Vx,Ft=m(()=>{"use
|
|
|
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=`${dl}px`,e.style.height=`${dl}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=W_.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ci(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==FR||!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()}};Ld.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"accessibility"};Ld.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};X_=Ld});var Y_,q_=m(()=>{"use strict";Y_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var K_=m(()=>{R();ur();j_();q_();D.add(X_);D.mixin(yt,Y_)});var mn,Z_=m(()=>{R();mn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};mn.extension=b.Application});var di,fl=m(()=>{"use strict";di=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(di||{})});var Is,Q_=m(()=>{"use strict";Is=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var J_,Ie,gn=m(()=>{fl();Q_();J_=class He{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 Is(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=di.NORMAL){return this._addListener(new Is(t,e,r))}addOnce(t,e,r=di.NORMAL){return this._addListener(new Is(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*He.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,He.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!He._shared){let t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){let t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};J_.targetFPMS=.06;Ie=J_});var xn,ty=m(()=>{R();fl();gn();xn=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,di.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ie.shared:new Ie,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};xn.extension=b.Application});var Hd=m(()=>{R();Z_();ty();D.add(mn);D.add(xn)});var Vd,vr,Wd=m(()=>{fl();gn();Vd=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||(Ie.system.add(this._tickerUpdate,this,di.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ie.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())}},vr=new Vd});var $r,pl=m(()=>{Ze();cl();$r=class extends ci{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,c,u,d,f,p,g){throw new Error("Method not implemented.")}}});var Se,zd=m(()=>{pl();Se=class extends $r{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 Tr,$d=m(()=>{pl();Tr=class extends $r{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Tr.DOM_DELTA_PIXEL=0;Tr.DOM_DELTA_LINE=1;Tr.DOM_DELTA_PAGE=2});var DR,LR,_n,ml,ey=m(()=>{ge();Ze();Tt();Wd();pl();zd();$d();DR=2048,LR=new at,_n=new at,ml=class{constructor(t){this.dispatch=new Et,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else H(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){vr.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,LR.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<DR&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.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,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,_n),!t.hitArea.contains(_n.x,_n.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,_n),t.containsPoint(_n)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"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),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"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),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Se)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Tr)){H("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Se);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Tr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Se);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Se&&e instanceof Se&&(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 $r&&e instanceof $r&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var HR,VR,jd,gl,Yd=m(()=>{R();ey();Wd();zd();$d();HR=1,VR={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},jd=class Xd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new ml(null),vr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Se(null),this._rootWheelEvent=new Tr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Xd.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Xd._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,vr.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,vr.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;vr.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;vr.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=HR),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=VR[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}};jd.extension={name:"events",type:[b.WebGLSystem,b.CanvasSystem,b.WebGPUSystem],priority:-1};jd.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};gl=jd});var ry,iy=m(()=>{Yd();cl();ry={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??gl.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n)}),o?h.once(i,a,n):h.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof ci))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var sy=m(()=>{R();ur();Yd();iy();D.add(gl);D.mixin(yt,ry)});var yn,oy=m(()=>{R();yn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};yn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"dom"}});var fi,xl=m(()=>{Me();ur();fi=class extends yt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new vt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r)}}});var ny=m(()=>{R();oy();D.add(yn)});var se,Xr=m(()=>{"use strict";se=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(se||{})});var ay,hy=m(()=>{"use strict";ay={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var ly,j,At=m(()=>{hy();ly=ay,j={get(){return ly},set(i){ly=i}}});function dr(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function bn(i){return i.split("?")[0].split("#")[0]}function WR(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zR(i,t,e){return i.replace(new RegExp(WR(t),"g"),e)}function $R(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var Kt,Wi=m(()=>{At();Kt={toPosix(i){return zR(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){dr(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(dr(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=bn(this.toPosix(t??j.get().getBaseUrl())),s=bn(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Kt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(dr(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=$R(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return dr(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(dr(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(dr(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){dr(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){dr(i),t&&dr(t),i=bn(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){dr(i),i=bn(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){dr(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=bn(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=!1,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var we,vn=m(()=>{"use strict";we=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function cy(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?cy(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function uy(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),cy(i,s,0,e,r)}else r.push(i);return r}var dy=m(()=>{"use strict"});var zi,_l=m(()=>{"use strict";zi=i=>!Array.isArray(i)});function XR(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ve,Fs=m(()=>{Tt();Wi();vn();dy();_l();Ve=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return we(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&H("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));r.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&H(`[Resolver] already has key: ${o} overwriting`)},we(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=we(n).map(f=>typeof f=="string"?uy(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];c.forEach(f=>{f.forEach(p=>{let g={};if(typeof p!="object"){g.src=p;for(let x=0;x<this._parsers.length;x++){let v=this._parsers[x];if(v.test(p)){g=v.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,g={...g,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:h,loadParser:l}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=zi(t);t=we(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=zi(t);t=we(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(c=>c[a]?c[a]===h:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=Kt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??XR(t.src),t}};Ve.RETINA_PREFIX=/@([0-9\.]+)x/});var Tn,qd=m(()=>{"use strict";Tn=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var fy,Kd,py=m(()=>{qt();_t();fy=class Sn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof I?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Sn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=Sn.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new rt(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 rt(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&&(h=new rt(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 I({source:this.textureSource,frame:a,orig:c,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Sn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Sn.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=[]}};fy.BATCH_SIZE=1e3;Kd=fy});function my(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=Kt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=my([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var jR,gy,xy=m(()=>{Xr();Fs();qd();R();_t();Wi();py();jR=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];gy={extension:b.Asset,cache:{test:i=>i instanceof Kd,getCacheableAssets:(i,t)=>my(i,t,!1)},resolver:{extension:{type:b.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&jR.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:b.LoadParser,priority:se.Normal,name:"spritesheetLoader"},async testParse(i,t){return Kt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Kt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof I)a=r;else{let c=Tn(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new Kd(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Tn(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);h.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var yl=m(()=>{R();xy();D.add(gy)});function bl(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Zd=m(()=>{"use strict"});var Zt,vl=m(()=>{Qh();_t();Zd();Ft();xl();Zt=class i extends fi{constructor(t=I.EMPTY){t instanceof I&&(t={texture:t});let{texture:e=I.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new de({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof I?new i(t):new i(I.from(t,e))}set texture(t){t||(t=I.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 bl(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return X("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Tl(i,t,e){let r=YR;i.measurable=!0,Es(i,e,r),t.addBoundsMask(r),i.measurable=!1}var YR,Qd=m(()=>{Me();un();YR=new vt});function Sl(i,t,e){let r=Le.get();i.measurable=!0;let s=zt.get().identity(),o=_y(i,e,s);Cs(i,r,o),i.measurable=!1,t.addBoundsMask(r),zt.return(s),Le.return(r)}function _y(i,t,e){return i?(i!==t&&(_y(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(H("Mask bounds, renderable is not inside the root container"),e)}var Jd=m(()=>{ol();ki();Tt()});var wn,yy=m(()=>{R();vl();Qd();Jd();wn=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 Zt),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||Tl(this.mask,t,e)}addLocalBounds(t,e){Sl(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Zt}};wn.extension=b.MaskEffect});var En,by=m(()=>{R();En=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"}};En.extension=b.MaskEffect});var An,vy=m(()=>{R();ur();Qd();Jd();An=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){Tl(this.mask,t,e)}addLocalBounds(t,e){Sl(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof yt}};An.extension=b.MaskEffect});var xe,Gs=m(()=>{At();R();Be();xe=class extends xt{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,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};xe.extension=b.TextureSource});var Fe,Us=m(()=>{At();R();Tt();Be();Fe=class extends xt{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,H("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}};Fe.extension=b.TextureSource});async function wl(){return tf??(tf=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),tf}var tf,ef=m(()=>{"use strict"});var El,ks,rf=m(()=>{R();gn();ef();Be();El=class Ty extends xt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Ty.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=Ie.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 wl(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ie.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||(Ie.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ie.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};El.extension=b.TextureSource;El.defaultOptions={...xt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};El.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ks=El});var sf,mt,pi=m(()=>{Tt();vn();sf=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||H(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=we(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&H("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){H(`[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}},mt=new sf});function Sy(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<of.length;s++){let o=of[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function wy(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&mt.has(r))return mt.get(r);let o=new I({source:Sy(s)});return o.on("destroy",()=>{mt.has(r)&&mt.remove(r)}),t||mt.set(r,o),o}function Ey(i,t=!1){return typeof i=="string"?mt.get(i):i instanceof xt?new I({source:i}):wy(i,t)}var of,nf=m(()=>{pi();R();Be();_t();of=[];D.handleByList(b.TextureSource,of);I.from=Ey;xt.from=Sy});var Al=m(()=>{R();yy();by();vy();Md();Gs();Us();rf();nf();D.add(wn,En,An,ks,Fe,xe,Hi)});var oe,mi=m(()=>{"use strict";oe=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Pl(){return(!Cl||Cl?.isContextLost())&&(Cl=j.get().createCanvas().getContext("webgl",{})),Cl}var Cl,af=m(()=>{At()});function KR(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function
|
|
21
|
-
`)});function Qe(){if(Os)return Os;let i=Pl();return Os=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Os=Ay(Os,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Os}var Os,$i=m(()=>{af();Cy();Os=null});function Ns(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Py[e]||ZR(i,t,e)}function ZR(i,t,e){let r={},s=0;hf||(hf=Qe());for(let n=0;n<hf;n++){let a=n<t?i[n]:I.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new oe(r);return Py[e]=o,o}var Py,hf,Rl=m(()=>{mi();_t();$i();Py={};hf=0});var Sr,lf=m(()=>{"use strict";Sr=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 Cn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var cf=m(()=>{"use strict"});var Ry,Pt,Xi=m(()=>{"use strict";Ry={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Pt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(Pt||{})});function jr(i,t){return t.alphaMode==="no-premultiply-alpha"&&Ry[i]||i}var Pn=m(()=>{Xi()});var Ml,My=m(()=>{"use strict";Ml=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 By(){return df>0?Fy[--df]:new uf}function Iy(i){Fy[df++]=i}var uf,Fy,df,Rn,Gy,Uy,ky=m(()=>{fe();lf();cf();Pn();$i();My();uf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ml,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Fy=[],df=0;Rn=0,Gy=class Bl{constructor(t={}){this.uid=nt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Bl.defaultOptions.maxTextures=Bl.defaultOptions.maxTextures??Qe(),t={...Bl.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Sr(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Iy(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=By(),s=r.textures;s.clear();let o=e[this.elementStart],n=jr(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 h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let x=e[g];e[g]=null;let _=x.texture._source,y=jr(x.blendMode,_),T=n!==y||a!==x.topology;if(_._batchTick===Rn&&!T){x._textureId=_._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}_._batchTick=Rn,(s.count>=p||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=y,a=x.topology,r=By(),s=r.textures,s.clear(),++Rn),x._textureId=_._textureBindLocation=s.count,s.ids[_.uid]=s.count,s.textures[s.count++]=_,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Rn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Rn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Sr(e);Cn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Cn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)Iy(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}};Gy.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Uy=Gy});var ot,Yr=m(()=>{"use strict";ot=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(ot||{})});var kt,gi=m(()=>{ge();fe();Yr();kt=class extends Et{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=nt("buffer"),this._resourceType="buffer",this._resourceId=nt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ot.STATIC)}set static(t){t?this.descriptor.usage|=ot.STATIC:this.descriptor.usage&=~ot.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=nt("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function ff(i,t){if(!(i instanceof kt)){let e=t?ot.INDEX:ot.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=ot.INDEX|ot.COPY_DST):(i=new Float32Array(i),e=ot.VERTEX|ot.COPY_DST)),i=new kt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var Oy=m(()=>{gi();Yr()});function Ny(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>h&&(h=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var Dy=m(()=>{"use strict"});function QR(i){return(i instanceof kt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=ff(i.buffer,!1),i}var Je,Ds=m(()=>{ge();Me();fe();gi();Oy();Dy();Je=class extends Et{constructor(t={}){super(),this.uid=nt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new vt,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=QR(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=ff(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Ny(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 JR,tM,Il,Ly=m(()=>{gi();Yr();Ds();JR=new Float32Array(1),tM=new Uint32Array(1),Il=class extends Je{constructor(){let e=new kt({data:JR,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),r=new kt({data:tM,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:r})}}});function qr(i,t){let e=Hy[i];return e===void 0&&(pf[t]===void 0&&(pf[t]=1),Hy[i]=e=pf[t]++),e}var pf,Hy,Mn=m(()=>{"use strict";pf=Object.create(null),Hy=Object.create(null)});function Vy(){if(!Fl){Fl="mediump";let i=Pl();i&&i.getShaderPrecisionFormat&&(Fl=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Fl}var Fl,Wy=m(()=>{af()});function zy(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
19
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${fl}px`,e.style.height=`${fl}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=I_.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new fi(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==NR||!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()}};Gd.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"accessibility"};Gd.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};U_=Gd});var O_,L_=g(()=>{"use strict";O_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var D_=g(()=>{C();fr();k_();L_();G.add(U_);G.mixin(vt,O_)});var xn,N_=g(()=>{C();xn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};xn.extension=_.Application});var mi,pl=g(()=>{"use strict";mi=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(mi||{})});var Fs,H_=g(()=>{"use strict";Fs=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var V_,Ie,_n=g(()=>{pl();H_();V_=class He{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 Fs(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=mi.NORMAL){return this._addListener(new Fs(t,e,r))}addOnce(t,e,r=mi.NORMAL){return this._addListener(new Fs(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*He.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,He.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!He._shared){let t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){let t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};V_.targetFPMS=.06;Ie=V_});var yn,W_=g(()=>{C();pl();_n();yn=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,mi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ie.shared:new Ie,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};yn.extension=_.Application});var Ud=g(()=>{C();N_();W_();G.add(xn);G.add(yn)});var kd,Er,Od=g(()=>{pl();_n();kd=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||(Ie.system.add(this._tickerUpdate,this,mi.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ie.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())}},Er=new kd});var Yr,ml=g(()=>{Qe();ul();Yr=class extends fi{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,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Se,Ld=g(()=>{ml();Se=class extends Yr{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 Ar,Dd=g(()=>{ml();Ar=class extends Yr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Ar.DOM_DELTA_PIXEL=0;Ar.DOM_DELTA_LINE=1;Ar.DOM_DELTA_PAGE=2});var XR,jR,bn,gl,z_=g(()=>{_e();Qe();At();Od();ml();Ld();Dd();XR=2048,jR=new ht,bn=new ht,gl=class{constructor(t){this.dispatch=new Pt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Er.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,jR.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<XR&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Er.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,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Er.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,bn),!t.hitArea.contains(bn.x,bn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,bn),t.containsPoint(bn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"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),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"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),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Ar)){O("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Se);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Ar);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Se);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Se&&e instanceof Se&&(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 Yr&&e instanceof Yr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var YR,qR,Hd,xl,Vd=g(()=>{C();z_();Od();Ld();Dd();YR=1,qR={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Hd=class Nd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gl(null),Er.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Se(null),this._rootWheelEvent=new Ar(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Nd.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Nd._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Er.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Er.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Er.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;Er.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=YR),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=qR[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}};Hd.extension={name:"events",type:[_.WebGLSystem,_.CanvasSystem,_.WebGPUSystem],priority:-1};Hd.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};xl=Hd});var $_,X_=g(()=>{Vd();ul();$_={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??xl.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n)}),o?h.once(i,a,n):h.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof fi))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var j_=g(()=>{C();fr();Vd();X_();G.add(xl);G.mixin(vt,$_)});var vn,Y_=g(()=>{C();vn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};vn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"dom"}});var gi,_l=g(()=>{Me();fr();gi=class extends vt{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:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r)}}});var q_=g(()=>{C();Y_();G.add(vn)});var ce,qr=g(()=>{"use strict";ce=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(ce||{})});var K_,Z_=g(()=>{"use strict";K_={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Q_,$,Mt=g(()=>{Z_();Q_=K_,$={get(){return Q_},set(i){Q_=i}}});function pr(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Tn(i){return i.split("?")[0].split("#")[0]}function KR(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZR(i,t,e){return i.replace(new RegExp(KR(t),"g"),e)}function QR(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ie,zi=g(()=>{Mt();ie={toPosix(i){return ZR(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){pr(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(pr(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Tn(this.toPosix(t??$.get().getBaseUrl())),s=Tn(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?ie.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(pr(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=QR(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return pr(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(pr(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(pr(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){pr(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){pr(i),t&&pr(t),i=Tn(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){pr(i),i=Tn(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){pr(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Tn(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=!1,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ee,Sn=g(()=>{"use strict";Ee=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function J_(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?J_(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function ty(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),J_(i,s,0,e,r)}else r.push(i);return r}var ey=g(()=>{"use strict"});var $i,yl=g(()=>{"use strict";$i=i=>!Array.isArray(i)});function JR(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ve,Gs=g(()=>{At();zi();Sn();ey();yl();Ve=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Ee(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&O("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));r.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`)},Ee(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ee(n).map(f=>typeof f=="string"?ty(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let x=0;x<this._parsers.length;x++){let v=this._parsers[x];if(v.test(p)){m=v.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:h,loadParser:l}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=$i(t);t=Ee(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=$i(t);t=Ee(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(c=>c[a]?c[a]===h:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ie.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??JR(t.src),t}};Ve.RETINA_PREFIX=/@([0-9\.]+)x/});var En,Wd=g(()=>{"use strict";En=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var ry,zd,iy=g(()=>{le();bt();ry=class An{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof E?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=An.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=An.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.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&&(h=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 E({source:this.textureSource,frame:a,orig:c,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*An.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*An.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=[]}};ry.BATCH_SIZE=1e3;zd=ry});function sy(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=ie.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=sy([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var tM,oy,ny=g(()=>{qr();Gs();Wd();C();bt();zi();iy();tM=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];oy={extension:_.Asset,cache:{test:i=>i instanceof zd,getCacheableAssets:(i,t)=>sy(i,t,!1)},resolver:{extension:{type:_.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&tM.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:_.LoadParser,priority:ce.Normal,name:"spritesheetLoader"},async testParse(i,t){return ie.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=ie.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof E)a=r;else{let c=En(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new zd(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=En(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);h.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var bl=g(()=>{C();ny();G.add(oy)});function vl(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var $d=g(()=>{"use strict"});var se,Tl=g(()=>{Jh();bt();$d();Lt();_l();se=class i extends gi{constructor(t=E.EMPTY){t instanceof E&&(t={texture:t});let{texture:e=E.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new me({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof E?new i(t):new i(E.from(t,e))}set texture(t){t||(t=E.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 vl(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return z("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Sl(i,t,e){let r=eM;i.measurable=!0,ws(i,e,r),t.addBoundsMask(r),i.measurable=!1}var eM,Xd=g(()=>{Me();fn();eM=new Et});function El(i,t,e){let r=Ne.get();i.measurable=!0;let s=Zt.get().identity(),o=ay(i,e,s);Ps(i,r,o),i.measurable=!1,t.addBoundsMask(r),Zt.return(s),Ne.return(r)}function ay(i,t,e){return i?(i!==t&&(ay(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var jd=g(()=>{nl();Oi();At()});var wn,hy=g(()=>{C();Tl();Xd();jd();wn=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 se),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||Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof se}};wn.extension=_.MaskEffect});var Cn,ly=g(()=>{C();Cn=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"}};Cn.extension=_.MaskEffect});var Pn,cy=g(()=>{C();fr();Xd();jd();Pn=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){Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof vt}};Pn.extension=_.MaskEffect});var ye,Us=g(()=>{Mt();C();Be();ye=class extends yt{constructor(t){t.resource||(t.resource=$.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};ye.extension=_.TextureSource});var Fe,ks=g(()=>{Mt();C();At();Be();Fe=class extends yt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=$.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,O("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}};Fe.extension=_.TextureSource});async function Al(){return Yd??(Yd=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Yd}var Yd,qd=g(()=>{"use strict"});var wl,Os,Kd=g(()=>{C();_n();qd();Be();wl=class uy extends yt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...uy.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=Ie.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 Al(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ie.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||(Ie.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ie.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};wl.extension=_.TextureSource;wl.defaultOptions={...yt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};wl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Os=wl});var Zd,xt,xi=g(()=>{At();Sn();Zd=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||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ee(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){O(`[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}},xt=new Zd});function dy(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Qd.length;s++){let o=Qd[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function fy(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&xt.has(r))return xt.get(r);let o=new E({source:dy(s)});return o.on("destroy",()=>{xt.has(r)&&xt.remove(r)}),t||xt.set(r,o),o}function py(i,t=!1){return typeof i=="string"?xt.get(i):i instanceof yt?new E({source:i}):fy(i,t)}var Qd,Jd=g(()=>{xi();C();Be();bt();Qd=[];G.handleByList(_.TextureSource,Qd);E.from=py;yt.from=dy});var Cl=g(()=>{C();hy();ly();cy();Ed();Us();ks();Kd();Jd();G.add(wn,Cn,Pn,Os,Fe,ye,Vi)});var ue,_i=g(()=>{"use strict";ue=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Rl(){return(!Pl||Pl?.isContextLost())&&(Pl=$.get().createCanvas().getContext("webgl",{})),Pl}var Pl,tf=g(()=>{Mt()});function iM(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function my(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=rM.replace(/%forloop%/gi,iM(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var rM,gy=g(()=>{"use strict";rM=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
+
`)});function Je(){if(Ls)return Ls;let i=Rl();return Ls=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Ls=my(Ls,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Ls}var Ls,Xi=g(()=>{tf();gy();Ls=null});function Ds(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return xy[e]||sM(i,t,e)}function sM(i,t,e){let r={},s=0;ef||(ef=Je());for(let n=0;n<ef;n++){let a=n<t?i[n]:E.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new ue(r);return xy[e]=o,o}var xy,ef,Ml=g(()=>{_i();bt();Xi();xy={};ef=0});var wr,rf=g(()=>{"use strict";wr=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 Rn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var sf=g(()=>{"use strict"});var _y,Ft,ji=g(()=>{"use strict";_y={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ft=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(Ft||{})});function Kr(i,t){return t.alphaMode==="no-premultiply-alpha"&&_y[i]||i}var Mn=g(()=>{ji()});var Bl,yy=g(()=>{"use strict";Bl=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 by(){return nf>0?Ty[--nf]:new of}function vy(i){Ty[nf++]=i}var of,Ty,nf,Bn,Sy,Ey,Ay=g(()=>{ge();rf();sf();Mn();Xi();yy();of=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Bl,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Ty=[],nf=0;Bn=0,Sy=class Il{constructor(t={}){this.uid=ot("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Il.defaultOptions.maxTextures=Il.defaultOptions.maxTextures??Je(),t={...Il.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new wr(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)vy(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=by(),s=r.textures;s.clear();let o=e[this.elementStart],n=Kr(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 h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let x=e[m];e[m]=null;let y=x.texture._source,b=Kr(x.blendMode,y),T=n!==b||a!==x.topology;if(y._batchTick===Bn&&!T){x._textureId=y._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}y._batchTick=Bn,(s.count>=p||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=b,a=x.topology,r=by(),s=r.textures,s.clear(),++Bn),x._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Bn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Bn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new wr(e);Rn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Rn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)vy(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}};Sy.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ey=Sy});var st,Zr=g(()=>{"use strict";st=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(st||{})});var Vt,yi=g(()=>{_e();ge();Zr();Vt=class extends Pt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=ot("buffer"),this._resourceType="buffer",this._resourceId=ot("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&st.STATIC)}set static(t){t?this.descriptor.usage|=st.STATIC:this.descriptor.usage&=~st.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ot("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function af(i,t){if(!(i instanceof Vt)){let e=t?st.INDEX:st.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=st.INDEX|st.COPY_DST):(i=new Float32Array(i),e=st.VERTEX|st.COPY_DST)),i=new Vt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var wy=g(()=>{yi();Zr()});function Cy(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>h&&(h=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var Py=g(()=>{"use strict"});function oM(i){return(i instanceof Vt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=af(i.buffer,!1),i}var tr,Ns=g(()=>{_e();Me();ge();yi();wy();Py();tr=class extends Pt{constructor(t={}){super(),this.uid=ot("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=oM(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=af(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Cy(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 nM,aM,Fl,Ry=g(()=>{yi();Zr();Ns();nM=new Float32Array(1),aM=new Uint32Array(1),Fl=class extends tr{constructor(){let e=new Vt({data:nM,label:"attribute-batch-buffer",usage:st.VERTEX|st.COPY_DST,shrinkToFit:!1}),r=new Vt({data:aM,label:"index-batch-buffer",usage:st.INDEX|st.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Qr(i,t){let e=My[i];return e===void 0&&(hf[t]===void 0&&(hf[t]=1),My[i]=e=hf[t]++),e}var hf,My,In=g(()=>{"use strict";hf=Object.create(null),My=Object.create(null)});function By(){if(!Gl){Gl="mediump";let i=Rl();i&&i.getShaderPrecisionFormat&&(Gl=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Gl}var Gl,Iy=g(()=>{tf()});function Fy(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -33,27 +33,27 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Ay(i,t){if(i===0)th
|
|
|
33
33
|
#define out varying
|
|
34
34
|
#endif
|
|
35
35
|
${i}
|
|
36
|
-
`}var
|
|
37
|
-
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var
|
|
38
|
-
${i}`:i}var
|
|
39
|
-
${i}`}var
|
|
36
|
+
`}var Gy=g(()=>{"use strict"});function Uy(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
37
|
+
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var ky=g(()=>{"use strict"});function Oy(i,t){return t?`#version 300 es
|
|
38
|
+
${i}`:i}var Ly=g(()=>{"use strict"});function Dy(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?hM:lM;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
|
|
39
|
+
${i}`}var hM,lM,Ny=g(()=>{"use strict";hM={},lM={}});function Hy(i,t){return t?i.replace("#version 300 es",""):i}var Vy=g(()=>{"use strict"});var lf,cf,Wy,er,Yi=g(()=>{In();Iy();Gy();ky();Ly();Ny();Vy();lf={stripVersion:Hy,ensurePrecision:Uy,addProgramDefines:Fy,setProgramName:Dy,insertVersion:Oy},cf=Object.create(null),Wy=class uf{constructor(t){t={...uf.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:By()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(lf).forEach(n=>{let a=r[n];s=lf[n](s,a,!0),o=lf[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Qr(`${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 cf[e]||(cf[e]=new uf(t)),cf[e]}};Wy.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};er=Wy});function Ge(i){return zy[i]??zy.float32}var zy,qi=g(()=>{"use strict";zy={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 $y({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let h=cM[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:Ge(h).stride,offset:0,instance:!1,start:0}}}}return e}var cM,Xy=g(()=>{qi();cM={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 Ul(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=i.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return{groups:[],structs:[]};let c=i.match(n)?.map(u=>{let d=u.match(h)[1],f=u.match(a).reduce((p,m)=>{let[x,v]=m.split(":");return p[x.trim()]=v.trim(),p},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:c}}var jy=g(()=>{"use strict"});var Hs,Yy=g(()=>{"use strict";Hs=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Hs||{})});function qy({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:Hs.VERTEX|Hs.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Hs.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Hs.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Ky=g(()=>{Yy()});function Zy({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var Qy=g(()=>{"use strict"});function Jy(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var tb=g(()=>{"use strict"});var df,rr,Vs=g(()=>{In();Xy();jy();Ky();Qy();tb();df=Object.create(null),rr=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Ul(e.source);this.structsAndGroups=a}else{let a=Ul(r.source),h=Ul(e.source);this.structsAndGroups=Jy(a,h)}this.layout=s??Zy(this.structsAndGroups),this.gpuLayout=o??qy(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Qr(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=$y(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 df[e]||(df[e]=new i(t)),df[e]}}});function ff(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else O(`${r} placement hook does not exist in shader`)}}var eb=g(()=>{At()});function pf(i){let t={};return(i.match(uM)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var uM,rb=g(()=>{"use strict";uM=/\{\{(.*?)\}\}/g});function ib(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function mf(i,t,e=!1){let r=[];ib(t,r),i.forEach(a=>{a.header&&ib(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,h)=>` @location(${h}) ${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(h=>` var ${
|
|
42
|
+
`),n}var sb=g(()=>{"use strict"});function ob(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function dM(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function fM(i){let t=/@.*?\s+/g;return i.replace(t,"")}function nb(i,t){let e=[];ob(t,e),i.forEach(h=>{h.header&&ob(h.header,e)});let r=0,s=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${r++}) ${h}`).join(`,
|
|
43
|
+
`),o=e.sort().map(h=>` var ${fM(h)};`).join(`
|
|
44
44
|
`),n=`return VSOutput(
|
|
45
|
-
${e.sort().map(h=>` ${
|
|
45
|
+
${e.sort().map(h=>` ${dM(h)}`).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 ab=g(()=>{"use strict"});function gf(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
|
|
53
53
|
`).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
54
54
|
${s.join(`
|
|
55
55
|
`)}
|
|
56
|
-
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var
|
|
56
|
+
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var hb=g(()=>{"use strict"});function lb({template:i,bits:t}){let e=ub(i,t);if(bi[e])return bi[e];let{vertex:r,fragment:s}=mM(i,t);return bi[e]=db(r,s,t),bi[e]}function cb({template:i,bits:t}){let e=ub(i,t);return bi[e]||(bi[e]=db(i.vertex,i.fragment,t)),bi[e]}function mM(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=mf(e,i.vertex,!0);s=nb(e,s);let o=mf(r,i.fragment,!0);return{vertex:s,fragment:o}}function ub(i,t){return t.map(e=>(xf.has(e)||xf.set(e,pM++),xf.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function db(i,t,e){let r=pf(i),s=pf(t);return e.forEach(o=>{ff(o.vertex,r,o.name),ff(o.fragment,s,o.name)}),{vertex:gf(i,r),fragment:gf(t,s)}}var bi,xf,pM,fb=g(()=>{eb();rb();sb();ab();hb();bi=Object.create(null),xf=new Map,pM=0});var pb,mb,gb,xb,_b=g(()=>{"use strict";pb=`
|
|
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
|
+
`,mb=`
|
|
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
|
+
`,gb=`
|
|
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
|
+
`,xb=`
|
|
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 yb,bb,vb=g(()=>{"use strict";yb={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
|
+
`}},bb={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 Cr({bits:i,name:t}){let e=lb({template:{fragment:mb,vertex:pb},bits:[yb,...i]});return rr.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Pr({bits:i,name:t}){return new er({name:t,...cb({template:{vertex:gb,fragment:xb},bits:[bb,...i]})})}var vi=g(()=>{Yi();Vs();fb();_b();vb()});var Ws,zs,Fn=g(()=>{"use strict";Ws={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
|
+
`}},zs={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 gM(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
|
|
203
|
+
`)}function xM(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
204
|
+
`)}function $s(i){return _f[i]||(_f[i]={name:"texture-batch-bit",vertex:{header:`
|
|
205
205
|
@in aTextureIdAndRound: vec2<u32>;
|
|
206
206
|
@out @interpolate(flat) vTextureId : u32;
|
|
207
207
|
`,main:`
|
|
@@ -214,14 +214,14 @@ ${s.join(`
|
|
|
214
214
|
`},fragment:{header:`
|
|
215
215
|
@in @interpolate(flat) vTextureId: u32;
|
|
216
216
|
|
|
217
|
-
${
|
|
217
|
+
${gM(i)}
|
|
218
218
|
`,main:`
|
|
219
219
|
var uvDx = dpdx(vUV);
|
|
220
220
|
var uvDy = dpdy(vUV);
|
|
221
221
|
|
|
222
|
-
${
|
|
223
|
-
`}}),
|
|
224
|
-
`)}function
|
|
222
|
+
${xM(i)}
|
|
223
|
+
`}}),_f[i]}function _M(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
224
|
+
`)}function Xs(i){return yf[i]||(yf[i]={name:"texture-batch-bit",vertex:{header:`
|
|
225
225
|
in vec2 aTextureIdAndRound;
|
|
226
226
|
out float vTextureId;
|
|
227
227
|
|
|
@@ -239,18 +239,18 @@ ${s.join(`
|
|
|
239
239
|
|
|
240
240
|
`,main:`
|
|
241
241
|
|
|
242
|
-
${
|
|
243
|
-
`}}),
|
|
242
|
+
${_M(i)}
|
|
243
|
+
`}}),yf[i]}var _f,yf,Gn=g(()=>{"use strict";_f={};yf={}});var Rr,Mr,Ti=g(()=>{"use strict";Rr={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
|
+
`}},Mr={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 Af,Fb,Gb=m(()=>{"use strict";Af=["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>"],Fb=Af.reduce((i,t)=>(i[t]=!0,i),{})});function Ub(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var kb=m(()=>{"use strict"});var Ob,St,Ee=m(()=>{fe();Mn();Gb();kb();Ob=class Nb{constructor(t,e){this._touched=0,this.uid=nt("uniform"),this._resourceType="uniformGroup",this._resourceId=nt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Nb.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Fb[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Af.join(", ")}`);o.value??(o.value=Ub(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=qr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Ob.defaultOptions={ubo:!1,isStatic:!1};St=Ob});function Xs(i){let t=Db[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Db[i]=new St({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var Db,Ul=m(()=>{Ee();Db={}});var $t,Pr=m(()=>{"use strict";$t=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))($t||{})});var Ot,fr=m(()=>{ge();fe();ji();mi();Hs();Pr();Ee();Ot=class i extends Et{constructor(t){super(),this.uid=nt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=$t.WEBGPU),r&&(n|=$t.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[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,h[u.name]=u});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new oe,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new St(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new oe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new oe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=er.from(e)),r&&(n=tr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var kl,Lb=m(()=>{_i();Bn();In();yi();Ul();fr();kl=class extends Ot{constructor(t){let e=Er({name:"batch",bits:[Ws,$s(t),Cr]}),r=wr({name:"batch",bits:[Vs,zs(t),Ar]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Xs(t)}})}}});var Hb,Vb,Fn,Cf=m(()=>{R();ky();Ly();Lb();Hb=null,Vb=class Wb extends Uy{constructor(){super(...arguments),this.geometry=new Il,this.shader=Hb||(Hb=new kl(this.maxTextures)),this.name=Wb.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:g}=t,x=t.color,v=t.attributeOffset,_=v+t.attributeSize;for(let y=v;y<_;y++){let T=y*2,E=p[T],w=p[T+1];e[s++]=h*E+c*w+d,e[s++]=u*w+l*E+f,e[s++]=g[T],e[s++]=g[T+1],r[s++]=x,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,g=p.maxX,x=p.minX,v=p.maxY,_=p.minY,y=n.uvs,T=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=h*x+c*_+d,e[s+1]=u*_+l*x+f,e[s+2]=y.x0,e[s+3]=y.y0,r[s+4]=T,r[s+5]=E,e[s+6]=h*g+c*_+d,e[s+7]=u*_+l*g+f,e[s+8]=y.x1,e[s+9]=y.y1,r[s+10]=T,r[s+11]=E,e[s+12]=h*g+c*v+d,e[s+13]=u*v+l*g+f,e[s+14]=y.x2,e[s+15]=y.y2,r[s+16]=T,r[s+17]=E,e[s+18]=h*x+c*v+d,e[s+19]=u*v+l*x+f,e[s+20]=y.x3,e[s+21]=y.y3,r[s+22]=T,r[s+23]=E}};Vb.extension={type:[b.Batcher],name:"default"};Fn=Vb});function zb(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;h<n;){let g=i[e],x=i[e+1];r[s]=l*g+u*x+f,r[s+1]=c*g+d*x+p,s+=o,e+=t,h++}}function $b(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Xb=m(()=>{"use strict"});function Pf(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+h*p+c,u+=r}}var jb=m(()=>{"use strict"});var dM,qi,Rf=m(()=>{dt();bd();dM=new U,qi=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?sl(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||dM}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 js,Yb,qb,Kb=m(()=>{R();js={extension:{type:b.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,E=T.width/2,w=T.height/2;e=T.x+E,r=T.y+w,n=a=Math.max(0,Math.min(T.radius,Math.min(E,w))),s=E-n,o=w-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,g=o,x=e+p,v=e-p,_=r+g;if(t[c++]=x,t[c++]=_,t[--u]=_,t[--u]=v,o){let T=r-g;t[d++]=v,t[d++]=T,t[--f]=T,t[--f]=x}for(let T=1;T<h;T++){let E=Math.PI/2*(T/h),w=s+Math.cos(E)*n,C=o+Math.sin(E)*a,M=e+w,P=e-w,S=r+C,A=r-C;t[c++]=M,t[c++]=S,t[--u]=S,t[--u]=P,t[d++]=P,t[d++]=A,t[--f]=A,t[--f]=M}p=s,g=o+a,x=e+p,v=e-p,_=r+g;let y=r-g;return t[c++]=x,t[c++]=_,t[--f]=y,t[--f]=x,s&&(t[c++]=v,t[c++]=_,t[--f]=y,t[--f]=v),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1}},Yb={...js,extension:{...js.extension,name:"ellipse"}},qb={...js,extension:{...js.extension,name:"roundedRectangle"}}});function Zb(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Qb=m(()=>{"use strict"});function Jb(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=h+d,g=l+f,x=c+d,v=u+f;return a.push(p,g),a.push(x,v),2}function Ki(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),g=Math.sqrt(h*h+l*l),x=(15*p*Math.sqrt(g)/Math.PI>>0)+1,v=f/x;if(d+=v,a){n.push(i,t),n.push(e,r);for(let _=1,y=d;_<x;_++,y+=v)n.push(i,t),n.push(i+Math.sin(y)*g,t+Math.cos(y)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let _=1,y=d;_<x;_++,y+=v)n.push(i+Math.sin(y)*g,t+Math.cos(y)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return x*2}function tv(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let O=Zb(i);e&&(O*=-1),h=(h-.5)*O+.5}let l=new at(i[0],i[1]),c=new at(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let O=(l.x+c.x)*.5,Y=(c.y+l.y)*.5;i.unshift(O,Y),i.push(O,Y)}let f=s,p=i.length/2,g=i.length,x=f.length/2,v=a.width/2,_=v*v,y=a.miterLimit*a.miterLimit,T=i[0],E=i[1],w=i[2],C=i[3],M=0,P=0,S=-(E-C),A=T-w,B=0,F=0,W=Math.sqrt(S*S+A*A);S/=W,A/=W,S*=v,A*=v;let z=h,k=(1-z)*2,G=z*2;u||(a.cap==="round"?g+=Ki(T-S*(k-G)*.5,E-A*(k-G)*.5,T-S*k,E-A*k,T+S*G,E+A*G,f,!0)+2:a.cap==="square"&&(g+=Jb(T,E,S,A,k,G,!0,f))),f.push(T-S*k,E-A*k),f.push(T+S*G,E+A*G);for(let O=1;O<p-1;++O){T=i[(O-1)*2],E=i[(O-1)*2+1],w=i[O*2],C=i[O*2+1],M=i[(O+1)*2],P=i[(O+1)*2+1],S=-(E-C),A=T-w,W=Math.sqrt(S*S+A*A),S/=W,A/=W,S*=v,A*=v,B=-(C-P),F=w-M,W=Math.sqrt(B*B+F*F),B/=W,F/=W,B*=v,F*=v;let Y=w-T,lt=E-C,bt=w-M,It=P-C,Wt=Y*bt+lt*It,re=lt*bt-It*Y,le=re<0;if(Math.abs(re)<.001*Math.abs(Wt)){f.push(w-S*k,C-A*k),f.push(w+S*G,C+A*G),Wt>=0&&(a.join==="round"?g+=Ki(w,C,w-S*k,C-A*k,w-B*k,C-F*k,f,!1)+4:g+=2,f.push(w-B*G,C-F*G),f.push(w+B*k,C+F*k));continue}let Ne=(-S+T)*(-A+C)-(-S+w)*(-A+E),qe=(-B+M)*(-F+C)-(-B+w)*(-F+P),Dt=(Y*qe-bt*Ne)/re,ce=(It*Ne-lt*qe)/re,ye=(Dt-w)*(Dt-w)+(ce-C)*(ce-C),pe=w+(Dt-w)*k,be=C+(ce-C)*k,cr=w-(Dt-w)*G,Fi=C-(ce-C)*G,nR=Math.min(Y*Y+lt*lt,bt*bt+It*It),vx=le?k:G,aR=nR+vx*vx*_;ye<=aR?a.join==="bevel"||ye/_>y?(le?(f.push(pe,be),f.push(w+S*G,C+A*G),f.push(pe,be),f.push(w+B*G,C+F*G)):(f.push(w-S*k,C-A*k),f.push(cr,Fi),f.push(w-B*k,C-F*k),f.push(cr,Fi)),g+=2):a.join==="round"?le?(f.push(pe,be),f.push(w+S*G,C+A*G),g+=Ki(w,C,w+S*G,C+A*G,w+B*G,C+F*G,f,!0)+4,f.push(pe,be),f.push(w+B*G,C+F*G)):(f.push(w-S*k,C-A*k),f.push(cr,Fi),g+=Ki(w,C,w-S*k,C-A*k,w-B*k,C-F*k,f,!1)+4,f.push(w-B*k,C-F*k),f.push(cr,Fi)):(f.push(pe,be),f.push(cr,Fi)):(f.push(w-S*k,C-A*k),f.push(w+S*G,C+A*G),a.join==="round"?le?g+=Ki(w,C,w+S*G,C+A*G,w+B*G,C+F*G,f,!0)+2:g+=Ki(w,C,w-S*k,C-A*k,w-B*k,C-F*k,f,!1)+2:a.join==="miter"&&ye/_<=y&&(le?(f.push(cr,Fi),f.push(cr,Fi)):(f.push(pe,be),f.push(pe,be)),g+=2),f.push(w-B*k,C-F*k),f.push(w+B*G,C+F*G),g+=2)}T=i[(p-2)*2],E=i[(p-2)*2+1],w=i[(p-1)*2],C=i[(p-1)*2+1],S=-(E-C),A=T-w,W=Math.sqrt(S*S+A*A),S/=W,A/=W,S*=v,A*=v,f.push(w-S*k,C-A*k),f.push(w+S*G,C+A*G),u||(a.cap==="round"?g+=Ki(w-S*(k-G)*.5,C-A*(k-G)*.5,w-S*k,C-A*k,w+S*G,C+A*G,f,!1)+2:a.cap==="square"&&(g+=Jb(w,C,S,A,k,G,!1,f)));let N=1e-4*1e-4;for(let O=x;O<g+x-2;++O)T=f[O*2],E=f[O*2+1],w=f[(O+1)*2],C=f[(O+1)*2+1],M=f[(O+2)*2],P=f[(O+2)*2+1],!(Math.abs(T*(C-P)+w*(P-E)+M*(E-C))<N)&&o.push(O,O+1,O+2)}var ev=m(()=>{Ze();Qb()});function rv(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=i.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(i[f*2]),c.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var iv=m(()=>{});var Hl=Q((p4,Ff)=>{"use strict";Ff.exports=Dl;Ff.exports.default=Dl;function Dl(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=ov(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(r&&(o=yM(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return Gn(o,n,e,a,h,f,0),n}function ov(i,t,e,r,s){var o,n;if(s===If(i,t,e,r)>0)for(o=t;o<e;o+=r)n=sv(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=sv(o,i[o],i[o+1],n);return n&&Ll(n,n.next)&&(kn(n),n=n.next),n}function Zi(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Ll(e,e.next)||Ut(e.prev,e,e.next)===0)){if(kn(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Gn(i,t,e,r,s,o,n){if(i){!n&&o&&wM(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?gM(i,r,s,o):mM(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),kn(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=xM(Zi(i),t,e),Gn(i,t,e,r,s,o,2)):n===2&&_M(i,t,e,r,s,o):Gn(Zi(i),t,e,r,s,o,1);break}}}}function mM(i){var t=i.prev,e=i,r=i.next;if(Ut(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=s<o?s<n?s:n:o<n?o:n,u=a<h?a<l?a:l:h<l?h:l,d=s>o?s>n?s:n:o>n?o:n,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&Ys(s,a,o,h,n,l,p.x,p.y)&&Ut(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function gM(i,t,e,r){var s=i.prev,o=i,n=i.next;if(Ut(s,o,n)>=0)return!1;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,d=n.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,g=a>h?a>l?a:l:h>l?h:l,x=c>u?c>d?c:d:u>d?u:d,v=Mf(f,p,t,e,r),_=Mf(g,x,t,e,r),y=i.prevZ,T=i.nextZ;y&&y.z>=v&&T&&T.z<=_;){if(y.x>=f&&y.x<=g&&y.y>=p&&y.y<=x&&y!==s&&y!==n&&Ys(a,c,h,u,l,d,y.x,y.y)&&Ut(y.prev,y,y.next)>=0||(y=y.prevZ,T.x>=f&&T.x<=g&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&Ys(a,c,h,u,l,d,T.x,T.y)&&Ut(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;y&&y.z>=v;){if(y.x>=f&&y.x<=g&&y.y>=p&&y.y<=x&&y!==s&&y!==n&&Ys(a,c,h,u,l,d,y.x,y.y)&&Ut(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;T&&T.z<=_;){if(T.x>=f&&T.x<=g&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&Ys(a,c,h,u,l,d,T.x,T.y)&&Ut(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function xM(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Ll(s,o)&&nv(s,r,r.next,o)&&Un(s,o)&&Un(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),kn(r),kn(r.next),r=i=o),r=r.next}while(r!==i);return Zi(r)}function _M(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&CM(n,a)){var h=av(n,a);n=Zi(n,n.next),h=Zi(h,h.next),Gn(n,t,e,r,s,o,0),Gn(h,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function yM(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=ov(i,a,h,r,!1),l===l.next&&(l.steiner=!0),s.push(AM(l));for(s.sort(bM),o=0;o<s.length;o++)e=vM(s[o],e);return e}function bM(i,t){return i.x-t.x}function vM(i,t){var e=TM(i,t);if(!e)return t;var r=av(e,i);return Zi(r,r.next),Zi(e,e.next)}function TM(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var h=n,l=n.x,c=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&Ys(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),Un(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&SM(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function SM(i,t){return Ut(i.prev,i,t.prev)<0&&Ut(t.next,i,i.next)<0}function wM(i,t,e,r){var s=i;do s.z===0&&(s.z=Mf(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,EM(s)}function EM(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function Mf(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function AM(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function Ys(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function CM(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!PM(i,t)&&(Un(i,t)&&Un(t,i)&&RM(i,t)&&(Ut(i.prev,i,t.prev)||Ut(i,t.prev,t))||Ll(i,t)&&Ut(i.prev,i,i.next)>0&&Ut(t.prev,t,t.next)>0)}function Ut(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Ll(i,t){return i.x===t.x&&i.y===t.y}function nv(i,t,e,r){var s=Nl(Ut(i,t,e)),o=Nl(Ut(i,t,r)),n=Nl(Ut(e,r,i)),a=Nl(Ut(e,r,t));return!!(s!==o&&n!==a||s===0&&Ol(i,e,t)||o===0&&Ol(i,r,t)||n===0&&Ol(e,i,r)||a===0&&Ol(e,t,r))}function Ol(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Nl(i){return i>0?1:i<0?-1:0}function PM(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&nv(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Un(i,t){return Ut(i.prev,i,i.next)<0?Ut(i,t,i.next)>=0&&Ut(i,i.prev,t)>=0:Ut(i,t,i.prev)<0||Ut(i,i.next,t)<0}function RM(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function av(i,t){var e=new Bf(i.i,i.x,i.y),r=new Bf(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function sv(i,t,e,r){var s=new Bf(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function kn(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Bf(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Dl.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(If(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(If(i,l,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function If(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Dl.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Vl(i,t,e,r,s,o,n){let a=(0,hv.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r}var hv,Gf=m(()=>{hv=Gi(Hl(),1)});var MM,lv,cv=m(()=>{R();Gf();MM=[],lv={extension:{type:b.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Vl(i,MM,t,e,r,s,o)}}});var uv,dv=m(()=>{R();uv={extension:{type:b.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var fv,pv=m(()=>{R();fv={extension:{type:b.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function gv(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function xv(i,t){let e=j.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function BM(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Ue.defaultLinearOptions.textureSize}),t}var mv,kf,Ue,qs=m(()=>{ue();At();dt();Us();_t();fe();Ft();Ad();mv=[{offset:0,color:"white"},{offset:1,color:"black"}],kf=class Uf{constructor(...t){this.uid=nt("fillGradient"),this.type="linear",this.colorStops=[];let e=BM(t);e={...e.type==="radial"?Uf.defaultRadialOptions:Uf.defaultLinearOptions,...nl(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:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=r,r=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let h=this.colorStops.length?this.colorStops:mv,l=this._textureSize,{canvas:c,context:u}=xv(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);gv(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new I({source:new Fe({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),g=new U;g.scale(f/l,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:mv,e=this._textureSize,{canvas:r,context:s}=xv(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),p=(o-u)*f,g=(n-d)*f,x=s.createRadialGradient(p,g,l*f,(a-u)*f,(h-d)*f,c*f);gv(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-g),s.fillRect(0,0,e,e),this.texture=new I({source:new Fe({resource:r,addressMode:this._wrapMode})});let v=new U;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}};kf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};kf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Ue=kf});function _v(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(FM);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,d=-h*c,f=s.a,p=s.b,g=s.c,x=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*g+s.tx,s.ty=u*p+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Ue)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(IM.copyFrom(r).invert()),s}var IM,FM,yv=m(()=>{dt();qt();qs();IM=new U,FM=new rt});function vv(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")kM(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&bv(l.shapePath,h,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),bv(a,h,n,r,e)}}}function kM(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=Wl.rectangle,c=GM,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let d=i.transform;l.build(c,h),d&&Pf(h,d),l.triangulate(h,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=et.get(qi);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function bv(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=Wl[h.type],g="triangle-list";if(p.build(h,f),l&&Pf(f,l),e){let y=h.closePath??!0,T=t;T.pixelLine?(rv(f,y,o,a),g="line-list"):tv(f,T,!1,y,o,a)}else if(c){let y=[],T=f.slice();OM(c).forEach(w=>{y.push(T.length/2),T.push(...w)}),Vl(T,y,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let x=n.length/2,v=t.texture;if(v!==I.WHITE){let y=_v(UM,t,h,l);zb(o,2,d,n,x,2,o.length/2-d,y)}else $b(n,x,2,o.length/2-d);let _=et.get(qi);_.indexOffset=u,_.indexSize=a.length-u,_.attributeOffset=d,_.attributeSize=o.length/2-d,_.baseColor=t.color,_.alpha=t.alpha,_.texture=v,_.geometryData=s,_.topology=g,r.push(_)})}function OM(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Wl[r.type].build(r,s),t.push(s)}return t}var Wl,GM,UM,Tv=m(()=>{R();dt();qt();Xb();jb();_t();Te();Rf();Kb();ev();iv();cv();dv();pv();yv();Gf();Wl={};D.handleByMap(b.ShapeBuilder,Wl);D.add(uv,lv,fv,js,Yb,qb);GM=new rt,UM=new U});var Of,Nf,Lf,Ks,zl=m(()=>{R();Rl();Cf();wd();Ft();Te();Tv();Of=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Nf=class{constructor(){this.batcher=new Fn,this.instructions=new Ps}init(){this.instructions.reset()}get geometry(){return X(Vx,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Lf=class Df{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Df.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Df.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),vv(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=et.get(Nf),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u)}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let c=0;c<l.length;c++){let u=l[c];u.bindGroup=Ns(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Of;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(et.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{et.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Lf.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"graphicsContext"};Lf.defaultOptions={bezierSmoothness:.5};Ks=Lf});var NM,Hf,Vf,Wf,zf,$f,Xf,jf,Lt,pr=m(()=>{"use strict";NM={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},Hf=0,Vf=1,Wf=2,zf=3,$f=4,Xf=5,jf=class Sv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Hf)}set blend(t){!!(this.data&1<<Hf)!==t&&(this.data^=1<<Hf)}get offsets(){return!!(this.data&1<<Vf)}set offsets(t){!!(this.data&1<<Vf)!==t&&(this.data^=1<<Vf)}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<<Wf)}set culling(t){!!(this.data&1<<Wf)!==t&&(this.data^=1<<Wf)}get depthTest(){return!!(this.data&1<<zf)}set depthTest(t){!!(this.data&1<<zf)!==t&&(this.data^=1<<zf)}get depthMask(){return!!(this.data&1<<Xf)}set depthMask(t){!!(this.data&1<<Xf)!==t&&(this.data^=1<<Xf)}get clockwiseFrontFace(){return!!(this.data&1<<$f)}set clockwiseFrontFace(t){!!(this.data&1<<$f)!==t&&(this.data^=1<<$f)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=NM[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 Sv;return t.depthTest=!1,t.blend=!0,t}};jf.default2d=jf.for2d();Lt=jf});function Rr(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Zs=m(()=>{"use strict"});var On,wv=m(()=>{R();pr();Te();Zs();Rf();On=class{constructor(t,e){this.state=Lt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Rr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=et.get(qi);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{et.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};On.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"graphics"}});var Yf=m(()=>{R();zl();wv();D.add(On);D.add(Ks)});var bi,$l=m(()=>{"use strict";bi=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Nn,Ev=m(()=>{R();dt();mi();Ee();Pn();Te();Zs();$l();Nn=class{constructor(t,e){this.localUniforms=new St({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new oe({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(et.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=jr(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Rr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=et.get(bi);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&et.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Nn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"mesh"}});var qf=m(()=>{R();Ev();D.add(Nn)});var Xl,Av=m(()=>{"use strict";Xl=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function Kf(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Cv=m(()=>{"use strict"});function Rv(i){return{dynamicUpdate:Pv(i,!0),staticUpdate:Pv(i,!1)}}function Pv(i,t){let e=[];e.push(`
|
|
253
|
+
`}}});var bf,Tb,Sb=g(()=>{"use strict";bf=["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>"],Tb=bf.reduce((i,t)=>(i[t]=!0,i),{})});function Eb(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Ab=g(()=>{"use strict"});var wb,wt,Ae=g(()=>{ge();In();Sb();Ab();wb=class Cb{constructor(t,e){this._touched=0,this.uid=ot("uniform"),this._resourceType="uniformGroup",this._resourceId=ot("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Cb.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Tb[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${bf.join(", ")}`);o.value??(o.value=Eb(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Qr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};wb.defaultOptions={ubo:!1,isStatic:!1};wt=wb});function js(i){let t=Pb[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Pb[i]=new wt({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var Pb,kl=g(()=>{Ae();Pb={}});var Qt,Br=g(()=>{"use strict";Qt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Qt||{})});var Wt,mr=g(()=>{_e();ge();Yi();_i();Vs();Br();Ae();Wt=class i extends Pt{constructor(t){super(),this.uid=ot("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Qt.WEBGPU),r&&(n|=Qt.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[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,h[u.name]=u});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new ue,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new wt(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new ue,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new ue,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Ol,Rb=g(()=>{vi();Fn();Gn();Ti();kl();mr();Ol=class extends Wt{constructor(t){let e=Pr({name:"batch",bits:[zs,Xs(t),Mr]}),r=Cr({name:"batch",bits:[Ws,$s(t),Rr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:js(t)}})}}});var Mb,Bb,Un,vf=g(()=>{C();Ay();Ry();Rb();Mb=null,Bb=class Ib extends Ey{constructor(){super(...arguments),this.geometry=new Fl,this.shader=Mb||(Mb=new Ol(this.maxTextures)),this.name=Ib.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,x=t.color,v=t.attributeOffset,y=v+t.attributeSize;for(let b=v;b<y;b++){let T=b*2,w=p[T],S=p[T+1];e[s++]=h*w+c*S+d,e[s++]=u*S+l*w+f,e[s++]=m[T],e[s++]=m[T+1],r[s++]=x,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,x=p.minX,v=p.maxY,y=p.minY,b=n.uvs,T=t.color,w=o<<16|t.roundPixels&65535;e[s+0]=h*x+c*y+d,e[s+1]=u*y+l*x+f,e[s+2]=b.x0,e[s+3]=b.y0,r[s+4]=T,r[s+5]=w,e[s+6]=h*m+c*y+d,e[s+7]=u*y+l*m+f,e[s+8]=b.x1,e[s+9]=b.y1,r[s+10]=T,r[s+11]=w,e[s+12]=h*m+c*v+d,e[s+13]=u*v+l*m+f,e[s+14]=b.x2,e[s+15]=b.y2,r[s+16]=T,r[s+17]=w,e[s+18]=h*x+c*v+d,e[s+19]=u*v+l*x+f,e[s+20]=b.x3,e[s+21]=b.y3,r[s+22]=T,r[s+23]=w}};Bb.extension={type:[_.Batcher],name:"default"};Un=Bb});function Fb(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;h<n;){let m=i[e],x=i[e+1];r[s]=l*m+u*x+f,r[s+1]=c*m+d*x+p,s+=o,e+=t,h++}}function Gb(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Ub=g(()=>{"use strict"});function Tf(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+h*p+c,u+=r}}var kb=g(()=>{"use strict"});var yM,Ki,Sf=g(()=>{ft();pd();yM=new M,Ki=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ol(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||yM}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 Ys,Ob,Lb,Db=g(()=>{C();Ys={extension:{type:_.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,w=T.width/2,S=T.height/2;e=T.x+w,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(w,S))),s=w-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,m=o,x=e+p,v=e-p,y=r+m;if(t[c++]=x,t[c++]=y,t[--u]=y,t[--u]=v,o){let T=r-m;t[d++]=v,t[d++]=T,t[--f]=T,t[--f]=x}for(let T=1;T<h;T++){let w=Math.PI/2*(T/h),S=s+Math.cos(w)*n,A=o+Math.sin(w)*a,R=e+S,I=e-S,P=r+A,B=r-A;t[c++]=R,t[c++]=P,t[--u]=P,t[--u]=I,t[d++]=I,t[d++]=B,t[--f]=B,t[--f]=R}p=s,m=o+a,x=e+p,v=e-p,y=r+m;let b=r-m;return t[c++]=x,t[c++]=y,t[--f]=b,t[--f]=x,s&&(t[c++]=v,t[c++]=y,t[--f]=b,t[--f]=v),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1}},Ob={...Ys,extension:{...Ys.extension,name:"ellipse"}},Lb={...Ys,extension:{...Ys.extension,name:"roundedRectangle"}}});function Nb(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Hb=g(()=>{"use strict"});function Vb(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=h+d,m=l+f,x=c+d,v=u+f;return a.push(p,m),a.push(x,v),2}function Zi(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),x=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/x;if(d+=v,a){n.push(i,t),n.push(e,r);for(let y=1,b=d;y<x;y++,b+=v)n.push(i,t),n.push(i+Math.sin(b)*m,t+Math.cos(b)*m);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,b=d;y<x;y++,b+=v)n.push(i+Math.sin(b)*m,t+Math.cos(b)*m),n.push(i,t);n.push(s,o),n.push(i,t)}return x*2}function Wb(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let k=Nb(i);e&&(k*=-1),h=(h-.5)*k+.5}let l=new ht(i[0],i[1]),c=new ht(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let k=(l.x+c.x)*.5,tt=(c.y+l.y)*.5;i.unshift(k,tt),i.push(k,tt)}let f=s,p=i.length/2,m=i.length,x=f.length/2,v=a.width/2,y=v*v,b=a.miterLimit*a.miterLimit,T=i[0],w=i[1],S=i[2],A=i[3],R=0,I=0,P=-(w-A),B=T-S,W=0,N=0,nt=Math.sqrt(P*P+B*B);P/=nt,B/=nt,P*=v,B*=v;let j=h,F=(1-j)*2,H=j*2;u||(a.cap==="round"?m+=Zi(T-P*(F-H)*.5,w-B*(F-H)*.5,T-P*F,w-B*F,T+P*H,w+B*H,f,!0)+2:a.cap==="square"&&(m+=Vb(T,w,P,B,F,H,!0,f))),f.push(T-P*F,w-B*F),f.push(T+P*H,w+B*H);for(let k=1;k<p-1;++k){T=i[(k-1)*2],w=i[(k-1)*2+1],S=i[k*2],A=i[k*2+1],R=i[(k+1)*2],I=i[(k+1)*2+1],P=-(w-A),B=T-S,nt=Math.sqrt(P*P+B*B),P/=nt,B/=nt,P*=v,B*=v,W=-(A-I),N=S-R,nt=Math.sqrt(W*W+N*N),W/=nt,N/=nt,W*=v,N*=v;let tt=S-T,pt=w-A,dt=S-R,Ut=I-A,Ht=tt*dt+pt*Ut,qt=pt*dt-Ut*tt,Kt=qt<0;if(Math.abs(qt)<.001*Math.abs(Ht)){f.push(S-P*F,A-B*F),f.push(S+P*H,A+B*H),Ht>=0&&(a.join==="round"?m+=Zi(S,A,S-P*F,A-B*F,S-W*F,A-N*F,f,!1)+4:m+=2,f.push(S-W*H,A-N*H),f.push(S+W*F,A+N*F));continue}let Tt=(-P+T)*(-B+A)-(-P+S)*(-B+w),St=(-W+R)*(-N+A)-(-W+S)*(-N+I),at=(tt*St-dt*Tt)/qt,Rt=(Ut*Tt-pt*St)/qt,re=(at-S)*(at-S)+(Rt-A)*(Rt-A),$t=S+(at-S)*F,ae=A+(Rt-A)*F,ur=S-(at-S)*H,Gi=A-(Rt-A)*H,dR=Math.min(tt*tt+pt*pt,dt*dt+Ut*Ut),ox=Kt?F:H,fR=dR+ox*ox*y;re<=fR?a.join==="bevel"||re/y>b?(Kt?(f.push($t,ae),f.push(S+P*H,A+B*H),f.push($t,ae),f.push(S+W*H,A+N*H)):(f.push(S-P*F,A-B*F),f.push(ur,Gi),f.push(S-W*F,A-N*F),f.push(ur,Gi)),m+=2):a.join==="round"?Kt?(f.push($t,ae),f.push(S+P*H,A+B*H),m+=Zi(S,A,S+P*H,A+B*H,S+W*H,A+N*H,f,!0)+4,f.push($t,ae),f.push(S+W*H,A+N*H)):(f.push(S-P*F,A-B*F),f.push(ur,Gi),m+=Zi(S,A,S-P*F,A-B*F,S-W*F,A-N*F,f,!1)+4,f.push(S-W*F,A-N*F),f.push(ur,Gi)):(f.push($t,ae),f.push(ur,Gi)):(f.push(S-P*F,A-B*F),f.push(S+P*H,A+B*H),a.join==="round"?Kt?m+=Zi(S,A,S+P*H,A+B*H,S+W*H,A+N*H,f,!0)+2:m+=Zi(S,A,S-P*F,A-B*F,S-W*F,A-N*F,f,!1)+2:a.join==="miter"&&re/y<=b&&(Kt?(f.push(ur,Gi),f.push(ur,Gi)):(f.push($t,ae),f.push($t,ae)),m+=2),f.push(S-W*F,A-N*F),f.push(S+W*H,A+N*H),m+=2)}T=i[(p-2)*2],w=i[(p-2)*2+1],S=i[(p-1)*2],A=i[(p-1)*2+1],P=-(w-A),B=T-S,nt=Math.sqrt(P*P+B*B),P/=nt,B/=nt,P*=v,B*=v,f.push(S-P*F,A-B*F),f.push(S+P*H,A+B*H),u||(a.cap==="round"?m+=Zi(S-P*(F-H)*.5,A-B*(F-H)*.5,S-P*F,A-B*F,S+P*H,A+B*H,f,!1)+2:a.cap==="square"&&(m+=Vb(S,A,P,B,F,H,!1,f)));let D=1e-4*1e-4;for(let k=x;k<m+x-2;++k)T=f[k*2],w=f[k*2+1],S=f[(k+1)*2],A=f[(k+1)*2+1],R=f[(k+2)*2],I=f[(k+2)*2+1],!(Math.abs(T*(A-I)+S*(I-w)+R*(w-A))<D)&&o.push(k,k+1,k+2)}var zb=g(()=>{Qe();Hb()});function $b(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=i.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(i[f*2]),c.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var Xb=g(()=>{});var Vl=K((Q4,Cf)=>{"use strict";Cf.exports=Nl;Cf.exports.default=Nl;function Nl(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Yb(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(r&&(o=wM(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return kn(o,n,e,a,h,f,0),n}function Yb(i,t,e,r,s){var o,n;if(s===wf(i,t,e,r)>0)for(o=t;o<e;o+=r)n=jb(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=jb(o,i[o],i[o+1],n);return n&&Hl(n,n.next)&&(Ln(n),n=n.next),n}function Qi(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Hl(e,e.next)||Nt(e.prev,e,e.next)===0)){if(Ln(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function kn(i,t,e,r,s,o,n){if(i){!n&&o&&BM(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?SM(i,r,s,o):TM(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ln(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=EM(Qi(i),t,e),kn(i,t,e,r,s,o,2)):n===2&&AM(i,t,e,r,s,o):kn(Qi(i),t,e,r,s,o,1);break}}}}function TM(i){var t=i.prev,e=i,r=i.next;if(Nt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=s<o?s<n?s:n:o<n?o:n,u=a<h?a<l?a:l:h<l?h:l,d=s>o?s>n?s:n:o>n?o:n,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&qs(s,a,o,h,n,l,p.x,p.y)&&Nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function SM(i,t,e,r){var s=i.prev,o=i,n=i.next;if(Nt(s,o,n)>=0)return!1;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,d=n.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,x=c>u?c>d?c:d:u>d?u:d,v=Ef(f,p,t,e,r),y=Ef(m,x,t,e,r),b=i.prevZ,T=i.nextZ;b&&b.z>=v&&T&&T.z<=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&qs(a,c,h,u,l,d,b.x,b.y)&&Nt(b.prev,b,b.next)>=0||(b=b.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&qs(a,c,h,u,l,d,T.x,T.y)&&Nt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;b&&b.z>=v;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&qs(a,c,h,u,l,d,b.x,b.y)&&Nt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&qs(a,c,h,u,l,d,T.x,T.y)&&Nt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function EM(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Hl(s,o)&&qb(s,r,r.next,o)&&On(s,o)&&On(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ln(r),Ln(r.next),r=i=o),r=r.next}while(r!==i);return Qi(r)}function AM(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&GM(n,a)){var h=Kb(n,a);n=Qi(n,n.next),h=Qi(h,h.next),kn(n,t,e,r,s,o,0),kn(h,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function wM(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=Yb(i,a,h,r,!1),l===l.next&&(l.steiner=!0),s.push(FM(l));for(s.sort(CM),o=0;o<s.length;o++)e=PM(s[o],e);return e}function CM(i,t){return i.x-t.x}function PM(i,t){var e=RM(i,t);if(!e)return t;var r=Kb(e,i);return Qi(r,r.next),Qi(e,e.next)}function RM(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var h=n,l=n.x,c=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&qs(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),On(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&MM(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function MM(i,t){return Nt(i.prev,i,t.prev)<0&&Nt(t.next,i,i.next)<0}function BM(i,t,e,r){var s=i;do s.z===0&&(s.z=Ef(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,IM(s)}function IM(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function Ef(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function FM(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function qs(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function GM(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!UM(i,t)&&(On(i,t)&&On(t,i)&&kM(i,t)&&(Nt(i.prev,i,t.prev)||Nt(i,t.prev,t))||Hl(i,t)&&Nt(i.prev,i,i.next)>0&&Nt(t.prev,t,t.next)>0)}function Nt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Hl(i,t){return i.x===t.x&&i.y===t.y}function qb(i,t,e,r){var s=Dl(Nt(i,t,e)),o=Dl(Nt(i,t,r)),n=Dl(Nt(e,r,i)),a=Dl(Nt(e,r,t));return!!(s!==o&&n!==a||s===0&&Ll(i,e,t)||o===0&&Ll(i,r,t)||n===0&&Ll(e,i,r)||a===0&&Ll(e,t,r))}function Ll(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Dl(i){return i>0?1:i<0?-1:0}function UM(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&qb(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function On(i,t){return Nt(i.prev,i,i.next)<0?Nt(i,t,i.next)>=0&&Nt(i,i.prev,t)>=0:Nt(i,t,i.prev)<0||Nt(i,i.next,t)<0}function kM(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Kb(i,t){var e=new Af(i.i,i.x,i.y),r=new Af(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function jb(i,t,e,r){var s=new Af(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ln(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Af(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Nl.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(wf(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(wf(i,l,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function wf(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Nl.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Wl(i,t,e,r,s,o,n){let a=(0,Zb.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r}var Zb,Pf=g(()=>{Zb=Ui(Vl(),1)});var OM,Qb,Jb=g(()=>{C();Pf();OM=[],Qb={extension:{type:_.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Wl(i,OM,t,e,r,s,o)}}});var tv,ev=g(()=>{C();tv={extension:{type:_.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var rv,iv=g(()=>{C();rv={extension:{type:_.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function ov(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function nv(i,t){let e=$.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function LM(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(z("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Ue.defaultLinearOptions.textureSize}),t}var sv,Mf,Ue,Ks=g(()=>{pe();Mt();ft();ks();bt();ge();Lt();bd();sv=[{offset:0,color:"white"},{offset:1,color:"black"}],Mf=class Rf{constructor(...t){this.uid=ot("fillGradient"),this.type="linear",this.colorStops=[];let e=LM(t);e={...e.type==="radial"?Rf.defaultRadialOptions:Rf.defaultLinearOptions,...al(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:et.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=r,r=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let h=this.colorStops.length?this.colorStops:sv,l=this._textureSize,{canvas:c,context:u}=nv(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);ov(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new E({source:new Fe({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new M;m.scale(f/l,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(l,l),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:sv,e=this._textureSize,{canvas:r,context:s}=nv(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),p=(o-u)*f,m=(n-d)*f,x=s.createRadialGradient(p,m,l*f,(a-u)*f,(h-d)*f,c*f);ov(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new E({source:new Fe({resource:r,addressMode:this._wrapMode})});let v=new M;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}};Mf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Mf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Ue=Mf});function av(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(NM);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,d=-h*c,f=s.a,p=s.b,m=s.c,x=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Ue)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(DM.copyFrom(r).invert()),s}var DM,NM,hv=g(()=>{ft();le();Ks();DM=new M,NM=new it});function cv(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")WM(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&lv(l.shapePath,h,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),lv(a,h,n,r,e)}}}function WM(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=zl.rectangle,c=HM,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let d=i.transform;l.build(c,h),d&&Tf(h,d),l.triangulate(h,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=J.get(Ki);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function lv(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=zl[h.type],m="triangle-list";if(p.build(h,f),l&&Tf(f,l),e){let b=h.closePath??!0,T=t;T.pixelLine?($b(f,b,o,a),m="line-list"):Wb(f,T,!1,b,o,a)}else if(c){let b=[],T=f.slice();zM(c).forEach(S=>{b.push(T.length/2),T.push(...S)}),Wl(T,b,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let x=n.length/2,v=t.texture;if(v!==E.WHITE){let b=av(VM,t,h,l);Fb(o,2,d,n,x,2,o.length/2-d,b)}else Gb(n,x,2,o.length/2-d);let y=J.get(Ki);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=m,r.push(y)})}function zM(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];zl[r.type].build(r,s),t.push(s)}return t}var zl,HM,VM,uv=g(()=>{C();ft();le();Ub();kb();bt();Te();Sf();Db();zb();Xb();Jb();ev();iv();hv();Pf();zl={};G.handleByMap(_.ShapeBuilder,zl);G.add(tv,Qb,rv,Ys,Ob,Lb);HM=new it,VM=new M});var Bf,If,Gf,Zs,$l=g(()=>{C();Ml();vf();_d();Lt();Te();uv();Bf=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},If=class{constructor(){this.batcher=new Un,this.instructions=new Rs}init(){this.instructions.reset()}get geometry(){return z(Bx,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Gf=class Ff{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Ff.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ff.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),cv(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=J.get(If),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u)}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let c=0;c<l.length;c++){let u=l[c];u.bindGroup=Ds(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Bf;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]&&(J.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{J.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Gf.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"graphicsContext"};Gf.defaultOptions={bezierSmoothness:.5};Zs=Gf});var $M,Uf,kf,Of,Lf,Df,Nf,Hf,Xt,gr=g(()=>{"use strict";$M={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},Uf=0,kf=1,Of=2,Lf=3,Df=4,Nf=5,Hf=class dv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Uf)}set blend(t){!!(this.data&1<<Uf)!==t&&(this.data^=1<<Uf)}get offsets(){return!!(this.data&1<<kf)}set offsets(t){!!(this.data&1<<kf)!==t&&(this.data^=1<<kf)}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<<Of)}set culling(t){!!(this.data&1<<Of)!==t&&(this.data^=1<<Of)}get depthTest(){return!!(this.data&1<<Lf)}set depthTest(t){!!(this.data&1<<Lf)!==t&&(this.data^=1<<Lf)}get depthMask(){return!!(this.data&1<<Nf)}set depthMask(t){!!(this.data&1<<Nf)!==t&&(this.data^=1<<Nf)}get clockwiseFrontFace(){return!!(this.data&1<<Df)}set clockwiseFrontFace(t){!!(this.data&1<<Df)!==t&&(this.data^=1<<Df)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=$M[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 dv;return t.depthTest=!1,t.blend=!0,t}};Hf.default2d=Hf.for2d();Xt=Hf});function Ir(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Qs=g(()=>{"use strict"});var Dn,fv=g(()=>{C();gr();Te();Qs();Sf();Dn=class{constructor(t,e){this.state=Xt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ir(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=J.get(Ki);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=>{J.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}};Dn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"graphics"}});var Vf=g(()=>{C();$l();fv();G.add(Dn);G.add(Zs)});var Si,Xl=g(()=>{"use strict";Si=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Nn,pv=g(()=>{C();ft();_i();Ae();Mn();Te();Qs();Xl();Nn=class{constructor(t,e){this.localUniforms=new wt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new ue({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(J.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Kr(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ir(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=J.get(Si);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]&&J.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}};Nn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"mesh"}});var Wf=g(()=>{C();pv();G.add(Nn)});var jl,mv=g(()=>{"use strict";jl=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function zf(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var gv=g(()=>{"use strict"});function _v(i){return{dynamicUpdate:xv(i,!0),staticUpdate:xv(i,!1)}}function xv(i,t){let e=[];e.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -264,7 +264,7 @@ ${s.join(`
|
|
|
264
264
|
`),e.unshift(`
|
|
265
265
|
var stride = ${r};
|
|
266
266
|
`);let s=e.join(`
|
|
267
|
-
`);return new Function("ps","f32v","u32v",s)}var
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}var yv=g(()=>{qi()});function XM(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Yl,bv=g(()=>{yi();Zr();Ns();qi();rf();gv();yv();Yl=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let c in r){let u=r[c],d=Ge(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new wr(e*4*s),this.dynamicAttributeBuffer=new wr(e*4*o),this.indexBuffer=zf(e);let n=new tr,a=0,h=0;this._staticBuffer=new Vt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:st.VERTEX|st.COPY_DST}),this._dynamicBuffer=new Vt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:st.VERTEX|st.COPY_DST});for(let c in r){let u=r[c],d=Ge(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:h*4,format:u.format}),h+=d.size)}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=XM(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return _v(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new wr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new wr(this._size*this._dynamicStride*4*4),this.indexBuffer=zf(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var vv,Tv=g(()=>{vv=`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 Sv,Ev=g(()=>{Sv=`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 $f,Av=g(()=>{$f=`
|
|
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 Yl,Ov=m(()=>{ue();dt();ji();Hs();fr();_t();Cd();Fv();Uv();kv();Yl=class extends Ot{constructor(){let t=tr.from({vertex:Gv,fragment:Iv}),e=er.from({fragment:{source:Zf,entryPoint:"mainFragment"},vertex:{source:Zf,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new al({}),uniforms:{uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new it(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Qs,Qf=m(()=>{dt();Ee();Pn();pr();Zs();Bv();Ov();Qs=class{constructor(t,e){this.state=Lt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new St({uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Yl,this.state=Lt.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 jl({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=jr(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Rr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Dn,Nv=m(()=>{R();Av();Qf();Dn=class extends Qs{constructor(t){super(t,new Xl)}};Dn.extension={type:[b.WebGLPipes],name:"particle"}});var ql,Dv=m(()=>{"use strict";ql=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Ln,Lv=m(()=>{R();Dv();Qf();Ln=class extends Qs{constructor(t){super(t,new ql)}};Ln.extension={type:[b.WebGPUPipes],name:"particle"}});var Jf=m(()=>{R();Nv();Lv();D.add(Dn);D.add(Ln)});var Mr,Hn=m(()=>{"use strict";Mr=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 Vn(i,t){let{texture:e,bounds:r}=i;bl(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var tp=m(()=>{Zd()});var Wn,Hv=m(()=>{R();Te();Hn();tp();Wn=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Vn(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:et.get(Mr)};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}};Wn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"text"}});var ep,ke,Js=m(()=>{At();fn();ep=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=j.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Wr(t),e=Wr(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},ke=new ep});function Vv(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Wv(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function zv(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,c=r-1;for(;h<r&&Vv(n,e,h);)++h;if(h===r)return rt.EMPTY;for(;Vv(n,e,c);)--c;for(;Wv(n,e,a,h,c);)++a;for(;Wv(n,e,l,h,c);)--l;return++l,++c,new rt(a/t,h/t,(l-a)/t,(c-h)/t)}var $v=m(()=>{qt()});var Xv,Kr,Kl=m(()=>{dt();fe();Xv={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"}},Kr=class{constructor(t,e){this.uid=nt("fillPattern"),this.transform=new U,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Xv[e].addressModeU,t.source.style.addressModeV=Xv[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 Yv=Q((NW,jv)=>{jv.exports=HM;var rp={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},LM=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function HM(i){var t=[];return i.replace(LM,function(e,r,s){var o=r.toLowerCase();for(s=WM(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==rp[o])return s.unshift(r),t.push(s);if(s.length<rp[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,rp[o])))}}),t}var VM=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function WM(i){var t=i.match(VM);return t?t.map(Number):[]}});function Kv(i,t){let e=(0,qv.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){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(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:H(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var qv,Zv=m(()=>{qv=Gi(Yv(),1);Tt()});var Zl,Qv=m(()=>{qt();Zl=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new rt),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 Ql,Jv=m(()=>{qt();Ql=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),h=r-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,g=f*f/(l*l)+p*p/(c*c),x=f*f/(u*u)+p*p/(d*d);return g>1&&x<=1}getBounds(t){return t||(t=new rt),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 t0(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*h,p=r+d*l);let g=i-f,x=t-p;return g*g+x*x}var e0=m(()=>{"use strict"});var zM,$M,to,r0=m(()=>{e0();qt();to=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(zM),r=t.getBounds($M);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],d=h[c+1],f=h[(c+2)%h.length],p=h[(c+3)%h.length],g=t0(t,e,u,d,f,p),x=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(g<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new rt);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Jl,tc,i0=m(()=>{qt();Jl=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},tc=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new rt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=r*(1-s),u=r-c,d=o+l,f=n+l,p=a-l*2,g=h-l*2,x=o+a,v=n+h;return(t>=o-c&&t<=o+u||t>=x-u&&t<=x+c)&&e>=f&&e<=f+g||(e>=n-c&&e<=n+u||e>=v-u&&e<=v+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Jl(t,e,d,f,l,u,c)||t>x-l&&e<f&&Jl(t,e,x-l,f,l,u,c)||t>x-l&&e>v-l&&Jl(t,e,x-l,v-l,l,u,c)||t<d&&e>v-l&&Jl(t,e,d,v-l,l,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(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??Ks.defaultOptions.bezierSmoothness)),d=(jM-u)/1;return d*=d,YM(t,e,r,s,o,n,a,h,i,d),i}function YM(i,t,e,r,s,o,n,a,h,l){sp(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a)}function sp(i,t,e,r,s,o,n,a,h,l,c){if(c>XM)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,g=(r+o)/2,x=(s+n)/2,v=(o+a)/2,_=(d+p)/2,y=(f+g)/2,T=(p+x)/2,E=(g+v)/2,w=(_+T)/2,C=(y+E)/2;if(c>0){let M=n-i,P=a-t,S=Math.abs((e-n)*P-(r-a)*M),A=Math.abs((s-n)*P-(o-a)*M),B,F;if(S>ec&&A>ec){if((S+A)*(S+A)<=l*(M*M+P*P)){if(eo<ip){h.push(w,C);return}let W=Math.atan2(o-r,s-e);if(B=Math.abs(W-Math.atan2(r-t,e-i)),F=Math.abs(Math.atan2(a-o,n-s)-W),B>=u&&(B=2*u-B),F>=u&&(F=2*u-F),B+F<eo){h.push(w,C);return}if(Qi!==0){if(B>Qi){h.push(e,r);return}if(F>Qi){h.push(s,o);return}}}}else if(S>ec){if(S*S<=l*(M*M+P*P)){if(eo<ip){h.push(w,C);return}if(B=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),B>=u&&(B=2*u-B),B<eo){h.push(e,r),h.push(s,o);return}if(Qi!==0&&B>Qi){h.push(e,r);return}}}else if(A>ec){if(A*A<=l*(M*M+P*P)){if(eo<ip){h.push(w,C);return}if(B=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),B>=u&&(B=2*u-B),B<eo){h.push(e,r),h.push(s,o);return}if(Qi!==0&&B>Qi){h.push(s,o);return}}}else if(M=w-(i+n)/2,P=C-(t+a)/2,M*M+P*P<=l){h.push(w,C);return}}sp(i,t,d,f,_,y,w,C,h,l,c+1),sp(w,C,T,E,x,v,n,a,h,l,c+1)}var XM,ec,jM,ip,eo,Qi,op=m(()=>{zl();XM=8,ec=11920929e-14,jM=1,ip=.01,eo=0,Qi=0});function o0(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??Ks.defaultOptions.bezierSmoothness)),c=(ZM-l)/1;return c*=c,JM(t,e,r,s,o,n,i,c),i}function JM(i,t,e,r,s,o,n,a){np(n,i,t,e,r,s,o,a,0),n.push(s,o)}function np(i,t,e,r,s,o,n,a,h){if(h>qM)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(c+d)/2,g=(u+f)/2,x=o-t,v=n-e,_=Math.abs((r-o)*v-(s-n)*x);if(_>KM){if(_*_<=a*(x*x+v*v)){if(s0<QM){i.push(p,g);return}let y=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(y>=l&&(y=2*l-y),y<s0){i.push(p,g);return}}}else if(x=p-(t+o)/2,v=g-(e+n)/2,x*x+v*v<=a){i.push(p,g);return}np(i,t,e,c,u,p,g,a,h+1),np(i,p,g,d,f,o,n,a,h+1)}var qM,KM,ZM,QM,s0,n0=m(()=>{zl();qM=8,KM=11920929e-14,ZM=1,QM=.01,s0=0});function ic(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*r,g=e+f*r;i.push(p,g),c+=l}}var ap=m(()=>{"use strict"});function a0(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,g=h*c+l*u,x=o*Math.sqrt(f)/d,v=o*Math.sqrt(p)/d,_=x*g/f,y=v*g/p,T=x*u+v*l,E=x*c+v*h,w=l*(v+_),C=h*(v+_),M=u*(x+y),P=c*(x+y),S=Math.atan2(C-E,w-T),A=Math.atan2(P-E,M-T);ic(i,T+t,E+e,o,S,A,l*c>u*h)}var h0=m(()=>{ap()});function tB(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function c0(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*zn/360),u=Math.cos(a*zn/360),d=u*(t-r)/2+c*(e-s)/2,f=-c*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),eB(t,e,r,s,o,n,h,l,c,u,d,f,hp);let{ang1:g,ang2:x}=hp,{centerX:v,centerY:_}=hp,y=Math.abs(x)/(zn/4);Math.abs(1-y)<1e-7&&(y=1);let T=Math.max(Math.ceil(y),1);x/=T;let E=i[i.length-2],w=i[i.length-1],C={x:0,y:0};for(let M=0;M<T;M++){let P=tB(g,x),{x:S,y:A}=lp(P[0],o,n,u,c,v,_,C),{x:B,y:F}=lp(P[1],o,n,u,c,v,_,C),{x:W,y:z}=lp(P[2],o,n,u,c,v,_,C);rc(i,E,w,S,A,B,F,W,z),E=W,w=z,g+=x}}var zn,hp,lp,l0,eB,u0=m(()=>{op();zn=Math.PI*2,hp={centerX:0,centerY:0,ang1:0,ang2:0},lp=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};l0=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},eB=(i,t,e,r,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),g=Math.pow(c,2),x=Math.pow(u,2),v=f*p-f*x-p*g;v<0&&(v=0),v/=f*x+p*g,v=Math.sqrt(v)*(n===a?-1:1);let _=v*s/o*u,y=v*-o/s*c,T=l*_-h*y+(i+e)/2,E=h*_+l*y+(t+r)/2,w=(c-_)/s,C=(u-y)/o,M=(-c-_)/s,P=(-u-y)/o,S=l0(1,0,w,C),A=l0(w,C,M,P);a===0&&A>0&&(A-=zn),a===1&&A<0&&(A+=zn),d.centerX=T,d.centerY=E,d.ang1=S,d.ang2=A}});function d0(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=r(a,o),u=r(a,l);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,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let g=d/2,x,v=Math.abs(Math.cos(g)*h/Math.sin(g));v>Math.min(c.len/2,u.len/2)?(v=Math.min(c.len/2,u.len/2),x=Math.abs(v*Math.sin(g)/Math.cos(g))):x=h;let _=a.x+u.nx*v+-u.ny*x*f,y=a.y+u.ny*v+u.nx*x*f,T=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(_+Math.cos(T)*x,y+Math.sin(T)*x),i.arc(_,y,x,T,E,p),o=a}}function f0(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,h),f;if(d<1e-4)f=h;else{let x=Math.min(d/2,l);f=o(h,c,x/d)}let p=s(u,h),g;if(p<1e-4)g=h;else{let x=Math.min(p/2,l);g=o(h,u,x/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(h.x,h.y,g.x,g.y,r)}}var p0=m(()=>{"use strict"});var rB,sc,m0=m(()=>{Qv();Jv();r0();qt();i0();Me();op();n0();ap();h0();u0();p0();rB=new rt,sc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new vt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return ic(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return a0(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return c0(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return rc(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return o0(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new rt(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Zl(t,e,r),s),this}poly(t,e,r){let s=new to(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-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+l,p=t+r*Math.cos(f),g=e+r*Math.sin(f),x=f+Math.PI+u,v=f-Math.PI-u,_=p+o*Math.cos(x),y=g+o*Math.sin(x),T=p+o*Math.cos(v),E=g+o*Math.sin(v);d===0?this.moveTo(_,y):this.lineTo(_,y),this.quadraticCurveTo(p,g,T,E,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?f0(this,t,e,s):d0(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=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(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-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,r,s,o){return this.drawShape(new Ql(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new tc(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new to,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new to,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(rB);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function $n(i,t){return i?i.prepend(t):t.clone()}var vi,cp=m(()=>{Ze();fe();Tt();Zv();m0();vi=class i{constructor(t,e=!1){this.instructions=[],this.uid=nt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Kv(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new sc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(at.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(at.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 h=o.x,l=o.y;n=h+(h-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*c+h;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,d=0,f=0,p=0,g=0;for(let x=0;x<this.instructions.length;x++){let v=this.instructions[x],_=v.data;switch(v.action){case"moveTo":case"lineTo":h=_[0],l=_[1],_[0]=e*h+s*l+n,_[1]=r*h+o*l+a;break;case"bezierCurveTo":c=_[0],u=_[1],d=_[2],f=_[3],h=_[4],l=_[5],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*d+s*f+n,_[3]=r*d+o*f+a,_[4]=e*h+s*l+n,_[5]=r*h+o*l+a;break;case"quadraticCurveTo":c=_[0],u=_[1],h=_[2],l=_[3],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*h+s*l+n,_[3]=r*h+o*l+a;break;case"arcToSvg":h=_[5],l=_[6],p=_[0],g=_[1],_[0]=e*p+s*g,_[1]=r*p+o*g,_[5]=e*h+s*l+n,_[6]=r*h+o*l+a;break;case"circle":_[4]=$n(_[3],t);break;case"rect":_[4]=$n(_[4],t);break;case"ellipse":_[8]=$n(_[8],t);break;case"roundRect":_[5]=$n(_[5],t);break;case"addPath":_[0].transform(t);break;case"poly":_[2]=$n(_[2],t);break;default:H("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,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function Bt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var up=m(()=>{"use strict"});function g0(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=iB(n);break;case"radialgradient":t.defs[n.id]=sB(n);break;default:break}}}}function iB(i){let t=Bt(i,"x1",0),e=Bt(i,"y1",0),r=Bt(i,"x2",1),s=Bt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Ue(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=Bt(h,"offset",0),c=it.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function sB(i){return H("[SVG Parser] Radial gradients are not yet supported"),new Ue(0,0,1,0)}var x0=m(()=>{ue();Tt();qs();up()});function dp(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var _0=m(()=>{"use strict"});function fp(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in y0){let a=i.getAttribute(n);a&&b0(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");y0[l]&&b0(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function b0(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=dp(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=it.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=dp(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=it.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var y0,v0=m(()=>{ue();_0();y0={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 T0(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new vi};g0(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=fp(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&S0(a,e,s,o)}return t}function S0(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=fp(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,c,u,d,f,p,g,x,v,_,y,T,E,w,C,M;switch(i.nodeName.toLowerCase()){case"path":E=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&H("SVG Evenodd fill rule not supported, your svg may render incorrectly"),w=new vi(E,!0),t.context.path(w),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=Bt(i,"cx",0),g=Bt(i,"cy",0),x=Bt(i,"r",0),t.context.ellipse(p,g,x,x),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":h=Bt(i,"x",0),l=Bt(i,"y",0),C=Bt(i,"width",0),M=Bt(i,"height",0),v=Bt(i,"rx",0),_=Bt(i,"ry",0),v||_?t.context.roundRect(h,l,C,M,v||_):t.context.rect(h,l,C,M),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=Bt(i,"cx",0),g=Bt(i,"cy",0),v=Bt(i,"rx",0),_=Bt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,v,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=Bt(i,"x1",0),u=Bt(i,"y1",0),d=Bt(i,"x2",0),f=Bt(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),y=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(y,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),y=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(y,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{H(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)S0(s[P],t,e,r)}var w0=m(()=>{Tt();cp();x0();up();v0()});function oB(i){return it.isColorLike(i)}function E0(i){return i instanceof Kr}function A0(i){return i instanceof Ue}function nB(i){return i instanceof I}function aB(i,t,e){let r=it.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=I.WHITE,{...e,...i}}function hB(i,t,e){return i.texture=t,{...e,...i}}function C0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function P0(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function lB(i,t){let e={...t,...i},r=it.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Zr(i,t){if(i==null)return null;let e={},r=i;return oB(i)?aB(e,i,t):nB(i)?hB(e,i,t):E0(i)?C0(e,i,t):A0(i)?P0(e,i,t):r.fill&&E0(r.fill)?C0(r,r.fill,t):r.fill&&A0(r.fill)?P0(r,r.fill,t):lB(r,t)}function ro(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Zr(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var pp=m(()=>{ue();_t();qs();Kl()});var cB,R0,mp,Ae,oc=m(()=>{ge();ue();dt();Ze();_t();fe();Ft();Me();cp();w0();pp();cB=new at,R0=new U,mp=class Br extends Et{constructor(){super(...arguments),this.uid=nt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new vi,this._transform=new U,this._fillStyle={...Br.defaultFillStyle},this._strokeStyle={...Br.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new vt,this._boundsDirty=!0}clone(){let t=new Br;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=Zr(t,Br.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ro(t,Br.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Zr(t,Br.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Zr(t,Br.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?it.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new vi,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(tt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Zr(t,Br.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(at.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ro(t,Br.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,T0(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof U?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof U?(this._transform.append(t),this):(R0.set(t,e,r,s,o,n),this._transform.append(R0),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let d=l[c].transform,f=d?d.applyInverse(t,cB):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=h;r=u.strokeContains(f.x,f.y,g.width,g.alignment)}let p=n.hole;if(p){let g=p.shapePath?.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};mp.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};mp.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ae=mp});function nc(i){let t=[],e=0;for(let r=0;r<M0.length;r++){let s=`_${M0[r]}`;t[e++]=i[s]}return e=B0(i._fill,t,e),e=uB(i._stroke,t,e),e=dB(i.dropShadow,t,e),t.join("-")}function B0(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function uB(i,t,e){return i&&(e=B0(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function dB(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=it.shared.setValue(i.color).toNumber()),e}var M0,gp=m(()=>{ue();M0=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function fB(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Ht.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){X(tt,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(it.isColorLike(e))r.color=e;else if(e instanceof Ue||e instanceof Kr)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){X(tt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Ht.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Ue({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);r.addColorStop(a,o)}),i.fill={fill:r}}}var xp,Ht,Ji=m(()=>{ge();ue();Ft();qs();Kl();oc();pp();gp();xp=class io extends Et{constructor(t={}){super(),fB(t);let e={...io.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...io.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...io.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({...Ae.defaultFillStyle,...t},()=>{this._fill=Zr({...this._originalFill},Ae.defaultFillStyle)})),this._fill=Zr(t===0?"black":t,Ae.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ae.defaultStrokeStyle,...t},()=>{this._stroke=ro({...this._originalStroke},Ae.defaultStrokeStyle)})),this._stroke=ro(t,Ae.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=nc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=io.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new io({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(it.isColorLike(t)||t instanceof Ue||t instanceof Kr)}};xp.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};xp.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};Ht=xp});function ac(i,t,e,r){let s=pB;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Gt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var pB,_p=m(()=>{li();Me();pB=new vt});function ts(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!mB.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var mB,hc=m(()=>{"use strict";mB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var yp,mr,gt,Xn=m(()=>{At();hc();yp={willReadFrequently:!0},mr=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){let e=j.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,r=q._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=ts(e),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=q.__context;h.font=n;let c=(s?q._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let _=0;_<c.length;_++){let y=q._measureText(c[_],e.letterSpacing,h);u[_]=y,d=Math.max(d,y)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,x=Math.max(g,a.fontSize+f)+(c.length-1)*(g+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new q(t,e,p,x,c,u,g+e.leading,d,a)}static _measureText(t,e,r){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(q.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,r=q._canvas){let s=r.getContext("2d",yp),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=q._collapseSpaces(c),d=q._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,g=q._tokenize(t);for(let x=0;x<g.length;x++){let v=g[x];if(q._isNewline(v)){if(!d){a+=q._addLine(n),f=!u,n="",o=0;continue}v=" "}if(u){let y=q.isBreakingSpace(v),T=q.isBreakingSpace(n[n.length-1]);if(y&&T)continue}let _=q._getFromCache(v,l,h,s);if(_>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(v,e.breakWords)){let y=q.wordWrapSplit(v);for(let T=0;T<y.length;T++){let E=y[T],w=E,C=1;for(;y[T+C];){let P=y[T+C];if(!q.canBreakChars(w,P,v,T,e.breakWords))E+=P;else break;w=P,C++}T+=C-1;let M=q._getFromCache(E,l,h,s);M+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=E,o+=M}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let y=x===g.length-1;a+=q._addLine(v,!y),f=!1,n="",o=0}else _+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(v)||f)&&(n+=v,o+=_)}return a+=q._addLine(n,!1),a}static _addLine(t,e=!0){return t=q._trimRight(t),t=e?`${t}
|
|
368
|
-
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=q._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!q.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];let e=q._context;e.font=t;let r=e.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return q._fonts[t]=s,s}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){if(!q.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",yp)?.measureText)return q.__canvas=e,e;t=j.get().createCanvas()}catch{t=j.get().createCanvas()}t.width=t.height=10,q.__canvas=t}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",yp)),q.__context}};mr.METRICS_STRING="|\xC9q\xC5";mr.BASELINE_SYMBOL="M";mr.BASELINE_MULTIPLIER=1.4;mr.HEIGHT_MULTIPLIER=2;mr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();mr.experimentalLetterSpacing=!1;mr._fonts={};mr._newlines=[10,13];mr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];mr._measurementCache={};gt=mr});function so(i,t,e,r=0){if(i.texture===I.WHITE&&!i.fill)return it.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Kr){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(U.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Ue){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,c=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*h,d.x*a,d.y*h),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,d*a,f.x*a,f.y*h,p*a)}if(c&&n&&e){let u=e.lineHeight/h;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let g=f+p.offset*u;l.addColorStop(Math.floor(g*I0)/I0,it.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,it.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(U.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return H("FillStyle not recognised",i),"red"}var I0,bp=m(()=>{ue();dt();_t();Tt();qs();Kl();I0=1e5});var jn,F0=m(()=>{ue();R();fn();Js();li();$v();Ft();Ji();_p();Xn();hc();bp();jn=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=gt.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Wr(o),n=Wr(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Ht||(t.style=new Ht(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),ke.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=gt.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=ke.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=ac(l,n,a,s);if(r.trim){let u=zv(l,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Gt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(ke.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=ts(e),h=gt.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,d=h.maxLineWidth,f=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let _=e._stroke;n.lineWidth=_.width,n.miterLimit=_.miterLimit,n.lineJoin=_.join,n.lineCap=_.cap}n.font=a;let g,x,v=e.dropShadow?2:1;for(let _=0;_<v;++_){let y=e.dropShadow&&_===0,T=y?Math.ceil(Math.max(1,p)+e.padding*2):0,E=T*r;if(y){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,P=M.color,S=M.alpha;n.shadowColor=it.shared.setValue(P).setAlpha(S).toRgbaString();let A=M.blur*r,B=M.distance*r;n.shadowBlur=A,n.shadowOffsetX=Math.cos(M.angle)*B,n.shadowOffsetY=Math.sin(M.angle)*B+E}else{if(n.fillStyle=e._fill?so(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=so(e._stroke,n,h,M)}n.shadowColor="black"}let w=(c-f.fontSize)/2;c-f.fontSize<0&&(w=0);let C=e._stroke?.width??0;for(let M=0;M<l.length;M++)g=C/2,x=C/2+M*c+f.ascent+w,e.align==="right"?g+=d-u[M]:e.align==="center"&&(g+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,g+e.padding,x+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,g+e.padding,x+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,h=e.letterSpacing,l=!1;if(gt.experimentalLetterSpacingSupported&&(gt.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=gt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let g=u[p];n?a.strokeText(g,c,o):a.fillText(g,c,o);let x="";for(let v=p+1;v<u.length;++v)x+=u[v];f=a.measureText(x).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};jn.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"canvasText"}});var vp=m(()=>{R();Hv();F0();D.add(jn);D.add(Wn)});var Qt,Tp=m(()=>{Ft();xl();oc();Qt=class i extends fi{constructor(t){t instanceof Ae&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Ae,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){X(tt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){X(tt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){X(tt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ae.defaultStrokeStyle.width||t.color!==Ae.defaultStrokeStyle.color||t.alpha!==Ae.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return X(tt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return X(tt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return X(tt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return X(tt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return X(tt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return X(tt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var G0,U0,k0=m(()=>{"use strict";G0={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`});var ql,wv=g(()=>{pe();ft();Yi();Vs();mr();bt();vd();Tv();Ev();Av();ql=class extends Wt{constructor(){let t=er.from({vertex:Sv,fragment:vv}),e=rr.from({fragment:{source:$f,entryPoint:"mainFragment"},vertex:{source:$f,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:E.WHITE.source,uSampler:new hl({}),uniforms:{uTranslationMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new et(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Js,Xf=g(()=>{ft();Ae();Mn();gr();Qs();bv();wv();Js=class{constructor(t,e){this.state=Xt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new wt({uTranslationMatrix:{value:new M,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 ql,this.state=Xt.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 Yl({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Kr(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Ir(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Hn,Cv=g(()=>{C();mv();Xf();Hn=class extends Js{constructor(t){super(t,new jl)}};Hn.extension={type:[_.WebGLPipes],name:"particle"}});var Kl,Pv=g(()=>{"use strict";Kl=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Vn,Rv=g(()=>{C();Pv();Xf();Vn=class extends Js{constructor(t){super(t,new Kl)}};Vn.extension={type:[_.WebGPUPipes],name:"particle"}});var jf=g(()=>{C();Cv();Rv();G.add(Hn);G.add(Vn)});var Fr,Wn=g(()=>{"use strict";Fr=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 zn(i,t){let{texture:e,bounds:r}=i;vl(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Yf=g(()=>{$d()});var $n,Mv=g(()=>{C();Te();Wn();Yf();$n=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,zn(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:J.get(Fr)};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}};$n.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"text"}});var qf,ke,to=g(()=>{Mt();mn();qf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=$.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Xr(t),e=Xr(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},ke=new qf});function Bv(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Iv(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function Fv(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,c=r-1;for(;h<r&&Bv(n,e,h);)++h;if(h===r)return it.EMPTY;for(;Bv(n,e,c);)--c;for(;Iv(n,e,a,h,c);)++a;for(;Iv(n,e,l,h,c);)--l;return++l,++c,new it(a/t,h/t,(l-a)/t,(c-h)/t)}var Gv=g(()=>{le()});var Uv,Jr,Zl=g(()=>{ft();ge();Uv={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"}},Jr=class{constructor(t,e){this.uid=ot("fillPattern"),this.transform=new M,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Uv[e].addressModeU,t.source.style.addressModeV=Uv[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 Ov=K((Tz,kv)=>{kv.exports=YM;var Kf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},jM=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function YM(i){var t=[];return i.replace(jM,function(e,r,s){var o=r.toLowerCase();for(s=KM(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Kf[o])return s.unshift(r),t.push(s);if(s.length<Kf[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Kf[o])))}}),t}var qM=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function KM(i){var t=i.match(qM);return t?t.map(Number):[]}});function Dv(i,t){let e=(0,Lv.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){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(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Lv,Nv=g(()=>{Lv=Ui(Ov(),1);At()});var Ql,Hv=g(()=>{le();Ql=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}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 Jl,Vv=g(()=>{le();Jl=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),h=r-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(l*l)+p*p/(c*c),x=f*f/(u*u)+p*p/(d*d);return m>1&&x<=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 Wv(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*h,p=r+d*l);let m=i-f,x=t-p;return m*m+x*x}var zv=g(()=>{"use strict"});var ZM,QM,eo,$v=g(()=>{zv();le();eo=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(ZM),r=t.getBounds(QM);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],d=h[c+1],f=h[(c+2)%h.length],p=h[(c+3)%h.length],m=Wv(t,e,u,d,f,p),x=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new it);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var tc,ec,Xv=g(()=>{le();tc=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},ec=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new it),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=r*(1-s),u=r-c,d=o+l,f=n+l,p=a-l*2,m=h-l*2,x=o+a,v=n+h;return(t>=o-c&&t<=o+u||t>=x-u&&t<=x+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=v-u&&e<=v+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&tc(t,e,d,f,l,u,c)||t>x-l&&e<f&&tc(t,e,x-l,f,l,u,c)||t>x-l&&e>v-l&&tc(t,e,x-l,v-l,l,u,c)||t<d&&e>v-l&&tc(t,e,d,v-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function ic(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??Zs.defaultOptions.bezierSmoothness)),d=(tB-u)/1;return d*=d,eB(t,e,r,s,o,n,a,h,i,d),i}function eB(i,t,e,r,s,o,n,a,h,l){Qf(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a)}function Qf(i,t,e,r,s,o,n,a,h,l,c){if(c>JM)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,m=(r+o)/2,x=(s+n)/2,v=(o+a)/2,y=(d+p)/2,b=(f+m)/2,T=(p+x)/2,w=(m+v)/2,S=(y+T)/2,A=(b+w)/2;if(c>0){let R=n-i,I=a-t,P=Math.abs((e-n)*I-(r-a)*R),B=Math.abs((s-n)*I-(o-a)*R),W,N;if(P>rc&&B>rc){if((P+B)*(P+B)<=l*(R*R+I*I)){if(ro<Zf){h.push(S,A);return}let nt=Math.atan2(o-r,s-e);if(W=Math.abs(nt-Math.atan2(r-t,e-i)),N=Math.abs(Math.atan2(a-o,n-s)-nt),W>=u&&(W=2*u-W),N>=u&&(N=2*u-N),W+N<ro){h.push(S,A);return}if(Ji!==0){if(W>Ji){h.push(e,r);return}if(N>Ji){h.push(s,o);return}}}}else if(P>rc){if(P*P<=l*(R*R+I*I)){if(ro<Zf){h.push(S,A);return}if(W=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),W>=u&&(W=2*u-W),W<ro){h.push(e,r),h.push(s,o);return}if(Ji!==0&&W>Ji){h.push(e,r);return}}}else if(B>rc){if(B*B<=l*(R*R+I*I)){if(ro<Zf){h.push(S,A);return}if(W=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),W>=u&&(W=2*u-W),W<ro){h.push(e,r),h.push(s,o);return}if(Ji!==0&&W>Ji){h.push(s,o);return}}}else if(R=S-(i+n)/2,I=A-(t+a)/2,R*R+I*I<=l){h.push(S,A);return}}Qf(i,t,d,f,y,b,S,A,h,l,c+1),Qf(S,A,T,w,x,v,n,a,h,l,c+1)}var JM,rc,tB,Zf,ro,Ji,Jf=g(()=>{$l();JM=8,rc=11920929e-14,tB=1,Zf=.01,ro=0,Ji=0});function Yv(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??Zs.defaultOptions.bezierSmoothness)),c=(sB-l)/1;return c*=c,nB(t,e,r,s,o,n,i,c),i}function nB(i,t,e,r,s,o,n,a){tp(n,i,t,e,r,s,o,a,0),n.push(s,o)}function tp(i,t,e,r,s,o,n,a,h){if(h>rB)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,x=o-t,v=n-e,y=Math.abs((r-o)*v-(s-n)*x);if(y>iB){if(y*y<=a*(x*x+v*v)){if(jv<oB){i.push(p,m);return}let b=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(b>=l&&(b=2*l-b),b<jv){i.push(p,m);return}}}else if(x=p-(t+o)/2,v=m-(e+n)/2,x*x+v*v<=a){i.push(p,m);return}tp(i,t,e,c,u,p,m,a,h+1),tp(i,p,m,d,f,o,n,a,h+1)}var rB,iB,sB,oB,jv,qv=g(()=>{$l();rB=8,iB=11920929e-14,sB=1,oB=.01,jv=0});function sc(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*r,m=e+f*r;i.push(p,m),c+=l}}var ep=g(()=>{"use strict"});function Kv(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,x=o*Math.sqrt(f)/d,v=o*Math.sqrt(p)/d,y=x*m/f,b=v*m/p,T=x*u+v*l,w=x*c+v*h,S=l*(v+y),A=h*(v+y),R=u*(x+b),I=c*(x+b),P=Math.atan2(A-w,S-T),B=Math.atan2(I-w,R-T);sc(i,T+t,w+e,o,P,B,l*c>u*h)}var Zv=g(()=>{ep()});function aB(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Jv(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Xn/360),u=Math.cos(a*Xn/360),d=u*(t-r)/2+c*(e-s)/2,f=-c*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),hB(t,e,r,s,o,n,h,l,c,u,d,f,rp);let{ang1:m,ang2:x}=rp,{centerX:v,centerY:y}=rp,b=Math.abs(x)/(Xn/4);Math.abs(1-b)<1e-7&&(b=1);let T=Math.max(Math.ceil(b),1);x/=T;let w=i[i.length-2],S=i[i.length-1],A={x:0,y:0};for(let R=0;R<T;R++){let I=aB(m,x),{x:P,y:B}=ip(I[0],o,n,u,c,v,y,A),{x:W,y:N}=ip(I[1],o,n,u,c,v,y,A),{x:nt,y:j}=ip(I[2],o,n,u,c,v,y,A);ic(i,w,S,P,B,W,N,nt,j),w=nt,S=j,m+=x}}var Xn,rp,ip,Qv,hB,t0=g(()=>{Jf();Xn=Math.PI*2,rp={centerX:0,centerY:0,ang1:0,ang2:0},ip=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};Qv=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},hB=(i,t,e,r,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),x=Math.pow(u,2),v=f*p-f*x-p*m;v<0&&(v=0),v/=f*x+p*m,v=Math.sqrt(v)*(n===a?-1:1);let y=v*s/o*u,b=v*-o/s*c,T=l*y-h*b+(i+e)/2,w=h*y+l*b+(t+r)/2,S=(c-y)/s,A=(u-b)/o,R=(-c-y)/s,I=(-u-b)/o,P=Qv(1,0,S,A),B=Qv(S,A,R,I);a===0&&B>0&&(B-=Xn),a===1&&B<0&&(B+=Xn),d.centerX=T,d.centerY=w,d.ang1=P,d.ang2=B}});function e0(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=r(a,o),u=r(a,l);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,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,x,v=Math.abs(Math.cos(m)*h/Math.sin(m));v>Math.min(c.len/2,u.len/2)?(v=Math.min(c.len/2,u.len/2),x=Math.abs(v*Math.sin(m)/Math.cos(m))):x=h;let y=a.x+u.nx*v+-u.ny*x*f,b=a.y+u.ny*v+u.nx*x*f,T=Math.atan2(c.ny,c.nx)+Math.PI/2*f,w=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(T)*x,b+Math.sin(T)*x),i.arc(y,b,x,T,w,p),o=a}}function r0(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,h),f;if(d<1e-4)f=h;else{let x=Math.min(d/2,l);f=o(h,c,x/d)}let p=s(u,h),m;if(p<1e-4)m=h;else{let x=Math.min(p/2,l);m=o(h,u,x/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(h.x,h.y,m.x,m.y,r)}}var i0=g(()=>{"use strict"});var lB,oc,s0=g(()=>{Hv();Vv();$v();le();Xv();Me();Jf();qv();ep();Zv();t0();i0();lB=new it,oc=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 r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return sc(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Kv(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return Jv(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return ic(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Yv(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new it(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Ql(t,e,r),s),this}poly(t,e,r){let s=new eo(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-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+l,p=t+r*Math.cos(f),m=e+r*Math.sin(f),x=f+Math.PI+u,v=f-Math.PI-u,y=p+o*Math.cos(x),b=m+o*Math.sin(x),T=p+o*Math.cos(v),w=m+o*Math.sin(v);d===0?this.moveTo(y,b):this.lineTo(y,b),this.quadraticCurveTo(p,m,T,w,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?r0(this,t,e,s):e0(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=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(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-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,r,s,o){return this.drawShape(new Jl(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ec(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new eo,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new eo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(lB);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function jn(i,t){return i?i.prepend(t):t.clone()}var Ei,sp=g(()=>{Qe();ge();At();Nv();s0();Ei=class i{constructor(t,e=!1){this.instructions=[],this.uid=ot("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Dv(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new oc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ht.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(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 h=o.x,l=o.y;n=h+(h-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*c+h;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let x=0;x<this.instructions.length;x++){let v=this.instructions[x],y=v.data;switch(v.action){case"moveTo":case"lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=r*h+o*l+a;break;case"bezierCurveTo":c=y[0],u=y[1],d=y[2],f=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=r*c+o*u+a,y[2]=e*d+s*f+n,y[3]=r*d+o*f+a,y[4]=e*h+s*l+n,y[5]=r*h+o*l+a;break;case"quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=r*c+o*u+a,y[2]=e*h+s*l+n,y[3]=r*h+o*l+a;break;case"arcToSvg":h=y[5],l=y[6],p=y[0],m=y[1],y[0]=e*p+s*m,y[1]=r*p+o*m,y[5]=e*h+s*l+n,y[6]=r*h+o*l+a;break;case"circle":y[4]=jn(y[3],t);break;case"rect":y[4]=jn(y[4],t);break;case"ellipse":y[8]=jn(y[8],t);break;case"roundRect":y[5]=jn(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=jn(y[2],t);break;default:O("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,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function Ot(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var op=g(()=>{"use strict"});function o0(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=cB(n);break;case"radialgradient":t.defs[n.id]=uB(n);break;default:break}}}}function cB(i){let t=Ot(i,"x1",0),e=Ot(i,"y1",0),r=Ot(i,"x2",1),s=Ot(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Ue(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=Ot(h,"offset",0),c=et.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function uB(i){return O("[SVG Parser] Radial gradients are not yet supported"),new Ue(0,0,1,0)}var n0=g(()=>{pe();At();Ks();op()});function np(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var a0=g(()=>{"use strict"});function ap(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in h0){let a=i.getAttribute(n);a&&l0(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");h0[l]&&l0(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function l0(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=np(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=et.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=np(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=et.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var h0,c0=g(()=>{pe();a0();h0={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 u0(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new Ei};o0(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=ap(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&d0(a,e,s,o)}return t}function d0(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=ap(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,c,u,d,f,p,m,x,v,y,b,T,w,S,A,R;switch(i.nodeName.toLowerCase()){case"path":w=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Ei(w,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=Ot(i,"cx",0),m=Ot(i,"cy",0),x=Ot(i,"r",0),t.context.ellipse(p,m,x,x),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":h=Ot(i,"x",0),l=Ot(i,"y",0),A=Ot(i,"width",0),R=Ot(i,"height",0),v=Ot(i,"rx",0),y=Ot(i,"ry",0),v||y?t.context.roundRect(h,l,A,R,v||y):t.context.rect(h,l,A,R),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=Ot(i,"cx",0),m=Ot(i,"cy",0),v=Ot(i,"rx",0),y=Ot(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,v,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=Ot(i,"x1",0),u=Ot(i,"y1",0),d=Ot(i,"x2",0),f=Ot(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),b=T.match(/\d+/g).map(I=>parseInt(I,10)),t.context.poly(b,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),b=T.match(/\d+/g).map(I=>parseInt(I,10)),t.context.poly(b,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{O(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let I=0;I<s.length;I++)d0(s[I],t,e,r)}var f0=g(()=>{At();sp();n0();op();c0()});function dB(i){return et.isColorLike(i)}function p0(i){return i instanceof Jr}function m0(i){return i instanceof Ue}function fB(i){return i instanceof E}function pB(i,t,e){let r=et.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=E.WHITE,{...e,...i}}function mB(i,t,e){return i.texture=t,{...e,...i}}function g0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function x0(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function gB(i,t){let e={...t,...i},r=et.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function ti(i,t){if(i==null)return null;let e={},r=i;return dB(i)?pB(e,i,t):fB(i)?mB(e,i,t):p0(i)?g0(e,i,t):m0(i)?x0(e,i,t):r.fill&&p0(r.fill)?g0(r,r.fill,t):r.fill&&m0(r.fill)?x0(r,r.fill,t):gB(r,t)}function io(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=ti(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var hp=g(()=>{pe();bt();Ks();Zl()});var xB,_0,lp,we,nc=g(()=>{_e();pe();ft();Qe();bt();ge();Lt();Me();sp();f0();hp();xB=new ht,_0=new M,lp=class Gr extends Pt{constructor(){super(...arguments),this.uid=ot("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Ei,this._transform=new M,this._fillStyle={...Gr.defaultFillStyle},this._strokeStyle={...Gr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Gr;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=ti(t,Gr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=io(t,Gr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=ti(t,Gr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ti(t,Gr.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?et.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ei,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(z(Q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=ti(t,Gr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ht.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=io(t,Gr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,u0(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof M?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof M?(this._transform.append(t),this):(_0.set(t,e,r,s,o,n),this._transform.append(_0),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let d=l[c].transform,f=d?d.applyInverse(t,xB):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let m=h;r=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let x=0;x<m.length;x++)m[x].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};lp.defaultFillStyle={color:16777215,alpha:1,texture:E.WHITE,matrix:null,fill:null,textureSpace:"local"};lp.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:E.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};we=lp});function ac(i){let t=[],e=0;for(let r=0;r<y0.length;r++){let s=`_${y0[r]}`;t[e++]=i[s]}return e=b0(i._fill,t,e),e=_B(i._stroke,t,e),e=yB(i.dropShadow,t,e),t.join("-")}function b0(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function _B(i,t,e){return i&&(e=b0(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function yB(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=et.shared.setValue(i.color).toNumber()),e}var y0,cp=g(()=>{pe();y0=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function bB(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Bt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){z(Q,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(et.isColorLike(e))r.color=e;else if(e instanceof Ue||e instanceof Jr)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){z(Q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Bt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Ue({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>et.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var up,Bt,ts=g(()=>{_e();pe();Lt();Ks();Zl();nc();hp();cp();up=class so extends Pt{constructor(t={}){super(),bB(t);let e={...so.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...so.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...so.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({...we.defaultFillStyle,...t},()=>{this._fill=ti({...this._originalFill},we.defaultFillStyle)})),this._fill=ti(t===0?"black":t,we.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...we.defaultStrokeStyle,...t},()=>{this._stroke=io({...this._originalStroke},we.defaultStrokeStyle)})),this._stroke=io(t,we.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ac(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=so.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new so({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(et.isColorLike(t)||t instanceof Ue||t instanceof Jr)}};up.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};up.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=up});function hc(i,t,e,r){let s=vB;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Dt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var vB,dp=g(()=>{di();Me();vB=new Et});function es(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!TB.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var TB,lc=g(()=>{"use strict";TB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var fp,xr,jt,Yn=g(()=>{Mt();lc();fp={willReadFrequently:!0},xr=class X{static get experimentalLetterSpacingSupported(){let t=X._experimentalLetterSpacingSupported;if(t!==void 0){let e=$.get().getCanvasRenderingContext2D().prototype;t=X._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,r=X._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(X._measurementCache[o])return X._measurementCache[o];let n=es(e),a=X.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=X.__context;h.font=n;let c=(s?X._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y<c.length;y++){let b=X._measureText(c[y],e.letterSpacing,h);u[y]=b,d=Math.max(d,b)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,x=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new X(t,e,p,x,c,u,m+e.leading,d,a)}static _measureText(t,e,r){let s=!1;X.experimentalLetterSpacingSupported&&(X.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(X.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,r=X._canvas){let s=r.getContext("2d",fp),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=X._collapseSpaces(c),d=X._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,m=X._tokenize(t);for(let x=0;x<m.length;x++){let v=m[x];if(X._isNewline(v)){if(!d){a+=X._addLine(n),f=!u,n="",o=0;continue}v=" "}if(u){let b=X.isBreakingSpace(v),T=X.isBreakingSpace(n[n.length-1]);if(b&&T)continue}let y=X._getFromCache(v,l,h,s);if(y>p)if(n!==""&&(a+=X._addLine(n),n="",o=0),X.canBreakWords(v,e.breakWords)){let b=X.wordWrapSplit(v);for(let T=0;T<b.length;T++){let w=b[T],S=w,A=1;for(;b[T+A];){let I=b[T+A];if(!X.canBreakChars(S,I,v,T,e.breakWords))w+=I;else break;S=I,A++}T+=A-1;let R=X._getFromCache(w,l,h,s);R+o>p&&(a+=X._addLine(n),f=!1,n="",o=0),n+=w,o+=R}}else{n.length>0&&(a+=X._addLine(n),n="",o=0);let b=x===m.length-1;a+=X._addLine(v,!b),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=X._addLine(n),n="",o=0),(n.length>0||!X.isBreakingSpace(v)||f)&&(n+=v,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,r,s){let o=r[t];return typeof o!="number"&&(o=X._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!X.isBreakingSpace(r))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=[],r="";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)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return X.graphemeSegmenter(t)}static measureFont(t){if(X._fonts[t])return X._fonts[t];let e=X._context;e.font=t;let r=e.measureText(X.METRICS_STRING+X.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.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",fp)?.measureText)return X.__canvas=e,e;t=$.get().createCanvas()}catch{t=$.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",fp)),X.__context}};xr.METRICS_STRING="|\xC9q\xC5";xr.BASELINE_SYMBOL="M";xr.BASELINE_MULTIPLIER=1.4;xr.HEIGHT_MULTIPLIER=2;xr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();xr.experimentalLetterSpacing=!1;xr._fonts={};xr._newlines=[10,13];xr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];xr._measurementCache={};jt=xr});function oo(i,t,e,r=0){if(i.texture===E.WHITE&&!i.fill)return et.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Jr){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(M.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Ue){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,c=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*h,d.x*a,d.y*h),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,d*a,f.x*a,f.y*h,p*a)}if(c&&n&&e){let u=e.lineHeight/h;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let m=f+p.offset*u;l.addColorStop(Math.floor(m*v0)/v0,et.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,et.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(M.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",i),"red"}var v0,pp=g(()=>{pe();ft();bt();At();Ks();Zl();v0=1e5});var qn,T0=g(()=>{pe();C();mn();to();di();Gv();Lt();ts();dp();Yn();lc();pp();qn=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=jt.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Xr(o),n=Xr(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(z("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,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),ke.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=jt.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=ke.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=hc(l,n,a,s);if(r.trim){let u=Fv(l,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Dt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(ke.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=es(e),h=jt.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,d=h.maxLineWidth,f=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let m,x,v=e.dropShadow?2:1;for(let y=0;y<v;++y){let b=e.dropShadow&&y===0,T=b?Math.ceil(Math.max(1,p)+e.padding*2):0,w=T*r;if(b){n.fillStyle="black",n.strokeStyle="black";let R=e.dropShadow,I=R.color,P=R.alpha;n.shadowColor=et.shared.setValue(I).setAlpha(P).toRgbaString();let B=R.blur*r,W=R.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(R.angle)*W,n.shadowOffsetY=Math.sin(R.angle)*W+w}else{if(n.fillStyle=e._fill?oo(e._fill,n,h):null,e._stroke?.width){let R=e._stroke.width*e._stroke.alignment;n.strokeStyle=oo(e._stroke,n,h,R)}n.shadowColor="black"}let S=(c-f.fontSize)/2;c-f.fontSize<0&&(S=0);let A=e._stroke?.width??0;for(let R=0;R<l.length;R++)m=A/2,x=A/2+R*c+f.ascent+S,e.align==="right"?m+=d-u[R]:e.align==="center"&&(m+=(d-u[R])/2),e._stroke?.width&&this._drawLetterSpacing(l[R],e,s,m+e.padding,x+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[R],e,s,m+e.padding,x+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,h=e.letterSpacing,l=!1;if(jt.experimentalLetterSpacingSupported&&(jt.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=jt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let x="";for(let v=p+1;v<u.length;++v)x+=u[v];f=a.measureText(x).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};qn.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"canvasText"}});var mp=g(()=>{C();Mv();T0();G.add(qn);G.add($n)});var _r,gp=g(()=>{Lt();_l();nc();_r=class i extends gi{constructor(t){t instanceof we&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new we,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){z(Q,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){z(Q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){z(Q,"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!==we.defaultStrokeStyle.width||t.color!==we.defaultStrokeStyle.color||t.alpha!==we.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return z(Q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return z(Q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return z(Q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return z(Q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return z(Q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return z(Q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var S0,E0,A0=g(()=>{"use strict";S0={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
|
+
`}},E0={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 w0,C0,P0=g(()=>{"use strict";w0={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
|
+
`}},C0={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
|
-
`&&v!=="\r"&&v!==" "&&v!==" "&&(f=!0,d=Math.ceil(Math.max(
|
|
467
|
-
`||x){if(!a&&t.wordWrap&&o.width+h.width-d>f?(c(),l(h),x||o.charPositions.push(0)):(h.start=o.width,l(h),x||o.charPositions.push(0)),
|
|
468
|
-
`)o.width!==0&&c();else if(!x){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 T=v.kerning[n]||0,E=v.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(g),h.width+=E}n=g}return c(),t.align==="center"?gB(s):t.align==="right"?xB(s):t.align==="justify"&&_B(s),s}function gB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function xB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function _B(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n}}var Pp=m(()=>{"use strict"});var dc,Rp,Yn,Mp=m(()=>{pi();Ft();Tt();Ji();W0();Pp();Ap();dc=0,Rp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!mt.has(r)){let n=new Cp({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});dc++,dc>50&&H("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--,mt.remove(r)}),mt.set(r,n)}let o=mt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return uc([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},X(tt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Ht?s:new Ht(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Cp({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=cc(e.chars);return a.ensureCharacters(h.join("")),mt.set(`${r}-bitmap`,a),a.once("destroy",()=>mt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=mt.get(e);r&&r.destroy()}},Yn=new Rp});function z0(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var qn,$0=m(()=>{pi();R();Te();Tp();L0();Mp();Pp();qn=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);z0(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(et.return(e.customShader),e.customShader=null),et.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);z0(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Yn.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=et.get(lc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=uc(o,n,s,!0),l=0,c=n.padding,u=h.scale,d=h.width,f=h.height+h.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<h.lines.length;g++){let x=h.lines[g];for(let v=0;v<x.charPositions.length;v++){let _=o[l++],y=s.chars[_];y?.texture&&r.texture(y.texture,p||"black",Math.round(x.charPositions[v]+y.xOffset),Math.round(a+y.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=et.get(Qt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=mt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+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}};qn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"bitmapText"}});var Bp=m(()=>{R();$0();D.add(qn)});var Kn,X0=m(()=>{R();_t();Te();Hn();tp();Kn=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Vn(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),Vn(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:I.EMPTY,currentKey:"--",batchableSprite:et.get(Mr),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=I.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Kn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"htmlText"}});function j0(){let{userAgent:i}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var Y0=m(()=>{At()});var q0,K0,no,Ip=m(()=>{"use strict";q0="http://www.w3.org/2000/svg",K0="http://www.w3.org/1999/xhtml",no=class{constructor(){this.svgRoot=document.createElementNS(q0,"svg"),this.foreignObject=document.createElementNS(q0,"foreignObject"),this.domElement=document.createElementNS(K0,"div"),this.styleElement=document.createElementNS(K0,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function J0(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${it.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[eT(t)]:[],...i.dropShadow?[tT(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return yB(i.tagStyles,s),s.join(" ")}function tT(i){let t=it.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function eT(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${it.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${it.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function yB(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Q0[o]?s.push(Q0[o](r[o])):Z0[o]&&s.push(Z0[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var Z0,Q0,rT=m(()=>{ue();Z0={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"},Q0={fill:i=>`color: ${it.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:eT,dropShadow:tT}});var fc,iT=m(()=>{Tt();Ji();gp();rT();fc=class i extends Ht{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 i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=J0(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&H("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&H("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function sT(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=!0)}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l)});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l)}return r}var oT=m(()=>{"use strict"});async function nT(i){let e=await(await j.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var aT=m(()=>{At()});async function Fp(i,t){let e=await nT(t);return`@font-face {
|
|
465
|
+
`}}});var xp,_p,cc,R0=g(()=>{ft();Xi();vi();Fn();Gn();Ti();kl();mr();Ae();A0();P0();cc=class extends Wt{constructor(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Je();xp??(xp=Cr({name:"sdf-shader",bits:[Ws,$s(e),S0,w0,Rr]})),_p??(_p=Pr({name:"sdf-shader",bits:[zs,Xs(e),E0,C0,Mr]})),super({glProgram:_p,gpuProgram:xp,resources:{localUniforms:t,batchSamplers:js(e)}})}}});var no,yp=g(()=>{_e();Lt();no=class extends Pt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return z(Q,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return z(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return z(Q,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return z(Q,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return z(Q,"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 uc(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,h=n;a<=h;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 bp=g(()=>{"use strict"});var M0,vp,I0=g(()=>{pe();le();to();ks();bt();Lt();Yn();lc();pp();ts();yp();bp();M0=class B0 extends no{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={...B0.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=E.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=es(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=jt.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=uc(t).filter(x=>!this._currentChars.includes(x)).filter((x,v,y)=>y.indexOf(x)===v);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,h=this._currentX,l=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let x=0;x<e.length;x++){let v=e[x],y=jt.measureText(v,a,s,!1);y.lineHeight=y.height;let b=y.width*c,T=Math.ceil((a.fontStyle==="italic"?2:1)*b),w=y.height*c,S=T+u*2,A=w+u*2;if(f=!1,v!==`
|
|
466
|
+
`&&v!=="\r"&&v!==" "&&v!==" "&&(f=!0,d=Math.ceil(Math.max(A,d))),h+S>p&&(l+=d,d=A,h=0,l+d>m)){n.update();let I=this._nextPage();s=I.canvasAndContext.canvas,o=I.canvasAndContext.context,n=I.texture.source,l=0}let R=b/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[v]={id:v.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:R,kerning:{}},f){this._drawGlyph(o,y,h+u,l+u,c,a);let I=n.width*c,P=n.height*c,B=new it(h/I*n.width,l/P*n.height,S/I*n.width,A/P*n.height);this.chars[v].texture=new E({source:n,frame:B}),h+=Math.ceil(S)}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return z(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],h=r[o];h||(h=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(h+l);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(h+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=ke.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new E({source:new Fe({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=es(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=oo(s,t)),e._fill&&(t.fillStyle=oo(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=et.shared.setValue(n.color).toArray(),h=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,h=e.fontProperties,c=(n._stroke?.width??0)*o,u=r+c/2,d=s-c/2,f=h.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];ke.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};M0.defaultOptions={textureSize:512,style:new Bt,mipmap:!0};vp=M0});function dc(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,h={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=p=>{let m=o.width;for(let x=0;x<h.index;x++){let v=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(v+m)}o.width+=p.width,a=!1,h.width=0,h.index=0,h.chars.length=0},c=()=>{let p=o.chars.length-1;if(r){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p<i.length+1;p++){let m,x=p===i.length;x||(m=i[p]);let v=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
|
|
467
|
+
`||x){if(!a&&t.wordWrap&&o.width+h.width-d>f?(c(),l(h),x||o.charPositions.push(0)):(h.start=o.width,l(h),x||o.charPositions.push(0)),m==="\r"||m===`
|
|
468
|
+
`)o.width!==0&&c();else if(!x){let w=v.xAdvance+(v.kerning[n]||0)+d;o.width+=w,o.spaceWidth=w,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=v.kerning[n]||0,w=v.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(m),h.width+=w}n=m}return c(),t.align==="center"?SB(s):t.align==="right"?EB(s):t.align==="justify"&&AB(s),s}function SB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function EB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function AB(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n}}var Tp=g(()=>{"use strict"});var fc,Sp,Kn,Ep=g(()=>{xi();Lt();At();ts();I0();Tp();bp();fc=0,Sp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!xt.has(r)){let n=new vp({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});fc++,fc>50&&O("BitmapText",`You have dynamically created ${fc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{fc--,xt.remove(r)}),xt.set(r,n)}let o=xt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return dc([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},z(Q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Bt?s:new Bt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new vp({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=uc(e.chars);return a.ensureCharacters(h.join("")),xt.set(`${r}-bitmap`,a),a.once("destroy",()=>xt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=xt.get(e);r&&r.destroy()}},Kn=new Sp});function F0(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Zn,G0=g(()=>{xi();C();Te();gp();R0();Ep();Tp();Zn=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);F0(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(J.return(e.customShader),e.customShader=null),J.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);F0(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Kn.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=J.get(cc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=dc(o,n,s,!0),l=0,c=n.padding,u=h.scale,d=h.width,f=h.height+h.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<h.lines.length;m++){let x=h.lines[m];for(let v=0;v<x.charPositions.length;v++){let y=o[l++],b=s.chars[y];b?.texture&&r.texture(b.texture,p||"black",Math.round(x.charPositions[v]+b.xOffset),Math.round(a+b.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=J.get(_r);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=xt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+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}};Zn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"bitmapText"}});var Ap=g(()=>{C();G0();G.add(Zn)});var Qn,U0=g(()=>{C();bt();Te();Wn();Yf();Qn=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,zn(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),zn(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:E.EMPTY,currentKey:"--",batchableSprite:J.get(Fr),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=E.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Qn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"htmlText"}});function k0(){let{userAgent:i}=$.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var O0=g(()=>{Mt()});var L0,D0,ao,wp=g(()=>{"use strict";L0="http://www.w3.org/2000/svg",D0="http://www.w3.org/1999/xhtml",ao=class{constructor(){this.svgRoot=document.createElementNS(L0,"svg"),this.foreignObject=document.createElementNS(L0,"foreignObject"),this.domElement=document.createElementNS(D0,"div"),this.styleElement=document.createElementNS(D0,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function V0(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${et.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[z0(t)]:[],...i.dropShadow?[W0(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return wB(i.tagStyles,s),s.join(" ")}function W0(i){let t=et.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function z0(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function wB(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)H0[o]?s.push(H0[o](r[o])):N0[o]&&s.push(N0[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var N0,H0,$0=g(()=>{pe();N0={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"},H0={fill:i=>`color: ${et.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:z0,dropShadow:W0}});var pc,X0=g(()=>{At();ts();cp();$0();pc=class i 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=ac(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=V0(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function j0(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=!0)}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l)});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l)}return r}var Y0=g(()=>{"use strict"});async function q0(i){let e=await(await $.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var K0=g(()=>{Mt()});async function Cp(i,t){let e=await q0(t);return`@font-face {
|
|
469
469
|
font-family: "${i.fontFamily}";
|
|
470
470
|
src: url('${e}');
|
|
471
471
|
font-weight: ${i.fontWeight};
|
|
472
472
|
font-style: ${i.fontStyle};
|
|
473
|
-
}`}var
|
|
474
|
-
`)}var
|
|
473
|
+
}`}var Z0=g(()=>{K0()});async function Q0(i,t,e){let r=i.filter(s=>xt.has(`${s}-and-url`)).map((s,o)=>{if(!mc.has(s)){let{url:n}=xt.get(`${s}-and-url`);o===0?mc.set(s,Cp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):mc.set(s,Cp({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return mc.get(s)});return(await Promise.all(r)).join(`
|
|
474
|
+
`)}var mc,J0=g(()=>{xi();Z0();mc=new Map});function tT(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var eT=g(()=>{"use strict"});function rT(i,t){let e=ke.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var iT=g(()=>{to()});function sT(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var oT=g(()=>{"use strict"});function aT(i,t,e,r){r||(r=nT||(nT=new ao));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let h=t.padding*2;return{width:a.width-h,height:a.height-h}}var nT,hT=g(()=>{wp()});var ho,lT=g(()=>{C();to();di();Br();O0();At();Te();dp();wp();X0();Y0();J0();eT();iT();oT();hT();ho=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Qt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=J.get(ao),o=j0(t,r),n=await Q0(o,r,pc.defaultTextStyle),a=aT(t,r,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=tT(t,r,e,n,s);await sT(c,d,k0()&&o.length>0);let f=c,p;this._createCanvas&&(p=rT(c,e));let m=hc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),ke.returnCanvasAndContext(p)),J.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{O("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Dt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};ho.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"htmlText"};ho.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Pp=g(()=>{C();U0();lT();G.add(ho);G.add(Qn)});var cT,lo,gc=g(()=>{yi();Zr();Ns();Lt();cT=class uT extends tr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(z(Q,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...uT.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Vt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:st.VERTEX|st.COPY_DST}),h=new Vt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:st.VERTEX|st.COPY_DST}),l=new Vt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:st.INDEX|st.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};cT.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};lo=cT});var rs,dT,co,uo=g(()=>{"use strict";rs={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
|
+
`}},dT={...rs,vertex:{...rs.vertex,header:rs.vertex.header.replace("group(1)","group(2)")}},co={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 fT,pT,mT=g(()=>{"use strict";fT={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
|
+
`}},pT={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 Up,kp,gc,CT=m(()=>{dt();_i();co();yi();fr();Ee();_t();AT();gc=class extends Ot{constructor(){Up??(Up=wr({name:"tiling-sprite-shader",bits:[es,wT,Ar]})),kp??(kp=Er({name:"tiling-sprite-shader",bits:[lo,ET,Cr]}));let t=new St({uMapCoord:{value:new U,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new U,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:kp,gpuProgram:Up,resources:{localUniforms:new St({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:I.EMPTY.source,uSampler:I.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.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 xc,PT=m(()=>{mc();xc=class extends ho{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 RT(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var MT=m(()=>{"use strict"});function BT(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+h*f+c,i[e+1]=a*d+l*f+u,e+=t,s++}}var IT=m(()=>{"use strict"});function FT(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=U.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),BT(t,2,0,a)}var GT=m(()=>{dt();IT()});var _c,Zn,UT=m(()=>{R();Pn();pr();Pr();Zs();$l();mc();CT();PT();MT();GT();_c=new xc,Zn=class{constructor(t){this._state=Lt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new bi);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new gc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Rr(t.groupColorAlpha,r.uColor,0),this._state.blendMode=jr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:_c,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new ho({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:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),FT(t,r.uvs),RT(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===$t.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Zn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"tilingSprite"}});var Op=m(()=>{R();UT();D.add(Zn)});var kT,NT,DT=m(()=>{Ft();mc();kT=class OT extends ho{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(X(tt,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...OT.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*h,f*l),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,p=f*this.verticesX+d,g=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(p,g,x,g,v,x)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};kT.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};NT=kT});var LT,VT,WT=m(()=>{DT();LT=class HT extends NT{constructor(t={}){t={...HT.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),g=h*e,x=l*r;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*p-g,t[4]=t[12]=t[20]=t[28]=e-o*p-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=r-a*p-x,t[25]=t[27]=t[29]=t[31]=r-x,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};LT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};VT=LT});var Qn,zT=m(()=>{R();Te();$l();WT();Qn=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];et.return(e.geometry),et.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=et.get(bi);return e.geometry=et.get(VT),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}};Qn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"nineSliceSprite"}});var Np=m(()=>{R();zT();D.add(Qn)});var Jn,$T=m(()=>{R();Jn=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Jn.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"filter"}});function XT(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var jT=m(()=>{"use strict"});var bB,ta,YT=m(()=>{R();dt();Ze();mi();Ds();Ee();_t();li();Pr();Me();jT();Tt();bB=new Je({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])}),ta=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new oe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?XT(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=!0,c=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){H("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(h|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=Gt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=I.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),Gt.returnTexture(r);else{let a=e.inputTexture,h=Gt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,!0);let u=a;a=h,h=u}n[l].apply(this,a,e.previousRenderSurface,!1),Gt.returnTexture(a),Gt.returnTexture(h)}e.blendRequired&&Gt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Gt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=at.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,g=p.uOutputFrame,x=p.uInputSize,v=p.uInputPixel,_=p.uInputClamp,y=p.uGlobalFrame,T=p.uOutputTexture;if(c){let C=this._filterStackIndex;for(;C>0;){C--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],v[0]=e.source.pixelWidth,v[1]=e.source.pixelHeight,v[2]=1/v[0],v[3]=1/v[1],_[0]=.5*v[2],_[1]=.5*v[3],_[2]=e.frame.width*x[2]-.5*v[2],_[3]=e.frame.height*x[3]-.5*v[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;y[0]=h.x*u,y[1]=h.y*u,y[2]=E.source.width*u,y[3]=E.source.height*u;let w=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof I?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=w.width,T[1]=w.height),T[2]=w.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let C=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(C,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:bB,shader:t,state:t._state,topology:"triangle-list"}),o.type===$t.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new vt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(U.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};ta.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"filter"}});var Dp=m(()=>{R();$T();YT();D.add(ta);D.add(Jn)});var vB={};var qT=m(()=>{K_();Hd();sy();ny();yl();Al();Yf();qf();Jf();vp();Bp();Gp();Op();Np();Dp()});var TB={};var ZT=m(()=>{Hd();yl();Al();Yf();qf();Jf();vp();Bp();Gp();Op();Np();Dp()});var JT,tS,eS=m(()=>{ji();Hs();fr();pr();JT=class Lp extends Ot{constructor(t){t={...Lp.defaultOptions,...t},super(t),this.enabled=!0,this._state=Lt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=er.from(e)),r&&(n=tr.from(r)),new Lp({gpuProgram:o,glProgram:n,...s})}};JT.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};tS=JT});async function rS(i){if(!i)for(let t=0;t<Hp.length;t++){let e=Hp[t];if(e.value.test()){await e.value.load();return}}}var Hp,iS=m(()=>{R();Hp=[];D.handleByNamedList(b.Environment,Hp)});function yc(){if(typeof ea=="boolean")return ea;try{ea=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ea=!1}return ea}var ea,Vp=m(()=>{"use strict"});var ne,uo=m(()=>{"use strict";ne=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(ne||{})});var fo,Wp=m(()=>{"use strict";fo=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,h){let{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);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 SB,sS,Ti,ra=m(()=>{ue();iS();ur();Vp();Ft();uo();Wp();ge();SB=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],sS=class oS extends Et{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=[...SB,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await rS(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...oS.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof yt&&(r={container:r},e&&(X(tt,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:it.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ne.ALL);let{clear:r,clearColor:s,target:o}=t;it.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,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 fo(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!yc())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()}};sS.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ti=sS});var ia,hS=m(()=>{R();dt();$i();Rl();_i();Bn();In();co();yi();fr();Ee();ia=class{init(){let t=new St({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=wr({name:"graphics",bits:[Vs,zs(Qe()),ST,Ar]});this.shader=new Ot({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=h.instructions,f=null;for(let p=0;p<h.instructionSize;p++){let g=d[p];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let x=g.textures;g.bindGroup=Ns(x.textures,x.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};ia.extension={type:[b.WebGPUPipesAdaptor],name:"graphics"}});var lS,cS,zp=m(()=>{"use strict";lS={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var Rp,Mp,xc,gT=g(()=>{ft();vi();uo();Ti();mr();Ae();bt();mT();xc=class extends Wt{constructor(){Rp??(Rp=Cr({name:"tiling-sprite-shader",bits:[rs,fT,Rr]})),Mp??(Mp=Pr({name:"tiling-sprite-shader",bits:[co,pT,Mr]}));let t=new wt({uMapCoord:{value:new M,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 M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Mp,gpuProgram:Rp,resources:{localUniforms:new wt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:E.EMPTY.source,uSampler:E.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.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 _c,xT=g(()=>{gc();_c=class extends lo{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 _T(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var yT=g(()=>{"use strict"});function bT(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+h*f+c,i[e+1]=a*d+l*f+u,e+=t,s++}}var vT=g(()=>{"use strict"});function TT(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),bT(t,2,0,a)}var ST=g(()=>{ft();vT()});var yc,Jn,ET=g(()=>{C();Mn();gr();Br();Qs();Xl();gc();gT();xT();yT();ST();yc=new _c,Jn=class{constructor(t){this._state=Xt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Si);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new xc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ir(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Kr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new lo({indices:yc.indices,positions:yc.positions.slice(),uvs:yc.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),TT(t,r.uvs),_T(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Jn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"tilingSprite"}});var Bp=g(()=>{C();ET();G.add(Jn)});var AT,CT,PT=g(()=>{Lt();gc();AT=class wT extends lo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(z(Q,"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={...wT.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*h,f*l),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,p=f*this.verticesX+d,m=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(p,m,x,m,v,x)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};AT.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};CT=AT});var RT,BT,IT=g(()=>{PT();RT=class MT extends CT{constructor(t={}){t={...MT.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),m=h*e,x=l*r;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=r-a*p-x,t[25]=t[27]=t[29]=t[31]=r-x,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};RT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};BT=RT});var ta,FT=g(()=>{C();Te();Xl();IT();ta=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.return(e.geometry),J.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=J.get(Si);return e.geometry=J.get(BT),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}};ta.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"nineSliceSprite"}});var Ip=g(()=>{C();FT();G.add(ta)});var ea,GT=g(()=>{C();ea=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ea.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"filter"}});function UT(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var kT=g(()=>{"use strict"});var CB,ra,OT=g(()=>{C();ft();Qe();_i();Ns();Ae();bt();di();Br();Me();kT();At();CB=new tr({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])}),ra=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new wt({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 ue({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?UT(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=!0,c=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(h|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=Dt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=E.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),Dt.returnTexture(r);else{let a=e.inputTexture,h=Dt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,!0);let u=a;a=h,h=u}n[l].apply(this,a,e.previousRenderSurface,!1),Dt.returnTexture(a),Dt.returnTexture(h)}e.blendRequired&&Dt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Dt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=ht.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,x=p.uInputSize,v=p.uInputPixel,y=p.uInputClamp,b=p.uGlobalFrame,T=p.uOutputTexture;if(c){let A=this._filterStackIndex;for(;A>0;){A--;let R=this._filterStack[this._filterStackIndex-1];if(!R.skip){h.x=R.bounds.minX,h.y=R.bounds.minY;break}}m[0]=a.minX-h.x,m[1]=a.minY-h.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],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*x[2]-.5*v[2],y[3]=e.frame.height*x[3]-.5*v[3];let w=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*u,b[1]=h.y*u,b[2]=w.source.width*u,b[3]=w.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof E?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let A=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(A,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:CB,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.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 r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.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}};ra.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"filter"}});var Fp=g(()=>{C();GT();OT();G.add(ra);G.add(ea)});var PB={};var LT=g(()=>{D_();Ud();j_();q_();bl();Cl();Vf();Wf();jf();mp();Ap();Pp();Bp();Ip();Fp()});var RB={};var NT=g(()=>{Ud();bl();Cl();Vf();Wf();jf();mp();Ap();Pp();Bp();Ip();Fp()});var VT,WT,zT=g(()=>{Yi();Vs();mr();gr();VT=class Gp extends Wt{constructor(t){t={...Gp.defaultOptions,...t},super(t),this.enabled=!0,this._state=Xt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new Gp({gpuProgram:o,glProgram:n,...s})}};VT.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};WT=VT});async function $T(i){if(!i)for(let t=0;t<Up.length;t++){let e=Up[t];if(e.value.test()){await e.value.load();return}}}var Up,XT=g(()=>{C();Up=[];G.handleByNamedList(_.Environment,Up)});function bc(){if(typeof ia=="boolean")return ia;try{ia=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ia=!1}return ia}var ia,kp=g(()=>{"use strict"});var de,fo=g(()=>{"use strict";de=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(de||{})});var po,Op=g(()=>{"use strict";po=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,h){let{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);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 MB,jT,Ai,sa=g(()=>{pe();XT();fr();kp();Lt();fo();Op();_e();MB=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],jT=class YT extends Pt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...MB,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await $T(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...YT.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof vt&&(r={container:r},e&&(z(Q,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:et.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=de.ALL);let{clear:r,clearColor:s,target:o}=t;et.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,et.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 po(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!bc())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()}};jT.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ai=jT});var oa,ZT=g(()=>{C();ft();Xi();Ml();vi();Fn();Gn();uo();Ti();mr();Ae();oa=class{init(){let t=new wt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Cr({name:"graphics",bits:[Ws,$s(Je()),dT,Rr]});this.shader=new Wt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=h.instructions,f=null;for(let p=0;p<h.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let x=m.textures;m.bindGroup=Ds(x.textures,x.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};oa.extension={type:[_.WebGPUPipesAdaptor],name:"graphics"}});var QT,JT,Lp=g(()=>{"use strict";QT={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
|
+
`}},JT={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 sa,uS=m(()=>{R();dt();_i();co();yi();zp();fr();_t();Tt();sa=class{init(){let t=wr({name:"mesh",bits:[es,lS,Ar]});this._shader=new Ot({gpuProgram:t,resources:{uTexture:I.EMPTY._source,uSampler:I.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){H("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};sa.extension={type:[b.WebGPUPipesAdaptor],name:"mesh"}});var Tc,oa,dS=m(()=>{R();pr();Rl();Tc=Lt.for2d(),oa=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Tc.blendMode="normal",s.pipeline.getPipeline(e,n,Tc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Ns(h.textures,h.count)}Tc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Tc,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};oa.extension={type:[b.WebGPUPipesAdaptor],name:"batch"}});var na,fS=m(()=>{R();na=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}};na.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"customRender"}});function aa(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var $p=m(()=>{"use strict"});var wB,ha,pS=m(()=>{R();dt();Te();Hn();$p();wB=new U,ha=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&&(et.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=et.get(Mr));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=wB.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}),aa(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}),aa(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};ha.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"renderGroup"}});function la(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var Xp=m(()=>{"use strict"});function jp(i,t=!1){AB(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,h=n.index;for(let l=0;l<h;l++){let c=a[l];c.parentRenderGroup===i&&c.relativeRenderGroupDepth===o&&xS(c,r,0)}la(a,h),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)jp(i.renderGroupChildren[s],t)}function AB(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=As(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function xS(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&mS&&gS(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&mS&&gS(i,EB,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)xS(o[l],t,e);let a=i.parentRenderGroup,h=i;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function gS(i,t,e){if(e&Ms){i.groupColor=As(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&pn&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Vi&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var EB,mS,_S=m(()=>{ur();Xp();vd();EB=new yt,mS=Vi|Ms|pn});function yS(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var bS=m(()=>{"use strict"});var CB,ca,vS=m(()=>{R();dt();li();Me();Xp();$p();_S();bS();CB=new U,ca=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=CB;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}),aa(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&Gt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Gt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new vt),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Gt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?la(t.childrenRenderablesToUpdate.list,0):yS(t,r),jp(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}la(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};ca.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"renderGroup"}});var ua,TS=m(()=>{R();Te();Hn();ua=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];et.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=et.get(Mr);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)et.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};ua.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"sprite"}});var po,Yp=m(()=>{ge();po="8.9.2"});var da,fa,qp=m(()=>{R();Yp();da=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,po)}static destroy(){}};da.extension=b.Application;fa=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,po)}destroy(){this._renderer=null}};fa.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"initHook",priority:-10}});var Kp,Zp,wS=m(()=>{R();pr();Cf();Kp=class SS{constructor(t,e){this.state=Lt.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 Fn)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=SS.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Kp.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"batch"};Kp._availableBatchers=Object.create(null);Zp=Kp;D.handleByMap(b.Batcher,Zp._availableBatchers);D.add(Fn)});var ES,AS=m(()=>{ES=`in vec2 vMaskCoord;
|
|
595
|
+
`}}});var na,tS=g(()=>{C();ft();vi();uo();Ti();Lp();mr();bt();At();na=class{init(){let t=Cr({name:"mesh",bits:[rs,QT,Rr]});this._shader=new Wt({gpuProgram:t,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new M}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){O("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};na.extension={type:[_.WebGPUPipesAdaptor],name:"mesh"}});var Sc,aa,eS=g(()=>{C();gr();Ml();Sc=Xt.for2d(),aa=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Sc.blendMode="normal",s.pipeline.getPipeline(e,n,Sc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Ds(h.textures,h.count)}Sc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Sc,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:[_.WebGPUPipesAdaptor],name:"batch"}});var ha,rS=g(()=>{C();ha=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}};ha.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"customRender"}});function la(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Dp=g(()=>{"use strict"});var BB,ca,iS=g(()=>{C();ft();Te();Wn();Dp();BB=new M,ca=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&&(J.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=J.get(Fr));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=BB.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}),la(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}),la(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};ca.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"renderGroup"}});function ua(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var Np=g(()=>{"use strict"});function Hp(i,t=!1){FB(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,h=n.index;for(let l=0;l<h;l++){let c=a[l];c.parentRenderGroup===i&&c.relativeRenderGroupDepth===o&&nS(c,r,0)}ua(a,h),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Hp(i.renderGroupChildren[s],t)}function FB(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Cs(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function nS(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&sS&&oS(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&sS&&oS(i,IB,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)nS(o[l],t,e);let a=i.parentRenderGroup,h=i;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function oS(i,t,e){if(e&Bs){i.groupColor=Cs(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&gn&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Wi&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var IB,sS,aS=g(()=>{fr();Np();md();IB=new vt,sS=Wi|Bs|gn});function hS(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var lS=g(()=>{"use strict"});var GB,da,cS=g(()=>{C();ft();di();Me();Np();Dp();aS();lS();GB=new M,da=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=GB;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}),la(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&Dt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Dt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Dt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ua(t.childrenRenderablesToUpdate.list,0):hS(t,r),Hp(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ua(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};da.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"renderGroup"}});var fa,uS=g(()=>{C();Te();Wn();fa=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.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=J.get(Fr);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)J.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};fa.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"sprite"}});var mo,Vp=g(()=>{_e();mo="8.9.2"});var pa,ma,Wp=g(()=>{C();Vp();pa=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,mo)}static destroy(){}};pa.extension=_.Application;ma=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,mo)}destroy(){this._renderer=null}};ma.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"initHook",priority:-10}});var zp,$p,fS=g(()=>{C();gr();vf();zp=class dS{constructor(t,e){this.state=Xt.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 Un)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=dS.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};zp.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"batch"};zp._availableBatchers=Object.create(null);$p=zp;G.handleByMap(_.Batcher,$p._availableBatchers);G.add(Un)});var pS,mS=g(()=>{pS=`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 gS,xS=g(()=>{gS=`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 Xp,_S=g(()=>{Xp=`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 Sc,MS=m(()=>{dt();ji();Hs();Ee();Bd();eS();AS();PS();RS();Sc=class extends tS{constructor(t){let{sprite:e,...r}=t,s=new Rs(e.texture),o=new St({uFilterMatrix:{value:new U,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=er.from({vertex:{source:Qp,entryPoint:"mainVertex"},fragment:{source:Qp,entryPoint:"mainFragment"}}),a=tr.from({vertex:CS,fragment:ES,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var PB,Jp,pa,BS=m(()=>{R();tl();MS();Me();un();vl();Te();_t();li();Pr();PB=new vt,Jp=class extends Vr{constructor(){super(),this.filters=[new Sc({sprite:new Zt(I.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}},pa=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=et.get(Jp);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Es(t.mask.mask,!0,PB);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Gt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let h=s.sprite;h.texture=a,h.worldTransform.tx=o.minX,h.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===$t.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&Gt.returnTexture(s.filterTexture),et.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};pa.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"alphaMask"}});var ma,IS=m(()=>{R();ma=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};ma.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"colorMask"}});var ga,FS=m(()=>{R();uo();Xi();ga=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let h=this._maskHash.get(o);h.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(Pt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(Pt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Pt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(Pt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,ne.STENCIL),r.stencil.setStencilMode(Pt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(Pt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Pt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};ga.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"stencilMask"}});var tm,US,kS=m(()=>{ue();R();tm=class GS{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new it(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...GS.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(){}};tm.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"background",priority:0};tm.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};US=tm});var xa,_a,OS=m(()=>{R();tl();Tt();xa={};D.handle(b.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");xa[i.name]=i.ref},i=>{delete xa[i.name]});_a=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!xa[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!xa[e]){H(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Vr,r.filters=[new xa[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};_a.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"blendMode"}});var em,rm,DS,LS=m(()=>{R();ur();_t();em={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},rm=class NS{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof yt||t instanceof I?{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,NS.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let h=new FileReader;h.onload=()=>o(h.result),h.onerror=n,h.readAsDataURL(a)},em[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(em[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:em[e],quality:r});return new Promise((n,a)=>{let h=new FileReader;h.onload=()=>n(h.result),h.onerror=a,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof I)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof I?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof yt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof I?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};rm.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"extract"};rm.defaultImageOptions={format:"png",quality:1};DS=rm});var wc,HS=m(()=>{Be();_t();wc=class i extends I{static create(t){return new i({source:new xt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var RB,MB,BB,ya,VS=m(()=>{ue();R();dt();qt();Me();ol();ur();HS();RB=new rt,MB=new vt,BB=[0,0,0,0],ya=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,r=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=BB;let n=t.frame?.copyTo(RB)||Cs(s,MB).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=wc.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),h=U.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:h,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};ya.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"textureGenerator"}});var ba,WS=m(()=>{R();dt();Ze();Zs();mi();Pr();Ee();ba=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new U,worldColor:4294967295,offset:new at},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let c=l.uniforms;c.uProjectionMatrix=h.projectionMatrix,c.uResolution=h.resolution,c.uWorldTransformMatrix.copyFrom(h.worldTransformMatrix),c.uWorldTransformMatrix.tx-=h.offset.x,c.uWorldTransformMatrix.ty-=h.offset.y,Rr(h.worldColor,c.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new oe,this._activeBindGroups.push(u),u.setResource(l,0)),h.bindGroup=u,this._currentGlobalUniformData=h}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===$t.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new St({uProjectionMatrix:{value:new U,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new U,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};ba.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"globalUniforms"}});var IB,va,zS=m(()=>{R();gn();IB=1,va=class{constructor(){this._tasks=[],this._offset=0}init(){Ie.system.add(this._update,this)}repeat(t,e,r=!0){let s=IB++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Ie.system.remove(this._update,this),this._tasks.length=0}};va.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"scheduler",priority:0}});function XS(i){if(!$S){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${po} (${i}) http://www.pixijs.com/
|
|
764
|
+
`});var Ec,yS=g(()=>{ft();Yi();Vs();Ae();Ad();zT();mS();xS();_S();Ec=class extends WT{constructor(t){let{sprite:e,...r}=t,s=new Ms(e.texture),o=new wt({uFilterMatrix:{value:new M,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=rr.from({vertex:{source:Xp,entryPoint:"mainVertex"},fragment:{source:Xp,entryPoint:"mainFragment"}}),a=er.from({vertex:gS,fragment:pS,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var UB,jp,ga,bS=g(()=>{C();el();yS();Me();fn();Tl();Te();bt();di();Br();UB=new Et,jp=class extends $r{constructor(){super(),this.filters=[new Ec({sprite:new se(E.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,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=J.get(jp);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=ws(t.mask.mask,!0,UB);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Dt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let h=s.sprite;h.texture=a,h.worldTransform.tx=o.minX,h.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Qt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&Dt.returnTexture(s.filterTexture),J.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ga.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"alphaMask"}});var xa,vS=g(()=>{C();xa=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};xa.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"colorMask"}});var _a,TS=g(()=>{C();fo();ji();_a=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let h=this._maskHash.get(o);h.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(Ft.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(Ft.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Ft.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(Ft.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,de.STENCIL),r.stencil.setStencilMode(Ft.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(Ft.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Ft.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};_a.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"stencilMask"}});var Yp,ES,AS=g(()=>{pe();C();Yp=class SS{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new et(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...SS.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(){}};Yp.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"background",priority:0};Yp.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};ES=Yp});var ya,ba,wS=g(()=>{C();el();At();ya={};G.handle(_.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ya[i.name]=i.ref},i=>{delete ya[i.name]});ba=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ya[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ya[e]){O(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new $r,r.filters=[new ya[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};ba.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"blendMode"}});var qp,Kp,PS,RS=g(()=>{C();fr();bt();qp={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Kp=class CS{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof vt||t instanceof E?{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,CS.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let h=new FileReader;h.onload=()=>o(h.result),h.onerror=n,h.readAsDataURL(a)},qp[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(qp[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:qp[e],quality:r});return new Promise((n,a)=>{let h=new FileReader;h.onload=()=>n(h.result),h.onerror=a,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof E)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof E?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof vt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof E?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Kp.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"extract"};Kp.defaultImageOptions={format:"png",quality:1};PS=Kp});var Ac,MS=g(()=>{Be();bt();Ac=class i extends E{static create(t){return new i({source:new yt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var kB,OB,LB,va,BS=g(()=>{pe();C();ft();le();Me();nl();fr();MS();kB=new it,OB=new Et,LB=[0,0,0,0],va=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof vt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:et.shared.setValue(o).toArray():o=LB;let n=t.frame?.copyTo(kB)||Ps(s,OB).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ac.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),h=M.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:h,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};va.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"textureGenerator"}});var Ta,IS=g(()=>{C();ft();Qe();Qs();_i();Br();Ae();Ta=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new M,worldColor:4294967295,offset:new ht},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let c=l.uniforms;c.uProjectionMatrix=h.projectionMatrix,c.uResolution=h.resolution,c.uWorldTransformMatrix.copyFrom(h.worldTransformMatrix),c.uWorldTransformMatrix.tx-=h.offset.x,c.uWorldTransformMatrix.ty-=h.offset.y,Ir(h.worldColor,c.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new ue,this._activeBindGroups.push(u),u.setResource(l,0)),h.bindGroup=u,this._currentGlobalUniformData=h}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Qt.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 wt({uProjectionMatrix:{value:new M,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new M,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ta.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"globalUniforms"}});var DB,Sa,FS=g(()=>{C();_n();DB=1,Sa=class{constructor(){this._tasks=[],this._offset=0}init(){Ie.system.add(this._update,this)}repeat(t,e,r=!0){let s=DB++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Ie.system.remove(this._update,this),this._tasks.length=0}};Sa.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"scheduler",priority:0}});function US(i){if(!GS){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${mo} (${i}) http://www.pixijs.com/
|
|
765
765
|
|
|
766
|
-
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${po} - ${i} - http://www.pixijs.com/`);$S=!0}}var $S,jS=m(()=>{At();Yp();$S=!1});var mo,YS=m(()=>{R();jS();Pr();mo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===$t.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),XS(e)}}};mo.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"hello",priority:-2};mo.defaultOptions={hello:!1}});function qS(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function KS(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var ZS=m(()=>{"use strict"});var FB,im,JS,tw=m(()=>{R();ZS();FB=0,im=class QS{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...QS.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]=qS(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)KS(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=FB++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,h=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===h&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};im.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"renderableGC",priority:0};im.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};JS=im});var sm,rw,iw=m(()=>{R();sm=class ew{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...ew.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};sm.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"textureGC"};sm.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};rw=sm});var sw,Ta,om=m(()=>{fe();Be();_t();sw=class ow{constructor(t={}){if(this.uid=nt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...ow.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 xt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof I||t.depthStencilTexture instanceof xt?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 xt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};sw.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Ta=sw});function Ec(i,t){if(!Sa.has(i)){let e=new I({source:new xe({resource:i,...t})}),r=()=>{Sa.get(i)===e&&Sa.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Sa.set(i,e)}return Sa.get(i)}var Sa,nm=m(()=>{Gs();_t();Sa=new Map});var am,aw,hw=m(()=>{At();R();qt();Ft();om();nm();am=class nw{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={...nw.defaultOptions,...t},t.view&&(X(tt,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new rt(0,0,t.width,t.height),this.canvas=t.canvas||j.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ec(this.canvas,t),this.renderTarget=new Ta({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};am.extension={type:[b.WebGLSystem,b.WebGPUSystem,b.CanvasSystem],name:"view",priority:0};am.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};aw=am});var Ac,Cc,hm=m(()=>{fS();pS();vS();TS();qp();wS();BS();IS();FS();kS();OS();LS();VS();WS();zS();YS();tw();iw();hw();Ac=[US,ba,mo,aw,ca,rw,ya,DS,fa,JS,va],Cc=[_a,Zp,ua,ha,pa,ga,ma,na]});var wa,lw=m(()=>{R();wa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let 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 p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.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 h=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:h,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};wa.extension={type:[b.WebGPUSystem],name:"bindGroup"}});var Ea,cw=m(()=>{R();cf();Ea=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Cn(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}};Ea.extension={type:[b.WebGPUSystem],name:"buffer"}});var Aa,uw=m(()=>{R();Aa=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}};Aa.extension={type:[b.WebGPUSystem],name:"colorMask"}});var go,dw=m(()=>{At();R();go=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}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};go.extension={type:[b.WebGPUSystem],name:"device"};go.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ca,fw=m(()=>{R();Ca=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,h??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),h??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Ca.extension={type:[b.WebGPUSystem],name:"encoder",priority:1}});var Pa,pw=m(()=>{R();Xi();Pa=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:Pt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Pa.extension={type:[b.WebGPUSystem],name:"stencil"}});var xo,lm=m(()=>{Vp();gi();Yr();xo=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!yc())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 kt({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,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new kt({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),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function mw(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=Ra[s.data.type].size,n=Ra[s.data.type].align;if(!Ra[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 Ra,cm=m(()=>{"use strict";Ra={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 Qr,um=m(()=>{"use strict";Qr=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
766
|
+
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${mo} - ${i} - http://www.pixijs.com/`);GS=!0}}var GS,kS=g(()=>{Mt();Vp();GS=!1});var go,OS=g(()=>{C();kS();Br();go=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Qt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),US(e)}}};go.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"hello",priority:-2};go.defaultOptions={hello:!1}});function LS(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function DS(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var NS=g(()=>{"use strict"});var NB,Zp,VS,WS=g(()=>{C();NS();NB=0,Zp=class HS{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...HS.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]=LS(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)DS(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=NB++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,h=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===h&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Zp.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"renderableGC",priority:0};Zp.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};VS=Zp});var Qp,$S,XS=g(()=>{C();Qp=class zS{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...zS.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Qp.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"textureGC"};Qp.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};$S=Qp});var jS,Ea,Jp=g(()=>{ge();Be();bt();jS=class YS{constructor(t={}){if(this.uid=ot("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...YS.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 yt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof E||t.depthStencilTexture instanceof yt?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 yt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};jS.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Ea=jS});function wc(i,t){if(!Aa.has(i)){let e=new E({source:new ye({resource:i,...t})}),r=()=>{Aa.get(i)===e&&Aa.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Aa.set(i,e)}return Aa.get(i)}var Aa,tm=g(()=>{Us();bt();Aa=new Map});var em,KS,ZS=g(()=>{Mt();C();le();Lt();Jp();tm();em=class qS{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={...qS.defaultOptions,...t},t.view&&(z(Q,"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||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=wc(this.canvas,t),this.renderTarget=new Ea({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};em.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"view",priority:0};em.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};KS=em});var Cc,Pc,rm=g(()=>{rS();iS();cS();uS();Wp();fS();bS();vS();TS();AS();wS();RS();BS();IS();FS();OS();WS();XS();ZS();Cc=[ES,Ta,go,KS,da,$S,va,PS,ma,VS,Sa],Pc=[ba,$p,fa,ca,ga,_a,xa,ha]});var wa,QS=g(()=>{C();wa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let 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 p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.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 h=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:h,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};wa.extension={type:[_.WebGPUSystem],name:"bindGroup"}});var Ca,JS=g(()=>{C();sf();Ca=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Rn(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}};Ca.extension={type:[_.WebGPUSystem],name:"buffer"}});var Pa,tE=g(()=>{C();Pa=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}};Pa.extension={type:[_.WebGPUSystem],name:"colorMask"}});var xo,eE=g(()=>{Mt();C();xo=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 $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};xo.extension={type:[_.WebGPUSystem],name:"device"};xo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ra,rE=g(()=>{C();Ra=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,h??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),h??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Ra.extension={type:[_.WebGPUSystem],name:"encoder",priority:1}});var Ma,iE=g(()=>{C();ji();Ma=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 r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Ma.extension={type:[_.WebGPUSystem],name:"stencil"}});var _o,im=g(()=>{kp();yi();Zr();_o=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!bc())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 Vt({data:new Float32Array(e.layout.size/4),usage:st.UNIFORM|st.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Vt({data:new Float32Array(s.layout.size/4),usage:st.UNIFORM|st.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function sE(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=Ba[s.data.type].size,n=Ba[s.data.type].align;if(!Ba[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 Ba,sm=g(()=>{"use strict";Ba={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 ei,om=g(()=>{"use strict";ei=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
767
767
|
var matrix = uv[name].toArray(true);
|
|
768
768
|
data[offset] = matrix[0];
|
|
769
769
|
data[offset + 1] = matrix[1];
|
|
@@ -834,23 +834,23 @@ fn mainFragment(
|
|
|
834
834
|
cv[2] = v.blue;
|
|
835
835
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
836
836
|
}
|
|
837
|
-
`}]});function
|
|
837
|
+
`}]});function Rc(i,t,e,r){let s=[`
|
|
838
838
|
var v = null;
|
|
839
839
|
var v2 = null;
|
|
840
840
|
var t = 0;
|
|
841
841
|
var index = 0;
|
|
842
842
|
var name = null;
|
|
843
843
|
var arrayOffset = null;
|
|
844
|
-
`],o=0;for(let a=0;a<i.length;a++){let h=i[a],l=h.data.name,c=!1,u=0;for(let d=0;d<
|
|
844
|
+
`],o=0;for(let a=0;a<i.length;a++){let h=i[a],l=h.data.name,c=!1,u=0;for(let d=0;d<ei.length;d++)if(ei[d].test(h.data)){u=h.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,ei[d][t]||ei[d].ubo),c=!0;break}if(!c)if(h.data.size>1)u=h.offset/4,s.push(e(h,u-o));else{let d=r[h.data.type];u=h.offset/4,s.push(`
|
|
845
845
|
v = uv.${l};
|
|
846
846
|
offset += ${u-o};
|
|
847
847
|
${d};
|
|
848
848
|
`)}o=u}let n=s.join(`
|
|
849
|
-
`);return new Function("uv","data","dataInt32","offset",n)}var
|
|
849
|
+
`);return new Function("uv","data","dataInt32","offset",n)}var nm=g(()=>{om()});function yo(i,t){return`
|
|
850
850
|
for (let i = 0; i < ${i*t}; i++) {
|
|
851
851
|
data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
|
|
852
852
|
}
|
|
853
|
-
`}var
|
|
853
|
+
`}var am,oE,hm=g(()=>{"use strict";am={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>":yo(3,2),"mat4x2<f32>":yo(4,2),"mat2x3<f32>":yo(2,3),"mat4x3<f32>":yo(4,3),"mat2x4<f32>":yo(2,4),"mat3x4<f32>":yo(3,4)},oE={...am,"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 nE(i,t){let{size:e,align:r}=Ba[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
895
895
|
v = uv.${i.data.name};
|
|
896
896
|
${t!==0?`offset += ${t};`:""}
|
|
897
897
|
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var _w=m(()=>{cm()});function yw(i){return Pc(i,"uboWgsl",xw,gw)}var bw=m(()=>{dm();pm();_w()});var Ma,vw=m(()=>{R();lm();cm();bw();Ma=class extends xo{constructor(){super({createUboElements:mw,generateUboSync:yw})}};Ma.extension={type:[b.WebGPUSystem],name:"ubo"}});var Si,Rc=m(()=>{ge();fe();Si=class extends Et{constructor({buffer:t,offset:e,size:r}){super(),this.uid=nt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=nt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=nt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Mc,Tw=m(()=>{"use strict";Mc=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var wi,Ba,Sw=m(()=>{R();gi();Rc();Yr();Tw();mi();wi=128,Ba=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 Mc({minUniformOffsetAlignment:wi});let e=256/wi;for(let r=0;r<e;r++){let s=ot.UNIFORM|ot.COPY_DST;r===0&&(s|=ot.COPY_SRC),this._buffers.push(new kt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/wi),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/wi)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/wi)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/wi;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Si({buffer:e,offset:(t/2|0)*256,size:wi})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new oe({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),wi,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Ba.extension={type:[b.WebGPUPipes],name:"uniformBatch"}});function Bc(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):H(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}GB(i)}function GB(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Ge(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Ge(n.format).stride}}var mm=m(()=>{Tt();Yi()});var Ir,gm=m(()=>{Xi();Ir=[];Ir[Pt.NONE]=void 0;Ir[Pt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Ir[Pt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Ir[Pt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Ir[Pt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Ir[Pt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function kB(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function OB(i,t,e,r){return e<<6|i<<3|r<<1|t}var UB,Ia,ww=m(()=>{R();Tt();mm();Xi();Mn();gm();UB={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ia=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(Pt.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=Ir[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Bc(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=kB(t._layoutKey,e._layoutKey,r.data,r._blendModeId,UB[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===Pt.RENDERING_MASK_ADD?0:this._colorMask;let h=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=qr(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=qr(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===l){o[a]=c;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let h in e.attributeData){let l=t.attributes[h];(l.divisor??1)!==1&&H(`Attribute ${h} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[h].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=OB(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}};Ia.extension={type:[b.WebGPUSystem],name:"pipeline"}});function Ew(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var Aw=m(()=>{"use strict"});function Cw(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Pw=m(()=>{"use strict"});var yo,xm=m(()=>{dt();qt();uo();Aw();Wp();Gs();Be();_t();nm();Pw();om();yo=class{constructor(t){this.rootViewPort=new rt,this.viewport=new rt,this.onRenderTargetChange=new fo("onRenderTargetChange"),this.projectionMatrix=new U,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Cw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let h=o.colorTexture,l=this.viewport,c=h.pixelWidth,u=h.pixelHeight;if(!s&&t instanceof I&&(s=t.frame),s){let d=h._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=u;return Ew(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ne.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ne.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return xe.test(t)&&(t=Ec(t).source),t instanceof Ta?e=t:t instanceof xt&&(e=new Ta({colorTextures:[t]}),xe.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var Ic,Rw=m(()=>{"use strict";Ic=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Fc,Mw=m(()=>{uo();Gs();Be();Rw();Fc=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?ne.ALL:ne.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&ne.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&ne.STENCIL?"clear":"load",c=e&ne.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),c=this.getDescriptor(t,e,r),u=l.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Ic;return t.colorTextures.forEach((r,s)=>{if(xe.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new xt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Fa,Bw=m(()=>{R();xm();Mw();Fa=class extends yo{constructor(t){super(t),this.adaptor=new Fc,this.adaptor.init(t,this)}};Fa.extension={type:[b.WebGPUSystem],name:"renderTarget"}});var Ga,Iw=m(()=>{R();Ga=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Ga.extension={type:[b.WebGPUSystem],name:"shader"}});var Ce,Fw=m(()=>{"use strict";Ce={};Ce.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ce.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ce["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ce["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ce.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ce.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ce.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Ua,Gw=m(()=>{R();pr();Fw();Ua=class{constructor(){this.defaultState=new Lt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ce[t.blendMode]||Ce.normal}]}destroy(){this.gpu=null}};Ua.extension={type:[b.WebGPUSystem],name:"state"}});var Uw,kw=m(()=>{"use strict";Uw={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var _m,NB,Ow,Nw=m(()=>{"use strict";_m={"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}},NB={blockBytes:4,blockWidth:1,blockHeight:1},Ow={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=_m[i.format]||NB;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],h=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Gc,ym=m(()=>{"use strict";Gc={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var Dw,Lw=m(()=>{ym();Dw={type:"video",upload(i,t,e){Gc.upload(i,t,e)}}});var Uc,Hw=m(()=>{"use strict";Uc=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 aE=g(()=>{sm()});function hE(i){return Rc(i,"uboWgsl",nE,oE)}var lE=g(()=>{nm();hm();aE()});var Ia,cE=g(()=>{C();im();sm();lE();Ia=class extends _o{constructor(){super({createUboElements:sE,generateUboSync:hE})}};Ia.extension={type:[_.WebGPUSystem],name:"ubo"}});var wi,Mc=g(()=>{_e();ge();wi=class extends Pt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=ot("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ot("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ot("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Bc,uE=g(()=>{"use strict";Bc=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var Ci,Fa,dE=g(()=>{C();yi();Mc();Zr();uE();_i();Ci=128,Fa=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 Bc({minUniformOffsetAlignment:Ci});let e=256/Ci;for(let r=0;r<e;r++){let s=st.UNIFORM|st.COPY_DST;r===0&&(s|=st.COPY_SRC),this._buffers.push(new Vt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Ci),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/Ci)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ci)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/Ci;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new wi({buffer:e,offset:(t/2|0)*256,size:Ci})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new ue({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),Ci,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Fa.extension={type:[_.WebGPUPipes],name:"uniformBatch"}});function Ic(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):O(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}HB(i)}function HB(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Ge(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Ge(n.format).stride}}var lm=g(()=>{At();qi()});var Ur,cm=g(()=>{ji();Ur=[];Ur[Ft.NONE]=void 0;Ur[Ft.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Ur[Ft.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Ur[Ft.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Ur[Ft.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Ur[Ft.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function WB(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function zB(i,t,e,r){return e<<6|i<<3|r<<1|t}var VB,Ga,fE=g(()=>{C();At();lm();ji();In();cm();VB={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ga=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=Ur[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Ic(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=WB(t._layoutKey,e._layoutKey,r.data,r._blendModeId,VB[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===Ft.RENDERING_MASK_ADD?0:this._colorMask;let h=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Qr(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Qr(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===l){o[a]=c;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let h in e.attributeData){let l=t.attributes[h];(l.divisor??1)!==1&&O(`Attribute ${h} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[h].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=zB(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}};Ga.extension={type:[_.WebGPUSystem],name:"pipeline"}});function pE(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var mE=g(()=>{"use strict"});function gE(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var xE=g(()=>{"use strict"});var bo,um=g(()=>{ft();le();fo();mE();Op();Us();Be();bt();tm();xE();Jp();bo=class{constructor(t){this.rootViewPort=new it,this.viewport=new it,this.onRenderTargetChange=new po("onRenderTargetChange"),this.projectionMatrix=new M,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=gE(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let h=o.colorTexture,l=this.viewport,c=h.pixelWidth,u=h.pixelHeight;if(!s&&t instanceof E&&(s=t.frame),s){let d=h._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=u;return pE(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=de.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=de.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return ye.test(t)&&(t=wc(t).source),t instanceof Ea?e=t:t instanceof yt&&(e=new Ea({colorTextures:[t]}),ye.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var Fc,_E=g(()=>{"use strict";Fc=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Gc,yE=g(()=>{fo();Us();Be();_E();Gc=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?de.ALL:de.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&de.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&de.STENCIL?"clear":"load",c=e&de.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),c=this.getDescriptor(t,e,r),u=l.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Fc;return t.colorTextures.forEach((r,s)=>{if(ye.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new yt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ua,bE=g(()=>{C();um();yE();Ua=class extends bo{constructor(t){super(t),this.adaptor=new Gc,this.adaptor.init(t,this)}};Ua.extension={type:[_.WebGPUSystem],name:"renderTarget"}});var ka,vE=g(()=>{C();ka=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};ka.extension={type:[_.WebGPUSystem],name:"shader"}});var Ce,TE=g(()=>{"use strict";Ce={};Ce.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ce.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ce["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ce["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ce.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ce.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ce.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Oa,SE=g(()=>{C();gr();TE();Oa=class{constructor(){this.defaultState=new Xt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ce[t.blendMode]||Ce.normal}]}destroy(){this.gpu=null}};Oa.extension={type:[_.WebGPUSystem],name:"state"}});var EE,AE=g(()=>{"use strict";EE={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var dm,$B,wE,CE=g(()=>{"use strict";dm={"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}},$B={blockBytes:4,blockWidth:1,blockHeight:1},wE={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=dm[i.format]||$B;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],h=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Uc,fm=g(()=>{"use strict";Uc={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var PE,RE=g(()=>{fm();PE={type:"video",upload(i,t,e){Uc.upload(i,t,e)}}});var kc,ME=g(()=>{"use strict";kc=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -931,7 +931,7 @@ fn mainFragment(
|
|
|
931
931
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
932
932
|
return textureSample(img, imgSampler, texCoord);
|
|
933
933
|
}
|
|
934
|
-
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let h={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(h)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let h=0;h<s;++h){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let h={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},h),h.width=Math.ceil(h.width/2),h.height=Math.ceil(h.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var ka,Vw=m(()=>{At();R();Ee();Js();mi();kw();Nw();ym();Lw();Hw();ka=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:Gc,buffer:Uw,video:Dw,compressed:Ow},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 h=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(h))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=_m[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Uc(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 oe({0:e,1:e.style,2:new St({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=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"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=ke.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),h=new Uint8ClampedArray(a.data.buffer);return ke.returnCanvasAndContext(r),{pixels:h,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}};ka.extension={type:[b.WebGPUSystem],name:"texture"}});var Xw={};Tx(Xw,{WebGPURenderer:()=>bm});var DB,LB,HB,Ww,zw,$w,bm,jw=m(()=>{R();hS();uS();dS();ra();hm();Pr();lw();cw();uw();dw();fw();pw();vw();Sw();ww();Bw();Iw();Gw();Vw();DB=[...Ac,Ma,Ca,go,Ea,ka,Fa,Ga,Ua,Ia,Aa,Pa,wa],LB=[...Cc,Ba],HB=[oa,sa,ia],Ww=[],zw=[],$w=[];D.handleByNamedList(b.WebGPUSystem,Ww);D.handleByNamedList(b.WebGPUPipes,zw);D.handleByNamedList(b.WebGPUPipesAdaptor,$w);D.add(...DB,...LB,...HB);bm=class extends Ti{constructor(){let t={name:"webgpu",type:$t.WEBGPU,systems:Ww,renderPipes:zw,renderPipeAdaptors:$w};super(t)}}});var Oa,Yw=m(()=>{R();dt();$i();_i();Bn();In();co();yi();Ul();fr();Ee();Oa=class{init(){let t=new St({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Qe(),r=Er({name:"graphics",bits:[Ws,$s(e),lo,Cr]});this.shader=new Ot({glProgram:r,resources:{localUniforms:t,batchSamplers:Xs(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=h.instructions;for(let c=0;c<h.instructionSize;c++){let u=l[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}};Oa.extension={type:[b.WebGLPipesAdaptor],name:"graphics"}});var Na,qw=m(()=>{R();dt();_i();co();yi();zp();fr();_t();Tt();Na=class{init(){let t=Er({name:"mesh",bits:[lo,cS,Cr]});this._shader=new Ot({glProgram:t,resources:{uTexture:I.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){H("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Na.extension={type:[b.WebGLPipesAdaptor],name:"mesh"}});var Da,Kw=m(()=>{R();pr();Da=class{constructor(){this._tempState=Lt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Da.extension={type:[b.WebGLPipesAdaptor],name:"batch"}});var La,Zw=m(()=>{"use strict";La=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(La||{})});var kc,Qw=m(()=>{"use strict";kc=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Ha,Jw=m(()=>{R();Yr();Zw();Qw();Ha=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&ot.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=La.ARRAY_BUFFER;t.descriptor.usage&ot.INDEX?r=La.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ot.UNIFORM&&(r=La.UNIFORM_BUFFER);let s=new kc(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Ha.extension={type:[b.WebGLSystem],name:"buffer"}});var vm,eE,rE=m(()=>{At();R();Tt();vm=class tE{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={...tE.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(H("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 r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&H("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 r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&H("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||H("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};vm.extension={type:[b.WebGLSystem],name:"context"};vm.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};eE=vm});var Oc,Tm,ft,Sm=m(()=>{"use strict";Oc=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Oc||{}),Tm=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Tm||{}),ft=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(ft||{})});function sE(i){return iE[i]??iE.float32}var iE,oE=m(()=>{Sm();iE={uint8x2:ft.UNSIGNED_BYTE,uint8x4:ft.UNSIGNED_BYTE,sint8x2:ft.BYTE,sint8x4:ft.BYTE,unorm8x2:ft.UNSIGNED_BYTE,unorm8x4:ft.UNSIGNED_BYTE,snorm8x2:ft.BYTE,snorm8x4:ft.BYTE,uint16x2:ft.UNSIGNED_SHORT,uint16x4:ft.UNSIGNED_SHORT,sint16x2:ft.SHORT,sint16x4:ft.SHORT,unorm16x2:ft.UNSIGNED_SHORT,unorm16x4:ft.UNSIGNED_SHORT,snorm16x2:ft.SHORT,snorm16x4:ft.SHORT,float16x2:ft.HALF_FLOAT,float16x4:ft.HALF_FLOAT,float32:ft.FLOAT,float32x2:ft.FLOAT,float32x3:ft.FLOAT,float32x4:ft.FLOAT,uint32:ft.UNSIGNED_INT,uint32x2:ft.UNSIGNED_INT,uint32x3:ft.UNSIGNED_INT,uint32x4:ft.UNSIGNED_INT,sint32:ft.INT,sint32x2:ft.INT,sint32x3:ft.INT,sint32x4:ft.INT}});var VB,Va,nE=m(()=>{R();Yi();mm();oE();VB={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Va=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{r.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],h=a[n];if(h)return a[e._key]=h,h;Bc(t,e._attributeData);let l=t.buffers;h=s.createVertexArray(),s.bindVertexArray(h);for(let c=0;c<l.length;c++){let u=l[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=h,a[n]=h,s.bindVertexArray(null),h}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let h=o[a],l=h.buffer,c=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==c&&(s.bind(l),n=c);let d=u.location;r.enableVertexAttribArray(d);let f=Ge(h.format),p=sE(h.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let g=h.divisor??1;r.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=VB[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let h=n.indexBuffer.data.BYTES_PER_ELEMENT,l=h===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*h)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};Va.extension={type:[b.WebGLSystem],name:"geometry"}});var WB,wm,hE,lE=m(()=>{R();Tt();Ds();fr();pr();Be();_t();ji();WB=new Je({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),wm=class aE{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...aE.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(H("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Lt.for2d();let s=new tr({vertex:`
|
|
934
|
+
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let h={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(h)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let h=0;h<s;++h){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let h={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},h),h.width=Math.ceil(h.width/2),h.height=Math.ceil(h.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var La,BE=g(()=>{Mt();C();Ae();to();_i();AE();CE();fm();RE();ME();La=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:Uc,buffer:EE,video:PE,compressed:wE},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 h=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(h))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=dm[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new kc(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 ue({0:e,1:e.style,2:new wt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=$.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:$.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=ke.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),h=new Uint8ClampedArray(a.data.buffer);return ke.returnCanvasAndContext(r),{pixels:h,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}};La.extension={type:[_.WebGPUSystem],name:"texture"}});var UE={};nx(UE,{WebGPURenderer:()=>pm});var XB,jB,YB,IE,FE,GE,pm,kE=g(()=>{C();ZT();tS();eS();sa();rm();Br();QS();JS();tE();eE();rE();iE();cE();dE();fE();bE();vE();SE();BE();XB=[...Cc,Ia,Ra,xo,Ca,La,Ua,ka,Oa,Ga,Pa,Ma,wa],jB=[...Pc,Fa],YB=[aa,na,oa],IE=[],FE=[],GE=[];G.handleByNamedList(_.WebGPUSystem,IE);G.handleByNamedList(_.WebGPUPipes,FE);G.handleByNamedList(_.WebGPUPipesAdaptor,GE);G.add(...XB,...jB,...YB);pm=class extends Ai{constructor(){let t={name:"webgpu",type:Qt.WEBGPU,systems:IE,renderPipes:FE,renderPipeAdaptors:GE};super(t)}}});var Da,OE=g(()=>{C();ft();Xi();vi();Fn();Gn();uo();Ti();kl();mr();Ae();Da=class{init(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Je(),r=Pr({name:"graphics",bits:[zs,Xs(e),co,Mr]});this.shader=new Wt({glProgram:r,resources:{localUniforms:t,batchSamplers:js(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=h.instructions;for(let c=0;c<h.instructionSize;c++){let u=l[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}};Da.extension={type:[_.WebGLPipesAdaptor],name:"graphics"}});var Na,LE=g(()=>{C();ft();vi();uo();Ti();Lp();mr();bt();At();Na=class{init(){let t=Pr({name:"mesh",bits:[co,JT,Mr]});this._shader=new Wt({glProgram:t,resources:{uTexture:E.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new M}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){O("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Na.extension={type:[_.WebGLPipesAdaptor],name:"mesh"}});var Ha,DE=g(()=>{C();gr();Ha=class{constructor(){this._tempState=Xt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Ha.extension={type:[_.WebGLPipesAdaptor],name:"batch"}});var Va,NE=g(()=>{"use strict";Va=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Va||{})});var Oc,HE=g(()=>{"use strict";Oc=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Wa,VE=g(()=>{C();Zr();NE();HE();Wa=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&st.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Va.ARRAY_BUFFER;t.descriptor.usage&st.INDEX?r=Va.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&st.UNIFORM&&(r=Va.UNIFORM_BUFFER);let s=new Oc(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Wa.extension={type:[_.WebGLSystem],name:"buffer"}});var mm,zE,$E=g(()=>{Mt();C();At();mm=class WE{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={...WE.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(O("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&O("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 $.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&O("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||O("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};mm.extension={type:[_.WebGLSystem],name:"context"};mm.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};zE=mm});var Lc,gm,mt,xm=g(()=>{"use strict";Lc=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Lc||{}),gm=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(gm||{}),mt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(mt||{})});function jE(i){return XE[i]??XE.float32}var XE,YE=g(()=>{xm();XE={uint8x2:mt.UNSIGNED_BYTE,uint8x4:mt.UNSIGNED_BYTE,sint8x2:mt.BYTE,sint8x4:mt.BYTE,unorm8x2:mt.UNSIGNED_BYTE,unorm8x4:mt.UNSIGNED_BYTE,snorm8x2:mt.BYTE,snorm8x4:mt.BYTE,uint16x2:mt.UNSIGNED_SHORT,uint16x4:mt.UNSIGNED_SHORT,sint16x2:mt.SHORT,sint16x4:mt.SHORT,unorm16x2:mt.UNSIGNED_SHORT,unorm16x4:mt.UNSIGNED_SHORT,snorm16x2:mt.SHORT,snorm16x4:mt.SHORT,float16x2:mt.HALF_FLOAT,float16x4:mt.HALF_FLOAT,float32:mt.FLOAT,float32x2:mt.FLOAT,float32x3:mt.FLOAT,float32x4:mt.FLOAT,uint32:mt.UNSIGNED_INT,uint32x2:mt.UNSIGNED_INT,uint32x3:mt.UNSIGNED_INT,uint32x4:mt.UNSIGNED_INT,sint32:mt.INT,sint32x2:mt.INT,sint32x3:mt.INT,sint32x4:mt.INT}});var qB,za,qE=g(()=>{C();qi();lm();YE();qB={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},za=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{r.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],h=a[n];if(h)return a[e._key]=h,h;Ic(t,e._attributeData);let l=t.buffers;h=s.createVertexArray(),s.bindVertexArray(h);for(let c=0;c<l.length;c++){let u=l[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=h,a[n]=h,s.bindVertexArray(null),h}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let h=o[a],l=h.buffer,c=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==c&&(s.bind(l),n=c);let d=u.location;r.enableVertexAttribArray(d);let f=Ge(h.format),p=jE(h.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let m=h.divisor??1;r.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=qB[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let h=n.indexBuffer.data.BYTES_PER_ELEMENT,l=h===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*h)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};za.extension={type:[_.WebGLSystem],name:"geometry"}});var KB,_m,ZE,QE=g(()=>{C();At();Ns();mr();gr();Be();bt();Yi();KB=new tr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),_m=class KE{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...KE.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(O("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Xt.for2d();let s=new er({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 Wt({glProgram:s,resources:{uTexture:E.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:KB,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new E({source:new yt({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)}};_m.extension={type:[_.WebGLSystem],name:"backBuffer",priority:1};_m.defaultOptions={useBackBuffer:!1};ZE=_m});var $a,JE=g(()=>{C();$a=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)))}};$a.extension={type:[_.WebGLSystem],name:"colorMask"}});var Xa,tA=g(()=>{C();Xa=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:h,start:l,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,h,l,c??r.instanceCount)}destroy(){this._renderer=null}};Xa.extension={type:[_.WebGLSystem],name:"encoder"}});var ja,eA=g(()=>{C();cm();ji();ja=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Ft.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:Ft.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Ft.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Ur[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===Ft.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]))}};ja.extension={type:[_.WebGLSystem],name:"stencil"}});function rA(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=ym[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let h=s%e;h>0&&e-h<a?s+=(e-h)%16:s+=(r-h%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var ym,bm=g(()=>{"use strict";ym={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 iA(i,t){let e=Math.max(ym[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
954
954
|
v = uv.${i.data.name};
|
|
955
955
|
offset += ${t};
|
|
956
956
|
|
|
@@ -966,7 +966,7 @@ fn mainFragment(
|
|
|
966
966
|
}
|
|
967
967
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
968
968
|
}
|
|
969
|
-
`}var
|
|
969
|
+
`}var sA=g(()=>{bm()});function oA(i){return Rc(i,"uboStd40",iA,am)}var nA=g(()=>{nm();hm();sA()});var Ya,aA=g(()=>{C();im();bm();nA();Ya=class extends _o{constructor(){super({createUboElements:rA,generateUboSync:oA})}};Ya.extension={type:[_.WebGLSystem],name:"ubo"}});var Dc,hA=g(()=>{"use strict";Dc=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Nc,lA=g(()=>{le();At();Us();fo();hA();Nc=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,r,s,o){let n=this._renderTargetSystem,a=this._renderer,h=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,h.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),h=s.y;t.isRoot&&(h=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==h||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=h,c.width=s.width,c.height=s.height,l.viewport(s.x,h,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Dc,o=t.colorTexture;return ye.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?de.ALL:de.NONE);let o=this._renderer.gl;if(e&de.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let h=n.source;h.antialias&&(r.context.supports.msaa?e.msaa=!0:O("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(h,0);let c=r.texture.getGlSource(h).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,h)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[h]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,h)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[h];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+h,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&ye.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&ye.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var qa,cA=g(()=>{C();um();lA();qa=class extends bo{constructor(t){super(t),this.adaptor=new Nc,this.adaptor.init(t,this)}};qa.extension={type:[_.WebGLSystem],name:"renderTarget"}});function uA(i,t){let e=[],r=[`
|
|
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(i.glProgram);for(let h in i.groups){let l=i.groups[h];e.push(`
|
|
976
976
|
resources = g[${h}].resources;
|
|
977
|
-
`);for(let c in l.resources){let u=l.resources[c];if(u instanceof
|
|
977
|
+
`);for(let c in l.resources){let u=l.resources[c];if(u instanceof wt)if(u.ubo){let d=i._uniformBindMap[h][Number(c)];e.push(`
|
|
978
978
|
sS.bindUniformBlock(
|
|
979
979
|
resources[${c}],
|
|
980
980
|
'${d}',
|
|
@@ -982,21 +982,21 @@ 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 wi){let d=i._uniformBindMap[h][Number(c)];e.push(`
|
|
986
986
|
sS.bindUniformBlock(
|
|
987
987
|
resources[${c}],
|
|
988
988
|
'${d}',
|
|
989
989
|
${i.glProgram._uniformBlockData[d].index}
|
|
990
990
|
);
|
|
991
|
-
`)}else if(u instanceof
|
|
991
|
+
`)}else if(u instanceof yt){let d=i._uniformBindMap[h][c],f=n.uniformData[d];f&&(s||(s=!0,r.push(`
|
|
992
992
|
var tS = r.texture;
|
|
993
993
|
`)),t._gl.uniform1i(f.location,o),e.push(`
|
|
994
994
|
tS.bind(resources[${c}], ${o});
|
|
995
995
|
`),o++)}}}let a=[...r,...e].join(`
|
|
996
|
-
`);return new Function("r","s","sD",a)}var
|
|
996
|
+
`);return new Function("r","s","sD",a)}var dA=g(()=>{Mc();Ae();Be()});var Hc,fA=g(()=>{"use strict";Hc=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 vm(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var pA=g(()=>{"use strict"});function Tm(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Vc(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Tm(2*t);case"bvec3":return Tm(3*t);case"bvec4":return Tm(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 Sm=g(()=>{"use strict"});function Em(i,t){if(!Wc){let e=Object.keys(mA);Wc={};for(let r=0;r<e.length;++r){let s=e[r];Wc[i[s]]=mA[s]}}return Wc[t]}function gA(i,t){let e=Em(i,t);return ZB[e]||"float32"}var Wc,mA,ZB,Am=g(()=>{"use strict";Wc=null,mA={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"},ZB={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 xA(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let h=gA(t,a.type);r[a.name]={location:0,format:h,stride:Ge(h).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var _A=g(()=>{qi();Am()});function yA(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var bA=g(()=>{"use strict"});function vA(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Em(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:Vc(h,o.size)}}return e}var TA=g(()=>{Sm();Am()});function SA(i,t){let e=i.getShaderSource(t).split(`
|
|
997
997
|
`).map((l,c)=>`${c}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
|
|
998
998
|
`),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=e.join(`
|
|
999
|
-
`);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
999
|
+
`);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function EA(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||SA(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||SA(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var AA=g(()=>{"use strict"});function wA(i,t){let e=vm(i,i.VERTEX_SHADER,t.vertex),r=vm(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?O("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||EA(i,s,e,r),t._attributeData=xA(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=vA(s,i),t._uniformBlockData=yA(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let h in t._uniformData){let l=t._uniformData[h];n[h]={location:i.getUniformLocation(s,h),value:Vc(l.type,l.size)}}return new Hc(s,n)}var CA=g(()=>{At();fA();pA();Sm();_A();bA();TA();AA()});var zc,Ka,PA=g(()=>{C();Xi();dA();CA();zc={textureCount:0,blockIndex:0},Ka=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=Je()}bind(t,e){if(this._setProgram(t.glProgram),e)return;zc.textureCount=0,zc.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,zc)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,zc)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,h=s.updateBuffer(a),l=s.freeLocationForBufferBase(h);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(h,l):s.bindBufferRange(h,l,u)}else s.getLastBindBaseLocation(h)!==l&&s.bindBufferBase(h,l);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,c,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=wA(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 uA(t,e)}resetState(){this._activeProgram=null}};Ka.extension={type:[_.WebGLSystem],name:"shader"}});var RA,MA,BA=g(()=>{"use strict";RA={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);"},MA={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 IA(i,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 r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof
|
|
1078
|
+
`];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof wt?i.uniforms[r].ubo?e.push(`
|
|
1079
1079
|
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
1080
1080
|
`):e.push(`
|
|
1081
1081
|
renderer.shader.updateUniformGroup(uv.${r});
|
|
1082
|
-
`):i.uniforms[r]instanceof
|
|
1082
|
+
`):i.uniforms[r]instanceof wi&&e.push(`
|
|
1083
1083
|
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
1084
|
-
`);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<
|
|
1084
|
+
`);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<ei.length;n++){let a=ei[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,ei[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?RA:MA)[s.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
1085
1085
|
cu = ud["${r}"];
|
|
1086
1086
|
cv = cu.value;
|
|
1087
1087
|
v = uv["${r}"];
|
|
1088
1088
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1089
|
-
`))}var zE=m(()=>{Rc();Ee();um();VE()});var qa,$E=m(()=>{R();zE();qa=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return WE(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};qa.extension={type:[b.WebGLSystem],name:"uniformGroup"}});function XE(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof j.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var jE=m(()=>{At()});var $B,XB,jB,YB,qB,KB,YE,qE,KE=m(()=>{R();pr();jE();$B=0,XB=1,jB=2,YB=3,qB=4,KB=5,YE=class Im{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[$B]=this.setBlend,this.map[XB]=this.setOffset,this.map[jB]=this.setCullFace,this.map[YB]=this.setDepthTest,this.map[qB]=this.setFrontFace,this.map[KB]=this.setDepthMask,this.checks=[],this.defaultState=Lt.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=XE(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Im._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Im._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};YE.extension={type:[b.WebGLSystem],name:"state"};qE=YE});var zc,ZE=m(()=>{Sm();zc=class{constructor(t){this.target=Tm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Oc.RGBA,this.format=Oc.RGBA,this.samplerType=0}}});var QE,JE=m(()=>{"use strict";QE={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var ZB,tA,eA=m(()=>{"use strict";ZB={"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},tA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!ZB[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var $c,Fm=m(()=>{"use strict";$c={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var rA,iA=m(()=>{Fm();rA={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}$c.upload(i,t,e,r)}}});var Gm,sA,Xc,oA,nA=m(()=>{"use strict";Gm={linear:9729,nearest:9728},sA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Xc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},oA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Um(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Xc[n?"clamp-to-edge":i.addressModeU],c=Xc[n?"clamp-to-edge":i.addressModeV],u=Xc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Gm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=sA[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Gm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,oA[i.compare])}var aA=m(()=>{nA()});function hA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var lA=m(()=>{"use strict"});function cA(i,t){let e={},r=i.RGBA;return i instanceof j.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var uA=m(()=>{At()});function dA(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var fA=m(()=>{"use strict"});var QB,Ka,pA=m(()=>{At();R();_t();ZE();JE();eA();Fm();iA();aA();lA();uA();fA();QB=4,Ka=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:$c,buffer:QE,video:rA,compressed:tA},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=cA(t,this._renderer.context.extensions),this._mapFormatToType=dA(t),this._mapFormatToFormat=hA(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(I.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=I.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new zc(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Um(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Um(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=j.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(QB*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.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(I.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Ka.extension={type:[b.WebGLSystem],name:"texture"}});var _A={};Tx(_A,{WebGLRenderer:()=>km});var JB,tI,eI,mA,gA,xA,km,yA=m(()=>{R();Yw();qw();Kw();ra();hm();Pr();Jw();rE();nE();lE();cE();uE();dE();_E();vE();DE();$E();KE();pA();JB=[...Ac,Xa,hE,eE,Ha,Ka,ja,Va,qa,Ya,za,qE,$a,Wa],tI=[...Cc],eI=[Da,Na,Oa],mA=[],gA=[],xA=[];D.handleByNamedList(b.WebGLSystem,mA);D.handleByNamedList(b.WebGLPipes,gA);D.handleByNamedList(b.WebGLPipesAdaptor,xA);D.add(...JB,...tI,...eI);km=class extends Ti{constructor(){let t={name:"webgl",type:$t.WEBGL,systems:mA,renderPipes:gA,renderPipeAdaptors:xA};super(t)}}});var zA=Q((Mit,$m)=>{"use strict";var MI=Object.prototype.hasOwnProperty,Re="~";function eh(){}Object.create&&(eh.prototype=Object.create(null),new eh().__proto__||(Re=!1));function BI(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function WA(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new BI(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function iu(i,t){--i._eventsCount===0?i._events=new eh:delete i._events[t]}function _e(){this._events=new eh,this._eventsCount=0}_e.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)MI.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};_e.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};_e.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};_e.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};_e.prototype.on=function(t,e,r){return WA(this,t,e,r,!1)};_e.prototype.once=function(t,e,r){return WA(this,t,e,r,!0)};_e.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return iu(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&iu(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:iu(this,o)}return this};_e.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&iu(this,e)):(this._events=new eh,this._eventsCount=0),this};_e.prototype.off=_e.prototype.removeListener;_e.prototype.addListener=_e.prototype.on;_e.prefixed=Re;_e.EventEmitter=_e;typeof $m<"u"&&($m.exports=_e)});var $A=Q((Co,Po)=>{(function(i){var t=typeof Co=="object"&&Co&&!Co.nodeType&&Co,e=typeof Po=="object"&&Po&&!Po.nodeType&&Po,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,g=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,y=Math.floor,T=String.fromCharCode,E;function w(N){throw new RangeError(v[N])}function C(N,O){for(var Y=N.length,lt=[];Y--;)lt[Y]=O(N[Y]);return lt}function M(N,O){var Y=N.split("@"),lt="";Y.length>1&&(lt=Y[0]+"@",N=Y[1]),N=N.replace(x,".");var bt=N.split("."),It=C(bt,O).join(".");return lt+It}function P(N){for(var O=[],Y=0,lt=N.length,bt,It;Y<lt;)bt=N.charCodeAt(Y++),bt>=55296&&bt<=56319&&Y<lt?(It=N.charCodeAt(Y++),(It&64512)==56320?O.push(((bt&1023)<<10)+(It&1023)+65536):(O.push(bt),Y--)):O.push(bt);return O}function S(N){return C(N,function(O){var Y="";return O>65535&&(O-=65536,Y+=T(O>>>10&1023|55296),O=56320|O&1023),Y+=T(O),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function B(N,O){return N+22+75*(N<26)-((O!=0)<<5)}function F(N,O,Y){var lt=0;for(N=Y?y(N/c):N>>1,N+=y(N/O);N>_*h>>1;lt+=n)N=y(N/_);return y(lt+(_+1)*N/(N+l))}function W(N){var O=[],Y=N.length,lt,bt=0,It=d,Wt=u,re,le,Ne,qe,Dt,ce,ye,pe,be;for(re=N.lastIndexOf(f),re<0&&(re=0),le=0;le<re;++le)N.charCodeAt(le)>=128&&w("not-basic"),O.push(N.charCodeAt(le));for(Ne=re>0?re+1:0;Ne<Y;){for(qe=bt,Dt=1,ce=n;Ne>=Y&&w("invalid-input"),ye=A(N.charCodeAt(Ne++)),(ye>=n||ye>y((o-bt)/Dt))&&w("overflow"),bt+=ye*Dt,pe=ce<=Wt?a:ce>=Wt+h?h:ce-Wt,!(ye<pe);ce+=n)be=n-pe,Dt>y(o/be)&&w("overflow"),Dt*=be;lt=O.length+1,Wt=F(bt-qe,lt,qe==0),y(bt/lt)>o-It&&w("overflow"),It+=y(bt/lt),bt%=lt,O.splice(bt++,0,It)}return S(O)}function z(N){var O,Y,lt,bt,It,Wt,re,le,Ne,qe,Dt,ce=[],ye,pe,be,cr;for(N=P(N),ye=N.length,O=d,Y=0,It=u,Wt=0;Wt<ye;++Wt)Dt=N[Wt],Dt<128&&ce.push(T(Dt));for(lt=bt=ce.length,bt&&ce.push(f);lt<ye;){for(re=o,Wt=0;Wt<ye;++Wt)Dt=N[Wt],Dt>=O&&Dt<re&&(re=Dt);for(pe=lt+1,re-O>y((o-Y)/pe)&&w("overflow"),Y+=(re-O)*pe,O=re,Wt=0;Wt<ye;++Wt)if(Dt=N[Wt],Dt<O&&++Y>o&&w("overflow"),Dt==O){for(le=Y,Ne=n;qe=Ne<=It?a:Ne>=It+h?h:Ne-It,!(le<qe);Ne+=n)cr=le-qe,be=n-qe,ce.push(T(B(qe+cr%be,0))),le=y(cr/be);ce.push(T(B(le,0))),It=F(Y,pe,lt==bt),Y=0,++lt}++Y,++O}return ce.join("")}function k(N){return M(N,function(O){return p.test(O)?W(O.slice(4).toLowerCase()):O})}function G(N){return M(N,function(O){return g.test(O)?"xn--"+z(O):O})}if(s={version:"1.4.1",ucs2:{decode:P,encode:S},decode:W,encode:z,toASCII:G,toUnicode:k},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Po.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else i.punycode=s})(Co)});var rs=Q((Bit,XA)=>{"use strict";XA.exports=TypeError});var jA=Q(()=>{});var nh=Q((Git,f1)=>{var eg=typeof Map=="function"&&Map.prototype,Xm=Object.getOwnPropertyDescriptor&&eg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ou=eg&&Xm&&typeof Xm.get=="function"?Xm.get:null,YA=eg&&Map.prototype.forEach,rg=typeof Set=="function"&&Set.prototype,jm=Object.getOwnPropertyDescriptor&&rg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,nu=rg&&jm&&typeof jm.get=="function"?jm.get:null,qA=rg&&Set.prototype.forEach,II=typeof WeakMap=="function"&&WeakMap.prototype,ih=II?WeakMap.prototype.has:null,FI=typeof WeakSet=="function"&&WeakSet.prototype,sh=FI?WeakSet.prototype.has:null,GI=typeof WeakRef=="function"&&WeakRef.prototype,KA=GI?WeakRef.prototype.deref:null,UI=Boolean.prototype.valueOf,kI=Object.prototype.toString,OI=Function.prototype.toString,NI=String.prototype.match,ig=String.prototype.slice,Ai=String.prototype.replace,DI=String.prototype.toUpperCase,ZA=String.prototype.toLowerCase,n1=RegExp.prototype.test,QA=Array.prototype.concat,Fr=Array.prototype.join,LI=Array.prototype.slice,JA=Math.floor,Km=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ym=Object.getOwnPropertySymbols,Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ro=typeof Symbol=="function"&&typeof Symbol.iterator=="object",oh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ro||!0)?Symbol.toStringTag:null,a1=Object.prototype.propertyIsEnumerable,t1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function e1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||n1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-JA(-i):JA(i);if(r!==i){var s=String(r),o=ig.call(t,s.length+1);return Ai.call(s,e,"$&_")+"."+Ai.call(Ai.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ai.call(t,e,"$&_")}var Qm=jA(),r1=Qm.custom,i1=c1(r1)?r1:null,h1={__proto__:null,double:'"',single:"'"},HI={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};f1.exports=function i(t,e,r,s){var o=e||{};if(ti(o,"quoteStyle")&&!ti(h1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ti(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ti(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ti(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ti(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return d1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?e1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?e1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Jm(t)?"[Array]":"[Object]";var u=oF(o,r);if(typeof s>"u")s=[];else if(u1(s,t)>=0)return"[Circular]";function d(F,W,z){if(W&&(s=LI.call(s),s.push(W)),z){var k={depth:o.depth};return ti(o,"quoteStyle")&&(k.quoteStyle=o.quoteStyle),i(F,k,r+1,s)}return i(F,o,r+1,s)}if(typeof t=="function"&&!s1(t)){var f=KI(t),p=su(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Fr.call(p,", ")+" }":"")}if(c1(t)){var g=Ro?Ai.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zm.call(t);return typeof t=="object"&&!Ro?rh(g):g}if(rF(t)){for(var x="<"+ZA.call(String(t.nodeName)),v=t.attributes||[],_=0;_<v.length;_++)x+=" "+v[_].name+"="+l1(VI(v[_].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+ZA.call(String(t.nodeName))+">",x}if(Jm(t)){if(t.length===0)return"[]";var y=su(t,d);return u&&!sF(y)?"["+tg(y,u)+"]":"[ "+Fr.call(y,", ")+" ]"}if(zI(t)){var T=su(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!a1.call(t,"cause")?"{ ["+String(t)+"] "+Fr.call(QA.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Fr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(i1&&typeof t[i1]=="function"&&Qm)return Qm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(ZI(t)){var E=[];return YA&&YA.call(t,function(F,W){E.push(d(W,t,!0)+" => "+d(F,t))}),o1("Map",ou.call(t),E,u)}if(tF(t)){var w=[];return qA&&qA.call(t,function(F){w.push(d(F,t))}),o1("Set",nu.call(t),w,u)}if(QI(t))return qm("WeakMap");if(eF(t))return qm("WeakSet");if(JI(t))return qm("WeakRef");if(XI(t))return rh(d(Number(t)));if(YI(t))return rh(d(Km.call(t)));if(jI(t))return rh(UI.call(t));if($I(t))return rh(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(!WI(t)&&!s1(t)){var C=su(t,d),M=t1?t1(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",S=!M&&oh&&Object(t)===t&&oh in t?ig.call(Ci(t),8,-1):P?"Object":"",A=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",B=A+(S||P?"["+Fr.call(QA.call([],S||[],P||[]),": ")+"] ":"");return C.length===0?B+"{}":u?B+"{"+tg(C,u)+"}":B+"{ "+Fr.call(C,", ")+" }"}return String(t)};function l1(i,t,e){var r=e.quoteStyle||t,s=h1[r];return s+i+s}function VI(i){return Ai.call(String(i),/"/g,""")}function is(i){return!oh||!(typeof i=="object"&&(oh in i||typeof i[oh]<"u"))}function Jm(i){return Ci(i)==="[object Array]"&&is(i)}function WI(i){return Ci(i)==="[object Date]"&&is(i)}function s1(i){return Ci(i)==="[object RegExp]"&&is(i)}function zI(i){return Ci(i)==="[object Error]"&&is(i)}function $I(i){return Ci(i)==="[object String]"&&is(i)}function XI(i){return Ci(i)==="[object Number]"&&is(i)}function jI(i){return Ci(i)==="[object Boolean]"&&is(i)}function c1(i){if(Ro)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Zm)return!1;try{return Zm.call(i),!0}catch{}return!1}function YI(i){if(!i||typeof i!="object"||!Km)return!1;try{return Km.call(i),!0}catch{}return!1}var qI=Object.prototype.hasOwnProperty||function(i){return i in this};function ti(i,t){return qI.call(i,t)}function Ci(i){return kI.call(i)}function KI(i){if(i.name)return i.name;var t=NI.call(OI.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function u1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function ZI(i){if(!ou||!i||typeof i!="object")return!1;try{ou.call(i);try{nu.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function QI(i){if(!ih||!i||typeof i!="object")return!1;try{ih.call(i,ih);try{sh.call(i,sh)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function JI(i){if(!KA||!i||typeof i!="object")return!1;try{return KA.call(i),!0}catch{}return!1}function tF(i){if(!nu||!i||typeof i!="object")return!1;try{nu.call(i);try{ou.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function eF(i){if(!sh||!i||typeof i!="object")return!1;try{sh.call(i,sh);try{ih.call(i,ih)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function rF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function d1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return d1(ig.call(i,0,t.maxStringLength),t)+r}var s=HI[t.quoteStyle||"single"];s.lastIndex=0;var o=Ai.call(Ai.call(i,s,"\\$1"),/[\x00-\x1f]/g,iF);return l1(o,"single",t)}function iF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+DI.call(t.toString(16))}function rh(i){return"Object("+i+")"}function qm(i){return i+" { ? }"}function o1(i,t,e,r){var s=r?tg(e,r):Fr.call(e,", ");return i+" ("+t+") {"+s+"}"}function sF(i){for(var t=0;t<i.length;t++)if(u1(i[t],`
|
|
1090
|
-
`)>=0)return!1;return!0}function
|
|
1091
|
-
`+t.prev+t.base;return e+
|
|
1092
|
-
`+t.prev}function su(i,t){var e=Jm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ti(i,s)?t(i[s],i):""}var o=typeof Ym=="function"?Ym(i):[],n;if(Ro){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ti(i,h)&&(e&&String(Number(h))===h&&h<i.length||Ro&&n["$"+h]instanceof Symbol||(n1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Ym=="function")for(var l=0;l<o.length;l++)a1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var m1=Q((Uit,p1)=>{"use strict";var nF=nh(),aF=rs(),au=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},hF=function(i,t){if(i){var e=au(i,t);return e&&e.value}},lF=function(i,t,e){var r=au(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},cF=function(i,t){return i?!!au(i,t):!1},uF=function(i,t){if(i)return au(i,t,!0)};p1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new aF("Side channel does not contain "+nF(r))},delete:function(r){var s=t&&t.next,o=uF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return hF(t,r)},has:function(r){return cF(t,r)},set:function(r,s){t||(t={next:void 0}),lF(t,r,s)}};return e}});var sg=Q((kit,g1)=>{"use strict";g1.exports=Object});var _1=Q((Oit,x1)=>{"use strict";x1.exports=Error});var b1=Q((Nit,y1)=>{"use strict";y1.exports=EvalError});var T1=Q((Dit,v1)=>{"use strict";v1.exports=RangeError});var w1=Q((Lit,S1)=>{"use strict";S1.exports=ReferenceError});var A1=Q((Hit,E1)=>{"use strict";E1.exports=SyntaxError});var P1=Q((Vit,C1)=>{"use strict";C1.exports=URIError});var M1=Q((Wit,R1)=>{"use strict";R1.exports=Math.abs});var I1=Q((zit,B1)=>{"use strict";B1.exports=Math.floor});var G1=Q(($it,F1)=>{"use strict";F1.exports=Math.max});var k1=Q((Xit,U1)=>{"use strict";U1.exports=Math.min});var N1=Q((jit,O1)=>{"use strict";O1.exports=Math.pow});var L1=Q((Yit,D1)=>{"use strict";D1.exports=Math.round});var V1=Q((qit,H1)=>{"use strict";H1.exports=Number.isNaN||function(t){return t!==t}});var z1=Q((Kit,W1)=>{"use strict";var dF=V1();W1.exports=function(t){return dF(t)||t===0?t:t<0?-1:1}});var X1=Q((Zit,$1)=>{"use strict";$1.exports=Object.getOwnPropertyDescriptor});var og=Q((Qit,j1)=>{"use strict";var hu=X1();if(hu)try{hu([],"length")}catch{hu=null}j1.exports=hu});var q1=Q((Jit,Y1)=>{"use strict";var lu=Object.defineProperty||!1;if(lu)try{lu({},"a",{value:1})}catch{lu=!1}Y1.exports=lu});var Z1=Q((tst,K1)=>{"use strict";K1.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[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 tC=Q((est,J1)=>{"use strict";var Q1=typeof Symbol<"u"&&Symbol,fF=Z1();J1.exports=function(){return typeof Q1!="function"||typeof Symbol!="function"||typeof Q1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:fF()}});var ng=Q((rst,eC)=>{"use strict";eC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ag=Q((ist,rC)=>{"use strict";var pF=sg();rC.exports=pF.getPrototypeOf||null});var oC=Q((sst,sC)=>{"use strict";var mF="Function.prototype.bind called on incompatible ",gF=Object.prototype.toString,xF=Math.max,_F="[object Function]",iC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},yF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},bF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};sC.exports=function(t){var e=this;if(typeof e!="function"||gF.apply(e)!==_F)throw new TypeError(mF+e);for(var r=yF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,iC(r,arguments));return Object(c)===c?c:this}return e.apply(t,iC(r,arguments))},n=xF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+bF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ah=Q((ost,nC)=>{"use strict";var vF=oC();nC.exports=Function.prototype.bind||vF});var cu=Q((nst,aC)=>{"use strict";aC.exports=Function.prototype.call});var hg=Q((ast,hC)=>{"use strict";hC.exports=Function.prototype.apply});var cC=Q((hst,lC)=>{"use strict";lC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var dC=Q((lst,uC)=>{"use strict";var TF=ah(),SF=hg(),wF=cu(),EF=cC();uC.exports=EF||TF.call(wF,SF)});var lg=Q((cst,fC)=>{"use strict";var AF=ah(),CF=rs(),PF=cu(),RF=dC();fC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new CF("a function is required");return RF(AF,PF,t)}});var yC=Q((ust,_C)=>{"use strict";var MF=lg(),pC=og(),gC;try{gC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var cg=!!gC&&pC&&pC(Object.prototype,"__proto__"),xC=Object,mC=xC.getPrototypeOf;_C.exports=cg&&typeof cg.get=="function"?MF([cg.get]):typeof mC=="function"?function(t){return mC(t==null?t:xC(t))}:!1});var wC=Q((dst,SC)=>{"use strict";var bC=ng(),vC=ag(),TC=yC();SC.exports=bC?function(t){return bC(t)}:vC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return vC(t)}:TC?function(t){return TC(t)}:null});var AC=Q((fst,EC)=>{"use strict";var BF=Function.prototype.call,IF=Object.prototype.hasOwnProperty,FF=ah();EC.exports=FF.call(BF,IF)});var fu=Q((pst,IC)=>{"use strict";var ct,GF=sg(),UF=_1(),kF=b1(),OF=T1(),NF=w1(),Fo=A1(),Io=rs(),DF=P1(),LF=M1(),HF=I1(),VF=G1(),WF=k1(),zF=N1(),$F=L1(),XF=z1(),MC=Function,ug=function(i){try{return MC('"use strict"; return ('+i+").constructor;")()}catch{}},hh=og(),jF=q1(),dg=function(){throw new Io},YF=hh?function(){try{return arguments.callee,dg}catch{try{return hh(arguments,"callee").get}catch{return dg}}}():dg,Mo=tC()(),ae=wC(),qF=ag(),KF=ng(),BC=hg(),lh=cu(),Bo={},ZF=typeof Uint8Array>"u"||!ae?ct:ae(Uint8Array),ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":Mo&&ae?ae([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Bo,"%AsyncGenerator%":Bo,"%AsyncGeneratorFunction%":Bo,"%AsyncIteratorPrototype%":Bo,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":UF,"%eval%":eval,"%EvalError%":kF,"%Float16Array%":typeof Float16Array>"u"?ct:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":MC,"%GeneratorFunction%":Bo,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Mo&&ae?ae(ae([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Mo||!ae?ct:ae(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":GF,"%Object.getOwnPropertyDescriptor%":hh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":OF,"%ReferenceError%":NF,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Mo||!ae?ct:ae(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Mo&&ae?ae(""[Symbol.iterator]()):ct,"%Symbol%":Mo?Symbol:ct,"%SyntaxError%":Fo,"%ThrowTypeError%":YF,"%TypedArray%":ZF,"%TypeError%":Io,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":DF,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":lh,"%Function.prototype.apply%":BC,"%Object.defineProperty%":jF,"%Object.getPrototypeOf%":qF,"%Math.abs%":LF,"%Math.floor%":HF,"%Math.max%":VF,"%Math.min%":WF,"%Math.pow%":zF,"%Math.round%":$F,"%Math.sign%":XF,"%Reflect.getPrototypeOf%":KF};if(ae)try{null.error}catch(i){CC=ae(ae(i)),ss["%Error.prototype%"]=CC}var CC,QF=function i(t){var e;if(t==="%AsyncFunction%")e=ug("async function () {}");else if(t==="%GeneratorFunction%")e=ug("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ug("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&ae&&(e=ae(s.prototype))}return ss[t]=e,e},PC={__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"]},ch=ah(),uu=AC(),JF=ch.call(lh,Array.prototype.concat),tG=ch.call(BC,Array.prototype.splice),RC=ch.call(lh,String.prototype.replace),du=ch.call(lh,String.prototype.slice),eG=ch.call(lh,RegExp.prototype.exec),rG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,iG=/\\(\\)?/g,sG=function(t){var e=du(t,0,1),r=du(t,-1);if(e==="%"&&r!=="%")throw new Fo("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Fo("invalid intrinsic syntax, expected opening `%`");var s=[];return RC(t,rG,function(o,n,a,h){s[s.length]=a?RC(h,iG,"$1"):n||o}),s},oG=function(t,e){var r=t,s;if(uu(PC,r)&&(s=PC[r],r="%"+s[0]+"%"),uu(ss,r)){var o=ss[r];if(o===Bo&&(o=QF(r)),typeof o>"u"&&!e)throw new Io("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new Fo("intrinsic "+t+" does not exist!")};IC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Io("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Io('"allowMissing" argument must be a boolean');if(eG(/^%?[^%]*%?$/,t)===null)throw new Fo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=sG(t),s=r.length>0?r[0]:"",o=oG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],tG(r,JF([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=du(d,0,1),p=du(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Fo("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",uu(ss,n))a=ss[n];else if(a!=null){if(!(d in a)){if(!e)throw new Io("base intrinsic for "+t+" exists, but the property is not available.");return}if(hh&&c+1>=r.length){var g=hh(a,d);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else u=uu(a,d),a=a[d];u&&!h&&(ss[n]=a)}}return a}});var fg=Q((mst,UC)=>{"use strict";var FC=fu(),GC=lg(),nG=GC([FC("%String.prototype.indexOf%")]);UC.exports=function(t,e){var r=FC(t,!!e);return typeof r=="function"&&nG(t,".prototype.")>-1?GC([r]):r}});var pg=Q((gst,OC)=>{"use strict";var aG=fu(),uh=fg(),hG=nh(),lG=rs(),kC=aG("%Map%",!0),cG=uh("Map.prototype.get",!0),uG=uh("Map.prototype.set",!0),dG=uh("Map.prototype.has",!0),fG=uh("Map.prototype.delete",!0),pG=uh("Map.prototype.size",!0);OC.exports=!!kC&&function(){var t,e={assert:function(r){if(!e.has(r))throw new lG("Side channel does not contain "+hG(r))},delete:function(r){if(t){var s=fG(t,r);return pG(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return cG(t,r)},has:function(r){return t?dG(t,r):!1},set:function(r,s){t||(t=new kC),uG(t,r,s)}};return e}});var DC=Q((xst,NC)=>{"use strict";var mG=fu(),mu=fg(),gG=nh(),pu=pg(),xG=rs(),Go=mG("%WeakMap%",!0),_G=mu("WeakMap.prototype.get",!0),yG=mu("WeakMap.prototype.set",!0),bG=mu("WeakMap.prototype.has",!0),vG=mu("WeakMap.prototype.delete",!0);NC.exports=Go?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new xG("Side channel does not contain "+gG(s))},delete:function(s){if(Go&&s&&(typeof s=="object"||typeof s=="function")){if(t)return vG(t,s)}else if(pu&&e)return e.delete(s);return!1},get:function(s){return Go&&s&&(typeof s=="object"||typeof s=="function")&&t?_G(t,s):e&&e.get(s)},has:function(s){return Go&&s&&(typeof s=="object"||typeof s=="function")&&t?bG(t,s):!!e&&e.has(s)},set:function(s,o){Go&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Go),yG(t,s,o)):pu&&(e||(e=pu()),e.set(s,o))}};return r}:pu});var HC=Q((_st,LC)=>{"use strict";var TG=rs(),SG=nh(),wG=m1(),EG=pg(),AG=DC(),CG=AG||EG||wG;LC.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new TG("Side channel does not contain "+SG(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=CG()),t.set(r,s)}};return e}});var gu=Q((yst,VC)=>{"use strict";var PG=String.prototype.replace,RG=/%20/g,mg={RFC1738:"RFC1738",RFC3986:"RFC3986"};VC.exports={default:mg.RFC3986,formatters:{RFC1738:function(i){return PG.call(i,RG,"+")},RFC3986:function(i){return String(i)}},RFC1738:mg.RFC1738,RFC3986:mg.RFC3986}});var _g=Q((bst,zC)=>{"use strict";var MG=gu(),gg=Object.prototype.hasOwnProperty,os=Array.isArray,Gr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),BG=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(os(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},WC=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},IG=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(os(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gg.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 os(t)&&!os(e)&&(s=WC(t,r)),os(t)&&os(e)?(e.forEach(function(o,n){if(gg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},FG=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},GG=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},xg=1024,UG=function(t,e,r,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)),r==="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="",h=0;h<n.length;h+=xg){for(var l=n.length>=xg?n.slice(h,h+xg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===MG.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=Gr[d];continue}if(d<2048){c[c.length]=Gr[192|d>>6]+Gr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Gr[224|d>>12]+Gr[128|d>>6&63]+Gr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=Gr[240|d>>18]+Gr[128|d>>12&63]+Gr[128|d>>6&63]+Gr[128|d&63]}a+=c.join("")}return a},kG=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return BG(e),t},OG=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},NG=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},DG=function(t,e){return[].concat(t,e)},LG=function(t,e){if(os(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};zC.exports={arrayToObject:WC,assign:FG,combine:DG,compact:kG,decode:GG,encode:UG,isBuffer:NG,isRegExp:OG,maybeMap:LG,merge:IG}});var KC=Q((vst,qC)=>{"use strict";var XC=HC(),xu=_g(),dh=gu(),HG=Object.prototype.hasOwnProperty,jC={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ur=Array.isArray,VG=Array.prototype.push,YC=function(i,t){VG.apply(i,Ur(t)?t:[t])},WG=Date.prototype.toISOString,$C=dh.default,Jt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xu.encode,encodeValuesOnly:!1,filter:void 0,format:$C,formatter:dh.formatters[$C],indices:!1,serializeDate:function(t){return WG.call(t)},skipNulls:!1,strictNullHandling:!1},zG=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},yg={},$G=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,g,x,v,_){for(var y=t,T=_,E=0,w=!1;(T=T.get(yg))!==void 0&&!w;){var C=T.get(t);if(E+=1,typeof C<"u"){if(C===E)throw new RangeError("Cyclic object value");w=!0}typeof T.get(yg)>"u"&&(E=0)}if(typeof c=="function"?y=c(e,y):y instanceof Date?y=f(y):r==="comma"&&Ur(y)&&(y=xu.maybeMap(y,function(Y){return Y instanceof Date?f(Y):Y})),y===null){if(n)return l&&!x?l(e,Jt.encoder,v,"key",p):e;y=""}if(zG(y)||xu.isBuffer(y)){if(l){var M=x?e:l(e,Jt.encoder,v,"key",p);return[g(M)+"="+g(l(y,Jt.encoder,v,"value",p))]}return[g(e)+"="+g(String(y))]}var P=[];if(typeof y>"u")return P;var S;if(r==="comma"&&Ur(y))x&&l&&(y=xu.maybeMap(y,l)),S=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ur(c))S=c;else{var A=Object.keys(y);S=u?A.sort(u):A}var B=h?String(e).replace(/\./g,"%2E"):String(e),F=s&&Ur(y)&&y.length===1?B+"[]":B;if(o&&Ur(y)&&y.length===0)return F+"[]";for(var W=0;W<S.length;++W){var z=S[W],k=typeof z=="object"&&z&&typeof z.value<"u"?z.value:y[z];if(!(a&&k===null)){var G=d&&h?String(z).replace(/\./g,"%2E"):String(z),N=Ur(y)?typeof r=="function"?r(F,G):F:F+(d?"."+G:"["+G+"]");_.set(t,E);var O=XC();O.set(yg,_),YC(P,i(k,N,r,s,o,n,a,h,r==="comma"&&x&&Ur(y)?null:l,c,u,d,f,p,g,x,v,O))}}return P},XG=function(t){if(!t)return Jt;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||Jt.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 r=dh.default;if(typeof t.format<"u"){if(!HG.call(dh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=dh.formatters[r],o=Jt.filter;(typeof t.filter=="function"||Ur(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in jC?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=Jt.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:Jt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Jt.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Jt.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Jt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Jt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Jt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Jt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Jt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Jt.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Jt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Jt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Jt.strictNullHandling}};qC.exports=function(i,t){var e=i,r=XG(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Ur(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=jC[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=XC(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||YC(n,$G(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var tP=Q((Tst,JC)=>{"use strict";var ns=_g(),bg=Object.prototype.hasOwnProperty,ZC=Array.isArray,Nt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},jG=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},QC=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.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 i},YG="utf8=%26%2310003%3B",qG="utf8=%E2%9C%93",KG=function(t,e){var r={__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,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===qG?l="utf-8":n[h]===YG&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,Nt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Nt.decoder,l,"key"),p=ns.maybeMap(QC(c.slice(d+1),e,ZC(r[f])?r[f].length:0),function(x){return e.decoder(x,Nt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=jG(String(p))),c.indexOf("[]=")>-1&&(p=ZC(p)?[p]:p);var g=bg.call(r,f);g&&e.duplicates==="combine"?r[f]=ns.combine(r[f],p):(!g||e.duplicates==="last")&&(r[f]=p)}return r},ZG=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:QC(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ns.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},QG=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&bg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&bg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return ZG(c,e,r,s)}},JG=function(t){if(!t)return Nt;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"?Nt.charset:t.charset,r=typeof t.duplicates>"u"?Nt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Nt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Nt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Nt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Nt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Nt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Nt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Nt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Nt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Nt.decoder,delimiter:typeof t.delimiter=="string"||ns.isRegExp(t.delimiter)?t.delimiter:Nt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Nt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Nt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Nt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Nt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Nt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Nt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};JC.exports=function(i,t){var e=JG(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?KG(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=QG(a,r[a],e,typeof i=="string");s=ns.merge(s,h,e)}return e.allowSparse===!0?s:ns.compact(s)}});var rP=Q((Sst,eP)=>{"use strict";var t2=KC(),e2=tP(),r2=gu();eP.exports={formats:r2,parse:e2,stringify:t2}});var nP=Q(ko=>{"use strict";var i2=$A();function nr(){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 s2=/^([a-z0-9.+-]+:)/i,o2=/:[0-9]*$/,n2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,a2=["<",">",'"',"`"," ","\r",`
|
|
1093
|
-
`," "],h2=["{","}","|","\\","^","`"].concat(a2),vg=["'"].concat(h2),iP=["%","/","?",";","#"].concat(vg),sP=["/","?","#"],l2=255,oP=/^[+a-z0-9A-Z_-]{0,63}$/,c2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,u2={javascript:!0,"javascript:":!0},Tg={javascript:!0,"javascript:":!0},Uo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sg=rP();function fh(i,t,e){if(i&&typeof i=="object"&&i instanceof nr)return i;var r=new nr;return r.parse(i,t,e),r}nr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=n2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=s2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Tg[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tg[l]&&(u||l&&!Uo[l])){for(var d=-1,f=0;f<sP.length;f++){var p=a.indexOf(sP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var g,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(g=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<iP.length;f++){var p=a.indexOf(iP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var _=this.hostname.split(/\./),f=0,y=_.length;f<y;f++){var T=_[f];if(T&&!T.match(oP)){for(var E="",w=0,C=T.length;w<C;w++)T.charCodeAt(w)>127?E+="x":E+=T[w];if(!E.match(oP)){var M=_.slice(0,f),P=_.slice(f+1),S=T.match(c2);S&&(M.push(S[1]),P.unshift(S[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>l2?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=i2.toASCII(this.hostname));var A=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+A,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!u2[c])for(var f=0,y=vg.length;f<y;f++){var F=vg[f];if(a.indexOf(F)!==-1){var W=encodeURIComponent(F);W===F&&(W=escape(F)),a=a.split(F).join(W)}}var z=a.indexOf("#");z!==-1&&(this.hash=a.substr(z),a=a.slice(0,z));var k=a.indexOf("?");if(k!==-1?(this.search=a.substr(k),this.query=a.substr(k+1),t&&(this.query=Sg.parse(this.query)),a=a.slice(0,k)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Uo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var A=this.pathname||"",G=this.search||"";this.path=A+G}return this.href=this.format(),this};function d2(i){return typeof i=="string"&&(i=fh(i)),i instanceof nr?i.format():nr.prototype.format.call(i)}nr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(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=Sg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Uo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function f2(i,t){return fh(i,!1,!0).resolve(t)}nr.prototype.resolve=function(i){return this.resolveObject(fh(i,!1,!0)).format()};function p2(i,t){return i?fh(i,!1,!0).resolveObject(t):t}nr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new nr;t.parse(i,!1,!0),i=t}for(var e=new nr,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Uo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Uo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!Tg[i.protocol]){for(var y=(i.pathname||"").split("/");y.length&&!(i.host=y.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",g=i.host||i.pathname&&i.pathname.charAt(0)==="/",x=g||p||e.host&&i.pathname,v=x,_=e.pathname&&e.pathname.split("/")||[],y=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Uo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(y[0]===""?y[0]=i.host:y.unshift(i.host)),i.host=null),x=x&&(y[0]===""||_[0]==="")),g)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=y;else if(y.length)_||(_=[]),_.pop(),_=_.concat(y),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.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=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var w=_.slice(-1)[0],C=(e.host||i.host||_.length>1)&&(w==="."||w==="..")||w==="",M=0,P=_.length;P>=0;P--)w=_[P],w==="."?_.splice(P,1):w===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!x&&!v)for(;M--;M)_.unshift("..");x&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),C&&_.join("/").substr(-1)!=="/"&&_.push("");var S=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=S?"":_.length?_.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 x=x||e.host&&_.length,x&&!S&&_.unshift(""),_.length>0?e.pathname=_.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=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};nr.prototype.parseHost=function(){var i=this.host,t=o2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};ko.parse=fh;ko.resolve=f2;ko.resolveObject=p2;ko.format=d2;ko.Url=nr});R();var KT={extension:{type:b.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(qT(),vB))}};R();var QT={extension:{type:b.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(ZT(),TB))}};R();R();Al();yl();R();At();ra();var bc;function nS(i){return bc!==void 0||(bc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ti.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let r=j.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),bc}At();var vc;async function aS(i={}){return vc!==void 0||(vc=await(async()=>{let t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),vc}ra();var bA=["webgl","webgpu","canvas"];async function vA(i){let t=[];i.preference?(t.push(i.preference),bA.forEach(o=>{o!==i.preference&&t.push(o)})):t=bA.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await aS()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(jw(),Xw));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&nS(i.failIfMajorPerformanceCaveat??Ti.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(yA(),_A));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}ur();qp();Ft();var TA=class Om{constructor(...t){this.stage=new yt,t[0]!==void 0&&X(tt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await vA(t),Om._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(tt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Om._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};TA._plugins=[];var Za=TA;D.handleByList(b.Application,Za._plugins);D.add(da);R();Xr();qd();At();R();Wi();qt();_t();Ep();Mp();var Qa=class extends oo{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new rt(n.x+a.x,n.y+a.y,n.width,n.height),c=new I({source:h,frame:l});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){Yn.install(t)}static uninstall(t){Yn.uninstall(t)}};var jc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let g in f){let x=f[g].split("="),v=x[0],_=x[1].replace(/"/gm,""),y=parseFloat(_),T=isNaN(y)?_:y;p[v]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};At();var Nm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[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 l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Dm={test(i){return typeof i=="string"&&i.includes("<font>")?Nm.test(j.get().parseXML(i)):!1},parse(i){return Nm.parse(j.get().parseXML(i))}};var rI=[".xml",".fnt"],SA={extension:{type:b.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Qa,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},wA={extension:{type:b.LoadParser,priority:se.Normal},name:"loadBitmapFont",test(i){return rI.includes(Kt.extname(i).toLowerCase())},async testParse(i){return jc.test(i)||Dm.test(i)},async parse(i,t,e){let r=jc.test(i)?jc.parse(i):Dm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=Kt.join(Kt.dirname(s),d);f=Tn(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new Qa({data:r,textures:l},s)},async load(i,t){return await(await j.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};Tt();var Yc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};pi();R();_t();var EA={extension:{type:b.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof I),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};R();async function qc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var AA={extension:{type:b.DetectionParser,priority:1},test:async()=>qc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};R();var CA=["png","jpg","jpeg"],PA={extension:{type:b.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...CA],remove:async i=>i.filter(t=>!CA.includes(t))};R();var iI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function bo(i){return iI?!1:document.createElement("video").canPlayType(i)!==""}var RA={extension:{type:b.DetectionParser,priority:0},test:async()=>bo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};R();var MA={extension:{type:b.DetectionParser,priority:0},test:async()=>bo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};R();var BA={extension:{type:b.DetectionParser,priority:0},test:async()=>bo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};R();var IA={extension:{type:b.DetectionParser,priority:0},test:async()=>qc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};Tt();Wi();vn();_l();var Kc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||H(`[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 H(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=zi(t),n=we(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=Kt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
-
${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=
|
|
1089
|
+
`))}var FA=g(()=>{Mc();Ae();om();BA()});var Za,GA=g(()=>{C();FA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return IA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[_.WebGLSystem],name:"uniformGroup"}});function UA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof $.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var kA=g(()=>{Mt()});var QB,JB,tI,eI,rI,iI,OA,LA,DA=g(()=>{C();gr();kA();QB=0,JB=1,tI=2,eI=3,rI=4,iI=5,OA=class wm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[QB]=this.setBlend,this.map[JB]=this.setOffset,this.map[tI]=this.setCullFace,this.map[eI]=this.setDepthTest,this.map[rI]=this.setFrontFace,this.map[iI]=this.setDepthMask,this.checks=[],this.defaultState=Xt.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=UA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(wm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(wm._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};OA.extension={type:[_.WebGLSystem],name:"state"};LA=OA});var $c,NA=g(()=>{xm();$c=class{constructor(t){this.target=gm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var HA,VA=g(()=>{"use strict";HA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var sI,WA,zA=g(()=>{"use strict";sI={"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},WA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!sI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Cm=g(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var $A,XA=g(()=>{Cm();$A={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Pm,jA,jc,YA,qA=g(()=>{"use strict";Pm={linear:9729,nearest:9728},jA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},YA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Rm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Pm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=jA[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Pm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,YA[i.compare])}var KA=g(()=>{qA()});function ZA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var QA=g(()=>{"use strict"});function JA(i,t){let e={},r=i.RGBA;return i instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var tw=g(()=>{Mt()});function ew(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var rw=g(()=>{"use strict"});var oI,Qa,iw=g(()=>{Mt();C();bt();NA();VA();zA();Cm();XA();KA();QA();tw();rw();oI=4,Qa=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:Xc,buffer:HA,video:$A,compressed:WA},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=JA(t,this._renderer.context.extensions),this._mapFormatToType=ew(t),this._mapFormatToFormat=ZA(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(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Rm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Rm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=$.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(oI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.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(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[_.WebGLSystem],name:"texture"}});var aw={};nx(aw,{WebGLRenderer:()=>Mm});var nI,aI,hI,sw,ow,nw,Mm,hw=g(()=>{C();OE();LE();DE();sa();rm();Br();VE();$E();qE();QE();JE();tA();eA();aA();cA();PA();GA();DA();iw();nI=[...Cc,Ya,ZE,zE,Wa,Qa,qa,za,Za,Ka,Xa,LA,ja,$a],aI=[...Pc],hI=[Ha,Na,Da],sw=[],ow=[],nw=[];G.handleByNamedList(_.WebGLSystem,sw);G.handleByNamedList(_.WebGLPipes,ow);G.handleByNamedList(_.WebGLPipesAdaptor,nw);G.add(...nI,...aI,...hI);Mm=class extends Ai{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:sw,renderPipes:ow,renderPipeAdaptors:nw};super(t)}}});var h1=K((wnt,Wm)=>{"use strict";var oF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function nF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function a1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new nF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function su(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)oF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return a1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return a1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return su(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&su(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:su(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&su(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof Wm<"u"&&(Wm.exports=be)});var l1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,b=Math.floor,T=String.fromCharCode,w;function S(D){throw new RangeError(v[D])}function A(D,k){for(var tt=D.length,pt=[];tt--;)pt[tt]=k(D[tt]);return pt}function R(D,k){var tt=D.split("@"),pt="";tt.length>1&&(pt=tt[0]+"@",D=tt[1]),D=D.replace(x,".");var dt=D.split("."),Ut=A(dt,k).join(".");return pt+Ut}function I(D){for(var k=[],tt=0,pt=D.length,dt,Ut;tt<pt;)dt=D.charCodeAt(tt++),dt>=55296&&dt<=56319&&tt<pt?(Ut=D.charCodeAt(tt++),(Ut&64512)==56320?k.push(((dt&1023)<<10)+(Ut&1023)+65536):(k.push(dt),tt--)):k.push(dt);return k}function P(D){return A(D,function(k){var tt="";return k>65535&&(k-=65536,tt+=T(k>>>10&1023|55296),k=56320|k&1023),tt+=T(k),tt}).join("")}function B(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:n}function W(D,k){return D+22+75*(D<26)-((k!=0)<<5)}function N(D,k,tt){var pt=0;for(D=tt?b(D/c):D>>1,D+=b(D/k);D>y*h>>1;pt+=n)D=b(D/y);return b(pt+(y+1)*D/(D+l))}function nt(D){var k=[],tt=D.length,pt,dt=0,Ut=d,Ht=u,qt,Kt,Tt,St,at,Rt,re,$t,ae;for(qt=D.lastIndexOf(f),qt<0&&(qt=0),Kt=0;Kt<qt;++Kt)D.charCodeAt(Kt)>=128&&S("not-basic"),k.push(D.charCodeAt(Kt));for(Tt=qt>0?qt+1:0;Tt<tt;){for(St=dt,at=1,Rt=n;Tt>=tt&&S("invalid-input"),re=B(D.charCodeAt(Tt++)),(re>=n||re>b((o-dt)/at))&&S("overflow"),dt+=re*at,$t=Rt<=Ht?a:Rt>=Ht+h?h:Rt-Ht,!(re<$t);Rt+=n)ae=n-$t,at>b(o/ae)&&S("overflow"),at*=ae;pt=k.length+1,Ht=N(dt-St,pt,St==0),b(dt/pt)>o-Ut&&S("overflow"),Ut+=b(dt/pt),dt%=pt,k.splice(dt++,0,Ut)}return P(k)}function j(D){var k,tt,pt,dt,Ut,Ht,qt,Kt,Tt,St,at,Rt=[],re,$t,ae,ur;for(D=I(D),re=D.length,k=d,tt=0,Ut=u,Ht=0;Ht<re;++Ht)at=D[Ht],at<128&&Rt.push(T(at));for(pt=dt=Rt.length,dt&&Rt.push(f);pt<re;){for(qt=o,Ht=0;Ht<re;++Ht)at=D[Ht],at>=k&&at<qt&&(qt=at);for($t=pt+1,qt-k>b((o-tt)/$t)&&S("overflow"),tt+=(qt-k)*$t,k=qt,Ht=0;Ht<re;++Ht)if(at=D[Ht],at<k&&++tt>o&&S("overflow"),at==k){for(Kt=tt,Tt=n;St=Tt<=Ut?a:Tt>=Ut+h?h:Tt-Ut,!(Kt<St);Tt+=n)ur=Kt-St,ae=n-St,Rt.push(T(W(St+ur%ae,0))),Kt=b(ur/ae);Rt.push(T(W(Kt,0))),Ut=N(tt,$t,pt==dt),tt=0,++pt}++tt,++k}return Rt.join("")}function F(D){return R(D,function(k){return p.test(k)?nt(k.slice(4).toLowerCase()):k})}function H(D){return R(D,function(k){return m.test(k)?"xn--"+j(k):k})}if(s={version:"1.4.1",ucs2:{decode:I,encode:P},decode:nt,encode:j,toASCII:H,toUnicode:F},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var is=K((Cnt,c1)=>{"use strict";c1.exports=TypeError});var u1=K(()=>{});var lh=K((Mnt,B1)=>{var Jm=typeof Map=="function"&&Map.prototype,zm=Object.getOwnPropertyDescriptor&&Jm?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,nu=Jm&&zm&&typeof zm.get=="function"?zm.get:null,d1=Jm&&Map.prototype.forEach,tg=typeof Set=="function"&&Set.prototype,$m=Object.getOwnPropertyDescriptor&&tg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,au=tg&&$m&&typeof $m.get=="function"?$m.get:null,f1=tg&&Set.prototype.forEach,aF=typeof WeakMap=="function"&&WeakMap.prototype,nh=aF?WeakMap.prototype.has:null,hF=typeof WeakSet=="function"&&WeakSet.prototype,ah=hF?WeakSet.prototype.has:null,lF=typeof WeakRef=="function"&&WeakRef.prototype,p1=lF?WeakRef.prototype.deref:null,cF=Boolean.prototype.valueOf,uF=Object.prototype.toString,dF=Function.prototype.toString,fF=String.prototype.match,eg=String.prototype.slice,Ri=String.prototype.replace,pF=String.prototype.toUpperCase,m1=String.prototype.toLowerCase,E1=RegExp.prototype.test,g1=Array.prototype.concat,kr=Array.prototype.join,mF=Array.prototype.slice,x1=Math.floor,Ym=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Xm=Object.getOwnPropertySymbols,qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,A1=Object.prototype.propertyIsEnumerable,_1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function y1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||E1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-x1(-i):x1(i);if(r!==i){var s=String(r),o=eg.call(t,s.length+1);return Ri.call(s,e,"$&_")+"."+Ri.call(Ri.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ri.call(t,e,"$&_")}var Km=u1(),b1=Km.custom,v1=P1(b1)?b1:null,w1={__proto__:null,double:'"',single:"'"},gF={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};B1.exports=function i(t,e,r,s){var o=e||{};if(ii(o,"quoteStyle")&&!ii(w1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ii(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=ii(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(ii(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(ii(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 M1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?y1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?y1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Zm(t)?"[Array]":"[Object]";var u=GF(o,r);if(typeof s>"u")s=[];else if(R1(s,t)>=0)return"[Circular]";function d(N,nt,j){if(nt&&(s=mF.call(s),s.push(nt)),j){var F={depth:o.depth};return ii(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),i(N,F,r+1,s)}return i(N,o,r+1,s)}if(typeof t=="function"&&!T1(t)){var f=AF(t),p=ou(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+kr.call(p,", ")+" }":"")}if(P1(t)){var m=Io?Ri.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(BF(t)){for(var x="<"+m1.call(String(t.nodeName)),v=t.attributes||[],y=0;y<v.length;y++)x+=" "+v[y].name+"="+C1(xF(v[y].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+m1.call(String(t.nodeName))+">",x}if(Zm(t)){if(t.length===0)return"[]";var b=ou(t,d);return u&&!FF(b)?"["+Qm(b,u)+"]":"[ "+kr.call(b,", ")+" ]"}if(yF(t)){var T=ou(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!A1.call(t,"cause")?"{ ["+String(t)+"] "+kr.call(g1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+kr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(v1&&typeof t[v1]=="function"&&Km)return Km(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(wF(t)){var w=[];return d1&&d1.call(t,function(N,nt){w.push(d(nt,t,!0)+" => "+d(N,t))}),S1("Map",nu.call(t),w,u)}if(RF(t)){var S=[];return f1&&f1.call(t,function(N){S.push(d(N,t))}),S1("Set",au.call(t),S,u)}if(CF(t))return jm("WeakMap");if(MF(t))return jm("WeakSet");if(PF(t))return jm("WeakRef");if(vF(t))return oh(d(Number(t)));if(SF(t))return oh(d(Ym.call(t)));if(TF(t))return oh(cF.call(t));if(bF(t))return oh(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(!_F(t)&&!T1(t)){var A=ou(t,d),R=_1?_1(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",P=!R&&hh&&Object(t)===t&&hh in t?eg.call(Mi(t),8,-1):I?"Object":"",B=R||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",W=B+(P||I?"["+kr.call(g1.call([],P||[],I||[]),": ")+"] ":"");return A.length===0?W+"{}":u?W+"{"+Qm(A,u)+"}":W+"{ "+kr.call(A,", ")+" }"}return String(t)};function C1(i,t,e){var r=e.quoteStyle||t,s=w1[r];return s+i+s}function xF(i){return Ri.call(String(i),/"/g,""")}function ss(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Zm(i){return Mi(i)==="[object Array]"&&ss(i)}function _F(i){return Mi(i)==="[object Date]"&&ss(i)}function T1(i){return Mi(i)==="[object RegExp]"&&ss(i)}function yF(i){return Mi(i)==="[object Error]"&&ss(i)}function bF(i){return Mi(i)==="[object String]"&&ss(i)}function vF(i){return Mi(i)==="[object Number]"&&ss(i)}function TF(i){return Mi(i)==="[object Boolean]"&&ss(i)}function P1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!qm)return!1;try{return qm.call(i),!0}catch{}return!1}function SF(i){if(!i||typeof i!="object"||!Ym)return!1;try{return Ym.call(i),!0}catch{}return!1}var EF=Object.prototype.hasOwnProperty||function(i){return i in this};function ii(i,t){return EF.call(i,t)}function Mi(i){return uF.call(i)}function AF(i){if(i.name)return i.name;var t=fF.call(dF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function R1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function wF(i){if(!nu||!i||typeof i!="object")return!1;try{nu.call(i);try{au.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function CF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function PF(i){if(!p1||!i||typeof i!="object")return!1;try{return p1.call(i),!0}catch{}return!1}function RF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{nu.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function MF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function BF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function M1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return M1(eg.call(i,0,t.maxStringLength),t)+r}var s=gF[t.quoteStyle||"single"];s.lastIndex=0;var o=Ri.call(Ri.call(i,s,"\\$1"),/[\x00-\x1f]/g,IF);return C1(o,"single",t)}function IF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+pF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function jm(i){return i+" { ? }"}function S1(i,t,e,r){var s=r?Qm(e,r):kr.call(e,", ");return i+" ("+t+") {"+s+"}"}function FF(i){for(var t=0;t<i.length;t++)if(R1(i[t],`
|
|
1090
|
+
`)>=0)return!1;return!0}function GF(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=kr.call(Array(i.indent+1)," ");else return null;return{base:e,prev:kr.call(Array(t+1),e)}}function Qm(i,t){if(i.length===0)return"";var e=`
|
|
1091
|
+
`+t.prev+t.base;return e+kr.call(i,","+e)+`
|
|
1092
|
+
`+t.prev}function ou(i,t){var e=Zm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ii(i,s)?t(i[s],i):""}var o=typeof Xm=="function"?Xm(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ii(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(E1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Xm=="function")for(var l=0;l<o.length;l++)A1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var F1=K((Bnt,I1)=>{"use strict";var UF=lh(),kF=is(),hu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},OF=function(i,t){if(i){var e=hu(i,t);return e&&e.value}},LF=function(i,t,e){var r=hu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},DF=function(i,t){return i?!!hu(i,t):!1},NF=function(i,t){if(i)return hu(i,t,!0)};I1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new kF("Side channel does not contain "+UF(r))},delete:function(r){var s=t&&t.next,o=NF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return OF(t,r)},has:function(r){return DF(t,r)},set:function(r,s){t||(t={next:void 0}),LF(t,r,s)}};return e}});var rg=K((Int,G1)=>{"use strict";G1.exports=Object});var k1=K((Fnt,U1)=>{"use strict";U1.exports=Error});var L1=K((Gnt,O1)=>{"use strict";O1.exports=EvalError});var N1=K((Unt,D1)=>{"use strict";D1.exports=RangeError});var V1=K((knt,H1)=>{"use strict";H1.exports=ReferenceError});var z1=K((Ont,W1)=>{"use strict";W1.exports=SyntaxError});var X1=K((Lnt,$1)=>{"use strict";$1.exports=URIError});var Y1=K((Dnt,j1)=>{"use strict";j1.exports=Math.abs});var K1=K((Nnt,q1)=>{"use strict";q1.exports=Math.floor});var Q1=K((Hnt,Z1)=>{"use strict";Z1.exports=Math.max});var tC=K((Vnt,J1)=>{"use strict";J1.exports=Math.min});var rC=K((Wnt,eC)=>{"use strict";eC.exports=Math.pow});var sC=K((znt,iC)=>{"use strict";iC.exports=Math.round});var nC=K(($nt,oC)=>{"use strict";oC.exports=Number.isNaN||function(t){return t!==t}});var hC=K((Xnt,aC)=>{"use strict";var HF=nC();aC.exports=function(t){return HF(t)||t===0?t:t<0?-1:1}});var cC=K((jnt,lC)=>{"use strict";lC.exports=Object.getOwnPropertyDescriptor});var ig=K((Ynt,uC)=>{"use strict";var lu=cC();if(lu)try{lu([],"length")}catch{lu=null}uC.exports=lu});var fC=K((qnt,dC)=>{"use strict";var cu=Object.defineProperty||!1;if(cu)try{cu({},"a",{value:1})}catch{cu=!1}dC.exports=cu});var mC=K((Knt,pC)=>{"use strict";pC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[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 _C=K((Znt,xC)=>{"use strict";var gC=typeof Symbol<"u"&&Symbol,VF=mC();xC.exports=function(){return typeof gC!="function"||typeof Symbol!="function"||typeof gC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:VF()}});var sg=K((Qnt,yC)=>{"use strict";yC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var og=K((Jnt,bC)=>{"use strict";var WF=rg();bC.exports=WF.getPrototypeOf||null});var SC=K((tat,TC)=>{"use strict";var zF="Function.prototype.bind called on incompatible ",$F=Object.prototype.toString,XF=Math.max,jF="[object Function]",vC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},YF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},qF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};TC.exports=function(t){var e=this;if(typeof e!="function"||$F.apply(e)!==jF)throw new TypeError(zF+e);for(var r=YF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,vC(r,arguments));return Object(c)===c?c:this}return e.apply(t,vC(r,arguments))},n=XF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+qF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((eat,EC)=>{"use strict";var KF=SC();EC.exports=Function.prototype.bind||KF});var uu=K((rat,AC)=>{"use strict";AC.exports=Function.prototype.call});var ng=K((iat,wC)=>{"use strict";wC.exports=Function.prototype.apply});var PC=K((sat,CC)=>{"use strict";CC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var MC=K((oat,RC)=>{"use strict";var ZF=ch(),QF=ng(),JF=uu(),tG=PC();RC.exports=tG||ZF.call(JF,QF)});var ag=K((nat,BC)=>{"use strict";var eG=ch(),rG=is(),iG=uu(),sG=MC();BC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new rG("a function is required");return sG(eG,iG,t)}});var OC=K((aat,kC)=>{"use strict";var oG=ag(),IC=ig(),GC;try{GC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var hg=!!GC&&IC&&IC(Object.prototype,"__proto__"),UC=Object,FC=UC.getPrototypeOf;kC.exports=hg&&typeof hg.get=="function"?oG([hg.get]):typeof FC=="function"?function(t){return FC(t==null?t:UC(t))}:!1});var VC=K((hat,HC)=>{"use strict";var LC=sg(),DC=og(),NC=OC();HC.exports=LC?function(t){return LC(t)}:DC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return DC(t)}:NC?function(t){return NC(t)}:null});var zC=K((lat,WC)=>{"use strict";var nG=Function.prototype.call,aG=Object.prototype.hasOwnProperty,hG=ch();WC.exports=hG.call(nG,aG)});var pu=K((cat,KC)=>{"use strict";var ct,lG=rg(),cG=k1(),uG=L1(),dG=N1(),fG=V1(),ko=z1(),Uo=is(),pG=X1(),mG=Y1(),gG=K1(),xG=Q1(),_G=tC(),yG=rC(),bG=sC(),vG=hC(),YC=Function,lg=function(i){try{return YC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=ig(),TG=fC(),cg=function(){throw new Uo},SG=uh?function(){try{return arguments.callee,cg}catch{try{return uh(arguments,"callee").get}catch{return cg}}}():cg,Fo=_C()(),fe=VC(),EG=og(),AG=sg(),qC=ng(),dh=uu(),Go={},wG=typeof Uint8Array>"u"||!fe?ct:fe(Uint8Array),os={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&fe?fe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cG,"%eval%":eval,"%EvalError%":uG,"%Float16Array%":typeof Float16Array>"u"?ct:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":YC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&fe?fe(fe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!fe?ct:fe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":lG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":dG,"%ReferenceError%":fG,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!fe?ct:fe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&fe?fe(""[Symbol.iterator]()):ct,"%Symbol%":Fo?Symbol:ct,"%SyntaxError%":ko,"%ThrowTypeError%":SG,"%TypedArray%":wG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":pG,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":qC,"%Object.defineProperty%":TG,"%Object.getPrototypeOf%":EG,"%Math.abs%":mG,"%Math.floor%":gG,"%Math.max%":xG,"%Math.min%":_G,"%Math.pow%":yG,"%Math.round%":bG,"%Math.sign%":vG,"%Reflect.getPrototypeOf%":AG};if(fe)try{null.error}catch(i){$C=fe(fe(i)),os["%Error.prototype%"]=$C}var $C,CG=function i(t){var e;if(t==="%AsyncFunction%")e=lg("async function () {}");else if(t==="%GeneratorFunction%")e=lg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=lg("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&fe&&(e=fe(s.prototype))}return os[t]=e,e},XC={__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"]},fh=ch(),du=zC(),PG=fh.call(dh,Array.prototype.concat),RG=fh.call(qC,Array.prototype.splice),jC=fh.call(dh,String.prototype.replace),fu=fh.call(dh,String.prototype.slice),MG=fh.call(dh,RegExp.prototype.exec),BG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,IG=/\\(\\)?/g,FG=function(t){var e=fu(t,0,1),r=fu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return jC(t,BG,function(o,n,a,h){s[s.length]=a?jC(h,IG,"$1"):n||o}),s},GG=function(t,e){var r=t,s;if(du(XC,r)&&(s=XC[r],r="%"+s[0]+"%"),du(os,r)){var o=os[r];if(o===Go&&(o=CG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};KC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(MG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=FG(t),s=r.length>0?r[0]:"",o=GG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],RG(r,PG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=fu(d,0,1),p=fu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",du(os,n))a=os[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=du(a,d),a=a[d];u&&!h&&(os[n]=a)}}return a}});var ug=K((uat,JC)=>{"use strict";var ZC=pu(),QC=ag(),UG=QC([ZC("%String.prototype.indexOf%")]);JC.exports=function(t,e){var r=ZC(t,!!e);return typeof r=="function"&&UG(t,".prototype.")>-1?QC([r]):r}});var dg=K((dat,eP)=>{"use strict";var kG=pu(),ph=ug(),OG=lh(),LG=is(),tP=kG("%Map%",!0),DG=ph("Map.prototype.get",!0),NG=ph("Map.prototype.set",!0),HG=ph("Map.prototype.has",!0),VG=ph("Map.prototype.delete",!0),WG=ph("Map.prototype.size",!0);eP.exports=!!tP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new LG("Side channel does not contain "+OG(r))},delete:function(r){if(t){var s=VG(t,r);return WG(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return DG(t,r)},has:function(r){return t?HG(t,r):!1},set:function(r,s){t||(t=new tP),NG(t,r,s)}};return e}});var iP=K((fat,rP)=>{"use strict";var zG=pu(),gu=ug(),$G=lh(),mu=dg(),XG=is(),Oo=zG("%WeakMap%",!0),jG=gu("WeakMap.prototype.get",!0),YG=gu("WeakMap.prototype.set",!0),qG=gu("WeakMap.prototype.has",!0),KG=gu("WeakMap.prototype.delete",!0);rP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new XG("Side channel does not contain "+$G(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return KG(t,s)}else if(mu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?jG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),YG(t,s,o)):mu&&(e||(e=mu()),e.set(s,o))}};return r}:mu});var oP=K((pat,sP)=>{"use strict";var ZG=is(),QG=lh(),JG=F1(),t2=dg(),e2=iP(),r2=e2||t2||JG;sP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new ZG("Side channel does not contain "+QG(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=r2()),t.set(r,s)}};return e}});var xu=K((mat,nP)=>{"use strict";var i2=String.prototype.replace,s2=/%20/g,fg={RFC1738:"RFC1738",RFC3986:"RFC3986"};nP.exports={default:fg.RFC3986,formatters:{RFC1738:function(i){return i2.call(i,s2,"+")},RFC3986:function(i){return String(i)}},RFC1738:fg.RFC1738,RFC3986:fg.RFC3986}});var gg=K((gat,hP)=>{"use strict";var o2=xu(),pg=Object.prototype.hasOwnProperty,ns=Array.isArray,Or=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),n2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(ns(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},aP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},a2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ns(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!pg.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 ns(t)&&!ns(e)&&(s=aP(t,r)),ns(t)&&ns(e)?(e.forEach(function(o,n){if(pg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return pg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},h2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},l2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},mg=1024,c2=function(t,e,r,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)),r==="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="",h=0;h<n.length;h+=mg){for(var l=n.length>=mg?n.slice(h,h+mg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===o2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=Or[d];continue}if(d<2048){c[c.length]=Or[192|d>>6]+Or[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Or[224|d>>12]+Or[128|d>>6&63]+Or[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=Or[240|d>>18]+Or[128|d>>12&63]+Or[128|d>>6&63]+Or[128|d&63]}a+=c.join("")}return a},u2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return n2(e),t},d2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},f2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},p2=function(t,e){return[].concat(t,e)},m2=function(t,e){if(ns(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};hP.exports={arrayToObject:aP,assign:h2,combine:p2,compact:u2,decode:l2,encode:c2,isBuffer:f2,isRegExp:d2,maybeMap:m2,merge:a2}});var pP=K((xat,fP)=>{"use strict";var cP=oP(),_u=gg(),mh=xu(),g2=Object.prototype.hasOwnProperty,uP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Lr=Array.isArray,x2=Array.prototype.push,dP=function(i,t){x2.apply(i,Lr(t)?t:[t])},_2=Date.prototype.toISOString,lP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_u.encode,encodeValuesOnly:!1,filter:void 0,format:lP,formatter:mh.formatters[lP],indices:!1,serializeDate:function(t){return _2.call(t)},skipNulls:!1,strictNullHandling:!1},y2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},xg={},b2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,x,v,y){for(var b=t,T=y,w=0,S=!1;(T=T.get(xg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(xg)>"u"&&(w=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=f(b):r==="comma"&&Lr(b)&&(b=_u.maybeMap(b,function(tt){return tt instanceof Date?f(tt):tt})),b===null){if(n)return l&&!x?l(e,oe.encoder,v,"key",p):e;b=""}if(y2(b)||_u.isBuffer(b)){if(l){var R=x?e:l(e,oe.encoder,v,"key",p);return[m(R)+"="+m(l(b,oe.encoder,v,"value",p))]}return[m(e)+"="+m(String(b))]}var I=[];if(typeof b>"u")return I;var P;if(r==="comma"&&Lr(b))x&&l&&(b=_u.maybeMap(b,l)),P=[{value:b.length>0?b.join(",")||null:void 0}];else if(Lr(c))P=c;else{var B=Object.keys(b);P=u?B.sort(u):B}var W=h?String(e).replace(/\./g,"%2E"):String(e),N=s&&Lr(b)&&b.length===1?W+"[]":W;if(o&&Lr(b)&&b.length===0)return N+"[]";for(var nt=0;nt<P.length;++nt){var j=P[nt],F=typeof j=="object"&&j&&typeof j.value<"u"?j.value:b[j];if(!(a&&F===null)){var H=d&&h?String(j).replace(/\./g,"%2E"):String(j),D=Lr(b)?typeof r=="function"?r(N,H):N:N+(d?"."+H:"["+H+"]");y.set(t,w);var k=cP();k.set(xg,y),dP(I,i(F,D,r,s,o,n,a,h,r==="comma"&&x&&Lr(b)?null:l,c,u,d,f,p,m,x,v,k))}}return I},v2=function(t){if(!t)return oe;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||oe.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 r=mh.default;if(typeof t.format<"u"){if(!g2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Lr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in uP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.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:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};fP.exports=function(i,t){var e=i,r=v2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Lr(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=uP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=cP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||dP(n,b2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var _P=K((_at,xP)=>{"use strict";var as=gg(),_g=Object.prototype.hasOwnProperty,mP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:as.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},T2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},gP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.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 i},S2="utf8=%26%2310003%3B",E2="utf8=%E2%9C%93",A2=function(t,e){var r={__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,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===E2?l="utf-8":n[h]===S2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=as.maybeMap(gP(c.slice(d+1),e,mP(r[f])?r[f].length:0),function(x){return e.decoder(x,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=T2(String(p))),c.indexOf("[]=")>-1&&(p=mP(p)?[p]:p);var m=_g.call(r,f);m&&e.duplicates==="combine"?r[f]=as.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},w2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:gP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:as.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},C2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&_g.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&_g.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return w2(c,e,r,s)}},P2=function(t){if(!t)return zt;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"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||as.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};xP.exports=function(i,t){var e=P2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?A2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=C2(a,r[a],e,typeof i=="string");s=as.merge(s,h,e)}return e.allowSparse===!0?s:as.compact(s)}});var bP=K((yat,yP)=>{"use strict";var R2=pP(),M2=_P(),B2=xu();yP.exports={formats:B2,parse:M2,stringify:R2}});var EP=K(Do=>{"use strict";var I2=l1();function ar(){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 F2=/^([a-z0-9.+-]+:)/i,G2=/:[0-9]*$/,U2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,k2=["<",">",'"',"`"," ","\r",`
|
|
1093
|
+
`," "],O2=["{","}","|","\\","^","`"].concat(k2),yg=["'"].concat(O2),vP=["%","/","?",";","#"].concat(yg),TP=["/","?","#"],L2=255,SP=/^[+a-z0-9A-Z_-]{0,63}$/,D2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,N2={javascript:!0,"javascript:":!0},bg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},vg=bP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof ar)return i;var r=new ar;return r.parse(i,t,e),r}ar.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=U2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=vg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=F2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&bg[l])&&(a=a.substr(2),this.slashes=!0)}if(!bg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(m=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<vP.length;f++){var p=a.indexOf(vP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var y=this.hostname.split(/\./),f=0,b=y.length;f<b;f++){var T=y[f];if(T&&!T.match(SP)){for(var w="",S=0,A=T.length;S<A;S++)T.charCodeAt(S)>127?w+="x":w+=T[S];if(!w.match(SP)){var R=y.slice(0,f),I=y.slice(f+1),P=T.match(D2);P&&(R.push(P[1]),I.unshift(P[2])),I.length&&(a="/"+I.join(".")+a),this.hostname=R.join(".");break}}}this.hostname.length>L2?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=I2.toASCII(this.hostname));var B=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+B,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!N2[c])for(var f=0,b=yg.length;f<b;f++){var N=yg[f];if(a.indexOf(N)!==-1){var nt=encodeURIComponent(N);nt===N&&(nt=escape(N)),a=a.split(N).join(nt)}}var j=a.indexOf("#");j!==-1&&(this.hash=a.substr(j),a=a.slice(0,j));var F=a.indexOf("?");if(F!==-1?(this.search=a.substr(F),this.query=a.substr(F+1),t&&(this.query=vg.parse(this.query)),a=a.slice(0,F)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",H=this.search||"";this.path=B+H}return this.href=this.format(),this};function H2(i){return typeof i=="string"&&(i=gh(i)),i instanceof ar?i.format():ar.prototype.format.call(i)}ar.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(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=vg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function V2(i,t){return gh(i,!1,!0).resolve(t)}ar.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function W2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}ar.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new ar;t.parse(i,!1,!0),i=t}for(var e=new ar,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!bg[i.protocol]){for(var b=(i.pathname||"").split("/");b.length&&!(i.host=b.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",x=m||p||e.host&&i.pathname,v=x,y=e.pathname&&e.pathname.split("/")||[],b=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(b[0]===""?b[0]=i.host:b.unshift(i.host)),i.host=null),x=x&&(b[0]===""||y[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,y=b;else if(b.length)y||(y=[]),y.pop(),y=y.concat(b),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=y.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.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 S=y.slice(-1)[0],A=(e.host||i.host||y.length>1)&&(S==="."||S==="..")||S==="",R=0,I=y.length;I>=0;I--)S=y[I],S==="."?y.splice(I,1):S===".."?(y.splice(I,1),R++):R&&(y.splice(I,1),R--);if(!x&&!v)for(;R--;R)y.unshift("..");x&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),A&&y.join("/").substr(-1)!=="/"&&y.push("");var P=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(T){e.hostname=P?"":y.length?y.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return x=x||e.host&&y.length,x&&!P&&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=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};ar.prototype.parseHost=function(){var i=this.host,t=G2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=V2;Do.resolveObject=W2;Do.format=H2;Do.Url=ar});var bR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};var ax=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var hx={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Zu={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var dr={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var Ke=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(dr).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(dr).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===dr.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=ax({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var lx=i=>{let t=i.direction,e=!!i.scroll,r=i.gap||0,s=structuredClone(i.children||[]),o=[],n=0,a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let v=0;v<s.length;v++){let y=v<s.length-1?r:0,b=s[v];v>0?t==="horizontal"?(b.x=h,b.y=d):t==="vertical"&&(b.x=f,b.y=l):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0),b=Es([b])[0],t==="horizontal"?(i.width&&b.width+p>i.width&&!e?(h=0,p=0,d+=c+r,c=b.height,b.x=0,b.y=d):c=Math.max(c,b.height),h+=b.width+y,p=b.x+b.width,n=Math.max(h,n),a=Math.max(b.height+b.y,a)):t==="vertical"&&(i.height&&b.height+m>i.height&&!e?(l=0,m=0,f+=u+r,u=b.width,b.x=f,b.y=0):u=Math.max(u,b.width),l+=b.height+y,m=b.y+b.height,n=Math.max(b.width+b.x,n),a=Math.max(l,a)),o.push(b)}return{...Ke({...i,width:i.width?i.width:n,height:i.height?i.height:a}),children:o,direction:t,gap:r,scroll:e,rotation:i.rotation??0}};var cx=i=>{let t=Ke(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}};var ux=i=>({...Ke(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});C();var DT={extension:{type:_.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(LT(),PB))}};C();var HT={extension:{type:_.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(NT(),RB))}};C();C();Cl();bl();C();Mt();sa();var vc;function qT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ai.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let r=$.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Mt();var Tc;async function KT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var lw=["webgl","webgpu","canvas"];async function cw(i){let t=[];i.preference?(t.push(i.preference),lw.forEach(o=>{o!==i.preference&&t.push(o)})):t=lw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await KT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(kE(),UE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&qT(i.failIfMajorPerformanceCaveat??Ai.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(hw(),aw));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}fr();Wp();Lt();var uw=class Bm{constructor(...t){this.stage=new vt,t[0]!==void 0&&z(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await cw(t),Bm._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return z(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Bm._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};uw._plugins=[];var Ja=uw;G.handleByList(_.Application,Ja._plugins);G.add(pa);C();qr();Wd();Mt();C();zi();le();bt();yp();Ep();var th=class extends no{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});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){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let x=f[m].split("="),v=x[0],y=x[1].replace(/"/gm,""),b=parseFloat(y),T=isNaN(b)?y:b;p[v]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Mt();var Im={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[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 l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Fm={test(i){return typeof i=="string"&&i.includes("<font>")?Im.test($.get().parseXML(i)):!1},parse(i){return Im.parse($.get().parseXML(i))}};var lI=[".xml",".fnt"],dw={extension:{type:_.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},fw={extension:{type:_.LoadParser,priority:ce.Normal},name:"loadBitmapFont",test(i){return lI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Fm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Fm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await $.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};xi();C();bt();var pw={extension:{type:_.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var mw={extension:{type:_.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var gw=["png","jpg","jpeg"],xw={extension:{type:_.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...gw],remove:async i=>i.filter(t=>!gw.includes(t))};C();var cI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function vo(i){return cI?!1:document.createElement("video").canPlayType(i)!==""}var _w={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var yw={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var bw={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var vw={extension:{type:_.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();zi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[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 O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=$i(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
+
${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t,s=>({alias:[s],src:s})).map(async s=>{let o=ie.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Mt();C();function ir(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}zi();function sr(i,t){let e=i.split("?")[0],r=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}qr();var uI=".json",dI="application/json",Tw={extension:{type:_.LoadParser,priority:ce.Low},name:"loadJson",test(i){return ir(i,dI)||sr(i,uI)},async load(i){return await(await $.get().fetch(i)).json()}};Mt();C();qr();var fI=".txt",pI="text/plain",Sw={name:"loadTxt",extension:{type:_.LoadParser,priority:ce.Low,name:"loadTxt"},test(i){return ir(i,pI)||sr(i,fI)},async load(i){return await(await $.get().fetch(i)).text()}};Mt();C();At();zi();xi();qr();var mI=["normal","bold","100","200","300","400","500","600","700","800","900"],gI=[".ttf",".otf",".woff",".woff2"],xI=["font/ttf","font/otf","font/woff","font/woff2"],_I=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function yI(i){let t=ie.extname(i),s=ie.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(_I)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var bI=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function vI(i){return bI.test(i)?i:encodeURI(i)}var Ew={extension:{type:_.LoadParser,priority:ce.Low},name:"loadWebFont",test(i){return ir(i,xI)||sr(i,gI)},async load(i,t){let e=$.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??yI(i),o=t.data?.weights?.filter(a=>mI.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${vI(i)})`,{...n,weight:h});await l.load(),e.add(l),r.push(l)}return xt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{xt.remove(`${t.family}-and-url`),$.get().getFontFaceSet().delete(t)})}};Mt();C();ks();nc();Gs();function To(i,t=1){let e=Ve.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}qr();bt();At();xi();function So(i,t,e){i.label=e,i._sourceOrigin=e;let r=new E({source:i,label:e}),s=()=>{delete t.promiseCache[e],xt.has(e)&&xt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var TI=".svg",SI="image/svg+xml",Aw={extension:{type:_.LoadParser,priority:ce.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ir(i,SI)||sr(i,TI)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?AI(i):EI(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function EI(i,t,e,r){let o=await(await $.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||To(i),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Fe({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return So(m,e,i)}async function AI(i){let e=await(await $.get().fetch(i)).text(),r=new we;return r.svg(e),r}Mt();C();ks();var wI=`(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(h),o?s[n[0].src]:s}async unload(t){let r=we(t
|
|
|
1112
1112
|
});
|
|
1113
1113
|
|
|
1114
1114
|
})();
|
|
1115
|
-
`,
|
|
1115
|
+
`,Eo=null,Ao=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([wI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};Ao.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var CI=`(function () {
|
|
1116
1116
|
'use strict';
|
|
1117
1117
|
|
|
1118
1118
|
async function loadImageBitmap(url, alphaMode) {
|
|
@@ -1141,20 +1141,20 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=we(t
|
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
1143
|
})();
|
|
1144
|
-
`,Eo=null,Ja=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([bI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};Ja.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var OA=0,Lm,Hm=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 wo;e.addEventListener("message",r=>{e.terminate(),wo.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Lm===void 0&&(Lm=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Lm&&(this._createdWorkers++,t=new Ja().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[OA]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:OA++,id:r})}},Vm=new Hm;Xr();var vI=[".jpeg",".jpg",".png",".webp",".avif"],TI=["image/jpeg","image/png","image/webp","image/avif"];async function SI(i,t){let e=await j.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Zc={name:"loadTextures",extension:{type:b.LoadParser,priority:se.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return rr(i,TI)||ir(i,vI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Vm.isImageBitmapSupported()?r=await Vm.loadImageBitmap(i,t):r=await SI(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Fe({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||vo(i),...t.data});return To(s,e,i)},unload(i){i.destroy(!0)}};R();rf();ef();var NA=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],wI=NA.map(i=>`video/${i.substring(1)}`);function EI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=CI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function AI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function CI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var DA={name:"loadVideo",extension:{type:b.LoadParser,name:"loadVideo"},test(i){let t=rr(i,wI),e=ir(i,NA);return t||e},async load(i,t,e){let r={...ks.defaultOptions,resolution:t.data?.resolution||vo(i),alphaMode:t.data?.alphaMode||await wl(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),EI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=ks.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new ks({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await AI(s),h(To(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};R();Fs();R();Fs();var Qc={extension:{type:b.ResolveParser,name:"resolveTexture"},test:Zc.test,parse:i=>({resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var LA={extension:{type:b.ResolveParser,priority:-2,name:"resolveJson"},test:i=>Ve.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Qc.parse};Fs();vn();_l();var Jc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ve,this.loader=new Kc,this.cache=mt,this._backgroundLoader=new Yc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){H("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=zi(t),s=we(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return mt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=mt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),mt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=we(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=we(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{mt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},sr=new Jc;D.handleByList(b.LoadParser,sr.loader.parsers).handleByList(b.ResolveParser,sr.resolver.parsers).handleByList(b.CacheParser,sr.cache.parsers).handleByList(b.DetectionParser,sr.detections);D.add(EA,PA,AA,IA,RA,MA,BA,FA,GA,UA,kA,Zc,DA,wA,SA,Qc,LA);var HA={loader:b.LoadParser,resolver:b.ResolveParser,cache:b.CacheParser,detection:b.DetectionParser};D.handle(b.Asset,i=>{let t=i.ref;Object.entries(HA).filter(([e])=>!!t[e]).forEach(([e,r])=>D.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(HA).filter(e=>!!t[e]).forEach(e=>D.remove(t[e]))});Qh();Ft();xl();var tu=class extends fi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new de({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function VA(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(X(tt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Xn();Ji();var gr=class extends tu{constructor(...t){let e=VA(t,"Text");super(e,Ht),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=gt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Xr();qt();_t();nf();ur();Tp();vl();Xn();Ji();ge();var PI=Gi(Hl(),1);D.add(KT,QT);var We=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(We||{}),Wm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Wm||{}),eu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(eu||{}),J=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(J||{}),Ao=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ao||{}),L=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(L||{}),Jr=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Jr||{}),st=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(st||{}),V=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(V||{}),or=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(or||{}),th=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(th||{}),xr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(xr||{}),ze=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(ze||{}),Ei=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ei||{}),ru=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(ru||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Xt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Xt||{});var wt=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(wt||{}),Oe=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Oe||{});var zm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var K={ADAPTER:zm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Dd();var RI=ui.default??ui,_r=RI(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var hs=Gi(zA(),1),b2=Gi(Hl(),1);var wg=Gi(nP(),1);var aP={};function ht(i,t,e=3){if(aP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1144
|
+
`,wo=null,eh=class{constructor(){wo||(wo=URL.createObjectURL(new Blob([CI],{type:"application/javascript"}))),this.worker=new Worker(wo)}};eh.revokeObjectURL=function(){wo&&(URL.revokeObjectURL(wo),wo=null)};var ww=0,Gm,Um=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 Ao;e.addEventListener("message",r=>{e.terminate(),Ao.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Gm===void 0&&(Gm=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Gm&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[ww]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ww++,id:r})}},km=new Um;qr();var PI=[".jpeg",".jpg",".png",".webp",".avif"],RI=["image/jpeg","image/png","image/webp","image/avif"];async function MI(i,t){let e=await $.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:_.LoadParser,priority:ce.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,RI)||sr(i,PI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await km.isImageBitmapSupported()?r=await km.loadImageBitmap(i,t):r=await MI(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Fe({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||To(i),...t.data});return So(s,e,i)},unload(i){i.destroy(!0)}};C();Kd();qd();var Cw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],BI=Cw.map(i=>`video/${i.substring(1)}`);function II(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=GI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function FI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function GI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Pw={name:"loadVideo",extension:{type:_.LoadParser,name:"loadVideo"},test(i){let t=ir(i,BI),e=sr(i,Cw);return t||e},async load(i,t,e){let r={...Os.defaultOptions,resolution:t.data?.resolution||To(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),II(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Os.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Os({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await FI(s),h(So(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Gs();C();Gs();var Jc={extension:{type:_.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Rw={extension:{type:_.ResolveParser,priority:-2,name:"resolveJson"},test:i=>Ve.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Gs();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ve,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=$i(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;G.handleByList(_.LoadParser,or.loader.parsers).handleByList(_.ResolveParser,or.resolver.parsers).handleByList(_.CacheParser,or.cache.parsers).handleByList(_.DetectionParser,or.detections);G.add(pw,xw,mw,vw,_w,yw,bw,Tw,Sw,Ew,Aw,Qc,Pw,fw,dw,Jc,Rw);var Mw={loader:_.LoadParser,resolver:_.ResolveParser,cache:_.CacheParser,detection:_.DetectionParser};G.handle(_.Asset,i=>{let t=i.ref;Object.entries(Mw).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Mw).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});Jh();Lt();_l();var eu=class extends gi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new me({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Bw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(z(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();ts();var yr=class extends eu{constructor(...t){let e=Bw(t,"Text");super(e,Bt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=jt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};qr();bt();Jd();fr();gp();Tl();Yn();ts();_e();var UI=Ui(Vl(),1);G.add(DT,HT);var Iw=i=>{let e={...{fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0,breakWords:!0},...i.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),i.width&&(e.wordWrapWidth=i.width,e.wordWrap=!0);let{width:r,height:s}=jt.measureText(i.content??"",new Bt(e)),o=Math.round(r),n=Math.round(s);return{...Ke({...i,width:o,height:n}),content:i.content??"",textStyle:{...e}}};var kI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=jt.measureText(u.text,new Bt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let x=jt.measureText(m,new Bt({...u.textStyle,wordWrap:!1,breakWords:!1})),v={text:m,textStyle:f,height:x.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let b=jt.measureText(u.furigana.text,new Bt(u.furigana.textStyle)),T=-b.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-b.width)/2,y:T};v.furigana=w}r.push(v),n=Math.max(n,x.height),s+=p.lineWidths[0],a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}r.length>0&&e.push({lineParts:r,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 p=f.height;f.height&&delete f.height;let m=f.y+(d-p),x=f.furigana;return x&&(x.y=x.y-f.y+m),{...f,...x&&{furigana:x},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}},Fw=i=>{let t={fill:"black",fontFamily:"Roboto",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=kI(e,r),a=i.width||o,l=Ke({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.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{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var Gw=i=>{let t=Ke(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.drag&&{drag:i.drag},...i.dragStart&&{dragStart:i.dragStart},...i.dragEnd&&{dragEnd:i.dragEnd}}};var OI=i=>i.map(e=>{switch(e.type){case dr.RECT:return cx(e);case dr.CONTAINER:return lx(e);case dr.TEXT:return Iw(e);case dr.TEXT_REVEALING:return Fw(e);case dr.SPRITE:return ux(e);case dr.SLIDER:return Gw(e);default:throw new Error(`Unsupported element type: ${e.type}`)}}),Es=OI;var LI=new(window.AudioContext||window.webkitAudioContext),Om={},DI=async(i,t)=>{if(!Om[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Om[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Om[i],Co={load:DI,getAsset:NI};var We=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Lm=({type:i,animate:t})=>({type:i,animate:t});var Dm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Oe=(i,t)=>{let e={fill:t.fill,fontFamily:t.fontFamily,fontSize:t.fontSize,align:t.align,lineHeight:t.lineHeight,wordWrap:t.wordWrap,breakWords:t.breakWords,wordWrapWidth:t.wordWrapWidth,strokeColor:t.strokeColor,strokeWidth:t.strokeWidth};i.style=e};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.elementId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Uw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let a=new yr({label:e.id}),h=()=>{a.text=e.content,Oe(a,e.textStyle),a.alpha=e.alpha,a.x=e.x,a.y=e.y};n.addEventListener("abort",()=>{h()}),h();let l=e?.hover,c=e?.click;if(s&&l){let{cursor:u,soundSrc:d,actionPayload:f}=l;a.eventMode="static";let p=()=>{f&&s(`${a.label}-pointer-over`,{_event:{id:a.label},...f}),u&&(a.cursor=u),d&&i.audioStage.add({id:`hover-${Date.now()}`,url:d,loop:!1}),l?.textStyle&&Oe(a,l.textStyle)},m=()=>{a.cursor="auto",Oe(a,e.textStyle)};a.on("pointerover",p),a.on("pointerout",m)}if(s&&c){let{soundSrc:u,actionPayload:d}=c;a.eventMode="static";let f=()=>{c?.textStyle&&Oe(a,c.textStyle)},p=()=>{Oe(a,e.textStyle),d&&s(`${a.label}-click`,{_event:{id:a.label},...d}),u&&i.audioStage.add({id:`click-${Date.now()}`,url:u,loop:!1})},m=()=>{Oe(a,e.textStyle)};a.on("pointerdown",f),a.on("pointerup",p),a.on("pointerupoutside",m)}t.addChild(a),r&&r.length>0&&await _t(e.id,o,{app:i,element:a,animations:r,signal:n})};var kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Oe(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(s&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&s(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.textStyle&&Oe(h,c.textStyle)},x=()=>{h.cursor="auto",Oe(h,r.textStyle)};h.on("pointerover",m),h.on("pointerout",x)}if(s&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{u?.textStyle&&Oe(h,u.textStyle)},m=()=>{Oe(h,r.textStyle),f&&s(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{Oe(h,r.textStyle)};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Ow=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),e.animations&&e.animations.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var HI=We({type:"text",add:Uw,update:kw,delete:Ow});var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:x,alpha:v}=e,y=new _r;y.label=a;let b=()=>{y.clear(),y.rect(0,0,Math.round(c),Math.round(u)).fill(d),y.x=Math.round(h),y.y=Math.round(l),y.alpha=v,f&&y.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})};n.addEventListener("abort",()=>{b()}),b();let T=e?.hover,w=e?.click;if(o&&T){let{cursor:S,soundSrc:A,actionPayload:R}=T;y.eventMode="static";let I=()=>{R&&o(`${y.label}-pointer-over`,{_event:{id:y.label},...R}),S&&(y.cursor=S),A&&i.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},P=()=>{y.cursor="auto"};y.on("pointerover",I),y.on("pointerout",P)}if(o&&w){let{soundSrc:S,actionPayload:A}=w;y.eventMode="static";let R=()=>{A&&o(`${y.label}-click`,{_event:{id:y.label},...A}),S&&i.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1})};y.on("pointerup",R)}t.addChild(y),r&&r.length>0&&await _t(a,s,{app:i,element:y,animations:r,signal:n})};var Dw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(n&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1})},x=()=>{h.cursor="auto"};h.on("pointerover",m),h.on("pointerout",x)}if(n&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{f&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})};h.on("pointerup",p)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Nw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var VI=We({type:"rect",add:Lw,update:Dw,delete:Nw});var Hw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,src:d,alpha:f}=e,p=d?E.from(d):E.EMPTY,m=new se(p);m.label=a;let x=()=>{m.x=Math.round(h),m.y=Math.round(l),m.width=Math.round(c),m.height=Math.round(u),m.alpha=f};n.addEventListener("abort",()=>{x()}),x();let v=e?.hover,y=e?.click;if(s&&v){let{cursor:b,soundSrc:T,actionPayload:w}=v;m.eventMode="static";let S=()=>{if(w&&s(`${m.label}-pointer-over`,{_event:{id:m.label},...w}),b&&(m.cursor=b),T&&i.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;m.texture=R}},A=()=>{m.cursor="auto",m.texture=p};m.on("pointerover",S),m.on("pointerout",A)}if(s&&y){let{soundSrc:b,actionPayload:T}=y;m.eventMode="static";let w=()=>{if(y?.src){let R=y.src?E.from(y.src):E.EMPTY;m.texture=R}},S=()=>{m.texture=p,T&&s(`${m.label}-click`,{_event:{id:m.label},...T}),b&&i.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},A=()=>{m.texture=p};m.on("pointerdown",w),m.on("pointerup",S),m.on("pointerupoutside",A)}t.addChild(m),r&&r.length>0&&await _t(a,o,{app:i,element:m,animations:r,signal:n})};var Vw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let d=r.src?E.from(r.src):E.EMPTY;h.texture=d}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(n&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{if(p&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.src){let v=c.src?E.from(c.src):E.EMPTY;h.texture=v}},x=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",m),h.on("pointerout",x)}if(n&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{if(u?.src){let v=u.src?E.from(u.src):E.EMPTY;h.texture=v}},m=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,f&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Ww=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.children.find(a=>a.label===e.id);n&&(r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),t.removeChild(n),n.destroy())};var WI=We({type:"sprite",add:Hw,update:Vw,delete:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,alpha:d,thumbSrc:f,barSrc:p,direction:m,min:x,max:v,step:y,initialValue:b,originX:T,originY:w,hover:S,drag:A,dragStart:R,dragEnd:I}=e,P=new vt;P.label=a,P.x=h,P.y=l,P.alpha=d,P.sortableChildren=!0,P.eventMode="static";let B=0,W=p?E.from(p):E.EMPTY,N=new se(W);N.label=`${a}-bar`,N.eventMode="static";let nt=f?E.from(f):E.EMPTY,j=new se(nt);j.label=`${a}-thumb`,j.eventMode="static";let F=b??x,H=v-x,D=Tt=>{let St=(Tt-x)/H;m==="horizontal"?(j.x=St*(N.width-j.width),j.y=(N.height-j.height)/2):(j.x=(N.width-j.width)/2,j.y=St*(N.height-j.height))},k=()=>{N.width=c,N.height=u;let Tt=m==="horizontal"?u-B*2:c-B*2,St=f?E.from(f):E.EMPTY,at=St.width,Rt=St.height,re=Tt/at,$t=Tt/Rt,ae=Math.min(re,$t);j.width=at*ae,j.height=Rt*ae,D(F)};n.addEventListener("abort",k),k();let tt=nt,pt=W,dt=!1,Ut=Tt=>{let St;if(m==="horizontal"){let Rt=Tt.x-j.width/2;St=Math.max(0,Math.min(1,Rt/(N.width-j.width)))}else{let Rt=Tt.y-j.height/2;St=Math.max(0,Math.min(1,Rt/(N.height-j.height)))}let at=x+St*H;return y>0&&(at=Math.round((at-x)/y)*y+x,at=Math.max(x,Math.min(v,at))),at},Ht=Tt=>{dt=!0;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),R?.actionPayload&&o(`${a}-drag-start`,{_event:{id:a,value:F},...R.actionPayload}))},qt=Tt=>{if(!dt)return;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),A?.actionPayload&&o(`${a}-drag`,{_event:{id:a,value:F},...A.actionPayload,currentValue:F}))},Kt=()=>{dt&&(dt=!1,I?.actionPayload&&o(`${a}-drag-end`,{_event:{id:a,value:F},...I.actionPayload}))};if(P.on("pointerdown",Ht),P.on("globalpointermove",qt),P.on("pointerup",Kt),P.on("pointerupoutside",Kt),S){let{cursor:Tt,soundSrc:St,thumbSrc:at,barSrc:Rt}=S,re=()=>{Tt&&(N.cursor=Tt,j.cursor=Tt),St&&i.audioStage.add({id:`hover-${Date.now()}`,url:St,loop:!1}),at&&(j.texture=E.from(at)),Rt&&(N.texture=E.from(Rt))},$t=()=>{dt||(N.cursor="auto",j.cursor="auto",j.texture=tt,N.texture=pt)};P.on("pointerover",re),P.on("pointerout",$t),P.on("pointerupoutside",$t)}P.addChild(N),P.addChild(j),t.addChild(P),r&&r.length>0&&await _t(a,s,{app:i,element:P,animations:r,signal:n})};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,x=p.height||16,v=f/m,y=f/x,b=Math.min(v,y);if(u.width=m*b,u.height=x*b,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,drag:f,dragStart:p,dragEnd:m,min:x,max:v,step:y,direction:b,initialValue:T}=r,w=T??x,S=v-x;h.eventMode="static";let A=j=>{let F=(j-x)/S;b==="horizontal"?(u.x=F*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=F*(c.height-u.height))},R=j=>{let F;if(b==="horizontal"){let D=j.x-u.width/2;F=Math.max(0,Math.min(1,D/(c.width-u.width)))}else{let D=j.y-u.height/2;F=Math.max(0,Math.min(1,D/(c.height-u.height)))}let H=x+F*S;return y>0&&(H=Math.round((H-x)/y)*y+x,H=Math.max(x,Math.min(v,H))),H},I=u.texture,P=c.texture,B=!1,W=j=>{B=!0;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),p?.actionPayload&&s(`${r.id}-drag-start`,{_event:{id:r.id},value:w,...p.actionPayload}))},N=j=>{if(!B)return;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),f?.actionPayload&&s(`${r.id}-drag`,{_event:{id:r.id},value:w,...f.actionPayload,currentValue:w}))},nt=()=>{B&&(B=!1,m?.actionPayload&&s(`${r.id}-drag-end`,{_event:{id:r.id},value:w,...m.actionPayload}))};if(h.on("pointerdown",W),h.on("globalpointermove",N),h.on("pointerup",nt),h.on("pointerupoutside",nt),d){let{cursor:j,soundSrc:F,actionPayload:H,thumbSrc:D,barSrc:k}=d,tt=()=>{H&&s(`${r.id}-pointer-over`,{_event:{id:r.id},...H}),j&&(h.cursor=j,u.cursor=j),F&&i.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1}),D&&(u.texture=E.from(D)),k&&(c.texture=E.from(k))},pt=()=>{h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P},dt=()=>{B||(h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P)};h.on("pointerover",tt),h.on("pointerout",dt),h.on("pointerup",pt),h.on("pointerupoutside",pt)}}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var zI=We({type:"slider",add:zw,update:$w,delete:Xw});var jw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{if(a?.aborted)return;let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new vt;p.label=h;let m=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f};if(a.addEventListener("abort",()=>{m()}),m(),t.addChild(p),u&&u.length>0)for(let x of u){let v=n.find(y=>y.type===x.type);if(!v)throw new Error(`No plugin found for child element type: ${x.type}`);await v.add({app:i,parent:p,element:x,animations:r,eventHandler:s,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&await _t(h,o,{app:i,element:p,animations:r,signal:a})},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new vt;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new _r().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var Yw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.elementId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=Yw(e,r,[]),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(x=>x.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}await Promise.all(d),XI(t,r)},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var qw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{if(h?.aborted)return;let l=t.children.find(u=>u.label===e.id),c=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))};h.addEventListener("abort",()=>{c()}),l&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:l,animations:o,signal:h}),await c())};var Kw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a()}};var jI=We({type:"container",add:jw,update:qw,delete:Kw});function Po(i,t){let e=i.text.substring(0,t),s=jt.measureText(e,i.style).width;return i.x+s}var Zw=i=>new Promise(t=>setTimeout(t,i)),Qw=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r));if(e?.aborted)return;let l=new vt;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){let p=d.lineParts[f],m=new Bt(p.textStyle),x=new yr({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),v=null;if(p.furigana){let T=new Bt(p.furigana.textStyle);v=new yr({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(v)}l.addChild(x);let y=p.text,b=p.furigana?.text||"";if(n||e?.aborted)x.text=y,c.x=Po(x,y.length-1)+o,v&&(v.text=b);else{let T=b.length;for(let w=0;w<y.length;w++){if(e?.aborted)return;x.text=y.substring(0,w+1),c.x=Po(x,w)+o;let S=Math.round((w+1)/y.length*T);v&&(v.text=b.substring(0,S)),w<y.length-1&&await Zw(a)}}}u<t.content.length-1&&await Zw(h)}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var Jw=i=>new Promise(t=>setTimeout(t,i)),t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s));if(r?.aborted)return;let c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],x=new Bt(m.textStyle),v=new yr({text:"",style:x,x:m.x,y:m.y}),y=null;if(m.furigana){let w=new Bt(m.furigana.textStyle);y=new yr({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(y)}c.addChild(v);let b=m.text,T=m.furigana?.text||"";if(a||r?.aborted)v.text=b,u.x=Po(v,b.length-1)+n,y&&(y.text=T);else{let w=T.length;for(let S=0;S<b.length;S++){v.text=b.substring(0,S+1),u.x=Po(v,S)+n;let A=Math.round((S+1)/b.length*w);y&&(y.text=T.substring(0,A)),S<b.length-1&&await Jw(h)}}}d<e.content.length-1&&await Jw(l)}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=()=>{r&&!r.destroyed&&r.destroy({children:!0})};e.addEventListener("abort",()=>{s()}),s()}};var YI=We({type:"text-revealing",add:Qw,update:t1,delete:e1});var qI={linear:i=>i},KI=(i,t,e,r)=>i+(t-i)*qI[r](e),ZI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},QI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},JI=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n,relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},tF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return KI(s,a,h,o)}}return i[i.length-1].value},eF=i=>Math.max.apply(null,i),r1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,x])=>{if(!hx[m])throw new Error(`${m} is not a supported property for transition.`);return{...x,property:m}}),h=a.map(m=>m.keyframes.reduce((x,v)=>x+v.duration||0,0)),l=eF(h),c={};a.forEach(m=>{c[m.property]=ZI(t,m.property)});let u=a.map(m=>{let x=[];m.initialValue!==void 0?x=[{value:m.initialValue}]:x=[{value:c[m.property]}],x=x.concat(m.keyframes);let v=JI(x);return{property:m.property,timeline:v}}),d=0,f=m=>{u.forEach(({property:x,timeline:v})=>{let y=tF(v,m);t&&!t.destroyed&&QI(t,x,y)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var rF=Lm({type:"tween",animate:r1});var i1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var s1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var o1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var iF=Dm({type:"sound",add:i1,update:s1,delete:o1});var n1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Nm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=n1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var ze=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(ze||{}),Hm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Hm||{}),ru=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(ru||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),U=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(U||{}),ri=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ri||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),L=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(L||{}),nr=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(nr||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),br=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(br||{}),$e=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))($e||{}),Pi=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Pi||{}),iu=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(iu||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),Le=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Le||{});var Vm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:Vm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Fd();var sF=pi.default??pi,vr=sF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ls=Ui(h1(),1),q2=Ui(Vl(),1);var Tg=Ui(EP(),1);var AP={};function lt(i,t,e=3){if(AP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1145
1145
|
Deprecated since v${i}`):(r=r.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${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1149
|
-
Deprecated since v${i}`),console.warn(r))),
|
|
1150
|
-
`);function
|
|
1151
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Su(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=v2.replace(/%forloop%/gi,T2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Bg=0,Ig=1,Fg=2,Gg=3,Ug=4,kg=5,Or=class i{constructor(){this.data=0,this.blendMode=J.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bg)}set blend(t){!!(this.data&1<<Bg)!==t&&(this.data^=1<<Bg)}get offsets(){return!!(this.data&1<<Ig)}set offsets(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get culling(){return!!(this.data&1<<Fg)}set culling(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get depthTest(){return!!(this.data&1<<Gg)}set depthTest(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get depthMask(){return!!(this.data&1<<kg)}set depthMask(t){!!(this.data&1<<kg)!==t&&(this.data^=1<<kg)}get clockwiseFrontFace(){return!!(this.data&1<<Ug)}set clockwiseFrontFace(t){!!(this.data&1<<Ug)!==t&&(this.data^=1<<Ug)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==J.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Or.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var mh=[];function Do(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=mh.length-1;r>=0;--r){let s=mh[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Vt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);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(Vt.prototype,{dispatch:{value:Vt.prototype.emit},run:{value:Vt.prototype.emit}});var Xe=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Vt("setRealSize"),this.onUpdate=new Vt("update"),this.onError=new Vt("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,r){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 ls=class extends Xe{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===ze.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.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 S2={scaleMode:or.NEAREST,alphaMode:ze.NPM},Og=class Lo extends hs.default{constructor(t=null,e=null){super(),e=Object.assign({},Lo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Xe)&&(t=Do(t,p),t.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ei(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>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 r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=yu(this.realWidth)&&yu(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 kr[this.cacheId],delete $e[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Lo.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,r=K.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}_${ei()}`}o=t._pixiId}let n=kr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Lo(t,e),n.cacheId=o,Lo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new ls(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=L.RGBA,a=st.FLOAT):t instanceof Int32Array?(n=L.RGBA_INTEGER,a=st.INT):t instanceof Uint32Array?(n=L.RGBA_INTEGER,a=st.UNSIGNED_INT):t instanceof Int16Array?(n=L.RGBA_INTEGER,a=st.SHORT):t instanceof Uint16Array?(n=L.RGBA_INTEGER,a=st.UNSIGNED_SHORT):t instanceof Int8Array?(n=L.RGBA,a=st.BYTE):(n=L.RGBA,a=st.UNSIGNED_BYTE),o.internal=!0,new Lo(o,Object.assign({},S2,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),kr[e]&&kr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),kr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=kr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete kr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete kr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Og.defaultOptions={mipmap:xr.POW2,anisotropicLevel:0,scaleMode:or.LINEAR,wrapMode:th.CLAMP,alphaMode:ze.UNPACK,target:Jr.TEXTURE_2D,format:L.RGBA,type:st.UNSIGNED_BYTE},Og._globalBatch=0;var ut=Og;var gh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ao.TRIANGLES,this.start=0,this.size=0,this.data=null}};var w2=0,jt=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=w2++,this.disposeRunner=new Vt("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?Oe.ELEMENT_ARRAY_BUFFER:Oe.ARRAY_BUFFER}get index(){return this.type===Oe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var Ho=class i{constructor(t,e=0,r=!1,s=st.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var E2={Float32Array,Uint32Array,Int32Array,Uint8Array};function uP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=No(c);s[u]||(s[u]=new E2[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var dP={5126:4,5123:2,5121:1},A2=0,C2={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},ri=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=A2++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Vt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof jt||(e instanceof Array&&(e=new Float32Array(e)),e=new jt(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,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 Ho(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new jt(t)),t.type=Oe.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=[],r=new jt,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*dP[o.type]/4),o.buffer=0}for(r.data=uP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],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 i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new jt(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new Ho(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Oe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new C2[No(n.buffers[a].data)](s[a]),e.buffers[a]=new jt(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Oe.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=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&&(h+=d.size*dP[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+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var xh=class extends ri{constructor(t=!1){super(),this._buffer=new jt(null,t,!1),this._indexBuffer=new jt(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 Ng=Math.PI*2,P2=180/Math.PI,R2=Math.PI/180,ar=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(ar||{});var Yt=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};Yt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var wu=[new Yt,new Yt,new Yt,new Yt],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=ar.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 i(0,0,0,0)}clone(){return new i(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 M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=wu[0].set(t.left,t.top),h=wu[1].set(t.left,t.bottom),l=wu[2].set(t.right,t.top),c=wu[3].set(t.right,t.bottom);if(l.x<=a.x||h.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(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,g=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,g,x,v)<=d*a.x+f*a.y||Math.min(p,g,x,v)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),y=u*(l.x-a.x),T=_*r+y*o,E=_*s+y*o,w=_*r+y*n,C=_*s+y*n;return!(Math.max(T,E,w,C)<=_*a.x+y*a.y||Math.min(T,E,w,C)>=_*c.x+y*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),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Eu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=ar.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Eu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Au=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=ar.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Au.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Cu=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=ar.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Cu.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Pu=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=ar.RREC}clone(){return new i(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Pu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ct=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new Yt;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new Yt;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Ng-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Ct.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 cs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],us=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ds=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dg=[],fP=[],Ru=Math.sign;function M2(){for(let i=0;i<16;i++){let t=[];Dg.push(t);for(let e=0;e<16;e++){let r=Ru(cs[i]*cs[e]+ds[i]*us[e]),s=Ru(us[i]*cs[e]+fs[i]*us[e]),o=Ru(cs[i]*ds[e]+ds[i]*fs[e]),n=Ru(us[i]*ds[e]+fs[i]*fs[e]);for(let a=0;a<16;a++)if(cs[a]===r&&us[a]===s&&ds[a]===o&&fs[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Ct;t.set(cs[i],us[i],ds[i],fs[i],0,0),fP.push(t)}}M2();var Rt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>cs[i],uY:i=>us[i],vX:i=>ds[i],vY:i=>fs[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Dg[i][t],sub:(i,t)=>Dg[i][Rt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Rt.S:Rt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Rt.E:Rt.W:t>0?i>0?Rt.SE:Rt.SW:i>0?Rt.NE:Rt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=fP[Rt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var ii=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(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))}};ii.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Lg=class{constructor(){this.worldTransform=new Ct,this.localTransform=new Ct,this.position=new ii(this.onChange,this,0,0),this.scale=new ii(this.onChange,this,1,1),this.pivot=new ii(this.onChange,this,0,0),this.skew=new ii(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){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!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Lg.IDENTITY=new Lg;var Mu=Lg;Mu.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 pP=`varying vec2 vTextureCoord;
|
|
1149
|
+
Deprecated since v${i}`),console.warn(r))),AP[t]=!0}var Sg;function Eg(){return typeof Sg>"u"&&(Sg=function(){let i={stencil:!0,failIfMajorPerformanceCaveat:Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Y.ADAPTER.getWebGLRenderingContext())return!1;let t=Y.ADAPTER.createCanvas(),e=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),r=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,r}catch{return!1}}()),Sg}od();nd();Zh([Qh]);var No=class yu{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 yu)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 r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,r,s]=this._components;return t[0]=e,t[1]=r,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,r,s,o]=yu.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let 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,r,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=yu.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=De(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}};No.shared=new No,No.temp=new No,No.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Tr=No;function z2(){let i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[Z.NORMAL_NPM]=Z.NORMAL,i[Z.ADD_NPM]=Z.ADD,i[Z.SCREEN_NPM]=Z.SCREEN,t[Z.NORMAL]=Z.NORMAL_NPM,t[Z.ADD]=Z.ADD_NPM,t[Z.SCREEN]=Z.SCREEN_NPM;let e=[];return e.push(t),e.push(i),e}var Ag=z2();function Ho(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function hs(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function bu(i){return!(i&i-1)&&!!i}function vu(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function wg(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var $2=0;function si(){return++$2}var wP=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};wP.EMPTY=new wP(0,0,0,0);var Tu={},Xe=Object.create(null),Dr=Object.create(null);function Cg(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Su(i,t=1){let e=Y.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}var V=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(V||{}),Pg=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},PP=(i,t)=>Pg(i).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Pg).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Pg).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>PP(o,e)-PP(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})}};var xh=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 K2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
1150
|
+
`);function Z2(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
1151
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Eu(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=K2.replace(/%forloop%/gi,Z2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Rg=0,Mg=1,Bg=2,Ig=3,Fg=4,Gg=5,Nr=class i{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Rg)}set blend(t){!!(this.data&1<<Rg)!==t&&(this.data^=1<<Rg)}get offsets(){return!!(this.data&1<<Mg)}set offsets(t){!!(this.data&1<<Mg)!==t&&(this.data^=1<<Mg)}get culling(){return!!(this.data&1<<Bg)}set culling(t){!!(this.data&1<<Bg)!==t&&(this.data^=1<<Bg)}get depthTest(){return!!(this.data&1<<Ig)}set depthTest(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get depthMask(){return!!(this.data&1<<Gg)}set depthMask(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get clockwiseFrontFace(){return!!(this.data&1<<Fg)}set clockwiseFrontFace(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Nr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var _h=[];function Vo(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=_h.length-1;r>=0;--r){let s=_h[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Yt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);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(Yt.prototype,{dispatch:{value:Yt.prototype.emit},run:{value:Yt.prototype.emit}});var je=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Yt("setRealSize"),this.onUpdate=new Yt("update"),this.onError=new Yt("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,r){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 cs=class extends je{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===$e.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.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 Q2={scaleMode:nr.NEAREST,alphaMode:$e.NPM},Ug=class Wo extends ls.default{constructor(t=null,e=null){super(),e=Object.assign({},Wo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof je)&&(t=Vo(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=si(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>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 r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=bu(this.realWidth)&&bu(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 Dr[this.cacheId],delete Xe[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wo.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,r=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}_${si()}`}o=t._pixiId}let n=Dr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Wo(t,e),n.cacheId=o,Wo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new cs(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=U.RGBA,a=rt.FLOAT):t instanceof Int32Array?(n=U.RGBA_INTEGER,a=rt.INT):t instanceof Uint32Array?(n=U.RGBA_INTEGER,a=rt.UNSIGNED_INT):t instanceof Int16Array?(n=U.RGBA_INTEGER,a=rt.SHORT):t instanceof Uint16Array?(n=U.RGBA_INTEGER,a=rt.UNSIGNED_SHORT):t instanceof Int8Array?(n=U.RGBA,a=rt.BYTE):(n=U.RGBA,a=rt.UNSIGNED_BYTE),o.internal=!0,new Wo(o,Object.assign({},Q2,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Dr[e]&&Dr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Dr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Dr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Dr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Dr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ug.defaultOptions={mipmap:br.POW2,anisotropicLevel:0,scaleMode:nr.LINEAR,wrapMode:ih.CLAMP,alphaMode:$e.UNPACK,target:ri.TEXTURE_2D,format:U.RGBA,type:rt.UNSIGNED_BYTE},Ug._globalBatch=0;var ut=Ug;var yh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ro.TRIANGLES,this.start=0,this.size=0,this.data=null}};var J2=0,te=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=J2++,this.disposeRunner=new Yt("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?Le.ELEMENT_ARRAY_BUFFER:Le.ARRAY_BUFFER}get index(){return this.type===Le.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var zo=class i{constructor(t,e=0,r=!1,s=rt.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var tU={Float32Array,Uint32Array,Int32Array,Uint8Array};function RP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Ho(c);s[u]||(s[u]=new tU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var MP={5126:4,5123:2,5121:1},eU=0,rU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},oi=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=eU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Yt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,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 zo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=Le.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=[],r=new te,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*MP[o.type]/4),o.buffer=0}for(r.data=RP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],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 i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new zo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Le.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new rU[Ho(n.buffers[a].data)](s[a]),e.buffers[a]=new te(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Le.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=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&&(h+=d.size*MP[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+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var bh=class extends oi{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,rt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,rt.FLOAT).addAttribute("aColor",this._buffer,4,!0,rt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,rt.FLOAT).addIndex(this._indexBuffer)}};var kg=Math.PI*2,iU=180/Math.PI,sU=Math.PI/180,hr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(hr||{});var ee=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};ee.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Au=[new ee,new ee,new ee,new ee],gt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=hr.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 i(0,0,0,0)}clone(){return new i(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 R=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=R)return!1;let I=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>I}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=Au[0].set(t.left,t.top),h=Au[1].set(t.left,t.bottom),l=Au[2].set(t.right,t.top),c=Au[3].set(t.right,t.bottom);if(l.x<=a.x||h.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(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),b=u*(l.x-a.x),T=y*r+b*o,w=y*s+b*o,S=y*r+b*n,A=y*s+b*n;return!(Math.max(T,w,S,A)<=y*a.x+b*a.y||Math.min(T,w,S,A)>=y*c.x+b*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),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};gt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var wu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=hr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new gt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};wu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Cu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=hr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new gt(this.x-this.width,this.y-this.height,this.width,this.height)}};Cu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Pu=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=hr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Pu.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Ru=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=hr.RREC}clone(){return new i(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Ru.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 i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ee;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ee;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(kg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};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 us=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ds=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ps=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Og=[],BP=[],Mu=Math.sign;function oU(){for(let i=0;i<16;i++){let t=[];Og.push(t);for(let e=0;e<16;e++){let r=Mu(us[i]*us[e]+fs[i]*ds[e]),s=Mu(ds[i]*us[e]+ps[i]*ds[e]),o=Mu(us[i]*fs[e]+fs[i]*ps[e]),n=Mu(ds[i]*fs[e]+ps[i]*ps[e]);for(let a=0;a<16;a++)if(us[a]===r&&ds[a]===s&&fs[a]===o&&ps[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new It;t.set(us[i],ds[i],fs[i],ps[i],0,0),BP.push(t)}}oU();var Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>us[i],uY:i=>ds[i],vX:i=>fs[i],vY:i=>ps[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Og[i][t],sub:(i,t)=>Og[i][Gt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:t>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=BP[Gt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var ni=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(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))}};ni.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Lg=class{constructor(){this.worldTransform=new It,this.localTransform=new It,this.position=new ni(this.onChange,this,0,0),this.scale=new ni(this.onChange,this,1,1),this.pivot=new ni(this.onChange,this,0,0),this.skew=new ni(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){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!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Lg.IDENTITY=new Lg;var Bu=Lg;Bu.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 IP=`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 FP=`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 Iu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function Dg(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function vh(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Dg(2*t);case"bvec3":return Dg(3*t);case"bvec4":return Dg(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 Hr=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
|
|
1169
1169
|
if(uv["${i}"] !== ud["${i}"].value)
|
|
1170
1170
|
{
|
|
1171
1171
|
ud["${i}"].value = uv["${i}"]
|
|
@@ -1285,7 +1285,7 @@ void main(void){
|
|
|
1285
1285
|
cv[3] = v[3];
|
|
1286
1286
|
|
|
1287
1287
|
gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
|
|
1288
|
-
}`}];var
|
|
1288
|
+
}`}];var nU={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
|
+
}`},aU={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 Ng(i,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.${r}, '${r}');
|
|
1432
1432
|
`):e.push(`
|
|
1433
1433
|
renderer.shader.syncUniformGroup(uv.${r}, syncData);
|
|
1434
|
-
`));continue}let o=i.uniforms[r],n=!1;for(let a=0;a<
|
|
1434
|
+
`));continue}let o=i.uniforms[r],n=!1;for(let a=0;a<Hr.length;a++)if(Hr[a].test(s,o)){e.push(Hr[a].code(r,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?nU:aU)[s.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
1435
1435
|
cu = ud["${r}"];
|
|
1436
1436
|
cv = cu.value;
|
|
1437
1437
|
v = uv["${r}"];
|
|
1438
1438
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1439
|
-
`))}var
|
|
1439
|
+
`))}var GP={},Fu=GP;function Gu(){if(Fu===GP||Fu?.isContextLost()){let i=Y.ADAPTER.createCanvas(),t;Y.PREFER_ENV>=ze.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Fu=t}return Fu}var Uu;function Hg(){if(!Uu){Uu=Pe.MEDIUM;let i=Gu();if(i&&i.getShaderPrecisionFormat){let t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(Uu=t.precision?Pe.HIGH:Pe.MEDIUM)}}return Uu}function UP(i,t){let e=i.getShaderSource(t).split(`
|
|
1440
1440
|
`).map((l,c)=>`${c}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
|
|
1441
1441
|
`),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=e.join(`
|
|
1442
|
-
`);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
1443
|
-
${i}`}else if(e!==Pe.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var
|
|
1442
|
+
`);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Vg(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||UP(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||UP(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var hU={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 Th(i){return hU[i]}var ku=null,kP={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 Sh(i,t){if(!ku){let e=Object.keys(kP);ku={};for(let r=0;r<e.length;++r){let s=e[r];ku[i[s]]=kP[s]}}return ku[t]}function Ou(i,t,e){if(i.substring(0,9)!=="precision"){let r=t;return t===Pe.HIGH&&e!==Pe.HIGH&&(r=Pe.MEDIUM),`precision ${r} float;
|
|
1443
|
+
${i}`}else if(e!==Pe.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Eh;function Lu(){if(typeof Eh=="boolean")return Eh;try{Eh=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Eh=!1}return Eh}var lU=0,Du={},Wg=class $o{constructor(t,e,r="pixi-shader",s={}){this.extra={},this.id=lU++,this.vertexSrc=t||$o.defaultVertexSrc,this.fragmentSrc=e||$o.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),Du[r]?(Du[r]++,r+=`-${Du[r]}`):Du[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
|
|
1444
1444
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}
|
|
1445
|
-
${this.fragmentSrc}`,this.vertexSrc=
|
|
1445
|
+
${this.fragmentSrc}`,this.vertexSrc=Ou(this.vertexSrc,$o.defaultVertexPrecision,Pe.HIGH),this.fragmentSrc=Ou(this.fragmentSrc,$o.defaultFragmentPrecision,Hg())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return FP}static get defaultFragmentSrc(){return IP}static from(t,e,r){let s=t+e,o=Tu[s];return o||(Tu[s]=o=new $o(t,e,r)),o}};Wg.defaultVertexPrecision=Pe.HIGH,Wg.defaultFragmentPrecision=vr.apple.device?Pe.HIGH:Pe.MEDIUM;var lr=Wg;var cU=0,Ye=class i{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=cU++,this.static=!!e,this.ubo=!!r,t instanceof te?(this.buffer=t,this.buffer.type=Le.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new te(new Float32Array(1)),this.buffer.type=Le.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(!this.ubo)this.uniforms[t]=new i(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,r){return new i(t,e,r)}static uboFrom(t,e){return new i(t,e??!0,!0)}};var ms=class i{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Ye?this.uniformGroup=e:this.uniformGroup=new Ye(e):this.uniformGroup=new Ye({}),this.disposeRunner=new Yt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let r in e.uniforms){let s=e.uniforms[r];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,r){let s=lr.from(t,e);return new i(s,r)}};var Ah=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 r=new Int32Array(t);for(let o=0;o<t;o++)r[o]=o;this.defaultGroupCache[t]=Ye.from({uSamplers:r},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new lr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new It,default:this.defaultGroupCache[t]};return new ms(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
1446
1446
|
`,e+=`
|
|
1447
1447
|
`;for(let r=0;r<t;r++)r>0&&(e+=`
|
|
1448
1448
|
else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=`
|
|
@@ -1450,7 +1450,7 @@ else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=`
|
|
|
1450
1450
|
color = texture2D(uSamplers[${r}], vTextureCoord);`,e+=`
|
|
1451
1451
|
}`;return e+=`
|
|
1452
1452
|
`,e+=`
|
|
1453
|
-
`,e}};var
|
|
1453
|
+
`,e}};var wh=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 OP(){return!vr.apple.device}function LP(i){let t=!0,e=Y.ADAPTER.getNavigator();if(vr.tablet||vr.phone){if(vr.apple.device){let r=e.userAgent.match(/OS (\d+)_(\d+)?/);r&&parseInt(r[1],10)<11&&(t=!1)}if(vr.android.device){let r=e.userAgent.match(/Android\s([0-9.]*)/);r&&parseInt(r[1],10)<7&&(t=!1)}}return t?i:4}var gs=class{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}};var DP=`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 NP=`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 Ch=class Sr extends gs{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=bh,this.vertexSize=6,this.state=Nr.for2d(),this.size=Sr.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??LP(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??OP(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return lt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return NP}static get defaultFragmentTemplate(){return DP}setShaderGenerator({vertex:t=Sr.defaultVertexSrc,fragment:e=Sr.defaultFragmentTemplate}={}){this.shaderGenerator=new Ah(t,e)}contextChange(){let t=this.renderer.gl;Y.PREFER_ENV===ze.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Sr.defaultMaxTextures),this.maxTextures=Eu(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}=Sr,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new yh);for(;e.length<s;)e.push(new wh);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,r=Sr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++ut._globalBatch,h=0,l=r[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&&(l.count>=e&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,u),c=u,l=r[++h],++a),d._batchEnabled=a,d.touched=n,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<o.length;u++)o[u]=null;ut._globalBatch=a}buildDrawCalls(t,e,r){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,h=Sr._drawCallPool,l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<r;++f){let p=s[f],m=p._texture.baseTexture,x=Ag[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==x&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=x}e<r&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;Sr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),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(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:r}=this.renderer,s=Sr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:h,size:l,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,r.set(this.state),e.drawElements(h,l,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),Sr.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=hs(Math.ceil(t/8)),r=vu(e),s=e*8;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new xh(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=hs(Math.ceil(t/12)),r=vu(e),s=e*12;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._iBuffers[r];return o||(this._iBuffers[r]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,r,s,o){let{uint32View:n,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Tr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=l[m],a[s++]=l[m+1],n[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)r[o++]=h+c[m]}};Ch.defaultBatchSize=4096,Ch.extension={name:"batch",type:V.RendererPlugin},Ch._drawCallPool=[],Ch._textureArrayPool=[];var ai=Ch;q.add(ai);var HP=`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 VP=`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 Xg=class Eh extends ps{constructor(t,e,r){let s=hr.from(t||Eh.defaultVertexSrc,e||Eh.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Eh.defaultResolution,this.multisample=Eh.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Or}apply(t,e,r,s,o){t.applyFilter(this,e,r,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 wP}static get defaultFragmentSrc(){return SP}};Xg.defaultResolution=1,Xg.defaultMultisample=wt.NONE;var Dr=Xg;var oi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new yr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??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(){}};oi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},oi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};Z.add(oi);var Wo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ms(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:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Wo.extension={type:$.RendererSystem,name:"batch"};Z.add(Wo);var EP=0,ni=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=EP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,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=EP++,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 r;if(K.PREFER_ENV>=We.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!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")}};ni.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ni.extension={type:$.RendererSystem,name:"context"};Z.add(ni);var Pi=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 Vt("disposeFramebuffer"),this.multisample=wt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:or.NEAREST,resolution:1,mipmap:xr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:or.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:xr.OFF,format:L.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 r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var gs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=wt.NONE),super(null,t),this.mipmap=xr.OFF,this.valid=!0,this._clear=new yr([0,0,0,0]),this.framebuffer=new Pi(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 te=class extends Xe{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Rg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,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===ze.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var xs=class extends te{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;te.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}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??K.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,r)=>{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=>{r(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,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ze.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,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&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 _s=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,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Rt.add(r,Rt.NW),this.x0=h+n*Rt.uX(r),this.y0=l+a*Rt.uY(r),r=Rt.add(r,2),this.x1=h+n*Rt.uX(r),this.y1=l+a*Rt.uY(r),r=Rt.add(r,2),this.x2=h+n*Rt.uX(r),this.y2=l+a*Rt.uY(r),r=Rt.add(r,2),this.x3=h+n*Rt.uX(r),this.y3=l+a*Rt.uY(r)}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}};_s.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 AP=new _s;function Du(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Ah=class i extends hs.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=AP,this.uvMatrix=null,this.orig=r||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 Yt(n.x,n.y):new Yt(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&&$e[e.url]&&i.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,i.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(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===AP&&(this._uvs=new _s),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ei()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ei()}`}o=t._pixiId}let n=$e[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Tu(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Tu(e)},s)),{resource:n}=o;n instanceof xs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),$e[e]&&$e[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),$e[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=$e[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete $e[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)$e[t.textureCacheIds[e]]===t&&delete $e[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:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${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 i._EMPTY||(i._EMPTY=new i(new ut),Du(i._EMPTY),Du(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=K.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Du(i._WHITE),Du(i._WHITE.baseTexture)}return i._WHITE}};var ys=class i extends Ah{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,r=!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,r&&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 i(new gs(t))}};var zo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=wt.NONE){let s=new gs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new ys(s)}getOptimalTexture(t,e,r=1,s=wt.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=as(t),e=as(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(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||wt.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 r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[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 r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};zo.SCREEN_KEY=-1;var Ch=class extends ri{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Ph=class extends ri{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 jt(this.vertices),this.uvBuffer=new jt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Rh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=wt.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Lu=[new Yt,new Yt,new Yt,new Yt],jg=new Ct,$o=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new zo,this.statePool=[],this.quad=new Ch,this.quadUv=new Ph,this.tempRect=new pt,this.activeState={},this.globalUniforms=new je({outputFrame:new pt,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 r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Rh,n=r.renderTexture,a,h;if(n.current){let x=n.current;a=x.resolution,h=x.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let x=1;x<e.length;x++){let v=e[x];l=Math.min(l,v.resolution||a),c=Math.min(c,v.multisample??h),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=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(jg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,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=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,g),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=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 l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ei.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ei.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ei.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ei.CLEAR){let{renderTexture:r,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,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ei.CLEAR||e===Ei.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,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(Ao.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ao.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Ct.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,r=1,s=wt.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){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,r||wt.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 r=Lu[0],s=Lu[1],o=Lu[2],n=Lu[3];r.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(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?jg.copyFrom(o):jg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};$o.extension={type:$.RendererSystem,name:"filter"};Z.add($o);var Mh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=wt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var k2=new pt,Xo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Pi(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 pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===We.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=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!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):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>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;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,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,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,r,s,o=eu.COLOR|eu.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Mh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.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,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.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],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._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:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.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,r=wt.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=wt.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Pi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.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=k2,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)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(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],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 r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};Xo.extension={type:$.RendererSystem,name:"framebuffer"};Z.add(Xo);var Yg={5126:4,5123:2,5121:1},jo=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 r=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===We.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.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:r}=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?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!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 h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let g in u)f[g]=0,p[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*Yg[d[g].type];for(let g in d){let x=d[g],v=x.size;x.stride===void 0&&(f[x.buffer]===v*Yg[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=v*Yg[x.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let g=0;g<u.length;g++){let x=u[g];n.bind(x),r&&x._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(Oe.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};jo.extension={type:$.RendererSystem,name:"geometry"};Z.add(jo);var CP=new Ct,Bh=class{constructor(t,e){this._texture=t,this.mapCoord=new Ct,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 r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(CP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(CP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var PP=`varying vec2 vMaskCoord;
|
|
1517
|
+
`;var zg=class Ph extends ms{constructor(t,e,r){let s=lr.from(t||Ph.defaultVertexSrc,e||Ph.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Ph.defaultResolution,this.multisample=Ph.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Nr}apply(t,e,r,s,o){t.applyFilter(this,e,r,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 VP}static get defaultFragmentSrc(){return HP}};zg.defaultResolution=1,zg.defaultMultisample=Ct.NONE;var Vr=zg;var hi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Tr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??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(){}};hi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},hi.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(hi);var Xo=class{constructor(t){this.renderer=t,this.emptyRenderer=new gs(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:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Xo.extension={type:V.RendererSystem,name:"batch"};q.add(Xo);var WP=0,li=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=WP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,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=WP++,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 r;if(Y.PREFER_ENV>=ze.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!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")}};li.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},li.extension={type:V.RendererSystem,name:"context"};q.add(li);var Bi=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 Yt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:nr.NEAREST,resolution:1,mipmap:br.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:nr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:br.OFF,format:U.DEPTH_COMPONENT,type:rt.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 r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var xs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,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=br.OFF,this.valid=!0,this._clear=new Tr([0,0,0,0]),this.framebuffer=new Bi(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 ne=class extends je{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Cg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,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===$e.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var _s=class extends ne{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;ne.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}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,r)=>{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=>{r(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,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===$e.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,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&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 ys=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,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Gt.add(r,Gt.NW),this.x0=h+n*Gt.uX(r),this.y0=l+a*Gt.uY(r),r=Gt.add(r,2),this.x1=h+n*Gt.uX(r),this.y1=l+a*Gt.uY(r),r=Gt.add(r,2),this.x2=h+n*Gt.uX(r),this.y2=l+a*Gt.uY(r),r=Gt.add(r,2),this.x3=h+n*Gt.uX(r),this.y3=l+a*Gt.uY(r)}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}};ys.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 zP=new ys;function Nu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Rh=class i extends ls.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new gt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=zP,this.uvMatrix=null,this.orig=r||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 ee(n.x,n.y):new ee(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&&Xe[e.url]&&i.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,i.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(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===zP&&(this._uvs=new ys),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${si()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${si()}`}o=t._pixiId}let n=Xe[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Su(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Su(e)},s)),{resource:n}=o;n instanceof _s&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Xe[e]&&Xe[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Xe[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Xe[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Xe[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Xe[t.textureCacheIds[e]]===t&&delete Xe[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:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${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 i._EMPTY||(i._EMPTY=new i(new ut),Nu(i._EMPTY),Nu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._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),i._WHITE=new i(ut.from(t)),Nu(i._WHITE),Nu(i._WHITE.baseTexture)}return i._WHITE}};var bs=class i extends Rh{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,r=!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,r&&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 i(new xs(t))}};var jo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=Ct.NONE){let s=new xs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new bs(s)}getOptimalTexture(t,e,r=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=hs(t),e=hs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||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 r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[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 r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};jo.SCREEN_KEY=-1;var Mh=class extends oi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Bh=class extends oi{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 te(this.vertices),this.uvBuffer=new te(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ih=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new gt,this.destinationFrame=new gt,this.bindingSourceFrame=new gt,this.bindingDestinationFrame=new gt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Hu=[new ee,new ee,new ee,new ee],$g=new It,Yo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new jo,this.statePool=[],this.quad=new Mh,this.quadUv=new Bh,this.tempRect=new gt,this.activeState={},this.globalUniforms=new Ye({outputFrame:new gt,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 r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ih,n=r.renderTexture,a,h;if(n.current){let x=n.current;a=x.resolution,h=x.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let x=1;x<e.length;x++){let v=e[x];l=Math.min(l,v.resolution||a),c=Math.min(c,v.multisample??h),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=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB($g.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,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=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=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 l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Pi.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Pi.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Pi.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Pi.CLEAR){let{renderTexture:r,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,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Pi.CLEAR||e===Pi.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,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(Ro.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ro.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.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,r=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){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,r||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 r=Hu[0],s=Hu[1],o=Hu[2],n=Hu[3];r.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(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?$g.copyFrom(o):$g.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Yo.extension={type:V.RendererSystem,name:"filter"};q.add(Yo);var Fh=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 uU=new gt,qo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Bi(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 gt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===ze.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=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!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):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>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;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,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,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,r,s,o=ru.COLOR|ru.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Fh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.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,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.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],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._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:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.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,r=Ct.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=Ct.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Bi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.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=uU,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)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(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],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 r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new gt}destroy(){this.renderer=null}};qo.extension={type:V.RendererSystem,name:"framebuffer"};q.add(qo);var Xg={5126:4,5123:2,5121:1},Ko=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 r=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===ze.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.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:r}=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?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!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 h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Xg[d[m].type];for(let m in d){let x=d[m],v=x.size;x.stride===void 0&&(f[x.buffer]===v*Xg[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=v*Xg[x.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let x=u[m];n.bind(x),r&&x._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(Le.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Ko.extension={type:V.RendererSystem,name:"geometry"};q.add(Ko);var $P=new It,Gh=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 r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&($P.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append($P));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var XP=`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 jP=`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 Ih=class extends Dr{constructor(t,e,r){let s=null;typeof t!="string"&&e===void 0&&r===void 0&&(s=t,t=void 0,e=void 0,r=void 0),super(t||RP,e||PP,r),this.maskSprite=s,this.maskMatrix=new Ct}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Bh(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,r,s))}};var Fh=class{constructor(t=null){this.type=Xt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Dr.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=Xt.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 Yo=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 r=e;if(!r.isMaskData){let o=this.maskDataPool.pop()||new Fh;o.pooled=!0,o.maskObject=e,r=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==Xt.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case Xt.SCISSOR:this.renderer.scissor.push(r);break;case Xt.STENCIL:this.renderer.stencil.push(r);break;case Xt.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case Xt.COLOR:this.pushColorMask(r);break;default:break}r.type===Xt.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Xt.SCISSOR:this.renderer.scissor.pop(e);break;case Xt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Xt.SPRITE:this.popSpriteMask(e);break;case Xt.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let r=this.maskStack[this.maskStack.length-1];r.type===Xt.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=Xt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Xt.SCISSOR:t.type=Xt.STENCIL:t.type=Xt.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Ih])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,s),r.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,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}};Yo.extension={type:$.RendererSystem,name:"mask"};Z.add(Yo);var qo=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==r&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var MP=new Ct,BP=[],IP=class Hu extends qo{constructor(t){super(t),this.glConst=K.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:r}=t,{renderer:s}=this,o=s.renderTexture,n=r.getBounds(!0,BP.pop()??new pt);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:r,c:s,d:o}=t;return(Math.abs(r)>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()||Hu.isMatrixRotated(e.worldTransform)||Hu.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,s,o){Hu.isMatrixRotated(o)||(o=o?MP.copyFrom(o):MP.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.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&&BP.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)}};IP.extension={type:$.RendererSystem,name:"scissor"};var qg=IP;Z.add(qg);var Ko=class extends qo{constructor(t){super(t),this.glConst=K.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:r}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,r.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 r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._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&&(r._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)}};Ko.extension={type:$.RendererSystem,name:"stencil"};Z.add(Ko);var Zo=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Zo.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};Z.add(Zo);var Qo=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ct,this.transform=null}update(t,e,r,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,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,r,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}};Qo.extension={type:$.RendererSystem,name:"projection"};Z.add(Qo);var O2=new Mu,FP=new pt,Jo=class{constructor(t){this.renderer=t,this._tempMatrix=new Ct}generateTexture(t,e){let{region:r,...s}=e||{},o=r?.copyTo(FP)||t.getLocalBounds(FP,!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=ys.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let h=t.transform;return t.transform=O2,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}};Jo.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};Z.add(Jo);var bs=new pt,Gh=new pt,tn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(bs.width=t.frame.width,bs.height=t.frame.height,e=bs),r||(Gh.x=t.frame.x,Gh.y=t.frame.y,Gh.width=e.width,Gh.height=e.height,r=Gh),n=o.framebuffer):(a=s.resolution,e||(bs.width=s._view.screen.width,bs.height=s._view.screen.height,e=bs),r||(r=bs,r.width=e.width,r.height=e.height));let h=this.viewportFrame;h.x=r.x*a,h.y=r.y*a,h.width=r.width*a,h.height=r.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(n,h),this.renderer.projection.update(r,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=yr.shared.setValue(t||r);(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:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,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}};tn.extension={type:$.RendererSystem,name:"renderTexture"};Z.add(tn);var Uh=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 GP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){let o=t.getActiveAttrib(i,s);if(o.name.startsWith("gl_"))continue;let n=bh(t,o.type),a={type:n,name:o.name,size:yh(n),location:t.getAttribLocation(i,o.name)};e[o.name]=a}return e}function UP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=bh(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:_h(h,o.size)}}return e}function Kg(i,t){let e=Bu(i,i.VERTEX_SHADER,t.vertexSrc),r=Bu(i,i.FRAGMENT_SHADER,t.fragmentSrc),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||zg(i,s,e,r),t.attributeData=GP(s,i),t.uniformData=UP(s,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((h,l)=>h>l?1:-1);for(let h=0;h<a.length;h++)t.attributeData[a[h]].location=h,i.bindAttribLocation(s,h,a[h]);i.linkProgram(s)}i.deleteShader(e),i.deleteShader(r);let n={};for(let a in t.uniformData){let h=t.uniformData[a];n[a]={location:i.getUniformLocation(s,a),value:_h(h.type,h.size)}}return new Uh(s,n)}function N2(i,t,e,r,s){e.buffer.update(s)}var D2={float:`
|
|
1558
|
+
`;var Uh=class extends Vr{constructor(t,e,r){let s=null;typeof t!="string"&&e===void 0&&r===void 0&&(s=t,t=void 0,e=void 0,r=void 0),super(t||jP,e||XP,r),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,r,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Gh(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,r,s))}};var kh=class{constructor(t=null){this.type=Jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Vr.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=Jt.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 Zo=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 r=e;if(!r.isMaskData){let o=this.maskDataPool.pop()||new kh;o.pooled=!0,o.maskObject=e,r=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==Jt.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case Jt.SCISSOR:this.renderer.scissor.push(r);break;case Jt.STENCIL:this.renderer.stencil.push(r);break;case Jt.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case Jt.COLOR:this.pushColorMask(r);break;default:break}r.type===Jt.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Jt.SCISSOR:this.renderer.scissor.pop(e);break;case Jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Jt.SPRITE:this.popSpriteMask(e);break;case Jt.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let r=this.maskStack[this.maskStack.length-1];r.type===Jt.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=Jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Jt.SCISSOR:t.type=Jt.STENCIL:t.type=Jt.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=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=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,s),r.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,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}};Zo.extension={type:V.RendererSystem,name:"mask"};q.add(Zo);var Qo=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==r&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var YP=new It,qP=[],KP=class Vu extends Qo{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:r}=t,{renderer:s}=this,o=s.renderTexture,n=r.getBounds(!0,qP.pop()??new gt);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:r,c:s,d:o}=t;return(Math.abs(r)>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()||Vu.isMatrixRotated(e.worldTransform)||Vu.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,s,o){Vu.isMatrixRotated(o)||(o=o?YP.copyFrom(o):YP.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.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&&qP.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)}};KP.extension={type:V.RendererSystem,name:"scissor"};var jg=KP;q.add(jg);var Jo=class extends Qo{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:r}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,r.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 r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._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&&(r._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)}};Jo.extension={type:V.RendererSystem,name:"stencil"};q.add(Jo);var tn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return lt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return lt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return lt("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}};tn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_plugin"};q.add(tn);var en=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,r,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,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,r,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}};en.extension={type:V.RendererSystem,name:"projection"};q.add(en);var dU=new Bu,ZP=new gt,rn=class{constructor(t){this.renderer=t,this._tempMatrix=new It}generateTexture(t,e){let{region:r,...s}=e||{},o=r?.copyTo(ZP)||t.getLocalBounds(ZP,!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=bs.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let h=t.transform;return t.transform=dU,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}};rn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"textureGenerator"};q.add(rn);var vs=new gt,Oh=new gt,sn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new gt,this.destinationFrame=new gt,this.viewportFrame=new gt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(vs.width=t.frame.width,vs.height=t.frame.height,e=vs),r||(Oh.x=t.frame.x,Oh.y=t.frame.y,Oh.width=e.width,Oh.height=e.height,r=Oh),n=o.framebuffer):(a=s.resolution,e||(vs.width=s._view.screen.width,vs.height=s._view.screen.height,e=vs),r||(r=vs,r.width=e.width,r.height=e.height));let h=this.viewportFrame;h.x=r.x*a,h.y=r.y*a,h.width=r.width*a,h.height=r.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(n,h),this.renderer.projection.update(r,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Tr.shared.setValue(t||r);(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:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,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}};sn.extension={type:V.RendererSystem,name:"renderTexture"};q.add(sn);var Lh=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 QP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){let o=t.getActiveAttrib(i,s);if(o.name.startsWith("gl_"))continue;let n=Sh(t,o.type),a={type:n,name:o.name,size:Th(n),location:t.getAttribLocation(i,o.name)};e[o.name]=a}return e}function JP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Sh(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:vh(h,o.size)}}return e}function Yg(i,t){let e=Iu(i,i.VERTEX_SHADER,t.vertexSrc),r=Iu(i,i.FRAGMENT_SHADER,t.fragmentSrc),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||Vg(i,s,e,r),t.attributeData=QP(s,i),t.uniformData=JP(s,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((h,l)=>h>l?1:-1);for(let h=0;h<a.length;h++)t.attributeData[a[h]].location=h,i.bindAttribLocation(s,h,a[h]);i.linkProgram(s)}i.deleteShader(e),i.deleteShader(r);let n={};for(let a in t.uniformData){let h=t.uniformData[a];n[a]={location:i.getUniformLocation(s,a),value:vh(h.type,h.size)}}return new Lh(s,n)}function fU(i,t,e,r,s){e.buffer.update(s)}var pU={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
|
+
`},tR={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 eR(i){let t=i.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=tR[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,r%e!==0&&r<16){let a=r%e%16;r+=a,s+=a}r+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,r=e):(n.offset=s,r+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function rR(i,t){let e=[];for(let r in i)t[r]&&e.push(t[r]);return e.sort((r,s)=>r.index-s.index),e}function qg(i,t){if(!i.autoManage)return{size:0,syncFunc:fU};let e=rR(i.uniforms,t),{uboElements:r,size:s}=eR(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<r.length;n++){let a=r[n],h=i.uniforms[a.data.name],l=a.data.name,c=!1;for(let u=0;u<
|
|
1604
|
+
`];for(let n=0;n<r.length;n++){let a=r[n],h=i.uniforms[a.data.name],l=a.data.name,c=!1;for(let u=0;u<Hr.length;u++){let d=Hr[u];if(d.codeUbo&&d.test(a.data,h)){o.push(`offset = ${a.offset/4};`,Hr[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){let u=Th(a.data.type),d=Math.max(tR[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;o.push(`
|
|
1605
1605
|
cv = ud.${l}.value;
|
|
1606
1606
|
v = uv.${l};
|
|
1607
1607
|
offset = ${a.offset/4};
|
|
@@ -1617,7 +1617,7 @@ void main(void)
|
|
|
1617
1617
|
offset += ${p};
|
|
1618
1618
|
}
|
|
1619
1619
|
|
|
1620
|
-
`)}else{let u=
|
|
1620
|
+
`)}else{let u=pU[a.data.type];o.push(`
|
|
1621
1621
|
cv = ud.${l}.value;
|
|
1622
1622
|
v = uv.${l};
|
|
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 L2=0,Vu={textureCount:0,uboCount:0},Ri=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=L2++}systemCheck(){if(!Ou())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 r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(Vu.textureCount=0,Vu.uboCount=0,this.syncUniformGroup(t.uniformGroup,Vu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,Vu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=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]=Zg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Kg(e,r);return r.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}};Ri.extension={type:$.RendererSystem,name:"shader"};Z.add(Ri);var ai=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(){}};ai.defaultOptions={hello:!1},ai.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(ai);function DP(i,t=[]){return t[J.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.ADD]=[i.ONE,i.ONE],t[J.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.NONE]=[0,0],t[J.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[J.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[J.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[J.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[J.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[J.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[J.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[J.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[J.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[J.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var H2=0,V2=1,W2=2,z2=3,$2=4,X2=5,LP=class Qg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=J.NONE,this._blendEq=!1,this.map=[],this.map[H2]=this.setBlend,this.map[V2]=this.setOffset,this.map[W2]=this.setCullFace,this.map[z2]=this.setDepthTest,this.map[$2]=this.setFrontFace,this.map[X2]=this.setDepthMask,this.checks=[],this.defaultState=new Or,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=DP(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Qg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qg.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],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}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 r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};LP.extension={type:$.RendererSystem,name:"state"};var Jg=LP;Z.add(Jg);var en=class extends hs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Vt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var kh=class Wu{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Wu.defaultMaxIdle,this.checkCountMax=Wu.defaultCheckCountMax,this.mode=Wu.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==ru.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!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,r=!0)}if(r){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,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};kh.defaultMode=ru.AUTO,kh.defaultMaxIdle=60*60,kh.defaultCheckCountMax=60*10,kh.extension={type:$.RendererSystem,name:"textureGC"};var Lr=kh;Z.add(Lr);var vs=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=L.RGBA,this.samplerType=0}};function HP(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:V.FLOAT,[i.RGBA]:V.FLOAT,[i.ALPHA]:V.FLOAT,[i.LUMINANCE]:V.FLOAT,[i.LUMINANCE_ALPHA]:V.FLOAT,[i.R8]:V.FLOAT,[i.R8_SNORM]:V.FLOAT,[i.RG8]:V.FLOAT,[i.RG8_SNORM]:V.FLOAT,[i.RGB8]:V.FLOAT,[i.RGB8_SNORM]:V.FLOAT,[i.RGB565]:V.FLOAT,[i.RGBA4]:V.FLOAT,[i.RGB5_A1]:V.FLOAT,[i.RGBA8]:V.FLOAT,[i.RGBA8_SNORM]:V.FLOAT,[i.RGB10_A2]:V.FLOAT,[i.RGB10_A2UI]:V.FLOAT,[i.SRGB8]:V.FLOAT,[i.SRGB8_ALPHA8]:V.FLOAT,[i.R16F]:V.FLOAT,[i.RG16F]:V.FLOAT,[i.RGB16F]:V.FLOAT,[i.RGBA16F]:V.FLOAT,[i.R32F]:V.FLOAT,[i.RG32F]:V.FLOAT,[i.RGB32F]:V.FLOAT,[i.RGBA32F]:V.FLOAT,[i.R11F_G11F_B10F]:V.FLOAT,[i.RGB9_E5]:V.FLOAT,[i.R8I]:V.INT,[i.R8UI]:V.UINT,[i.R16I]:V.INT,[i.R16UI]:V.UINT,[i.R32I]:V.INT,[i.R32UI]:V.UINT,[i.RG8I]:V.INT,[i.RG8UI]:V.UINT,[i.RG16I]:V.INT,[i.RG16UI]:V.UINT,[i.RG32I]:V.INT,[i.RG32UI]:V.UINT,[i.RGB8I]:V.INT,[i.RGB8UI]:V.UINT,[i.RGB16I]:V.INT,[i.RGB16UI]:V.UINT,[i.RGB32I]:V.INT,[i.RGB32UI]:V.UINT,[i.RGBA8I]:V.INT,[i.RGBA8UI]:V.UINT,[i.RGBA16I]:V.INT,[i.RGBA16UI]:V.UINT,[i.RGBA32I]:V.INT,[i.RGBA32UI]:V.UINT,[i.DEPTH_COMPONENT16]:V.FLOAT,[i.DEPTH_COMPONENT24]:V.FLOAT,[i.DEPTH_COMPONENT32F]:V.FLOAT,[i.DEPTH_STENCIL]:V.FLOAT,[i.DEPTH24_STENCIL8]:V.FLOAT,[i.DEPTH32F_STENCIL8]:V.FLOAT}:t={[i.RGB]:V.FLOAT,[i.RGBA]:V.FLOAT,[i.ALPHA]:V.FLOAT,[i.LUMINANCE]:V.FLOAT,[i.LUMINANCE_ALPHA]:V.FLOAT,[i.DEPTH_STENCIL]:V.FLOAT},t}function VP(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[st.UNSIGNED_BYTE]:{[L.RGBA]:i.RGBA8,[L.RGB]:i.RGB8,[L.RG]:i.RG8,[L.RED]:i.R8,[L.RGBA_INTEGER]:i.RGBA8UI,[L.RGB_INTEGER]:i.RGB8UI,[L.RG_INTEGER]:i.RG8UI,[L.RED_INTEGER]:i.R8UI,[L.ALPHA]:i.ALPHA,[L.LUMINANCE]:i.LUMINANCE,[L.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[st.BYTE]:{[L.RGBA]:i.RGBA8_SNORM,[L.RGB]:i.RGB8_SNORM,[L.RG]:i.RG8_SNORM,[L.RED]:i.R8_SNORM,[L.RGBA_INTEGER]:i.RGBA8I,[L.RGB_INTEGER]:i.RGB8I,[L.RG_INTEGER]:i.RG8I,[L.RED_INTEGER]:i.R8I},[st.UNSIGNED_SHORT]:{[L.RGBA_INTEGER]:i.RGBA16UI,[L.RGB_INTEGER]:i.RGB16UI,[L.RG_INTEGER]:i.RG16UI,[L.RED_INTEGER]:i.R16UI,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[st.SHORT]:{[L.RGBA_INTEGER]:i.RGBA16I,[L.RGB_INTEGER]:i.RGB16I,[L.RG_INTEGER]:i.RG16I,[L.RED_INTEGER]:i.R16I},[st.UNSIGNED_INT]:{[L.RGBA_INTEGER]:i.RGBA32UI,[L.RGB_INTEGER]:i.RGB32UI,[L.RG_INTEGER]:i.RG32UI,[L.RED_INTEGER]:i.R32UI,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[st.INT]:{[L.RGBA_INTEGER]:i.RGBA32I,[L.RGB_INTEGER]:i.RGB32I,[L.RG_INTEGER]:i.RG32I,[L.RED_INTEGER]:i.R32I},[st.FLOAT]:{[L.RGBA]:i.RGBA32F,[L.RGB]:i.RGB32F,[L.RG]:i.RG32F,[L.RED]:i.R32F,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[st.HALF_FLOAT]:{[L.RGBA]:i.RGBA16F,[L.RGB]:i.RGB16F,[L.RG]:i.RG16F,[L.RED]:i.R16F},[st.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:i.RGB565},[st.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:i.RGBA4},[st.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:i.RGB5_A1},[st.UNSIGNED_INT_2_10_10_10_REV]:{[L.RGBA]:i.RGB10_A2,[L.RGBA_INTEGER]:i.RGB10_A2UI},[st.UNSIGNED_INT_10F_11F_11F_REV]:{[L.RGB]:i.R11F_G11F_B10F},[st.UNSIGNED_INT_5_9_9_9_REV]:{[L.RGB]:i.RGB9_E5},[st.UNSIGNED_INT_24_8]:{[L.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[st.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[L.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[st.UNSIGNED_BYTE]:{[L.RGBA]:i.RGBA,[L.RGB]:i.RGB,[L.ALPHA]:i.ALPHA,[L.LUMINANCE]:i.LUMINANCE,[L.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[st.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:i.RGB},[st.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:i.RGBA},[st.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:i.RGBA}},t}var rn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,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=VP(t),this.samplerTypes=HP(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 r=new vs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.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]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new vs(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:r}=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,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.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:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==V.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new vs(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]??V.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 r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==V.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.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:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.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&&Pg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===xr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=th.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==xr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===or.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===or.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===or.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===or.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};rn.extension={type:$.RendererSystem,name:"texture"};Z.add(rn);var sn=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:r}=this,s=t._glTransformFeedbacks[r]||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:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,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&&(r.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 r=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 h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};sn.extension={type:$.RendererSystem,name:"transformFeedback"};Z.add(sn);var hi=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||K.ADAPTER.createCanvas(),this.resolution=t.resolution||K.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 r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,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}};hi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},hi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};Z.add(hi);K.PREFER_ENV=We.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={...ni.defaultOptions,...oi.defaultOptions,...hi.defaultOptions,...ai.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Dr.defaultResolution},set(i){Dr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Dr.defaultMultisample},set(i){Dr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return si.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),si.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return si.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),si.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return si.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),si.canUploadSameBuffer=i}},GC_MODE:{get(){return Lr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Lr.defaultMode=i}},GC_MAX_IDLE:{get(){return Lr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Lr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Lr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Lr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return hr.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),hr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return hr.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),hr.defaultFragmentPrecision=i}}});var Ts=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ts||{});var on=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var WP=class Ye{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 on(null,null,1/0),this.deltaMS=1/Ye.targetFPMS,this.elapsedMS=1/Ye.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ts.NORMAL){return this._addListener(new on(t,e,r))}addOnce(t,e,r=Ts.NORMAL){return this._addListener(new on(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ye.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ye.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ye._shared){let t=Ye._shared=new Ye;t.autoStart=!0,t._protected=!0}return Ye._shared}static get system(){if(!Ye._system){let t=Ye._system=new Ye;t.autoStart=!0,t._protected=!0}return Ye._system}};WP.targetFPMS=.06;var lr=WP;Object.defineProperties(K,{TARGET_FPMS:{get(){return lr.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),lr.targetFPMS=i}}});var Oh=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,Ts.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?lr.shared:new lr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Oh.extension=$.Application;Z.add(Oh);var j2=[];Z.handleByList($.Renderer,j2);var Nh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=wt.HIGH?this.multisample=wt.HIGH:e>=wt.MEDIUM?this.multisample=wt.MEDIUM:e>=wt.LOW?this.multisample=wt.LOW:this.multisample=wt.NONE}destroy(){}};Nh.extension={type:$.RendererSystem,name:"_multisample"};Z.add(Nh);var zu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Dh=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:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||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 r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new zu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Dh.extension={type:$.RendererSystem,name:"buffer"};Z.add(Dh);var Lh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Lh.extension={type:$.RendererSystem,name:"objectRenderer"};Z.add(Lh);var $u=class tx extends en{constructor(t){super(),this.type=Wm.WEBGL,t=Object.assign({},K.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new je({projectionMatrix:new Ct},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:tx.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=tx.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Ag()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};$u.extension={type:$.Renderer,priority:1},$u.__plugins={},$u.__systems={};var Xu=$u;Z.handleByMap($.RendererPlugin,Xu.__plugins);Z.handleByMap($.RendererSystem,Xu.__systems);Z.add(Xu);var Mi=class extends Xe{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Xe?this.addResourceAt(t[r],r):this.addResourceAt(Do(t[r],e),r))}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:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var Hh=class extends Mi{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,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=Jr.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var Vh=class extends te{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var zP=class Wh extends Mi{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Wh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Wh.SIDES;a++)this.items[a].target=Jr.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=Jr.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=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=Jr.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,r){let s=this.itemDirtyIds;for(let o=0;o<Wh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Wh.SIDES}};zP.SIDES=6;var ex=zP;var zh=class i extends te{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),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 r=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ze.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(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 i._EMPTY=i._EMPTY??K.ADAPTER.createCanvas(0,0),i._EMPTY}};var rx=class ju extends te{constructor(t,e){e=e||{},super(K.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)},ju.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;te.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,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ei()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=ju.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}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"&&ju.SVG_XML.test(t)}};rx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,rx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ix=rx;var Yu=class extends te{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sx=class ox extends te{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];te.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ox.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}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=lr.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,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,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&&(lr.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||(lr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(lr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ox.TYPES.includes(e)}};sx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var nx=sx;mh.push(zh,xs,Vh,nx,Yu,ix,ls,ex,Hh);var Y2={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},q2={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function $P(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.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,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.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,h.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],h.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,h.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],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?Y2:q2)[c.type].call(null,h,d.location,d.value,u)}}function K2(){Object.assign(Ri.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;$P(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}K2();var he={Add:"add",Remove:"remove",Update:"update"},qu=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},Bi=class{rendererName;rendererType;add=async(t,e,r)=>{throw new Error("Method not implemented.")};remove=async(t,e,r)=>{throw new Error("Method not implemented.")};update=async(t,e,r)=>{throw new Error("Method not implemented.")}};var Ss=new(window.AudioContext||window.webkitAudioContext),nn=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Ss.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},ax=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Ss.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Ss.destination)}play=()=>{let t=nn.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Ss.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Ss.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Ss.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Ss.destination))}},Ku=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new ax(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};function Zu(i,t){let{id:e,x:r,y:s,width:o,height:n,fill:a,border:h,originX:l,originY:c,zIndex:u,rotation:d}=t,f=new Qt().rect(r,s,o,n).fill(a);h&&f.stroke({color:h.color,alpha:h.alpha,width:h.width}),f.label=e,f.zIndex=u,i.addChild(f)}function $h(i,t){let e=new gr({text:t.text,style:{fill:t.style.fill,fontFamily:t.style.fontFamily,fontSize:t.style.fontSize,wordWrap:t.style.wordWrap,breakWords:t.style.breakWords,wordWrapWidth:t.style.wordWrapWidth},label:t.id});e.x=t.x,e.y=t.y,e.zIndex=t.zIndex,i.addChild(e)}async function Qu(i,t){let{id:e,x:r,y:s,width:o,height:n,url:a,alpha:h,zIndex:l}=t,c=a?I.from(a):I.EMPTY,u=new Zt(c);u.x=r,u.y=s,u.width=o,u.height=n,u.alpha=h,u.zIndex=l,u.label=e,i.addChild(u)}function hx(i,t){let{id:e,x:r,y:s,children:o,scroll:n,zIndex:a}=t,h=new yt;h.x=r,h.y=s,h.zIndex=a,h.label=e;for(let l of o)switch(l.type){case"rect":Zu(h,l);break;case"text":$h(h,l);break;case"sprite":Qu(h,l);break;case"container":hx(h,l);break;default:throw new Error("Unkown types")}n&&Z2({container:h,element:t}),i.addChild(h)}function Z2({container:i,element:t}){let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new yt;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new Qt().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,g=c-p;g>0?c=0:g<d?c=d:c=g,n.x=c}})}}function XP(i,t){let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):JSON.stringify(l)!==JSON.stringify(c)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}}function jP(i,t){let e=i.getChildByLabel(t.id);e&&e.destroy()}function YP(i,t){let e=i.getChildByLabel(t.id);e&&e.destroy()}function qP(i,t){let e=i.getChildByLabel(t.id);e&&e.destroy({children:!0})}function KP(i,t){let e=i.getChildByLabel(t.id);e&&e.destroy()}function ZP(i,t,e){let r=i.children.find(s=>s.label===t.id);r&&(r.clear(),r.rect(e.x,e.y,e.width,e.height).fill(e.fill),e.border&&r.stroke({color:e.border.color,alpha:e.border.alpha,width:e.border.width}),r.zIndex=e.zIndex)}function QP(i,t,e){let r=i.children.find(s=>s.label===t.id);r&&(r.text=e.text,r.style={fill:e.style.fill,fontFamily:e.style.fontFamily,fontSize:e.style.fontSize,wordWrap:e.style.wordWrap,breakWords:e.style.breakWords,wordWrapWidth:e.style.wordWrapWidth},r.x=e.x,r.y=e.y,r.zIndex=e.zIndex)}async function JP(i,t,e){let r=i.children.find(s=>s.label===t.id);if(r){if(t.url!==e.url){let s=e.url?I.from(e.url):I.EMPTY;r.texture=s}r.x=e.x,r.y=e.y,r.width=e.width,r.height=e.height,r.alpha=e.alpha,r.zIndex=e.zIndex}}function tR(i,t,e,r){let s=t.children.find(o=>o.label===e.id);s&&(s.x=r.x,s.y=r.y,s.zIndex=r.zIndex,s.label=r.id,JSON.stringify(e.children)!==JSON.stringify(r.children)&&Xh(i,s,e.children,r.children))}function Xh(i,t,e,r){let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=XP(e,r);for(let a of o)switch(a.type){case"rect":jP(t,a);break;case"text":YP(t,a);break;case"container":qP(t,a);break;case"sprite":KP(t,a);break;default:}for(let a of s)switch(a.type){case"rect":Zu(t,a);break;case"text":$h(t,a);break;case"container":hx(t,a);break;case"sprite":Qu(t,a);break;default:}for(let{prev:a,next:h}of n)switch(h.type){case"rect":ZP(t,a,h);break;case"text":QP(t,a,h);break;case"container":tR(i,t,a,h);break;case"sprite":JP(t,a,h);break;default:}Q2(t,r)}function Q2(i,t){i.children.sort((e,r)=>{let s=t.find(n=>n.id===e.label),o=t.find(n=>n.id===r.label);if(s&&o){let n=s.zIndex??0,a=o.zIndex??0;if(n!==a)return n-a;let h=t.findIndex(c=>c.id===e.label),l=t.findIndex(c=>c.id===r.label);return h-l}if(!s&&!o)return 0;if(!s)return-1;if(!o)return 1})}function eR({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0}){if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}}function Ii(i){if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!["rect","text","container","sprite"].includes(i.type))throw new Error("Input Error: Type must be one of rect, text, container, sprite");if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type==="container"&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=eR({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY});return{id:i.id,type:i.type,width:t,height:e,x:r,y:s,originX:o,originY:n,zIndex:i.zIndex||0}}function Ju(i){let t=Ii(i);return i.border&&(t={...t,border:{alpha:i?.border?.alpha??1,color:i?.border?.color??"black",width:i?.border?.width??0}}),{...t,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}}function td(i){let e={...{fill:"black",fontFamily:"Arial",fontSize:16},...i.style};i.width&&(e.wordWrapWidth=i.width,e.wordWrap=!0);let{width:r,height:s}=gt.measureText(i.text,new Ht(e));return{...Ii({...i,width:r,height:s}),text:i.text??"",style:{...e}}}function ed(i){return{...Ii(i),url:i.url??"",alpha:i.alpha??1,cursor:i.cursor??"",clickUrl:i.clickUrl??"",hoverUrl:i.hoverUrl??""}}function lx(i){let t=i.direction,e=!!i.scroll,r=i.gap||0,s=i.children||[],o=[],n=0,a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,g=0;for(let v=0;v<s.length;v++){let _=v<s.length-1?r:0,y=s[v];switch(v>0?t==="horizontal"?(y.x=h,y.y=d):t==="vertical"&&(y.x=f,y.y=l):(t==="horizontal"||t==="vertical")&&(y.x=0,y.y=0),y.type){case"rect":y=Ju(y);break;case"text":y=td(y);break;case"sprite":y=ed(y);break;case"container":y=lx(y);break;default:}t==="horizontal"?(i.width&&y.width+p>i.width&&!e?(h=0,p=0,d+=c+r,c=y.height,y.x=0,y.y=d):c=Math.max(c,y.height),h+=y.width+_,p=y.x+y.width,n=Math.max(h,n),a=Math.max(y.height+y.y,a)):t==="vertical"&&(i.height&&y.height+g>i.height&&!e?(l=0,g=0,f+=u+r,u=y.width,y.x=f,y.y=0):u=Math.max(u,y.width),l+=y.height+_,g=y.y+y.height,n=Math.max(y.width+y.x,n),a=Math.max(l,a)),o.push(y)}return{...Ii({...i,width:i.width?i.width:n,height:i.height?i.height:a}),children:o,direction:t,gap:r,scroll:e,rotation:i.rotation??0}}function jh(i){return i.map(e=>{switch(e.type){case"rect":return Ju(e);case"container":return lx(e);case"text":return td(e);case"sprite":return ed(e);default:throw new Error(`Unsupported element type: ${e.type}`)}})}var J2=i=>i.split("/").pop(),cx=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:J2(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof I)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new I.from(r)}async unload(t){t.destroy(!0)}},ux=class i extends qu{static rendererName="pixi";_app;_audioStage=new Ku;_state={elements:[],transitions:[]};_eventHandler;_plugins;_currentAbortController;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let h of r)if(h.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Za,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Qt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=t=>t?t.startsWith("audio/")?"audio":t.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(t)?"font":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>nn.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),h=new FontFace(s,`url(${a})`);try{await h.load(),document.fonts.add(h)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new cx(e.texture),sr.loader.parsers.length=0,sr.reset(),D.add({name:"advanced-buffer-loader",extension:b.Asset,priority:se.High,loader:this._advancedLoader}),typeof sr.registerPlugin=="function"&&sr.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>sr.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return nn.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};getStageElementBounds=()=>{let t={},e=r=>{if(!(!r||r.length===0))for(let s of r)t[s.label]={x:s.groupTransform.tx,y:s.groupTransform.ty,width:s.width,height:s.height},e(s.children)};return e(this._app.stage.children),t};render=t=>{let e=jh(t.elements),r={...t,elements:e};this._render(this._app,this._app.stage,this._state,r,this._eventHandler),this._state=r};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_applyGlobalCursorStyles=(t,e,r)=>{t.renderer.events.cursorStyles||(t.renderer.events.cursorStyles={}),t.renderer.events.cursorStyles.default||(t.renderer.events.cursorStyles.default="default"),t.renderer.events.cursorStyles.hover||(t.renderer.events.cursorStyles.hover="pointer");let s=e?.cursorStyles,o=r?.cursorStyles;JSON.stringify(s)!==JSON.stringify(o)&&(o?(o.default&&(t.renderer.events.cursorStyles.default=o.default,t.canvas.style.cursor=o.default),o.hover&&(t.renderer.events.cursorStyles.hover=o.hover)):s&&(t.renderer.events.cursorStyles.default="default",t.renderer.events.cursorStyles.hover="pointer"))};_render=async(t,e,r,s,o)=>{this._applyGlobalCursorStyles(t,r.global,s.global),Xh(t,e,r.elements,s.elements),this._currentAbortController&&this._currentAbortController.abort(),this._currentAbortController=new AbortController}},rR=ux;var dx=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h,elements:l=[]}=e,c=o.url?I.from(o.url):I.EMPTY,u,d,f=o.scaleX??1,p=o.scaleY??1;o.hoverUrl&&(u=I.from(o.hoverUrl)),o.clickUrl&&(d=I.from(o.clickUrl));let g=new Zt(c);g.label=o.id,g.interactiveChildren=!1,(o.eventName||o.hoverUrl||o.clickUrl)&&(g.cursor="hover",g.eventMode="static"),o.width!==void 0?g.width=o.width*f:g.width*=f,o.height!==void 0?g.height=o.height*p:g.height*=p,o.anchorX!==void 0&&(g.pivot.x=g.width*o.anchorX),o.anchorY!==void 0&&(g.pivot.y=g.height*o.anchorY),o.rotation!==void 0&&(g.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(g.x=o.x),o.y!==void 0&&(g.y=o.y),o.zIndex!==void 0&&(g.zIndex=o.zIndex),o.alpha!==void 0&&(g.alpha=o.alpha),(u||d)&&g.on("pointerup",()=>{g.texture=c}).on("pointerupoutside",()=>{g.texture=c}).on("pointerleave",()=>{g.texture=c}),d&&g.on("pointerdown",()=>{g.texture=d}),u&&g.on("pointerenter",()=>{g.texture=u}),g.on("pointerup",v=>{v.stopPropagation();let _=v.button;_===0?h&&h(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&h?h(o.rightClickEventName):t.stage.emit("rightclick",event))});let x=[];for(let v of n)if(v.elementId===o.id&&v.event===he.Add){let _=a(v.type);if(!_)throw new Error(`Transition class not found for type ${v.type}`);x.push(_.add(t,g,v,r))}s.addChild(g),Array.isArray(l)&&l.length>0&&s.children.sort((v,_)=>{let y=l.find(E=>E.id===v.label),T=l.find(E=>E.id===_.label);if(y&&T){let E=y.zIndex??0,w=T.zIndex??0;if(E!==w)return E-w;let C=l.findIndex(P=>P.id===v.label),M=l.findIndex(P=>P.id===_.label);return C-M}if(!y&&!T)return 0;if(!y)return-1;if(!T)return 1}),await Promise.all(x)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let c of n)if(c.elementId===o.id&&c.event===he.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},h)=>{if(h?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let c=[];for(let f of o)if(f.elementId===r.id&&f.event===he.Update){let p=n(f.type);if(!p)throw new Error(`Transition class not found for type ${f.type}`);c.push(p.add(t,l,f,h))}c.length>0?(await Promise.all(c),u()):d();function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let x=I.from(s.url);if(l.texture=x,!r.url&&s.url)if(x.baseTexture.valid){let v=s.scaleX??1,_=s.scaleY??1;l.width=(s.width??x.width)*v,l.height=(s.height??x.height)*_}else x.baseTexture.once("loaded",()=>{let v=s.scaleX??1,_=s.scaleY??1;l.width=(s.width??x.width)*v,l.height=(s.height??x.height)*_})}let p=r.hoverUrl||r.clickUrl,g=s.hoverUrl||s.clickUrl;if(!p&&g){let x=l.texture;l.on("pointerup",()=>{l.texture=x}).on("pointerupoutside",()=>{l.texture=x}).on("pointerleave",()=>{l.texture=x})}if(s.hoverUrl){let x=I.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=x})}if(s.clickUrl){let x=I.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=x})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="hover",l.eventMode="static")}function d(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let _=I.from(s.url);if(l.texture=_,!r.url&&s.url)if(_.baseTexture.valid){let y=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??_.width)*y,l.height=(s.height??_.height)*T}else _.baseTexture.once("loaded",()=>{let y=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??_.width)*y,l.height=(s.height??_.height)*T})}let x=r.hoverUrl||r.clickUrl,v=s.hoverUrl||s.clickUrl;if(!x&&v){let _=l.texture;l.on("pointerup",()=>{l.texture=_}).on("pointerupoutside",()=>{l.texture=_}).on("pointerleave",()=>{l.texture=_})}if(s.hoverUrl){let _=I.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=_})}if(s.clickUrl){let _=I.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=_})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let p=s.scaleX??1,g=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||p!==(r.scaleX??1))&&(l.width=s.width*p),s.height!==void 0&&(s.height!==r.height||g!==(r.scaleY??1))&&(l.height=s.height*g),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/p),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/g),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="hover",l.eventMode="static")}}};var rd=i=>new Ht({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),fx=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h}=e,l=rd(o.style),c=new gr({text:o.text,style:l}),u;o.hoverStyle&&(u=rd(o.hoverStyle));let d;if(o.clickedStyle&&(d=rd(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(c.cursor="hover",c.eventMode="static"),c.label=o.id,o.x!==void 0&&(c.x=o.x),o.y!==void 0&&(c.y=o.y),o.anchorX!==void 0&&(c.anchor.x=o.anchorX),o.anchorY!==void 0&&(c.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let p=c.getLocalBounds();c.hitArea=new rt(-p.width*c.anchor.x,-p.height*c.anchor.y,p.width,p.height)}c.on("pointerout",()=>{c.isOver=!1}).on("pointerupoutside",()=>{c.style=l}).on("pointerup",()=>{c.style=l}).on("pointerleave",()=>{c.style=l}),c.on("pointerup",p=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),p.stopPropagation(),h&&h(o.eventName,o.eventPayload)}),d&&c.on("pointerdown",()=>{c.style=d}),u&&c.on("pointerenter",()=>{c.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let p of n)if(p.elementId===o.id&&p.event===he.Add){let g=a(p.type);if(!g)throw new Error(`Transition class not found for type ${p.type}`);f.push(g.add(t,c,p,r))}s.addChild(c),await Promise.all(f)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`);return}let l=[];for(let c of n)if(c.elementId===o.id&&c.event===he.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:h,eventHandler:l}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`);return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:h,eventHandler:l},r),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:h},r)];await Promise.all(u)}else o.text!==n.text&&(c.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(c.style=rd(n?.style)),n.x!==void 0&&(c.x=n.x),n.y!==void 0&&(c.y=n.y)}};var ee=(i,t=!1)=>new Ht({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",whiteSpace:"pre",trim:!1,stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),px=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=r.content?.[0]?.text||"",o=ee(r.style,s),n=new gr({text:"",style:o});n.label=r.id,n.text_id=s;let a=new yt;r.x!==void 0&&(a.x=r.x),r.y!==void 0&&(a.y=r.y),a.addChild(n),a.label=r.id,e.addChild(a);let h=r.style.wordWrapWidth||500,l=r.content&&r.content.length>0?r.content.map(E=>({text:E.text.replace(/ +$/,w=>"\xA0".repeat(w.length)),style:E.style?{...r.style,...E.style}:r.style,align:E.align||r.align||"top",furigana:E.furigana})):r.segments,c=[];if(l.length===1){let E=[],w=0,C=0,M=0,P=[...l];for(;;){let S=P[0];if(!S){E.length>0&&c.push({lineParts:E,y:C});break}if(C>1e4)break;let A={...S.style,wordWrapWidth:h-w},B=gt.measureText(S.text,ee(A));B.lineHeight>M&&(M=B.lineHeight);let F=gt.measureText("a",ee(A)),z=gt.measureText("a a",ee(A)).width-F.width*2;if(B.lineWidths[0]+w>h){w=0,c.push({lineParts:E,y:C}),C+=M,M=0,E=[];continue}let k=B.lines[0];B.lines.length===1&&S.text.endsWith(" ")&&!k.endsWith(" ")&&(k+=" ");let G=B.lines.slice(1).join(" "),N={text:k,style:A,x:w,y:0,align:S.align};if(E.push(N),G&&G.length>0?S.text=G:P.shift(),!(!k||k.length===0)){if(S.furigana){let O=gt.measureText(S.furigana.text,ee(S.furigana.style)),Y={text:S.furigana.text,style:S.furigana.style,x:w+(B.width-O.width)/2,y:-10};E.push(Y)}w+=B.lineWidths[0]+z}}}else{let E=[],w=0,C=0,M=0,P=[...l],S=new WeakSet;for(;;){let A=P[0];if(!A){E.length>0&&c.push({lineParts:E,y:C});break}if(C>1e4)break;let B={...A.style,wordWrapWidth:h-w},F=gt.measureText(A.text,ee(B));F.lineHeight>M&&(M=F.lineHeight);let W=gt.measureText("a",ee(B)),k=gt.measureText("a a",ee(B)).width-W.width*2;if(F.lineWidths[0]+w>h){w=0,c.push({lineParts:E,y:C}),C+=M,M=0,E=[];continue}let G=F.lines[0];F.lines.length===1&&A.text.endsWith(" ")&&!G.endsWith(" ")&&(G+=" ");let N=F.lines.slice(1).join(" "),O={text:G,style:B,x:w,y:0,align:A.align};if(E.push(O),N&&N.length>0?A.text=N:P.shift(),!(!G||G.length===0)){if(A.furigana&&!S.has(A)){S.add(A);let Y=gt.measureText(A.furigana.text,ee(A.furigana.style)),lt={text:A.furigana.text,style:A.furigana.style,x:w+(F.lineWidths[0]-Y.width)/2,y:0,isFurigana:!0,parentAlign:A.align,parentX:w,parentWidth:F.lineWidths[0]};E.push(lt)}w+=F.lineWidths[0]}}}c.forEach(E=>{let w=new yt;w.y=E.y,w.alpha=0;let C=0;E.lineParts.forEach(P=>{let S=gt.measureText(P.text,ee(P.style));S.height>C&&(C=S.height)});let M=new Map;E.lineParts.forEach(P=>{if(!P.isFurigana){let S=gt.measureText(P.text,ee(P.style)),A=P.y,B=P.align||"top";B==="center"?A+=(C-S.height)/2:B==="bottom"&&(A+=C-S.height);let F=new gr({text:P.text,style:ee(P.style),x:P.x,y:A});w.addChild(F),M.set(P.x,{yOffset:A,height:S.height})}}),E.lineParts.forEach(P=>{if(P.isFurigana){let S=gt.measureText(P.text,ee(P.style)),A=M.get(P.parentX),B=-S.height-5;A&&(B=A.yOffset-S.height+2);let F=new gr({text:P.text,style:ee(P.style),x:P.x,y:B});w.addChild(F)}}),a.addChild(w)});let u=new Qt,d=1e3,f=h/2,p=h/2;u.fill({color:16777215,alpha:1}),u.rect(0,0,f,d);for(let E=0;E<p;E++)u.fill({color:16777215,alpha:1-E/p}),u.rect(f+E,0,f+1,d);let g=t.renderer.generateTexture(u),x=new Zt(g);x.x=-1.35*f-p,t.stage.addChild(x);let v=null,_=null;if(r.indicator?.revealing?.url){let E=I.from(r.indicator.revealing.url);v=new Zt(E),v.anchor.set(0,.5),v.visible=!1,r.indicator.revealing.width!==void 0&&(v.width=r.indicator.revealing.width),r.indicator.revealing.height!==void 0&&(v.height=r.indicator.revealing.height),a.addChild(v)}if(r.indicator?.complete?.url){let E=I.from(r.indicator.complete.url);_=new Zt(E),_.anchor.set(0,.5),_.visible=!1,r.indicator.complete.width!==void 0&&(_.width=r.indicator.complete.width),r.indicator.complete.height!==void 0&&(_.height=r.indicator.complete.height),a.addChild(_)}let y=0,T=1;if(c.length!==0){if(r.displaySpeed===100||r.hasEnded){if(a.children.forEach(E=>{t.stage.removeChild(x),E.mask=null,E.alpha=1}),_&&(_.visible=!0,c.length>0)){let E=c[c.length-1],w=0,C=E.y;E.lineParts.forEach(M=>{if(!M.isFurigana){let P=gt.measureText(M.text,ee(M.style)),S=M.x+P.width;S>w&&(w=S)}}),_.x=w+10,_.y=C+20}return}await new Promise(E=>{let w=C=>{if(T>a.children.length){if(v&&(v.visible=!1),_&&(_.visible=!0,c.length>0)){let S=c[c.length-1],A=0,B=S.y;S.lineParts.forEach(F=>{if(!F.isFurigana){let W=gt.measureText(F.text,ee(F.style)),z=F.x+W.width;z>A&&(A=z)}}),_.x=A+10,_.y=B+20}E();return}a.getChildAt(T).mask||(a.getChildAt(T).mask=x,a.getChildAt(T).alpha=1),y+=C.deltaMS;let P=(r.displaySpeed||50)/1e3;if(x.x+=P*y,v&&T<=c.length){let S=c[T-1];if(S&&(a.getChildAt(T).mask===x||T===c.length)){v.visible=!0;let B=x.x+f+p+150,F=0,W=!1,z=!0,k=0;for(let G of S.lineParts)if(!G.isFurigana){let N=gt.measureText(G.text,ee(G.style));k=Math.max(k,G.x+N.width)}for(let G of S.lineParts)if(!G.isFurigana){let N=gt.measureText(G.text,ee(G.style)),O=G.x,Y=G.x+N.width;if(Y<=B)F=Y,W=!0;else if(O<B){F=Math.max(O,B),W=!0,z=!1;break}else z=!1}B>=k&&(z=!0),W&&F>0?(v.x=F,v.y=S.y+20):T===c.length&&k>0?(v.x=k,v.y=S.y+20):v.visible=!1,_&&(_.visible=!1)}else v.visible=!1}if(x.x>=0&&(a.getChildAt(T).mask=null,x.x=-1.35*f-p,T=T+1,y=0,T===a.children.length)){if(v&&(v.visible=!1),_&&(_.visible=!0,c.length>0)){let S=c[c.length-1],A=0,B=S.y;S.lineParts.forEach(F=>{if(!F.isFurigana){let W=gt.measureText(F.text,ee(F.style)),z=F.x+W.width;z>A&&(A=z)}}),_.x=A+10,_.y=B+20}t.ticker.remove(w),E()}};t.ticker.add(w)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let h=[];for(let l of o)if(l.elementId===s.id&&l.event===he.Remove){let c=n(l.type);if(!c)throw new Error(`Transition class not found for type ${l.type}`);h.push(c.remove(t,a,l))}await Promise.all(h),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var iR=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let h=n.find(l=>l.id===a.id&&l.type===a.type);h?r.push({prev:a,next:h}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let h=t.find(l=>l.id===a.id&&l.type===a.type);h&&h.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var mx=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,elements:n=[],transitions:a=[],getTransitionByType:h,getRendererByElement:l,eventHandler:c}=e,u=structuredClone(o),d=new yt;d.label=u.id;let f={};u.x!==void 0&&(typeof u.x=="string"&&u.x.endsWith("%")?d.x=Number(u.x.replace("%",""))*t.screen.width/100:d.x=u.x),u.y!==void 0&&(typeof u.y=="string"&&u.y.endsWith("%")?d.y=Number(u.y.replace("%",""))*t.screen.height/100:d.y=u.y),u.scaleX!==void 0&&(d.scale.x=u.scaleX),u.scaleY!==void 0&&(d.scale.y=u.scaleY),u.zIndex!==void 0&&(d.zIndex=u.zIndex),u.rotation!==void 0&&(d.rotation=u.rotation*Math.PI/180),u.propagateEvents&&(d.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(P=>{d.on(P,S=>{S.stopPropagation();for(let A of d.children)A.emit(P)})}));let p=u.gap||0,g=new Qt().roundRect(0,0,u.width||0,u.height||0,1).fill(u.fill?u.fill.color:"transparent"),x=[0,.5,1],v=u.anchorX??0,_=u.anchorY??0;if(!x.includes(v))throw new Error(`Invalid anchorX value: ${v}. Must be 0, 0.5, or 1`);if(!x.includes(_))throw new Error(`Invalid anchorY value: ${_}. Must be 0, 0.5, or 1`);if(u.direction){let P,S;u.direction==="horizontal"?(P=u.children.reduce((B,F,W)=>B+F.width+(W>0?p:0),0),S=u.children.reduce((B,F)=>Math.max(B,F.height||0),0)):u.direction==="vertical"&&(P=u.children.reduce((B,F)=>Math.max(B,F.width||0),0),S=u.children.reduce((B,F,W)=>B+F.height+(W>0?p:0),0));let A={x:v,y:_};u.direction==="horizontal"?this.layoutChildren({element:u,anchor:A,totalWidth:P,totalHeight:S,gap:p,direction:"horizontal",scroll:u.scroll}):u.direction==="vertical"&&this.layoutChildren({element:u,anchor:A,totalWidth:P,totalHeight:S,gap:p,direction:"vertical",scroll:u.scroll}),this.setupScrolling({container:d,element:u,totalHeight:S,totalWidth:P,eventHandler:c,sliderRef:f}),g=this.createContainerGraphic(u,P,S,A)}g.label=`${u.id}-container-background`,d.addChild(g);let y=[];(u.children||[]).forEach(P=>{let S=l(P),A=u.width||0,B=u.height||0,F=v*A,W=_*B,z={zIndex:u.zIndex,...P,x:(P.x||0)+F,y:(P.y||0)+W};y.push(S.add(t,{parent:d,element:z,elements:u.children||[],transitions:a,getTransitionByType:h,getRendererByElement:l,eventHandler:c},r))});let T=[];for(let P of a)if(P.elementId===u.id&&P.event===he.Add){let S=h(P.type);if(!S)throw new Error(`Transition class not found for type ${P.type}`);T.push(S.add(t,d,P,r))}s.addChild(d),await Promise.all([...y,...T]);let{width:E,height:w}=this.getContainerDimensions(u,d),C=v*E,M=_*w;d.pivot.x=C,d.pivot.y=M};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");console.log("remove container 11111111111");let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}n.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,elements:a=[],getRendererByElement:h,transitions:l=[],getTransitionByType:c,eventHandler:u}=e,d=structuredClone(o),f=structuredClone(n),p=s.getChildByName(d.id);if(!p){console.warn(`Container with id ${d.id} not found`);return}f.x!==void 0&&(p.x=f.x),f.y!==void 0&&(p.y=f.y),f.rotation!==void 0&&f.rotation!==d.rotation&&(p.rotation=f.rotation*Math.PI/180);let g=[0,.5,1],x=f.anchorX??0,v=f.anchorY??0;if(!g.includes(x))throw new Error(`Invalid anchorX value: ${x}. Must be 0, 0.5, or 1`);if(!g.includes(v))throw new Error(`Invalid anchorY value: ${v}. Must be 0, 0.5, or 1`);if(f.direction){let S=f.gap||0,A,B;f.direction==="horizontal"?(A=f.children.reduce((z,k,G)=>z+k.width+(G>0?S:0),0),B=f.children.reduce((z,k)=>Math.max(z,k.height||0),0)):f.direction==="vertical"&&(A=f.children.reduce((z,k)=>Math.max(z,k.width||0),0),B=f.children.reduce((z,k,G)=>z+k.height+(G>0?S:0),0));let F={x,y:v};f.direction==="horizontal"?this.layoutChildren({element:f,anchor:F,totalWidth:A,totalHeight:B,gap:S,direction:"horizontal",scroll:f.scroll}):f.direction==="vertical"&&this.layoutChildren({element:f,anchor:F,totalWidth:A,totalHeight:B,gap:S,direction:"vertical",scroll:f.scroll});let W=p.children.find(z=>z.label===`${f.id}-container-background`);if(W){W.destroy();let z=this.createContainerGraphic(f,A,B,F);z.label=`${f.id}-container-background`,p.addChildAt(z,0)}d.scroll!==f.scroll&&this.setupScrolling({container:p,element:f,totalHeight:B,totalWidth:A,eventHandler:u,sliderRef:{}})}let _=[],{toAddElements:y,toUpdateElements:T,toDeleteElements:E}=iR(d.children,f.children);if(f.direction&&f.children){let S=new Map;f.children.forEach(A=>{S.set(A.id,{x:A.x,y:A.y})}),T.forEach(A=>{let B=S.get(A.next.id);B&&(A.next.x=B.x,A.next.y=B.y)}),y.forEach(A=>{let B=S.get(A.id);B&&(A.x=B.x,A.y=B.y)})}for(let S of E){let A=h(S);_.push(A.remove(t,{parent:p,element:S,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}for(let S of y){let A=h(S),B=f.width||0,F=f.height||0,W=x*B,z=v*F,k={...S,x:(S.x||0)+W,y:(S.y||0)+z};_.push(A.add(t,{parent:p,element:k,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}for(let S of T){let A=h(S.next),B=f.width||0,F=f.height||0,W=x*B,z=v*F,k=d.anchorX??0,G=d.anchorY??0,N=d.width||0,O=d.height||0,Y=k*N,lt=G*O,bt={...S.prev,x:(S.prev.x||0)+Y,y:(S.prev.y||0)+lt},It={...S.next,x:(S.next.x||0)+W,y:(S.next.y||0)+z};_.push(A.update(t,{parent:p,prevElement:bt,nextElement:It,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}f.children&&f.children.length>0&&p.children.sort((S,A)=>{let B=f.children.find(W=>W.id===S.label),F=f.children.find(W=>W.id===A.label);if(B&&F){let W=B.zIndex??0,z=F.zIndex??0;if(W!==z)return W-z;let k=f.children.indexOf(B),G=f.children.indexOf(F);return k-G}if(!B&&!F)return 0;if(!B)return-1;if(!F)return 1}),await Promise.all(_);let{width:w,height:C}=this.getContainerDimensions(f,p),M=x*w,P=v*C;p.pivot.x=M,p.pivot.y=P};layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let h=n==="horizontal",l=h?"x":"y",c=h?"y":"x",u=h?"width":"height",d=h?"height":"width",f=h?r:s,p=h?s:r,g=h?e.x:e.y,x=h?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let _=0,y=0,T=0,E=0;(t.children||[]).forEach((w,C)=>{_>0&&_+w[u]>t[u]&&(this.alignRowElements(t.children.slice(E,C),l,g,t[u]),_=0,y+=T+o,T=0,E=C),w[l]=_,w[c]=y,_+=w[u],C<t.children.length-1&&(_+=o),T=Math.max(T,w[d]||0)}),E<t.children.length&&this.alignRowElements(t.children.slice(E),l,g,t[u])}else{if(g===0){let _=0;(t.children||[]).forEach((y,T)=>{let E=y[u]||0,w=h?y.anchorX||0:y.anchorY||0;y[l]=_+E*w,_+=E,T<t.children.length-1&&(_+=o)})}else if(g===1){let _=-f;(t.children||[]).forEach((y,T)=>{let E=y[u]||0,w=h?y.anchorX||0:y.anchorY||0;y[l]=_+E*w,_+=E,T<t.children.length-1&&(_+=o)})}else if(g===.5){let _=-f/2;(t.children||[]).forEach((y,T)=>{let E=y[u]||0,w=h?y.anchorX||0:y.anchorY||0;y[l]=_+E*w,_+=E,T<t.children.length-1&&(_+=o)})}x===0?(t.children||[]).forEach(_=>{let y=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=y*T}):x===.5?(t.children||[]).forEach(_=>{let y=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=-y/2+y*T}):x===1&&(t.children||[]).forEach(_=>{let y=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=-y+y*T})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,h)=>n+a[e==="x"?"width":"height"]+(h>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(h=>{h[e]=a,a+=h[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(h=>{h[e]=a,a+=h[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new Qt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,h=-1/0;e.children.forEach(l=>{let c=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,c),n=Math.max(n,c+d),a=Math.min(a,u),h=Math.max(h,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=h-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,h=e.scroll&&e.width&&s>e.width;if(a||h){let l=0,c=0,u=-r+e.height,d=-s+e.width,f=new Qt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",p=>{if(a&&p.deltaY!==0&&(l-p.deltaY>0||l-p.deltaY<u||(l-=p.deltaY,t.y-=p.deltaY,f.y+=p.deltaY)),h&&(p.deltaX!==0||p.shiftKey&&p.deltaY!==0)){let g=p.deltaX!==0?p.deltaX:p.deltaY;if(c-g>0||c-g<d)return;c-=g,t.x-=g,f.x+=g}})}}};var tU={linear:i=>i},eU=(i,t,e,r)=>i+(t-i)*tU[r](e);function sR(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function oR(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var rU=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:h,relative:l},c)=>{c===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&h!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:h}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:h,easing:l}=e[n],{time:c,value:u}=e[n+1];if(t>=a&&t<=c){let d=(t-a)/(c-a);o=eU(h,u,d,l);break}else t>c&&(o=u)}return o};function iU(i){return Math.max.apply(null,i)}var gx=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=async(t,e,r,s)=>new Promise((o,n)=>{if(s?.aborted){n(new DOMException("Operation aborted","AbortError"));return}let{properties:a}=r,h=Array.isArray(a)?a:Object.entries(a).map(([x,v])=>({...v,property:x})),l=h.map(x=>x.keyframes.reduce((v,_)=>v+_.duration||0,0)),c=iU(l),u=0,d={};h.forEach(x=>{d[x.property]=sR(e,x.property)});let f=x=>{let v={};h.forEach(_=>{let y=[];_.initialValue!==void 0?y=[{value:_.initialValue,duration:0}]:y=[{value:d[_.property],duration:0}],y=y.concat(_.keyframes),oR(v,_.property,rU(y,x))}),h.forEach(_=>{let{property:y}=_;e&&!e.destroyed&&oR(e,y,sR(v,y))})},p=()=>{t.ticker.remove(g),f(c)};s&&s.addEventListener("abort",()=>{p(),n(new DOMException("Operation aborted","AbortError"))});let g=x=>{if(u+=x.deltaMS,u>=c){t.ticker.remove(g),o();return}f(u)};if(s?.aborted){p(),n(new DOMException("Operation aborted","AbortError"));return}t.ticker.add(g)});add=async(t,e,r,s)=>this._transition(t,e,r,s);remove=async(t,e,r,s)=>this._transition(t,e,r,s)};var xx=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h}=e,l=new Qt;l.label=o.id,l.interactiveChildren=!1,l.eventMode="none",o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180),o.cursor&&(l.cursor=o.cursor),o.pointerDown&&l.on("pointerdown",f=>{f.stopPropagation(),h&&h(o.pointerDown,{x:f.global.x,y:f.global.y})}),o.pointerUp&&l.on("pointerup",f=>{f.stopPropagation(),h&&h(o.pointerUp,{x:f.global.x,y:f.global.y})}),o.pointerMove&&l.on("pointermove",f=>{f.stopPropagation(),h&&h(o.pointerMove,{x:f.global.x,y:f.global.y})}),(o.cursor||o.pointerDown||o.pointerUp||o.pointerMove)&&(l.eventMode="static");let c=o.width,u=o.height;l.roundRect(0,0,c,u,o.radius??0),o.fill&&l.fill(o.fill),o.border&&l.stroke({width:o.border.width,color:o.border.color,alpha:o.border.alpha??1,alignment:o.border.alignment??1}),o.anchorX!==void 0&&(l.pivot.x=c*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&h&&(l.eventMode="static",l.on("pointerup",f=>{f.stopPropagation(),f.button===0?h(o.clickEventName,o.clickEventPayload):f.button===2&&h(o.rightClickEventName,o.rightClickEventPayload)})),o.wheelEventName&&h&&(l.eventMode="static",l.on("wheel",f=>{f.stopPropagation(),h(o.wheelEventName,{deltaY:f.deltaY})}));let d=[];for(let f of n)if(f.elementId===o.id&&f.event===he.Add){let p=a(f.type);if(!p)throw new Error(`Transition class not found for type ${f.type}`);d.push(p.add(t,l,f,r))}s.addChild(l),await Promise.all(d)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let c of n)if(c.elementId===o.id&&c.event===he.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},h)=>{if(h?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let c=[];for(let u of o)if(u.elementId===r.id&&u.event===he.Update){let d=n(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);c.push(d.add(t,l,u,h))}if(c.length>0)await Promise.all(c),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY);else{r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let u=JSON.stringify(r.border)!==JSON.stringify(s.border);(r.width!==s.width||r.height!==s.height||r.radius!==s.radius||r.fill!==s.fill||u)&&(l.clear(),l.roundRect(0,0,s.width,s.height,s.radius??0),s.fill&&l.fill(s.fill),s.border&&l.stroke({width:s.border.width,color:s.border.color,alpha:s.border.alpha??1,alignment:s.border.alignment??1})),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY)}}};var _x=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:h,idleThumb:l,hoverThumb:c,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:p,dragEventPayload:g,initialValue:x}=r,v={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},_=v[h].axis,y=v[h].size,T=I.from(l),E=I.from(c),w=I.from(u),C=I.from(d),M=new Zt({texture:w,anchor:{x:0,y:0}});M.label=r.id;let P=M[y];M.x=r.x||0,M.y=r.y||0;let S=new Zt({texture:T,anchor:{x:.5,y:.5}});if(S.y=M.height/2,S.x=M.width/2,S.eventMode="static",S.cursor="hover",M.eventMode="static",M.cursor="hover",S.on("pointerdown",F).on("pointerup",W).on("pointerupoutside",W),M.on("pointerdown",A).on("pointerup",B).on("pointerupoutside",B),M.addChild(S),x!==void 0){let G=S[y]/2;S[_]=x/100*(P-S[y])+G}function A(G){S.texture=E,M.texture=C,z(G),t.stage.eventMode="static",t.stage.addEventListener("pointermove",z)}function B(G){S.texture=T,M.texture=w,z(G),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",z)}function F(G){G.stopPropagation(),S.texture=E,M.texture=C,t.stage.eventMode="static",t.stage.addEventListener("pointermove",z)}function W(G){if(S.texture=T,M.texture=w,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",z),f){let N=M.toLocal(G.global)[_],O=S[y]/2;S[_]=Math.max(0+O,Math.min(N,P-O));let Y=Math.floor((S[_]-O)/(P-S[y])*100),lt=JSON.stringify(g);n&&n(f,JSON.parse(lt.replace('"{{ value }}"',String(Y))))}}function z(G){let N=M.toLocal(G.global)[_],O=S[y]/2;S[_]=Math.max(0+O,Math.min(N,P-O));let Y=Math.floor((S[_]-O)/(P-S[y])*100);if(p){let lt=JSON.stringify(g);n&&n(p,JSON.parse(lt.replace('"{{ value }}"',String(Y))))}return Y}a&&(a.current={updateValue:G=>{let N=S[y]/2;S[_]=G/100*(P-S[y])+N}});let k=[];for(let G of s)if(G.elementId===r.id&&G.event===he.Add){let N=o(G.type);if(!N)throw new Error(`Transition class not found for type ${G.type}`);k.push(N.add(t,M,G))}e.addChild(M),await Promise.all(k)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let h=[];for(let l of o)if(l.elementId===s.id&&l.event===he.Remove){let c=n(l.type);if(!c)throw new Error(`Transition class not found for type ${l.type}`);h.push(c.remove(t,a,l))}await Promise.all(h),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var yx=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var bx=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},sU=()=>new bx;var j_t=rR;export{Za as Application,sr as Assets,yx as AudioPlugin,mx as ContainerRendererPlugin,gx as KeyframeTransitionPlugin,xx as RectRendererPlugin,_x as SliderRendererPlugin,dx as SpriteRendererPlugin,fx as TextRendererPlugin,px as TextRevealingRendererPlugin,sU as createAssetBufferManager,j_t as default,jh as parse,jh as parseJSONToAST,Xh as renderApp};
|
|
1628
|
+
`))}}var mU=0,Wu={textureCount:0,uboCount:0},Ii=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=mU++}systemCheck(){if(!Lu())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 r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(Wu.textureCount=0,Wu.uboCount=0,this.syncUniformGroup(t.uniformGroup,Wu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ng(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,Wu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=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]=qg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Yg(e,r);return r.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}};Ii.extension={type:V.RendererSystem,name:"shader"};q.add(Ii);var ci=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(){}};ci.defaultOptions={hello:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(ci);function iR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var gU=0,xU=1,_U=2,yU=3,bU=4,vU=5,sR=class Kg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[gU]=this.setBlend,this.map[xU]=this.setOffset,this.map[_U]=this.setCullFace,this.map[yU]=this.setDepthTest,this.map[bU]=this.setFrontFace,this.map[vU]=this.setDepthMask,this.checks=[],this.defaultState=new Nr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=iR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Kg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Kg.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],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}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 r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};sR.extension={type:V.RendererSystem,name:"state"};var Zg=sR;q.add(Zg);var on=class extends ls.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Yt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class zu{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=zu.defaultMaxIdle,this.checkCountMax=zu.defaultCheckCountMax,this.mode=zu.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==iu.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!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,r=!0)}if(r){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,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=iu.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Wr=Dh;q.add(Wr);var Ts=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=rt.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.samplerType=0}};function oR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.R8]:L.FLOAT,[i.R8_SNORM]:L.FLOAT,[i.RG8]:L.FLOAT,[i.RG8_SNORM]:L.FLOAT,[i.RGB8]:L.FLOAT,[i.RGB8_SNORM]:L.FLOAT,[i.RGB565]:L.FLOAT,[i.RGBA4]:L.FLOAT,[i.RGB5_A1]:L.FLOAT,[i.RGBA8]:L.FLOAT,[i.RGBA8_SNORM]:L.FLOAT,[i.RGB10_A2]:L.FLOAT,[i.RGB10_A2UI]:L.FLOAT,[i.SRGB8]:L.FLOAT,[i.SRGB8_ALPHA8]:L.FLOAT,[i.R16F]:L.FLOAT,[i.RG16F]:L.FLOAT,[i.RGB16F]:L.FLOAT,[i.RGBA16F]:L.FLOAT,[i.R32F]:L.FLOAT,[i.RG32F]:L.FLOAT,[i.RGB32F]:L.FLOAT,[i.RGBA32F]:L.FLOAT,[i.R11F_G11F_B10F]:L.FLOAT,[i.RGB9_E5]:L.FLOAT,[i.R8I]:L.INT,[i.R8UI]:L.UINT,[i.R16I]:L.INT,[i.R16UI]:L.UINT,[i.R32I]:L.INT,[i.R32UI]:L.UINT,[i.RG8I]:L.INT,[i.RG8UI]:L.UINT,[i.RG16I]:L.INT,[i.RG16UI]:L.UINT,[i.RG32I]:L.INT,[i.RG32UI]:L.UINT,[i.RGB8I]:L.INT,[i.RGB8UI]:L.UINT,[i.RGB16I]:L.INT,[i.RGB16UI]:L.UINT,[i.RGB32I]:L.INT,[i.RGB32UI]:L.UINT,[i.RGBA8I]:L.INT,[i.RGBA8UI]:L.UINT,[i.RGBA16I]:L.INT,[i.RGBA16UI]:L.UINT,[i.RGBA32I]:L.INT,[i.RGBA32UI]:L.UINT,[i.DEPTH_COMPONENT16]:L.FLOAT,[i.DEPTH_COMPONENT24]:L.FLOAT,[i.DEPTH_COMPONENT32F]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT,[i.DEPTH24_STENCIL8]:L.FLOAT,[i.DEPTH32F_STENCIL8]:L.FLOAT}:t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT},t}function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA8,[U.RGB]:i.RGB8,[U.RG]:i.RG8,[U.RED]:i.R8,[U.RGBA_INTEGER]:i.RGBA8UI,[U.RGB_INTEGER]:i.RGB8UI,[U.RG_INTEGER]:i.RG8UI,[U.RED_INTEGER]:i.R8UI,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[U.RGBA]:i.RGBA8_SNORM,[U.RGB]:i.RGB8_SNORM,[U.RG]:i.RG8_SNORM,[U.RED]:i.R8_SNORM,[U.RGBA_INTEGER]:i.RGBA8I,[U.RGB_INTEGER]:i.RGB8I,[U.RG_INTEGER]:i.RG8I,[U.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[U.RGBA_INTEGER]:i.RGBA16UI,[U.RGB_INTEGER]:i.RGB16UI,[U.RG_INTEGER]:i.RG16UI,[U.RED_INTEGER]:i.R16UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[U.RGBA_INTEGER]:i.RGBA16I,[U.RGB_INTEGER]:i.RGB16I,[U.RG_INTEGER]:i.RG16I,[U.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[U.RGBA_INTEGER]:i.RGBA32UI,[U.RGB_INTEGER]:i.RGB32UI,[U.RG_INTEGER]:i.RG32UI,[U.RED_INTEGER]:i.R32UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[U.RGBA_INTEGER]:i.RGBA32I,[U.RGB_INTEGER]:i.RGB32I,[U.RG_INTEGER]:i.RG32I,[U.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[U.RGBA]:i.RGBA32F,[U.RGB]:i.RGB32F,[U.RG]:i.RG32F,[U.RED]:i.R32F,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[U.RGBA]:i.RGBA16F,[U.RGB]:i.RGB16F,[U.RG]:i.RG16F,[U.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[U.RGBA]:i.RGB10_A2,[U.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[U.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[U.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[U.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[U.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA,[U.RGB]:i.RGB,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,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=nR(t),this.samplerTypes=oR(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 r=new Ts(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.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]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ts(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:r}=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,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.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:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==L.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ts(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]??L.FLOAT,this.webGLVersion===2&&t.type===rt.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 r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==L.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.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:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.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&&wg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===br.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==br.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===nr.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=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:r}=this,s=t._glTransformFeedbacks[r]||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:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,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&&(r.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 r=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 h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ui=class{constructor(t){this.renderer=t}init(t){this.screen=new gt(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 r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,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}};ui.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ui.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ui);Y.PREFER_ENV=ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...li.defaultOptions,...hi.defaultOptions,...ui.defaultOptions,...ci.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Vr.defaultResolution},set(i){Vr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Vr.defaultMultisample},set(i){Vr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ai.defaultMaxTextures},set(i){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ai.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ai.defaultBatchSize},set(i){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ai.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ai.canUploadSameBuffer},set(i){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ai.canUploadSameBuffer=i}},GC_MODE:{get(){return Wr.defaultMode},set(i){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Wr.defaultMode=i}},GC_MAX_IDLE:{get(){return Wr.defaultMaxIdle},set(i){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Wr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Wr.defaultCheckCountMax},set(i){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Wr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return lr.defaultVertexPrecision},set(i){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),lr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return lr.defaultFragmentPrecision},set(i){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),lr.defaultFragmentPrecision=i}}});var Ss=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ss||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var aR=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 hn(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,r=Ss.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ss.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!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}};aR.targetFPMS=.06;var cr=aR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return cr.targetFPMS},set(i){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),cr.targetFPMS=i}}});var Nh=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,Ss.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?cr.shared:new cr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var TU=[];q.handleByList(V.Renderer,TU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}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(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var $u=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=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:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||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 r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new $u(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var Xu=class Qg extends on{constructor(t){super(),this.type=Hm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ye({projectionMatrix:new It},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Qg.__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&&(lt("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=Qg.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Eg()}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 lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("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)}};Xu.extension={type:V.Renderer,priority:1},Xu.__plugins={},Xu.__systems={};var ju=Xu;q.handleByMap(V.RendererPlugin,ju.__plugins);q.handleByMap(V.RendererSystem,ju.__systems);q.add(ju);var Fi=class extends je{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof je?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}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:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Fi{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,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=ri.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var hR=class Xh extends Fi{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ri.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=ri.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=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=ri.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,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};hR.SIDES=6;var Jg=hR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),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 r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===$e.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(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 i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var tx=class Yu extends ne{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)},Yu.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;ne.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,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${si()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Yu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}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"&&Yu.SVG_XML.test(t)}};tx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,tx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ex=tx;var qu=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var rx=class ix extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ix.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}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=cr.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,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,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&&(cr.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||(cr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(cr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ix.TYPES.includes(e)}};rx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],rx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var sx=rx;_h.push(jh,_s,$h,sx,qu,ex,cs,Jg,zh);var SU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},EU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function lR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.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,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.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,h.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],h.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,h.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],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?SU:EU)[c.type].call(null,h,d.location,d.value,u)}}function AU(){Object.assign(Ii.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;lR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}AU();var Yh=new(window.AudioContext||window.webkitAudioContext),wU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Co.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.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,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},cR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=wU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var CU=i=>i.split("/").pop(),PU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:CU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),RU=()=>{let i,t=cR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[]},o,n,a=u=>u?u.startsWith("audio/")?"audio":u.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(u)?"font":"texture":"texture",h=(u,d,f)=>{u.renderer.events.cursorStyles||(u.renderer.events.cursorStyles={}),u.renderer.events.cursorStyles.default||(u.renderer.events.cursorStyles.default="default"),u.renderer.events.cursorStyles.hover||(u.renderer.events.cursorStyles.hover="pointer");let p=d?.cursorStyles,m=f?.cursorStyles;JSON.stringify(p)!==JSON.stringify(m)&&(m?(m.default&&(u.renderer.events.cursorStyles.default=m.default,u.canvas.style.cursor=m.default),m.hover&&(u.renderer.events.cursorStyles.hover=m.hover)):p&&(u.renderer.events.cursorStyles.default="default",u.renderer.events.cursorStyles.hover="pointer"))},l=async(u,d,f,p,m)=>{h(u,f.global,p.global),o&&o.abort(),o=new AbortController;let x=o.signal;await rh({app:u,parent:d,prevASTTree:f.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:x}),await Nm({app:u,prevAudioTree:f.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:x})},c={rendererName:"pixi",get canvas(){return i.canvas},init:async u=>{let{eventHandler:d,plugins:f,width:p,height:m,backgroundColor:x}=u;s=f,r=d,i=new Ja,i.audioStage=t,await i.init({width:p,height:m,backgroundColor:x});let v=new _r;return v.rect(0,0,p,m),v.fill(x||0),i.stage.addChild(v),i.stage.width=p,i.stage.height=m,i.ticker.add(i.audioStage.tick),c},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async u=>{if(!u)throw new Error("assetBufferMap is required");let d={audio:{},font:{},texture:{}};for(let[p,m]of Object.entries(u)){let x=a(m.type);d[x][p]=m}await Promise.all(Object.entries(d.audio).map(([p,m])=>Co.load(p,m.buffer))),await Promise.all(Object.entries(d.font).map(async([p,m])=>{let x=new Blob([m.buffer],{type:m.type}),v=URL.createObjectURL(x),y=new FontFace(p,`url(${v})`);try{await y.load(),document.fonts.add(y)}catch(b){console.error(`Failed to load font ${p}:`,b)}finally{URL.revokeObjectURL(v)}})),n?Object.assign(n.bufferMap,d.texture):(n=PU(d.texture),or.loader.parsers.length=0,or.reset(),G.add({name:"advanced-buffer-loader",extension:_.Asset,priority:ce.High,loader:n}),typeof or.registerPlugin=="function"&&or.registerPlugin(n));let f=Object.keys(d.texture);return Promise.all(f.map(p=>or.load(p)))},loadAudioAssets:async u=>Promise.all(u.map(async d=>{let p=await(await fetch(d)).arrayBuffer();return Co.load(d,p)})),updatedBackgroundColor:u=>{i.renderer.background.color=u},getStageElementBounds:()=>{let u={},d=f=>{if(!(!f||f.length===0))for(let p of f)u[p.label]={x:p.groupTransform.tx,y:p.groupTransform.ty,width:p.width,height:p.height},d(p.children)};return d(i.stage.children),u},render:u=>{let d=Es(u.elements),f={...u,elements:d};l(i,i.stage,e,f,r),e=f}};return c},uR=RU;var abt=uR;export{Ja as Application,or as Assets,Co as AudioAsset,jI as containerPlugin,Lm as createAnimationPlugin,bR as createAssetBufferManager,Dm as createAudioPlugin,We as createElementPlugin,abt as default,Es as parse,Es as parseJSONToAST,VI as rectPlugin,Nm as renderAudio,rh as renderElements,zI as sliderPlugin,iF as soundPlugin,WI as spritePlugin,HI as textPlugin,YI as textRevealingPlugin,rF as tweenPlugin};
|
|
1629
1629
|
/*! Bundled license information:
|
|
1630
1630
|
|
|
1631
1631
|
punycode/punycode.js:
|