dsh-plugin-beyond-simulator 1.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.
@@ -0,0 +1,936 @@
1
+ var mv=Object.create;var il=Object.defineProperty;var gv=Object.getOwnPropertyDescriptor;var xv=Object.getOwnPropertyNames;var _v=Object.getPrototypeOf,yv=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var bv=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),sl=(i,t)=>{for(var e in t)il(i,e,{get:t[e],enumerable:!0})},vv=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xv(t))!yv.call(i,s)&&s!==e&&il(i,s,{get:()=>t[s],enumerable:!(r=gv(t,s))||r.enumerable});return i};var Tv=(i,t,e)=>(e=i!=null?mv(_v(i)):{},vv(t||!i||!i.__esModule?il(e,"default",{value:i,enumerable:!0}):e,i));var _,nl,Hn,H,P=p(()=>{"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.TextureUploaderWebGL="texture-uploader-webgl",i.TextureUploaderWebGPU="texture-uploader-webgpu",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(_||{}),nl=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},Hn=(i,t)=>nl(i).priority??t,H={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(nl).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(nl).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 n=this._queue;return n[i]&&(n[i]?.forEach(o=>t(o)),delete n[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(n=>n.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((n,o)=>Hn(o.value,e)-Hn(n.value,e)))},r=>{let s=t.findIndex(n=>n.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,n)=>Hn(n,e)-Hn(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 rd=bv((rC,ol)=>{"use strict";var Sv=Object.prototype.hasOwnProperty,Yt="~";function Xi(){}Object.create&&(Xi.prototype=Object.create(null),new Xi().__proto__||(Yt=!1));function Ev(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function ed(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var n=new Ev(e,r||i,s),o=Yt?Yt+t:t;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function Wn(i,t){--i._eventsCount===0?i._events=new Xi:delete i._events[t]}function Nt(){this._events=new Xi,this._eventsCount=0}Nt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Sv.call(e,r)&&t.push(Yt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Nt.prototype.listeners=function(t){var e=Yt?Yt+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s<n;s++)o[s]=r[s].fn;return o};Nt.prototype.listenerCount=function(t){var e=Yt?Yt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Nt.prototype.emit=function(t,e,r,s,n,o){var a=Yt?Yt+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,h,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,s),!0;case 5:return l.fn.call(l.context,e,r,s,n),!0;case 6:return l.fn.call(l.context,e,r,s,n,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,s);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0};Nt.prototype.on=function(t,e,r){return ed(this,t,e,r,!1)};Nt.prototype.once=function(t,e,r){return ed(this,t,e,r,!0)};Nt.prototype.removeListener=function(t,e,r,s){var n=Yt?Yt+t:t;if(!this._events[n])return this;if(!e)return Wn(this,n),this;var o=this._events[n];if(o.fn)o.fn===e&&(!s||o.once)&&(!r||o.context===r)&&Wn(this,n);else{for(var a=0,l=[],c=o.length;a<c;a++)(o[a].fn!==e||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:Wn(this,n)}return this};Nt.prototype.removeAllListeners=function(t){var e;return t?(e=Yt?Yt+t:t,this._events[e]&&Wn(this,e)):(this._events=new Xi,this._eventsCount=0),this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.addListener=Nt.prototype.on;Nt.prefixed=Yt;Nt.EventEmitter=Nt;typeof ol<"u"&&(ol.exports=Nt)});var id,lt,Gt=p(()=>{id=Tv(rd(),1),lt=id.default});var Cv,Le,kt,ne,ud,sd,al,wv,Vn,dd,fd,nd,od,ad,Yi,Pv,Mv,Av,Rv,hl,ld,Bv,ll,cl,cd,ul,me,hd,pd,md=p(()=>{Cv={grad:.9,turn:360,rad:360/(2*Math.PI)},Le=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},kt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},ne=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},ud=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},sd=function(i){return{r:ne(i.r,0,255),g:ne(i.g,0,255),b:ne(i.b,0,255),a:ne(i.a)}},al=function(i){return{r:kt(i.r),g:kt(i.g),b:kt(i.b),a:kt(i.a,3)}},wv=/^#([0-9a-f]{3,8})$/i,Vn=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},dd=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,n=Math.max(t,e,r),o=n-Math.min(t,e,r),a=o?n===t?(e-r)/o:n===e?2+(r-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},fd=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var n=Math.floor(t),o=r*(1-e),a=r*(1-(t-n)*e),l=r*(1-(1-t+n)*e),c=n%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:s}},nd=function(i){return{h:ud(i.h),s:ne(i.s,0,100),l:ne(i.l,0,100),a:ne(i.a)}},od=function(i){return{h:kt(i.h),s:kt(i.s),l:kt(i.l),a:kt(i.a,3)}},ad=function(i){return fd((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},Yi=function(i){return{h:(t=dd(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},Pv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Av=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hl={string:[[function(i){var t=wv.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?kt(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?kt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Av.exec(i)||Rv.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:sd({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=Pv.exec(i)||Mv.exec(i);if(!t)return null;var e,r,s=nd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Cv[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ad(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,n=s===void 0?1:s;return Le(t)&&Le(e)&&Le(r)?sd({r:Number(t),g:Number(e),b:Number(r),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,n=s===void 0?1:s;if(!Le(t)||!Le(e)||!Le(r))return null;var o=nd({h:Number(t),s:Number(e),l:Number(r),a:Number(n)});return ad(o)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,n=s===void 0?1:s;if(!Le(t)||!Le(e)||!Le(r))return null;var o=(function(a){return{h:ud(a.h),s:ne(a.s,0,100),v:ne(a.v,0,100),a:ne(a.a)}})({h:Number(t),s:Number(e),v:Number(r),a:Number(n)});return fd(o)},"hsv"]]},ld=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]},Bv=function(i){return typeof i=="string"?ld(i.trim(),hl.string):typeof i=="object"&&i!==null?ld(i,hl.object):[null,void 0]},ll=function(i,t){var e=Yi(i);return{h:e.h,s:ne(e.s+100*t,0,100),l:e.l,a:e.a}},cl=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},cd=function(i,t){var e=Yi(i);return{h:e.h,s:e.s,l:ne(e.l+100*t,0,100),a:e.a}},ul=(function(){function i(t){this.parsed=Bv(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 kt(cl(this.rgba),2)},i.prototype.isDark=function(){return cl(this.rgba)<.5},i.prototype.isLight=function(){return cl(this.rgba)>=.5},i.prototype.toHex=function(){return t=al(this.rgba),e=t.r,r=t.g,s=t.b,o=(n=t.a)<1?Vn(kt(255*n)):"","#"+Vn(e)+Vn(r)+Vn(s)+o;var t,e,r,s,n,o},i.prototype.toRgb=function(){return al(this.rgba)},i.prototype.toRgbString=function(){return t=al(this.rgba),e=t.r,r=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+r+", "+s+", "+n+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,n},i.prototype.toHsl=function(){return od(Yi(this.rgba))},i.prototype.toHslString=function(){return t=od(Yi(this.rgba)),e=t.h,r=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+n+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,n},i.prototype.toHsv=function(){return t=dd(this.rgba),{h:kt(t.h),s:kt(t.s),v:kt(t.v),a:kt(t.a,3)};var t},i.prototype.invert=function(){return me({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),me(ll(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),me(ll(this.rgba,-t))},i.prototype.grayscale=function(){return me(ll(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),me(cd(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),me(cd(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"?me({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):kt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Yi(this.rgba);return typeof t=="number"?me({h:t,s:e.s,l:e.l,a:e.a}):kt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===me(t).toHex()},i})(),me=function(i){return i instanceof ul?i:new ul(i)},hd=[],pd=function(i){i.forEach(function(t){hd.indexOf(t)<0&&(t(ul,hl),hd.push(t))})}});function gd(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 n={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o?.closest){var h=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var m in e){var g=(a=h,l=n[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<u&&(u=g,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"])}var xd=p(()=>{});var Qr,K,Ht=p(()=>{md();xd();pd([gd]);Qr=class ji{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 ji)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((n,o)=>n===e[o]);if(t!==null&&e!==null){let n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.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,n]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=n,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,n]=ji._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=n,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,n=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+n}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._value=null,this}_normalize(t){let e,r,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let o=t;e=(o>>16&255)/255,r=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,n=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,n=255]=t,e/=255,r/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=ji.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let o=me(t);o.isValid()&&({r:e,g:r,b:s,a:n}=o.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]=n,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,n)=>{t[n]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ji||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}};Qr.shared=new Qr;Qr._temp=new Qr;Qr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;K=Qr});var _d,yd=p(()=>{"use strict";_d={cullArea:null,cullable:!1,cullableChildren:!0}});var bd,vd,Td,dl=p(()=>{"use strict";bd=Math.PI*2,vd=180/Math.PI,Td=Math.PI/180});var tt,fl,ge=p(()=>{"use strict";tt=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 fl.x=0,fl.y=0,fl}},fl=new tt});var B,Gv,kv,et=p(()=>{dl();ge();B=class i{constructor(t=1,e=0,r=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=n,this.ty=o}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,n,o){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=n,this.ty=o,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 tt;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 tt;let r=this.a,s=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(r*o+n*-s),h=t.x,u=t.y;return e.x=o*c*h+-n*c*u+(l*n-a*o)*c,e.y=r*c*u+-s*c*h+(-l*r+a*s)*c,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,l=t.ty,c=e.a,h=e.b,u=e.c,d=e.d;return this.a=r*c+s*u,this.b=r*h+s*d,this.c=n*c+o*u,this.d=n*h+o*d,this.tx=a*c+l*u+e.tx,this.ty=a*h+l*d+e.ty,this}setTransform(t,e,r,s,n,o,a,l,c){return this.a=Math.cos(a+c)*n,this.b=Math.sin(a+c)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,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,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(r,e),c=Math.abs(a+l);return c<1e-5||Math.abs(bd-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*r+o.y*n),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,n=this.tx,o=t*s-e*r;return this.a=s/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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 kv.identity()}static get shared(){return Gv.identity()}},Gv=new B,kv=new B});var wt,zn=p(()=>{"use strict";wt=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=${this._x} y=${this._y} 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 j(i="default"){return pl[i]===void 0&&(pl[i]=-1),++pl[i]}var pl,Pt=p(()=>{"use strict";pl={default:-1}});var Sd,rt,Ed,Jr,N,_t=p(()=>{"use strict";Sd=new Set,rt="8.0.0",Ed="8.3.4",Jr={quiet:!1,noColor:!1},N=((i,t,e=3)=>{if(Jr.quiet||Sd.has(t))return;let r=new Error().stack,s=`${t}
2
+ Deprecated since v${i}`,n=typeof console.groupCollapsed=="function"&&!Jr.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split(`
3
+ `).splice(e).join(`
4
+ `),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),Sd.add(t)});Object.defineProperties(N,{quiet:{get:()=>Jr.quiet,set:i=>{Jr.quiet=i},enumerable:!0,configurable:!1},noColor:{get:()=>Jr.noColor,set:i=>{Jr.noColor=i},enumerable:!0,configurable:!1}})});function O(...i){ml!==Cd&&(ml++,ml===Cd?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var ml,Cd,ot=p(()=>{"use strict";ml=0,Cd=500});var oe,mr=p(()=>{"use strict";oe={_registeredResources:new Set,register(i){this._registeredResources.add(i)},unregister(i){this._registeredResources.delete(i)},release(){this._registeredResources.forEach(i=>i.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(i){return this._registeredResources.has(i)},reset(){this._registeredResources.clear()}}});var Xn,wd=p(()=>{"use strict";Xn=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,this._count++),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(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}});var gl,pt,Ne=p(()=>{mr();wd();gl=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 Xn(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}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}},pt=new gl;oe.register(pt)});var Pd,Md=p(()=>{_t();Pd={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){N("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Yn(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let n=r-e;for(s=t;s<n;++s)i[s]=i[s+e];i.length=n}var xl=p(()=>{"use strict"});var Ad,Rd=p(()=>{xl();_t();Ad={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let o=e-1;o>=i;o--){let a=this.children[o];a&&(s.push(a),a.parent=null)}Yn(this.children,i,e);let n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(s);for(let o=0;o<s.length;++o){let a=s[o];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,o),s[o].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||N(rt,"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}`);let r=i.parent===this;if(i.parent){let n=i.parent.children.indexOf(i);if(r){if(n===t)return i;i.parent.children.splice(n,1)}else i.removeFromParent()}t===e.length?e.push(i):e.splice(t,0,i);let s=this.renderGroup||this.parentRenderGroup;return this.sortableChildren&&(this.sortDirty=!0),r?(s&&(s.structureDidChange=!0),i):(i.parent=this,i.didChange=!0,i._updateFlags=15,s&&s.addChild(i),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},replaceChild(i,t){i.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(i)),t.setFromMatrix(i.localTransform),t.updateLocalTransform(),this.removeChild(i)}}});var Bd,Gd=p(()=>{"use strict";Bd={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 n=0;n<s;n++)r[n].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let n=this.effects[s];r[n.pipe].push(n,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let n=this.effects[s];r[n.pipe].pop(n,this,i)}}}});var He,jn=p(()=>{"use strict";He=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 _l,$n,kd=p(()=>{P();Ne();_l=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 pt.get(r.maskClass,t)}return t}returnMaskEffect(t){pt.return(t)}},$n=new _l;H.handleByList(_.MaskEffect,$n._effectClasses)});var Id,Fd=p(()=>{jn();kd();Id={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_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),$n.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=$n.getMaskEffect(i),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new He);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 He),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Dd,Ud=p(()=>{_t();Dd={label:null,get name(){return N(rt,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){N(rt,"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 n=e[r].getChildByLabel(i,!0);if(n)return n}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let n=r[s];(n.label===i||i instanceof RegExp&&i.test(n.label))&&e.push(n)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var Kn,q,Ut=p(()=>{ge();Kn=[new tt,new tt,new tt,new tt],q=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:n,height:o}=this;if(n<=0||o<=0)return!1;let a=this.x,l=this.y,c=r*(1-s),h=r-c,u=a-c,d=a+n+c,f=l-c,m=l+o+c,g=a+h,y=a+n-h,x=l+h,b=l+o-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>g&&t<y&&e>x&&e<b)}intersects(t,e){if(!e){let I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;let M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}let r=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=r||o<=n)return!1;let a=Kn[0].set(t.left,t.top),l=Kn[1].set(t.left,t.bottom),c=Kn[2].set(t.right,t.top),h=Kn[3].set(t.right,t.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=r||Math.min(a.x,l.x,c.x,h.x)>=s||Math.max(a.y,l.y,c.y,h.y)<=n||Math.min(a.y,l.y,c.y,h.y)>=o))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),m=d*r+f*n,g=d*s+f*n,y=d*r+f*o,x=d*s+f*o;if(Math.max(m,g,y,x)<=d*a.x+f*a.y||Math.min(m,g,y,x)>=d*h.x+f*h.y)return!1;let b=u*(a.y-c.y),v=u*(c.x-a.x),T=b*r+v*n,S=b*s+v*n,E=b*r+v*o,w=b*s+v*o;return!(Math.max(T,S,E,w)<=b*a.x+v*a.y||Math.min(T,S,E,w)>=b*h.x+v*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=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(n-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}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,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),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=n-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,n=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&&n>=this.y&&n<=this.y+this.height}set(t,e,r,s){return this.x=t,this.y=e,this.width=r,this.height=s,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Od,ct,jt=p(()=>{et();Ut();Od=new B,ct=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=Od,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 q);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Od,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,n){n||(n=this.matrix);let o=n.a,a=n.b,l=n.c,c=n.d,h=n.tx,u=n.ty,d=this.minX,f=this.minY,m=this.maxX,g=this.maxY,y=o*t+l*e+h,x=a*t+c*e+u;y<d&&(d=y),x<f&&(f=x),y>m&&(m=y),x>g&&(g=x),y=o*r+l*e+h,x=a*r+c*e+u,y<d&&(d=y),x<f&&(f=x),y>m&&(m=y),x>g&&(g=x),y=o*t+l*s+h,x=a*t+c*s+u,y<d&&(d=y),x<f&&(f=x),y>m&&(m=y),x>g&&(g=x),y=o*r+l*s+h,x=a*r+c*s+u,y<d&&(d=y),x<f&&(f=x),y>m&&(m=y),x>g&&(g=x),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,n=this.maxY,{a:o,b:a,c:l,d:c,tx:h,ty:u}=t,d=o*e+l*r+h,f=a*e+c*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=o*s+l*r+h,f=a*s+c*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=o*e+l*n+h,f=a*e+c*n+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=o*s+l*n+h,f=a*s+c*n+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 n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let g=e;g<r;g+=2){let y=t[g],x=t[g+1],b=c*y+u*x+f,v=h*y+d*x+m;n=b<n?b:n,o=v<o?v:o,a=b>a?b:a,l=v>l?v:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var Mt,re,gr=p(()=>{et();Ne();jt();Mt=pt.getPool(B),re=pt.getPool(ct)});var Iv,Ld,Nd=p(()=>{et();jt();gr();Iv=new B,Ld={getFastGlobalBounds(i,t){t||(t=new ct),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=re.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let o=this.bounds;r.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}let n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(i,r,e)}if(s){let n=!1,o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,r.applyMatrix(o.worldTransform)),this.effects[a].addBounds(r,!0));n&&r.applyMatrix(o.worldTransform.copyTo(Iv).invert()),t.addBounds(r),re.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),re.return(r))}}});function ti(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Mt.get().identity(),r=qn(i,s)):r=B.IDENTITY,Hd(i,e,r,t),s&&Mt.return(s),e.isValid||e.set(0,0,0,0),e}function Hd(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Mt.get(),s.appendFrom(i.localTransform,e));let n=t,o=!!i.effects.length;if(o&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{let a=i.bounds;a&&!a.isEmpty()&&(t.matrix=s,t.addBounds(a));for(let l=0;l<i.children.length;l++)Hd(i.children[l],t,s,r)}if(o){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);n.addBounds(t,B.IDENTITY),re.return(t)}r||Mt.return(s)}function qn(i,t){let e=i.parent;return e&&(qn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var $i=p(()=>{et();gr()});function Ce(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,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255|0,c=r*o/255|0,h=s*a/255|0;return(l<<16)+(c<<8)+h}var Ki=p(()=>{"use strict"});function ei(i,t){return i===Wd?t:t===Wd?i:Ce(i,t)}var Wd,yl=p(()=>{Ki();Wd=16777215});function We(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var Vd,Zn=p(()=>{et();$i();gr();yl();Vd={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=new B,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=qn(this,Mt.get().identity());return i.appendFrom(this.localTransform,e),Mt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?We(this.renderGroup.worldColor):this.parentRenderGroup?We(ei(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=ei(t,e.localColor),e=e.parent;return We(t)}}});function ri(i,t,e){return t.clear(),e||(e=B.IDENTITY),zd(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function zd(i,t,e,r,s){let n;if(s)n=Mt.get(),n=e.copyTo(n);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let l=i.localTransform;n=Mt.get(),n.appendFrom(l,e)}let o=t,a=!!i.effects.length;if(a&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,n);else{i.renderPipeId&&(t.matrix=n,t.addBounds(i.bounds));let l=i.children;for(let c=0;c<l.length;c++)zd(l[c],t,n,r,!1)}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(t,r);o.addBounds(t,B.IDENTITY),re.return(t)}Mt.return(n)}var Qn=p(()=>{et();gr()});function bl(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],n=s.uid,o=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,s.children.length&&bl(s,t)}return t.didChange}var Xd=p(()=>{"use strict"});var Fv,Yd,jd=p(()=>{et();jt();$i();Qn();Xd();Fv=new B,Yd={_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 ct});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),bl(this,i),i.didChange&&ri(this,i.localBounds,Fv),i.localBounds},getBounds(i,t){return ti(this,i,t||new ct)}}});var $d,Kd=p(()=>{"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 Dv(i,t){return i._zIndex-t._zIndex}var qd,Zd=p(()=>{"use strict";qd={_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(Dv))}}});var Qd,Jd=p(()=>{ge();gr();Qd={getGlobalPosition(i=new tt,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(Mt.get(),e);return t=r.apply(i,t),Mt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Mt.get(),r);return e=s.applyInverse(i,e),Mt.return(s),e}}});var Qe,Jn=p(()=>{Pt();Qe=class{constructor(){this.uid=j("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Ve(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 vl(i){return!(i&i-1)&&!!i}var qi=p(()=>{"use strict"});function to(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Tl=p(()=>{"use strict"});function Uv(i){let t=tf[i];return t===void 0&&(tf[i]=j("resource")),t}var tf,ef,Qt,xr=p(()=>{Gt();Pt();_t();tf=Object.create(null);ef=class rf extends lt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...rf.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){N(rt,"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._sharedResourceId=null,this.emit("change",this)}_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=Uv(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};ef.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Qt=ef});var sf,J,Ot=p(()=>{Gt();qi();Tl();Pt();xr();sf=class nf extends lt{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=j("textureSource"),this._resourceType="textureSource",this._resourceId=j("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.viewDimension="2d",this.arrayLayerCount=1,this._ownsStyle=!1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...nf.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.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.transient=t.transient??!1,this.alphaMode=t.alphaMode,this.style=new Qt(to(t)),this._ownsStyle=!0,this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._ownsStyle=!1,this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}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.unload(),this.emit("destroy",this),this._style&&(this._ownsStyle&&this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=j("resource"),this.emit("change",this),this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}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),n=Math.round(e*r);return this.width=s/r,this.height=n/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=n,this.emit("resize",this),this._resourceId=j("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=vl(this.pixelWidth)&&vl(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};sf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};J=sf});function Ov(){for(let i=0;i<16;i++){let t=[];Sl.push(t);for(let e=0;e<16;e++){let r=eo(_r[i]*_r[e]+br[i]*yr[e]),s=eo(yr[i]*_r[e]+vr[i]*yr[e]),n=eo(_r[i]*br[e]+br[i]*vr[e]),o=eo(yr[i]*br[e]+vr[i]*vr[e]);for(let a=0;a<16;a++)if(_r[a]===r&&yr[a]===s&&br[a]===n&&vr[a]===o){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(_r[i],yr[i],br[i],vr[i],0,0),of.push(t)}}var _r,yr,br,vr,Sl,of,eo,Q,Zi=p(()=>{et();_r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],br=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Sl=[],of=[],eo=Math.sign;Ov();Q={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=>_r[i],uY:i=>yr[i],vX:i=>br[i],vY:i=>vr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Sl[i][t],sub:(i,t)=>Sl[i][Q.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Q.S:Q.N:Math.abs(t)*2<=Math.abs(i)?i>0?Q.E:Q.W:t>0?i>0?Q.SE:Q.SW:i>0?Q.NE:Q.NW,matrixAppendRotationInv:(i,t,e=0,r=0,s=0,n=0)=>{let o=of[Q.inv(t)],a=o.a,l=o.b,c=o.c,h=o.d,u=e-Math.min(0,a*s,c*n,a*s+c*n),d=r-Math.min(0,l*s,h*n,l*s+h*n),f=i.a,m=i.b,g=i.c,y=i.d;i.a=a*f+l*g,i.b=a*m+l*y,i.c=c*f+h*g,i.d=c*m+h*y,i.tx=u*f+d*g+i.tx,i.ty=u*m+d*y+i.ty},transformRectCoords:(i,t,e,r)=>{let{x:s,y:n,width:o,height:a}=i,{x:l,y:c,width:h,height:u}=t;return e===Q.E?(r.set(s+l,n+c,o,a),r):e===Q.S?r.set(h-n-a+l,s+c,a,o):e===Q.W?r.set(h-s-o+l,u-n-a+c,o,a):e===Q.N?r.set(n+l,u-s-o+c,a,o):r.set(s+l,n+c,o,a)}}});var El,af=p(()=>{"use strict";El=()=>{}});var Tr,Cl=p(()=>{P();Ot();Tr=class extends J{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}};Tr.extension=_.TextureSource});var lf,ii,wl=p(()=>{et();lf=new B,ii=class{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),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()}destroy(){this._texture?.removeListener("update",this.update,this),this._texture=null}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let n=t[s],o=t[s+1];e[s]=n*r.a+o*r.c+r.tx,e[s+1]=n*r.b+o*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&&(lf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(lf));let n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+l)/n.width,o[1]=(t.frame.y+a+l)/n.height,o[2]=(t.frame.x+t.frame.width-a+l)/n.width,o[3]=(t.frame.y+t.frame.height-a+l)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}});var U,mt=p(()=>{Gt();Zi();Ut();Pt();_t();af();Cl();Ot();wl();U=class extends lt{constructor({source:t,label:e,frame:r,orig:s,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=j("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new J,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=n,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ii(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,n=e.x/r,o=e.y/s,a=e.width/r,l=e.height/s,c=this.rotate;if(c){let h=a/2,u=l/2,d=n+h,f=o+u;c=Q.add(c,Q.NW),t.x0=d+h*Q.uX(c),t.y0=f+u*Q.uY(c),c=Q.add(c,2),t.x1=d+h*Q.uX(c),t.y1=f+u*Q.uY(c),c=Q.add(c,2),t.x2=d+h*Q.uX(c),t.y2=f+u*Q.uY(c),c=Q.add(c,2),t.x3=d+h*Q.uX(c),t.y3=f+u*Q.uY(c)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+l,t.x3=n,t.y3=o+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),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 N(rt,"Texture.baseTexture is now Texture.source"),this._source}};U.EMPTY=new U({label:"EMPTY",source:new J({label:"EMPTY"})});U.EMPTY.destroy=El;U.WHITE=new U({source:new Tr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});U.WHITE.destroy=El});var Lv,Pl,Tt,Sr=p(()=>{qi();mr();Ot();mt();xr();Lv=0,Pl=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new Qt(this.textureOptions)}createTexture(t,e,r,s){let n=new J({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new U({source:n,label:`texturePool_${Lv++}`})}getOptimalTexture(t,e,r=1,s,n=!1){let o=Math.ceil(t*r-1e-6),a=Math.ceil(e*r-1e-6);o=Ve(o),a=Ve(a);let l=s?1:0,c=n?1:0,h=(o<<17)+(a<<2)+(c<<1)+l;this._texturePool[h]||(this._texturePool[h]=[]);let u=this._texturePool[h].pop();return u||(u=this.createTexture(o,a,s,n)),u.source._resolution=r,u.source.width=o/r,u.source.height=a/r,u.source.pixelWidth=o,u.source.pixelHeight=a,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=h,u}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=!1){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].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={}}},Tt=new Pl;oe.register(Tt)});var Er,Ml=p(()=>{et();Jn();Sr();Er=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,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 Qe,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&&(Tt.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;let t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}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.indexOf(t)===-1&&this._onRenderContainers.push(t)}removeOnRender(t){let e=this._onRenderContainers.indexOf(t);e!==-1&&this._onRenderContainers.splice(e,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 B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),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 B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function cf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var hf=p(()=>{"use strict"});var Al,ro,Rl,io,si,Qi,Cr,ut,xe=p(()=>{Gt();Ht();yd();P();et();dl();zn();Pt();_t();ot();Ne();Md();Rd();Gd();Fd();Ud();Nd();Zn();jd();Kd();Zd();Jd();Ml();hf();Al=new wt(null),ro=new wt(null),Rl=new wt(null,1,1),io=new wt(null),si=1,Qi=2,Cr=4,ut=class i extends lt{constructor(t={}){super(),this.uid=j("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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new wt(this,0,0),this._scale=Rl,this._pivot=ro,this._origin=io,this._skew=Al,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=[],cf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){N("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),H.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||N(rt,"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=pt.get(Er,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),pt.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 B),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*vd}set angle(t){this.rotation=t*Td}get pivot(){return this._pivot===ro&&(this._pivot=new wt(this,0,0)),this._pivot}set pivot(t){this._pivot===ro&&(this._pivot=new wt(this,0,0),this._origin!==io&&O("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Al&&(this._skew=new wt(this,0,0)),this._skew}set skew(t){this._skew===Al&&(this._skew=new wt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Rl&&(this._scale=new wt(this,1,1)),this._scale}set scale(t){this._scale===Rl&&(this._scale=new wt(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===io&&(this._origin=new wt(this,0,0)),this._origin}set origin(t){this._origin===io&&(this._origin=new wt(this,0,0),this._pivot!==ro&&O("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.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:this.scale.x,typeof t.scaleY=="number"?t.scaleY: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.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.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,n=this._origin,o=this._position,a=r._x,l=r._y,c=s._x,h=s._y,u=-n._x,d=-n._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*l,e.d=this._sy*l,e.tx=o._x-(c*e.a+h*e.c)+(u*e.a+d*e.c)-u,e.ty=o._y-(c*e.b+h*e.d)+(u*e.b+d*e.d)-d}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=si,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=K.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=si,this._onUpdate())}get tint(){return We(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Qi,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|=Cr,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}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|=Cr,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|=Cr,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._origin=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}};H.mixin(ut,Ad,Ld,Qd,$d,Yd,Id,Dd,qd,_d,Pd,Vd,Bd)});var we,Ji=p(()=>{"use strict";we=(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))(we||{})});var ni,uf=p(()=>{"use strict";ni=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 df,Lt,oi=p(()=>{Ji();uf();df=class ie{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 ni(null,null,1/0),this.deltaMS=1/ie.targetFPMS,this.elapsedMS=1/ie.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=we.NORMAL){return this._addListener(new ni(t,e,r))}addOnce(t,e,r=we.NORMAL){return this._addListener(new ni(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 n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ie.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(Math.max(0,t)/1e3,ie.targetFPMS);this._maxElapsedMS=1/e,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!ie._shared){let t=ie._shared=new ie;t.autoStart=!0,t._protected=!0}return ie._shared}static get system(){if(!ie._system){let t=ie._system=new ie;t.autoStart=!0,t._protected=!0}return ie._system}};df.targetFPMS=.06;Lt=df});var ai,Bl=p(()=>{Ji();oi();ai=class{constructor(t){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),r=this._canvas.width,s=this._canvas.height,n=e.width/r*this._renderer.resolution,o=e.height/s*this._renderer.resolution,a=e.left,l=e.top,c=`translate(${a}px, ${l}px) scale(${n}, ${o})`;c!==this._lastTransform&&(this._domElement.style.transform=c,this._lastTransform=c)},this._domElement=t.domElement,this._renderer=t.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(t=>{for(let e of t){if(e.target!==this._canvas)continue;let r=this.canvas.width,s=this.canvas.height,n=e.contentRect.width/r*this._renderer.resolution,o=e.contentRect.height/s*this._renderer.resolution;(this._lastScaleX!==n||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=n,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||Lt.shared.add(this.updateTranslation,this,we.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&Lt.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}});var Je,so=p(()=>{ge();Je=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 tt,this.page=new tt,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,n){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 Nv(i){return function(t){return t.test(i)}}function ts(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=Nv(e),n={apple:{phone:s(Gl)&&!s(ze),ipod:s(ff),tablet:!s(Gl)&&(s(pf)||Sf(t))&&!s(ze),universal:s(mf),device:(s(Gl)||s(ff)||s(pf)||s(mf)||Sf(t))&&!s(ze)},amazon:{phone:s(li),tablet:!s(li)&&s(no),device:s(li)||s(no)},android:{phone:!s(ze)&&s(li)||!s(ze)&&s(kl),tablet:!s(ze)&&!s(li)&&!s(kl)&&(s(no)||s(gf)),device:!s(ze)&&(s(li)||s(no)||s(kl)||s(gf))||s(/\bokhttp\b/i)},windows:{phone:s(ze),tablet:s(xf),device:s(ze)||s(xf)},other:{blackberry:s(_f),blackberry10:s(yf),opera:s(bf),firefox:s(Tf),chrome:s(vf),device:s(_f)||s(yf)||s(bf)||s(Tf)||s(vf)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var Gl,ff,pf,mf,kl,gf,li,no,ze,xf,_f,yf,bf,vf,Tf,Sf,Il=p(()=>{Gl=/iPhone/i,ff=/iPod/i,pf=/iPad/i,mf=/\biOS-universal(?:.+)Mac\b/i,kl=/\bAndroid(?:.+)Mobile\b/i,gf=/Android/i,li=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,no=/Silk/i,ze=/Windows Phone/i,xf=/\bWindows(?:.+)ARM\b/i,_f=/BlackBerry/i,yf=/BB10/i,bf=/Opera Mini/i,vf=/\b(CriOS|Chrome)(?:.+)Mobile/i,Tf=/Mobile(?:.+)Firefox\b/i,Sf=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Ef=p(()=>{Il();Il()});var Hv,Cf,wf=p(()=>{Ef();Hv=ts.default??ts,Cf=Hv(globalThis.navigator)});var Wv,Pf,Vv,zv,Mf,Af,Xv,Yv,jv,Fl,Bf,Gf=p(()=>{Bl();so();P();wf();xl();Wv=9,Pf=100,Vv=0,zv=0,Mf=2,Af=1,Xv=-1e3,Yv=-1e3,jv=2,Fl=class Rf{constructor(t,e=Cf){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),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}get div(){return this._div}_createTouchHook(){let t=document.createElement("button");t.style.width=`${Af}px`,t.style.height=`${Af}px`,t.style.position="absolute",t.style.top=`${Xv}px`,t.style.left=`${Yv}px`,t.style.zIndex=jv.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.position="absolute",this._div.style.top=`${Vv}px`,this._div.style.left=`${zv}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=Mf.toString(),this._canvasObserver=new ai({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);let t=this._renderer.view.canvas;if(t.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(e.disconnect(),this._canvasObserver.ensureAttached(),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._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv?.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;for(let t in this._pools)this._pools[t].forEach(r=>{r.parentNode&&r.parentNode.removeChild(r)}),delete this._pools[t];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},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:{...Rf.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault&&this._activate(),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)&&!this._isRunningTests))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._getPool(s.accessibleType).push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Yn(this._children,r,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let n=s._accessibleDiv,o=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform;n.style.left=`${a.tx+o.x*a.a}px`,n.style.top=`${a.ty+o.y*a.d}px`,n.style.width=`${o.width*a.a}px`,n.style.height=`${o.height*a.d}px`}else this._capHitArea(o),n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}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 r=this._getPool(t.accessibleType).pop();r?(r.innerHTML="",r.removeAttribute("title"),r.removeAttribute("aria-label"),r.tabIndex=0):(t.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(t.accessibleType),r.style.cssText=`
5
+ color: transparent;
6
+ pointer-events: none;
7
+ padding: 0;
8
+ margin: 0;
9
+ border: 0;
10
+ outline: 0;
11
+ background: transparent;
12
+ box-sizing: border-box;
13
+ user-select: none;
14
+ -webkit-user-select: none;
15
+ -moz-user-select: none;
16
+ -ms-user-select: none;
17
+ `,t.accessibleText&&(r.innerText=t.accessibleText)),r.style.width=`${Pf}px`,r.style.height=`${Pf}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=Mf.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=t.accessiblePointerEvents,r.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?r.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(r.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&r.setAttribute("aria-label",t.accessibleHint),t.interactive?r.tabIndex=t.tabIndex:r.tabIndex=0,this.debug&&this._updateDebugHTML(r),t._accessibleActive=!0,t._accessibleDiv=r,r.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,n=Object.assign(new Je(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_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!==Wv||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}_getPool(t){return this._pools[t]||(this._pools[t]=[]),this._pools[t]}};Fl.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"accessibility"};Fl.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Bf=Fl});var kf,If=p(()=>{"use strict";kf={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1}});var Ff=p(()=>{P();xe();Gf();If();H.add(Bf);H.mixin(ut,kf)});var es,Df=p(()=>{P();Bl();es=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._renderer.runners.init.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"}init(){this._canvasObserver=new ai({domElement:this._domElement,renderer:this._renderer})}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t)}updateRenderable(t){}validateRenderable(t){return!0}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let e=0;e<t.length;e++){let r=t[e],s=r.element;if(!r.parent||r.globalDisplayStatus<7)s?.remove(),t.splice(e,1),e--;else{this._domElement.contains(s)||(s.style.position="absolute",s.style.pointerEvents="auto",this._domElement.appendChild(s));let n=r.worldTransform,o=r._anchor,a=r.width*o.x,l=r.height*o.y;s.style.transformOrigin=`${a}px ${l}px`,s.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-a}, ${n.ty-l})`,s.style.opacity=r.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}};es.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"dom"}});var tr,oo=p(()=>{jt();xe();tr=class extends ut{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new ct(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!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)}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.pushBlendMode(this,this.groupBlendMode,t);let o=s[this.renderPipeId];o?.addRenderable&&o.addRenderable(this,t),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(t,e,r);s.blendMode.popBlendMode(t)}}});var Uf=p(()=>{P();Df();H.add(es)});var Dl,_e,Ul=p(()=>{Ji();oi();Dl=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||(Lt.system.add(this._tickerUpdate,this,we.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Lt.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(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}},_e=new Dl});var Xe,ao=p(()=>{ge();so();Xe=class extends Je{constructor(){super(...arguments),this.client=new tt,this.movement=new tt,this.offset=new tt,this.global=new tt,this.screen=new tt}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,n,o,a,l,c,h,u,d,f,m,g){throw new Error("Method not implemented.")}}});var $t,Ol=p(()=>{ao();$t=class extends Xe{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1,this.persistentDeviceId=0}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Pe,Ll=p(()=>{ao();Pe=class extends Xe{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Pe.DOM_DELTA_PIXEL=0;Pe.DOM_DELTA_LINE=1;Pe.DOM_DELTA_PAGE=2});var $v,Kv,rs,lo,Of=p(()=>{Gt();ge();ot();Ul();ao();Ol();Ll();$v=2048,Kv=new tt,rs=new tt,lo=class{constructor(t){this.dispatch=new lt,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){_e.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[s](this.rootTarget,this.rootTarget.eventMode,Kv.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=r.length-1;s<n;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 n=r.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=r[n],this.notifyTarget(t,o)})}propagationPath(t){let e=[t];for(let r=0;r<$v&&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,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,n,o||n(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(e),c=t.isInteractive();return c&&c&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,r)&&s(t,r)?c?[t]:[]:null}hitTestRecursive(t,e,r,s,n){if(this._interactivePrune(t)||n(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,c=r;for(let h=l.length-1;h>=0;h--){let u=l[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,c,s,n);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 o=this._isInteractive(e),a=t.isInteractive();return o&&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,rs),!t.hitArea.contains(rs.x,rs.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,rs),t.containsPoint(rs)):!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 $t)){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 $t)){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),n=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&n!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,l,n);if(this.dispatchEvent(c,"pointerout"),r&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){let h=this.createPointerEvent(t,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(c)}if(n!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,l);this.dispatchEvent(c,"pointerover"),r&&this.dispatchEvent(c,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==n&&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(c)}let o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),r&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=e.target?.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof $t)){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 n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof $t)){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),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");let o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),r&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof $t)){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),n=this.findMountedTarget(s.pressTargetsByButton[t.button]),o=n;if(n&&!r.composedPath().includes(n)){let a=n;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 l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){let a=this.clonePointerEvent(r,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let c=a.button===2;this.dispatchEvent(a,c?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof $t)){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 n=r;for(;n;)s.currentTarget=n,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"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Pe)){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($t);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(Pe);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($t);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 $t&&e instanceof $t&&(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,e.persistentDeviceId=t.persistentDeviceId)}copyMouseData(t,e){t instanceof Xe&&e instanceof Xe&&(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,n=r.length;s<n&&!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 qv,Zv,Hl,co,Wl=p(()=>{P();Of();Ul();Ol();Ll();qv=1,Zv={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Hl=class Nl{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new lo(null),_e.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new $t(null),this._rootWheelEvent=new Pe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Nl.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,Nl._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){_e.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 n=e[r],o=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,_e.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let n=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(n)}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 n=0,o=s.length;n<o;n++){let a=this._bootstrapEvent(this._rootPointerEvent,s[n]);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 n=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(n)}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,_e.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_e.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;_e.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},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(r-s.top)*(this.domElement.height/s.height)*n}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let n=t.changedTouches[r];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,n.altKey??(n.altKey=t.altKey),n.ctrlKey??(n.ctrlKey=t.ctrlKey),n.metaKey??(n.metaKey=t.metaKey),n.shiftKey??(n.shiftKey=t.shiftKey),e.push(n)}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=qv),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=Zv[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}};Hl.extension={name:"events",type:[_.WebGLSystem,_.CanvasSystem,_.WebGPUSystem],priority:-1};Hl.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};co=Hl});var Lf,Nf=p(()=>{Wl();so();Lf={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??co.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,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(i,a,o)}),n?l.once(i,a,o):l.on(i,a,o)},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 Je))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 Hf=p(()=>{P();xe();Wl();Nf();H.add(co);H.mixin(ut,Lf)});var Vl,Wf=p(()=>{"use strict";Vl=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Vl||{})});var Vf,zf=p(()=>{"use strict";Vf={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},createImage:()=>new Image,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 Xf,W,dt=p(()=>{zf();Xf=Vf,W={get(){return Xf},set(i){Xf=i}}});function ye(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function is(i){return i.split("?")[0].split("#")[0]}function Qv(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jv(i,t,e){return i.replace(new RegExp(Qv(t),"g"),e)}function tT(i,t){let e="",r=0,s=-1,n=0,o=-1;for(let a=0;a<=i.length;++a){if(a<i.length)o=i.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,n=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,n=0}else o===46&&n!==-1?++n:n=-1}return e}var wr,zl=p(()=>{dt();wr={toPosix(i){return Jv(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){ye(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(ye(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=is(this.toPosix(t??W.get().getBaseUrl())),s=is(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?wr.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ye(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=tT(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ye(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(ye(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(ye(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,n=this.getProtocol(i),o=i;i=i.slice(n.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(o)?n+i:n:e&&r===1?"//":n+i.slice(0,r)},rootname(i){ye(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){ye(i),t&&ye(t),i=is(this.toPosix(i));let e=0,r=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let o=t.length-1,a=-1;for(n=i.length-1;n>=0;--n){let l=i.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(r=n):(o=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!s){e=n+1;break}}else r===-1&&(s=!1,r=n+1);return r===-1?"":i.slice(e,r)},extname(i){ye(i),i=is(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,n=0;for(let o=i.length-1;o>=0;--o){let a=i.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}r===-1&&(s=!1,r=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||r===-1||n===0||n===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){ye(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=is(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,n="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let o=-1,a=0,l=-1,c=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!c){a=h+1;break}continue}l===-1&&(c=!1,l=h+1),e===46?o===-1?o=h:u!==1&&(u=1):o!==-1&&(u=-1)}return o===-1||l===-1||u===0||u===1&&o===l-1&&o===a+1?l!==-1&&(a===0&&r?t.base=t.name=i.slice(1,l):t.base=t.name=i.slice(a,l)):(a===0&&r?(t.name=i.slice(1,o),t.base=i.slice(1,l)):(t.name=i.slice(a,o),t.base=i.slice(a,l)),t.ext=i.slice(o,l)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var er,Xl=p(()=>{"use strict";er=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Yf(i,t,e,r,s){let n=t[e];for(let o=0;o<n.length;o++){let a=n[o];e<t.length-1?Yf(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function jf(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(n=>{let o=n.substring(1,n.length-1).split(",");s.push(o)}),Yf(i,s,0,e,r)}else r.push(i);return r}var $f=p(()=>{"use strict"});var Yl,Kf=p(()=>{"use strict";Yl=i=>!Array.isArray(i)});function eT(i){return i.split(".").pop().split("?").shift().split("#").shift()}var ss,qf=p(()=>{ot();zl();Xl();$f();Kf();ss=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 er(e||r,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>o?.src??o):n?.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}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(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),s.forEach(n=>{let o=n.src,a=n.alias,l;if(typeof a=="string"){let c=this._createBundleAssetId(t,a);r.push(c),l=[a,c]}else{let c=a.map(h=>this._createBundleAssetId(t,h));r.push(...c),l=[...a,...c]}this.add({...n,alias:l,src:o})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=n=>{this.hasKey(n)&&O(`[Resolver] already has key: ${n} overwriting`)},er(e).forEach(n=>{let{src:o}=n,{data:a,format:l,loadParser:c,parser:h}=n,u=er(o).map(g=>typeof g=="string"?jf(g):Array.isArray(g)?g:[g]),d=this.getAlias(n);Array.isArray(d)?d.forEach(r):r(d);let f=[],m=g=>{let y=this._parsers.find(x=>x.test(g));return{src:g,...y?.parse(g)}};u.forEach(g=>{g.forEach(y=>{let x={};if(typeof y!="object"?x=m(y):(a=y.data??a,l=y.format??l,(y.loadParser||y.parser)&&(c=y.loadParser??c,h=y.parser??h),x={...m(y.src),...y}),!d)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:d,data:a,format:l,loadParser:c,parser:h,progressSize:n.progressSize}),f.push(x)})}),d.forEach(g=>{this._assetMap[g]=f})})}resolveBundle(t){let e=Yl(t);t=er(t);let r={};return t.forEach(s=>{let n=this._bundles[s];if(n){let o=this.resolve(n),a={};for(let l in o){let c=o[l];a[this._extractAssetIdFromBundle(s,l)]=c}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=Yl(t);t=er(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s],o=this._getPreferredOrder(n);o?.priority.forEach(a=>{o.params[a].forEach(l=>{let c=n.filter(h=>h[a]?h[a]===l:!1);c.length&&(n=c)})}),this._resolverHash[s]=n[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(n=>n.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:n,parser:o,format:a,progressSize:l}=e;return(this._basePath||this._rootPath)&&(t.src=wr.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=n??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??eT(t.src),l!==void 0&&(t.progressSize=l),t}};ss.RETINA_PREFIX=/@([0-9\.]+)x/});var jl,Zf=p(()=>{"use strict";jl=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var Qf,$l,Jf=p(()=>{Ut();Ot();mt();Qf=class ns{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof J&&(r={texture:t,data:e});let{texture:s,data:n,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof U?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=n;let a=parseFloat(n.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.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<=ns.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,e=!1){let r=t,s=e?1/0:ns.BATCH_SIZE;for(;r-t<s&&r<this._frameKeys.length;){let n=this._frameKeys[r],o=this._frames[n],a=o.frame;if(a){let l=null,c=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new q(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?l=new q(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):l=new q(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new q(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new U({source:this.textureSource,frame:l,orig:u,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:n.toString()})}r++}}_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*ns.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ns.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=[]}};Qf.BATCH_SIZE=1e3;$l=Qf});function tp(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s]}),!e){let s=wr.dirname(i[0]);t.linkedSheets.forEach((n,o)=>{let a=tp([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(r,a)})}return r}var rT,ep,rp=p(()=>{Wf();qf();Zf();P();mt();zl();Jf();rT=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];ep={extension:_.Asset,cache:{test:i=>i instanceof $l,getCacheableAssets:(i,t)=>tp(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"&&rT.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(ss.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:_.LoadParser,priority:Vl.Normal,name:"spritesheetLoader"},async testParse(i,t){return wr.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:n,cachePrefix:o}=t?.data??{},a=wr.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof U)l=r;else{let u=jl(a+(s??i.meta.image),t.src);l=(await e.load([{src:u,data:n}]))[u]}let c=new $l({texture:l.source,data:i,cachePrefix:o});await c.parse();let h=i?.meta?.related_multi_packs;if(Array.isArray(h)){let u=[];for(let f of h){if(typeof f!="string")continue;let m=a+f;t.data?.ignoreMultiPack||(m=jl(m,t.src),u.push(e.load({src:m,data:{textureOptions:n,ignoreMultiPack:!0}})))}let d=await Promise.all(u);c.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[c].concat(c.linkedSheets.filter(m=>m!==f))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var ho=p(()=>{P();rp();H.add(ep)});function uo(i,t,e){let{width:r,height:s}=e.orig,n=e.trim;if(n){let o=n.width,a=n.height;i.minX=n.x-t._x*r,i.maxX=i.minX+o,i.minY=n.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 Kl=p(()=>{"use strict"});var Me,fo=p(()=>{zn();mt();Kl();_t();oo();Me=class i extends tr{constructor(t=U.EMPTY){t instanceof U&&(t={texture:t});let{texture:e=U.EMPTY,anchor:r,roundPixels:s,width:n,height:o,...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 wt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof U?new i(t):new i(U.from(t,e))}set texture(t){t||(t=U.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 uo(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return N("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:n}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*n,r.maxY=r.minY+n}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 po(i,t,e){let r=iT;i.measurable=!0,ti(i,e,r),t.addBoundsMask(r),i.measurable=!1}var iT,ql=p(()=>{jt();$i();iT=new ct});function mo(i,t,e){let r=re.get();i.measurable=!0;let s=Mt.get().identity(),n=ip(i,e,s);ri(i,r,n),i.measurable=!1,t.addBoundsMask(r),Mt.return(s),re.return(r)}function ip(i,t,e){return i?(i!==t&&(ip(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Zl=p(()=>{Qn();gr();ot()});var os,sp=p(()=>{P();fo();ql();Zl();os=class{constructor(t){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Me),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||po(this.mask,t,e)}addLocalBounds(t,e){mo(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Me}};os.extension=_.MaskEffect});var as,np=p(()=>{P();as=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"}};as.extension=_.MaskEffect});var ls,op=p(()=>{P();xe();ql();Zl();ls=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!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){po(this.mask,t,e)}addLocalBounds(t,e){mo(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof ut}};ls.extension=_.MaskEffect});var vt,rr=p(()=>{dt();P();Ot();vt=class extends J{constructor(t){t.resource||(t.resource=W.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"))}};vt.extension=_.TextureSource});var ir,Ql=p(()=>{P();Ot();ir=class extends J{constructor(t){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}};ir.extension=_.TextureSource});async function ap(){return Jl??(Jl=(async()=>{let t=W.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(o=>{let a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(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 n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Jl}var Jl,lp=p(()=>{dt()});var go,hp,up=p(()=>{P();oi();lp();Ot();go=class cp extends J{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...cp.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),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Lt.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.isValid||t.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await ap(),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._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),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.isValid&&(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("loadedmetadata",this._onLoadedMetadata),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&&(Lt.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||(Lt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Lt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};go.extension=_.TextureSource;go.defaultOptions={...J.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};go.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};hp=go});var tc,Pr,dp=p(()=>{ot();Xl();tc=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=er(t),s;for(let l=0;l<this.parsers.length;l++){let c=this.parsers[l];if(c.test(e)){s=c.getCacheableAssets(r,e);break}}let n=new Map(Object.entries(s||{}));s||r.forEach(l=>{n.set(l,e)});let o=[...n.keys()],a={cacheKeys:o,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{let c=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==c&&O("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}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}},Pr=new tc});function fp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<ec.length;s++){let n=ec[s];if(n.test(e))return new n(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function pp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&Pr.has(r))return Pr.get(r);let n=new U({source:fp(s)});return n.on("destroy",()=>{Pr.has(r)&&Pr.remove(r)}),t||Pr.set(r,n),n}function mp(i,t=!1){return typeof i=="string"?Pr.get(i):i instanceof J?new U({source:i}):pp(i,t)}var ec,rc=p(()=>{dp();P();Ot();mt();ec=[];H.handleByList(_.TextureSource,ec);U.from=mp;J.from=fp});var xo=p(()=>{P();sp();np();op();Cl();rr();Ql();up();rc();H.add(os,as,ls,hp,ir,vt,Tr)});function gp(i){let t=W.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=i,e.fillRect(0,0,6,1),t}function _o(){if(ci!==void 0)return ci;try{let i=gp("#ff00ff"),t=gp("#ffff00"),r=W.get().createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(i,0,0),r.drawImage(t,2,0);let s=r.getImageData(2,0,1,1);if(!s)ci=!1;else{let n=s.data;ci=n[0]===255&&n[1]===0&&n[2]===0}}catch{ci=!1}return ci}var ci,ic=p(()=>{dt()});var $,hi=p(()=>{Ht();dt();Zi();ic();$={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:_o(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:i=>{let t=i.source,e=t?.resource;if(!e)return null;let r=t.alphaMode==="premultiplied-alpha",s=t.resourceWidth??t.pixelWidth,n=t.resourceHeight??t.pixelHeight,o=s!==t.pixelWidth||n!==t.pixelHeight;if(r){if((e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)&&!o)return e;let a=$._unpremultipliedCache.get(t);if(a?.resourceId===t._resourceId)return a.canvas}if(e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof ArrayBuffer){let a=$._canvasSourceCache.get(t);if(a?.resourceId===t._resourceId)return a.canvas;let l=W.get().createCanvas(t.pixelWidth,t.pixelHeight),c=l.getContext("2d"),h=c.createImageData(t.pixelWidth,t.pixelHeight),u=h.data,d=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.format==="bgra8unorm")for(let f=0;f<u.length&&f+3<d.length;f+=4)u[f]=d[f+2],u[f+1]=d[f+1],u[f+2]=d[f],u[f+3]=d[f+3];else u.set(d.subarray(0,u.length));return c.putImageData(h,0,0),$._canvasSourceCache.set(t,{canvas:l,resourceId:t._resourceId}),l}if(r){let a=W.get().createCanvas(t.pixelWidth,t.pixelHeight),l=a.getContext("2d",{willReadFrequently:!0});a.width=t.pixelWidth,a.height=t.pixelHeight,l.drawImage(e,0,0);let c=l.getImageData(0,0,a.width,a.height),h=c.data;for(let u=0;u<h.length;u+=4){let d=h[u+3];if(d>0){let f=255/d;h[u]=Math.min(255,h[u]*f+.5),h[u+1]=Math.min(255,h[u+1]*f+.5),h[u+2]=Math.min(255,h[u+2]*f+.5)}}return l.putImageData(c,0,0),$._unpremultipliedCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(o){let a=$._canvasSourceCache.get(t);if(a?.resourceId===t._resourceId)return a.canvas;let l=W.get().createCanvas(t.pixelWidth,t.pixelHeight),c=l.getContext("2d");return l.width=t.pixelWidth,l.height=t.pixelHeight,c.drawImage(e,0,0),$._canvasSourceCache.set(t,{canvas:l,resourceId:t._resourceId}),l}return e},getTintedCanvas:(i,t)=>{let e=i.texture,r=K.shared.setValue(t).toHex(),s=e.tintCache||(e.tintCache={}),n=s[r],o=e.source._resourceId;if(n?.tintId===o)return n;let a=n&&"getContext"in n?n:W.get().createCanvas();if($.tintMethod(e,t,a),a.tintId=o,$.convertTintToImage&&a.toDataURL!==void 0){let l=W.get().createImage();l.src=a.toDataURL(),l.tintId=o,s[r]=l}else s[r]=a;return s[r]},getTintedPattern:(i,t)=>{let e=K.shared.setValue(t).toHex(),r=i.patternCache||(i.patternCache={}),s=i.source._resourceId,n=r[e];return n?.tintId===s||($.canvas||($.canvas=W.get().createCanvas()),$.tintMethod(i,t,$.canvas),n=$.canvas.getContext("2d").createPattern($.canvas,"repeat"),n.tintId=s,r[e]=n),n},applyPatternTransform:(i,t,e=!0)=>{if(!t)return;let r=i;if(!r.setTransform)return;let s=globalThis.DOMMatrix;if(!s)return;let n=new s([t.a,t.b,t.c,t.d,t.tx,t.ty]);r.setTransform(e?n.inverse():n)},tintWithMultiply:(i,t,e)=>{let r=e.getContext("2d"),s=i.frame.clone(),n=i.source._resolution??i.source.resolution??1,o=i.rotate;s.x*=n,s.y*=n,s.width*=n,s.height*=n;let a=Q.isVertical(o),l=a?s.height:s.width,c=a?s.width:s.height;e.width=Math.ceil(l),e.height=Math.ceil(c),r.save(),r.fillStyle=K.shared.setValue(t).toHex(),r.fillRect(0,0,l,c),r.globalCompositeOperation="multiply";let h=$.getCanvasSource(i);if(!h){r.restore();return}o&&$._applyInverseRotation(r,o,s.width,s.height),r.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),r.globalCompositeOperation="destination-atop",r.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),r.restore()},tintWithOverlay:(i,t,e)=>{let r=e.getContext("2d"),s=i.frame.clone(),n=i.source._resolution??i.source.resolution??1,o=i.rotate;s.x*=n,s.y*=n,s.width*=n,s.height*=n;let a=Q.isVertical(o),l=a?s.height:s.width,c=a?s.width:s.height;e.width=Math.ceil(l),e.height=Math.ceil(c),r.save(),r.globalCompositeOperation="copy",r.fillStyle=K.shared.setValue(t).toHex(),r.fillRect(0,0,l,c),r.globalCompositeOperation="destination-atop";let h=$.getCanvasSource(i);if(!h){r.restore();return}o&&$._applyInverseRotation(r,o,s.width,s.height),r.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),r.restore()},tintWithPerPixel:(i,t,e)=>{let r=e.getContext("2d"),s=i.frame.clone(),n=i.source._resolution??i.source.resolution??1,o=i.rotate;s.x*=n,s.y*=n,s.width*=n,s.height*=n;let a=Q.isVertical(o),l=a?s.height:s.width,c=a?s.width:s.height;e.width=Math.ceil(l),e.height=Math.ceil(c),r.save(),r.globalCompositeOperation="copy";let h=$.getCanvasSource(i);if(!h){r.restore();return}o&&$._applyInverseRotation(r,o,s.width,s.height),r.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),r.restore();let u=t>>16&255,d=t>>8&255,f=t&255,m=r.getImageData(0,0,l,c),g=m.data;for(let y=0;y<g.length;y+=4)g[y]=g[y]*u/255,g[y+1]=g[y+1]*d/255,g[y+2]=g[y+2]*f/255;r.putImageData(m,0,0)},_applyInverseRotation:(i,t,e,r)=>{let s=Q.inv(t),n=Q.uX(s),o=Q.uY(s),a=Q.vX(s),l=Q.vY(s),c=-Math.min(0,n*e,a*r,n*e+a*r),h=-Math.min(0,o*e,l*r,o*e+l*r);i.transform(n,o,a,l,c,h)}};$.tintMethod=$.canUseMultiply?$.tintWithMultiply:$.tintWithPerPixel});var sc,Ye,yo=p(()=>{dt();qi();mr();sc=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=W.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=Ve(t),e=Ve(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let n=this._canvasPool[s].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,n=(r<<17)+(s<<1);t.context.resetTransform(),t.context.clearRect(0,0,r,s),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},Ye=new sc;oe.register(Ye)});function bo(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],n=i[t-1];r<t;r+=2){let o=i[r],a=i[r+1];e+=(o-s)*(a+n),s=o,n=a}return e<0?-1:1}var nc=p(()=>{"use strict"});function xp(i,t,e,r,s,n){let o=i-e,a=t-r,l=s-e,c=n-r,h=o*l+a*c,u=l*l+c*c,d=-1;u!==0&&(d=h/u);let f,m;d<0?(f=e,m=r):d>1?(f=s,m=n):(f=e+d*l,m=r+d*c);let g=i-f,y=t-m;return g*g+y*y}var _p=p(()=>{"use strict"});var vo,yp=p(()=>{Ut();vo=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,n=this.y-e;return s*=s,n*=n,s+n<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let n=this.x-t,o=this.y-e,a=this.radius,l=(1-s)*r,c=Math.sqrt(n*n+o*o);return c<=a+l&&c>a-(r-l)}getBounds(t){return t||(t=new q),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var To,bp=p(()=>{Ut();To=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:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;let a=r*(1-s),l=r-a,c=n-l,h=o-l,u=n+a,d=o+a,f=t-this.x,m=e-this.y,g=f*f/(c*c)+m*m/(h*h),y=f*f/(u*u)+m*m/(d*d);return g>1&&y<=1}getBounds(t){return t||(t=new q),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});var sT,nT,ui,vp=p(()=>{_t();nc();_p();Ut();ui=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,n=e.length;s<n;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 n=e[s],o=e[s+1],a=e[(s+2)%r],l=e[(s+3)%r];t+=(a-n)*(l+o)}return t<0}containsPolygon(t){let e=this.getBounds(sT),r=t.getBounds(nT);if(!e.containsRect(r))return!1;let s=t.points;for(let n=0;n<s.length;n+=2){let o=s[n],a=s[n+1];if(!this.contains(o,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 n=0,o=s-1;n<s;o=n++){let a=this.points[n*2],l=this.points[n*2+1],c=this.points[o*2],h=this.points[o*2+1];l>e!=h>e&&t<(c-a)*((e-l)/(h-l))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let{points:n}=this,o=s===.5?s:(s-.5)*bo(n)+.5,a=r*o,l=r-a,c=a*a,h=l*l,u=n.length-(this.closePath?0:2);for(let d=0;d<u;d+=2){let f=n[d],m=n[d+1],g=n[(d+2)%n.length],y=n[(d+3)%n.length],x=xp(t,e,f,m,g,y),b=Math.sign((g-f)*(e-m)-(y-m)*(t-f));if(x<=(b<0?c:h))return!0}return!1}getBounds(t){t||(t=new q);let e=this.points,r=1/0,s=-1/0,n=1/0,o=-1/0;for(let a=0,l=e.length;a<l;a+=2){let c=e[a],h=e[a+1];r=c<r?c:r,s=c>s?c:s,n=h<n?h:n,o=h>o?h:o}return t.x=r,t.width=s-r,t.y=n,t.height=o-n,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 N("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return N("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}});var So,Eo,Tp=p(()=>{Ut();So=(i,t,e,r,s,n,o)=>{let a=i-e,l=t-r,c=Math.sqrt(a*a+l*l);return c>=s-n&&c<=s+o},Eo=class i{constructor(t=0,e=0,r=0,s=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=n}getBounds(t){return t||(t=new q),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new 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.radius=t.radius,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),n=e-(this.y+r),o=r*r;if(s*s+n*n<=o||(s=t-(this.x+this.width-r),s*s+n*n<=o)||(n=e-(this.y+this.height-r),s*s+n*n<=o)||(s=t-(this.x+r),s*s+n*n<=o))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:n,y:o,width:a,height:l,radius:c}=this,h=r*(1-s),u=r-h,d=n+c,f=o+c,m=a-c*2,g=l-c*2,y=n+a,x=o+l;return(t>=n-h&&t<=n+u||t>=y-u&&t<=y+h)&&e>=f&&e<=f+g||(e>=o-h&&e<=o+u||e>=x-u&&e<=x+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&So(t,e,d,f,c,u,h)||t>y-c&&e<f&&So(t,e,y-c,f,c,u,h)||t>y-c&&e>x-c&&So(t,e,y-c,x-c,c,u,h)||t<d&&e>x-c&&So(t,e,d,x-c,c,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Co(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];if(s.globalDisplayStatus<7)continue;let n=s.renderGroup??s.parentRenderGroup;n?.isCachedAsTexture?t.matrix=Sp.copyFrom(n.textureOffsetInverseTransform).append(s.worldTransform):n?._parentCacheAsTextureRenderGroup?t.matrix=Sp.copyFrom(n._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(s.groupTransform):t.matrix=s.worldTransform,t.addBounds(s.bounds)}return t.matrix=e,t}var Sp,oc=p(()=>{et();Sp=new B});function wo(i,t,e,r,s=!1){let n=oT;n.minX=0,n.minY=0,n.maxX=i.width/r|0,n.maxY=i.height/r|0;let o=Tt.getOptimalTexture(n.width,n.height,r,!1,s);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 oT,ac=p(()=>{Sr();jt();oT=new ct});function Ep(i){return typeof i.getCanvasFilterString=="function"}var lc,cs,Cp=p(()=>{P();hi();yo();jt();oc();ac();lc=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new ct,this.cssFilterString=""}},cs=class{constructor(t){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=t}push(t){let e=this._pushFilterFrame(),r=t.filterEffect.filters;if(e.skip=!1,e.useClip=!1,e.filters=r,e.container=t.container,e.cssFilterString="",r.every(l=>!l.enabled)){e.skip=!0;return}let s=[],n=1;for(let l of r){if(!l.enabled)continue;if(!Ep(l)){this._warnUnsupportedFilter(l);continue}let c=l.getCanvasFilterString();if(c===null){this._warnUnsupportedFilter(l);continue}c&&s.push(c)}if(s.length===0&&n===1){e.skip=!0;return}e.cssFilterString=s.join(" "),this._calculateFilterArea(t,e.bounds),e.useClip=!!t.filterEffect.filterArea;let o=this.renderer.canvasContext.activeContext,a=o.filter||"none";if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),e.useClip&&Number.isFinite(e.bounds.width)&&Number.isFinite(e.bounds.height)&&e.bounds.width>0&&e.bounds.height>0){let l=this.renderer.canvasContext.activeResolution||1;o.save(),o.setTransform(1,0,0,1,0,0),o.beginPath(),o.rect(e.bounds.x*l,e.bounds.y*l,e.bounds.width*l,e.bounds.height*l),o.clip()}else e.useClip=!1;n!==1&&(this._alphaMultiplier*=n),e.cssFilterString&&(o.filter=a!=="none"?`${a} ${e.cssFilterString}`:e.cssFilterString)}pop(){let t=this._popFilterFrame();if(t.skip)return;let e=this._savedStates.pop();if(!e)return;let r=this.renderer.canvasContext.activeContext;t.useClip?r.restore():r.filter=e.filter,this._alphaMultiplier=e.alphaMultiplier}generateFilteredTexture({texture:t,filters:e}){if(!e?.length||e.every(x=>!x.enabled))return t;let r=[],s=1;for(let x of e){if(!x.enabled)continue;if(!Ep(x)){this._warnUnsupportedFilter(x);continue}let b=x.getCanvasFilterString();if(b===null){this._warnUnsupportedFilter(x);continue}b&&r.push(b)}if(r.length===0&&s===1)return t;let n=$.getCanvasSource(t);if(!n)return t;let o=t.frame,a=t.source._resolution??t.source.resolution??1,l=o.width,c=o.height,h=Ye.getOptimalCanvasAndContext(l,c,a),{canvas:u,context:d}=h;d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u.width,u.height),r.length&&(d.filter=r.join(" ")),s!==1&&(d.globalAlpha=s);let f=o.x*a,m=o.y*a,g=l*a,y=c*a;return d.drawImage(n,f,m,g,y,0,0,g,y),d.filter="none",d.globalAlpha=1,wo(u,l,c,a)}_calculateFilterArea(t,e){if(t.renderables?Co(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup)?.cacheToLocalTransform;s&&e.applyMatrix(s)}}_warnUnsupportedFilter(t){let e=t?.constructor?.name||"Filter";this._warnedFilterTypes.has(e)||(this._warnedFilterTypes.add(e),console.warn(`CanvasRenderer: filter "${e}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new lc),this._filterStackIndex++,t}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}};cs.extension={type:[_.CanvasSystem],name:"filter"}});var hs,wp=p(()=>{P();hs=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}};hs.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"filter"}});function be(i,t){let e=Pp[i];return e===void 0&&(cc[t]===void 0&&(cc[t]=1),Pp[i]=e=cc[t]++),e}var cc,Pp,di=p(()=>{"use strict";cc=Object.create(null),Pp=Object.create(null)});function Mo(){return(!Po||Po?.isContextLost())&&(Po=W.get().createCanvas().getContext("webgl",{})),Po}var Po,hc=p(()=>{dt()});function Mp(){if(!Ao){Ao="mediump";let i=Mo();i&&i.getShaderPrecisionFormat&&(Ao=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Ao}var Ao,Ap=p(()=>{hc()});function Rp(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
18
+
19
+ #ifdef GL_ES // This checks if it is WebGL1
20
+ #define in varying
21
+ #define finalColor gl_FragColor
22
+ #define texture texture2D
23
+ #endif
24
+ ${i}
25
+ `):`
26
+
27
+ #ifdef GL_ES // This checks if it is WebGL1
28
+ #define in attribute
29
+ #define out varying
30
+ #endif
31
+ ${i}
32
+ `}var Bp=p(()=>{"use strict"});function Gp(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;
33
+ ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var kp=p(()=>{"use strict"});function Ip(i,t){return t?`#version 300 es
34
+ ${i}`:i}var Fp=p(()=>{"use strict"});function Dp(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?aT:lT;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
35
+ ${i}`}var aT,lT,Up=p(()=>{"use strict";aT={},lT={}});function Op(i,t){return t?i.replace("#version 300 es",""):i}var Lp=p(()=>{"use strict"});var uc,us,Np,ae,Mr=p(()=>{di();Ap();Bp();kp();Fp();Up();Lp();uc={stripVersion:Op,ensurePrecision:Gp,addProgramDefines:Rp,setProgramName:Dp,insertVersion:Ip},us=Object.create(null),Np=class dc{constructor(t){t={...dc.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Mp()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,n=t.vertex;Object.keys(uc).forEach(o=>{let a=r[o];s=uc[o](s,a,!0),n=uc[o](n,a,!1)}),this.fragment=s,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=be(`${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,us[this._cacheKey]=null}static from(t){let e=`${t.vertex}:${t.fragment}`;return us[e]||(us[e]=new dc(t),us[e]._cacheKey=e),us[e]}};Np.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};ae=Np});function Wt(i){return Hp[i]??Hp.float32}var Hp,sr=p(()=>{"use strict";Hp={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 Vp(i,t){let e;for(;(e=Wp.exec(i))!==null;){let r=cT[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:r,stride:Wt(r).stride,offset:0,instance:!1,start:0}}Wp.lastIndex=0}function hT(i){return i.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function zp({source:i,entryPoint:t}){let e={},r=hT(i),s=r.indexOf(`fn ${t}(`);if(s===-1)return e;let n=r.indexOf("->",s);if(n===-1)return e;let o=r.substring(s,n);if(Vp(o,e),Object.keys(e).length===0){let a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){let l=a[1],c=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),h=r.match(c);h&&Vp(h[1],e)}}return e}var cT,Wp,Xp=p(()=>{sr();cT={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",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},Wp=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g});function Ro(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,n=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=i.match(t)?.map(u=>{let d=u.match(s),f=d?.[1]??"",m;return f==="<uniform>"?m="uniform":f.startsWith("<storage")&&(m="storage"),{group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:d[2],accessMode:m,type:u.match(n)[1]}});if(!c)return{groups:[],structs:[]};let h=i.match(o)?.map(u=>{let d=u.match(l)[1],f=u.match(a).reduce((m,g)=>{let[y,x]=g.split(":");return m[y.trim()]=x.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>c.some(d=>d.type===u||d.type.includes(`<${u}>`)))??[];return{groups:c,structs:h}}var Yp=p(()=>{"use strict"});var At,jp=p(()=>{"use strict";At=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(At||{})});function $p({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.accessMode==="uniform"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,buffer:{type:"uniform"}}):r.accessMode==="storage"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,buffer:{type:"read-only-storage"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,sampler:{type:"filtering"}}):r.type==="sampler_comparison"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,sampler:{type:"comparison"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d_array"?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d-array",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&t[r.group].push({binding:r.binding,visibility:At.VERTEX|At.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}var Kp=p(()=>{jp()});function qp({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 Zp=p(()=>{"use strict"});function Qp(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...i.groups,...t.groups].filter(o=>{let a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:n}}var Jp=p(()=>{"use strict"});var ds,le,fi=p(()=>{di();Xp();Yp();Kp();Zp();Jp();ds=Object.create(null),le=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=r,e.source===r.source){let a=Ro(e.source);this.structsAndGroups=a}else{let a=Ro(r.source),l=Ro(e.source);this.structsAndGroups=Qp(a,l)}this.layout=s??qp(this.structsAndGroups),this.gpuLayout=n??$p(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=be(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=zp(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,ds[this._cacheKey]=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return ds[e]||(ds[e]=new i(t),ds[e]._cacheKey=e),ds[e]}}});var Vt,Ar=p(()=>{ot();Vt=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++)}}get _key(){if(this._dirty){this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]?this.resources[r]._resourceId:-1;this._keyValue=t.join("|")}return this._keyValue}setResource(t,e){let r=this.resources[e];t!==r&&(r&&r.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,e){let r=this.resources;for(let s in r){let n=r[s];n&&(n._gcLastUsed=t,n._touched=e)}}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);O(`[BindGroup] a '${t._resourceType}' was destroyed while still bound to a shader. Remove it from the shader before destroying it.`)}}}});var Rt,Ae=p(()=>{"use strict";Rt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.CANVAS=4]="CANVAS",i[i.BOTH=3]="BOTH",i))(Rt||{})});var pi,fc=p(()=>{di();pi=class i{constructor(t){this.data={...t};let e=Object.keys(t).sort().map(r=>`${r}:${t[r]}`).join("|");this.id=be(e,"shader-overrides")}static from(t){return t instanceof i?t:new i(t)}}});var pc,tm,em=p(()=>{"use strict";pc=["f32","i32","u32","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>","vec2<u32>","vec3<u32>","vec4<u32>"],tm=pc.reduce((i,t)=>(i[t]=!0,i),{})});function rm(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 im=p(()=>{"use strict"});var sm,St,ce=p(()=>{Gt();Pt();di();em();im();sm=class nm extends lt{constructor(t,e){super(),this._touched=0,this.uid=j("uniform"),this._resourceType="uniformGroup",this._resourceId=j("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...nm.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let n=t[s];if(n.name=s,n.size=n.size??1,!tm[n.type]){let o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){let[,a,l]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${pc.join(", ")}`)}n.value??(n.value=rm(n.type,n.size)),r[s]=n.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=be(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}get buffer(){return this._buffer}set buffer(t){this._buffer!==t&&(this._buffer?.off("change",this.onBufferChange,this),this._buffer=t,t?.on("change",this.onBufferChange,this))}get _gcLastUsed(){return this._buffer?._gcLastUsed??-1}set _gcLastUsed(t){this._buffer&&(this._buffer._gcLastUsed=t)}onBufferChange(){this._resourceId=j("resource"),this.emit("change",this)}update(){this._dirtyId++}};sm.defaultOptions={ubo:!1,isStatic:!1};St=sm});var zt,nr=p(()=>{Gt();Pt();ot();Mr();Ar();fi();Ae();fc();ce();zt=class i extends lt{constructor(t){super(),this.uid=j("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:r,groups:s,resources:n,compatibleRenderers:o,groupMap:a,overrides:l}=t;this._overrides=l?pi.from(l):null,this.gpuProgram=e,this.glProgram=r,o===void 0&&(o=0,e&&(o|=Rt.WEBGPU),r&&(o|=Rt.WEBGL)),this.compatibleRenderers=o;let c={};if(a)for(let h in a)for(let u in a[h]){let d=a[h][u];c[d]={group:h,binding:u,name:d}}if(!n&&!s&&(n={}),n&&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){let h=e.structsAndGroups.groups;a={},h.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u})}else if(n){s={},a||(a={}),e&&e.structsAndGroups.groups.forEach(d=>{a[d.group]=a[d.group]||{},a[d.group][d.binding]=d.name,c[d.name]=d});let h=0;for(let u in n)c[u]||(e&&!r&&O(`[Shader] the resource '${u}' matches no binding in the WGSL source \u2014 is the name correct?`),s[99]||(s[99]=new Vt,this._ownedBindGroups.push(s[99])),c[u]={group:99,binding:h,name:u},a[99]=a[99]||{},a[99][h]=u,h++);for(let u in n){let d=u,f=n[u];!f.source&&!f._resourceType&&(f=new St(f));let m=c[d];m&&(s[m.group]||(s[m.group]=new Vt,this._ownedBindGroups.push(s[m.group])),s[m.group].setResource(f,m.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}addResource(t,e,r){var s,n;(s=this._uniformBindMap)[e]||(s[e]={}),(n=this._uniformBindMap[e])[r]||(n[r]=t),this.groups[e]||(this.groups[e]=new Vt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let n=e[s];Object.defineProperty(r,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return r}destroy(t=!1){this._destroyed||(this._destroyed=!0,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,this._overrides=null)}static from(t){let{gpu:e,gl:r,...s}=t,n,o;return e&&(n=le.from(e)),r&&(o=ae.from(r)),new i({gpuProgram:n,glProgram:o,...s})}}});var uT,Tc,mc,gc,xc,_c,yc,bc,vc,It,Re=p(()=>{"use strict";uT={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},Tc={BLEND:0,OFFSET:1,CULLING:2,DEPTH_TEST:3,WINDING:4,DEPTH_MASK:5},{BLEND:mc,OFFSET:gc,CULLING:xc,DEPTH_TEST:_c,WINDING:yc,DEPTH_MASK:bc}=Tc,vc=class om{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<mc)}set blend(t){!!(this.data&1<<mc)!==t&&(this.data^=1<<mc)}get offsets(){return!!(this.data&1<<gc)}set offsets(t){!!(this.data&1<<gc)!==t&&(this.data^=1<<gc)}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<<xc)}set culling(t){!!(this.data&1<<xc)!==t&&(this.data^=1<<xc)}get depthTest(){return!!(this.data&1<<_c)}set depthTest(t){!!(this.data&1<<_c)!==t&&(this.data^=1<<_c)}get depthMask(){return!!(this.data&1<<bc)}set depthMask(t){!!(this.data&1<<bc)!==t&&(this.data^=1<<bc)}get clockwiseFrontFace(){return!!(this.data&1<<yc)}set clockwiseFrontFace(t){!!(this.data&1<<yc)!==t&&(this.data^=1<<yc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=uT[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 om;return t.depthTest=!1,t.depthMask=!1,t.blend=!0,t}};vc.default2d=vc.for2d();It=vc});var am,Bo,Ec=p(()=>{Mr();fi();nr();Re();am=class Sc extends zt{constructor(t){t={...Sc.defaultOptions,...t},super(t),this.enabled=!0,this._state=It.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),t.blendRequired&&this.addResource("uBackTexture",0,3)}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,n,o;return e&&(n=le.from(e)),r&&(o=ae.from(r)),new Sc({gpuProgram:n,glProgram:o,...s})}};am.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};Bo=am});var lm,cm=p(()=>{lm=`in vec2 aPosition;
36
+ out vec2 vTextureCoord;
37
+
38
+ uniform vec4 uInputSize;
39
+ uniform vec4 uOutputFrame;
40
+ uniform vec4 uOutputTexture;
41
+
42
+ vec4 filterVertexPosition( void )
43
+ {
44
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
45
+
46
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
47
+ position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
48
+
49
+ return vec4(position, 0.0, 1.0);
50
+ }
51
+
52
+ vec2 filterTextureCoord( void )
53
+ {
54
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
55
+ }
56
+
57
+ void main(void)
58
+ {
59
+ gl_Position = filterVertexPosition();
60
+ vTextureCoord = filterTextureCoord();
61
+ }
62
+ `});var hm,um=p(()=>{hm=`in vec2 vTextureCoord;
63
+ out vec4 finalColor;
64
+ uniform sampler2D uTexture;
65
+ void main() {
66
+ finalColor = texture(uTexture, vTextureCoord);
67
+ }
68
+ `});var Cc,dm=p(()=>{Cc=`struct GlobalFilterUniforms {
69
+ uInputSize: vec4<f32>,
70
+ uInputPixel: vec4<f32>,
71
+ uInputClamp: vec4<f32>,
72
+ uOutputFrame: vec4<f32>,
73
+ uGlobalFrame: vec4<f32>,
74
+ uOutputTexture: vec4<f32>,
75
+ };
76
+
77
+ @group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
78
+ @group(0) @binding(1) var uTexture: texture_2d<f32>;
79
+ @group(0) @binding(2) var uSampler: sampler;
80
+
81
+ struct VSOutput {
82
+ @builtin(position) position: vec4<f32>,
83
+ @location(0) uv: vec2<f32>
84
+ };
85
+
86
+ fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
87
+ {
88
+ var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
89
+
90
+ position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
91
+ position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
92
+
93
+ return vec4(position, 0.0, 1.0);
94
+ }
95
+
96
+ fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
97
+ {
98
+ return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
99
+ }
100
+
101
+ @vertex
102
+ fn mainVertex(
103
+ @location(0) aPosition: vec2<f32>,
104
+ ) -> VSOutput {
105
+ return VSOutput(
106
+ filterVertexPosition(aPosition),
107
+ filterTextureCoord(aPosition)
108
+ );
109
+ }
110
+
111
+ @fragment
112
+ fn mainFragment(
113
+ @location(0) uv: vec2<f32>,
114
+ ) -> @location(0) vec4<f32> {
115
+ return textureSample(uTexture, uSampler, uv);
116
+ }
117
+ `});var Go,fm=p(()=>{Mr();fi();Ec();cm();um();dm();Go=class extends Bo{constructor(){let t=le.from({vertex:{source:Cc,entryPoint:"mainVertex"},fragment:{source:Cc,entryPoint:"mainFragment"},name:"passthrough-filter"}),e=ae.from({vertex:lm,fragment:hm,name:"passthrough-filter"});super({gpuProgram:t,glProgram:e})}}});var it,or=p(()=>{"use strict";it=(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))(it||{})});var Ft,Rr=p(()=>{Gt();Pt();or();Ft=class extends lt{constructor(t){let{data:e,size:r}=t,{usage:s,label:n,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=j("buffer"),this._resourceType="buffer",this._resourceId=j("resource"),this._touched=0,this._updateID=1,this._updateOffset=0,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:n},this.shrinkToFit=o??!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&it.STATIC)}set static(t){t?this.descriptor.usage|=it.STATIC:this.descriptor.usage&=~it.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._updateOffset=0,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=j("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t,e){this._updateSize=t??this._updateSize,this._updateOffset=e||0,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.destroyed||(this._resourceId=j("resource"),this.emit("change",this))}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function wc(i,t){if(!(i instanceof Ft)){let e=t?it.INDEX:it.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=it.INDEX|it.COPY_DST):(i=new Float32Array(i),e=it.VERTEX|it.COPY_DST)),i=new Ft({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var pm=p(()=>{Rr();or()});function mm(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,n=1/0,o=1/0,a=-1/0,l=-1/0,c=s.BYTES_PER_ELEMENT,h=(r.offset||0)/c,u=(r.stride||8)/c;for(let d=h;d<s.length;d+=u){let f=s[d],m=s[d+1];f>a&&(a=f),m>l&&(l=m),f<n&&(n=f),m<o&&(o=m)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=l,e}var gm=p(()=>{"use strict"});function dT(i){return(i instanceof Ft||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=wc(i.buffer,!1),i}var Be,fs=p(()=>{Gt();jt();Pt();_t();Rr();pm();gm();Be=class extends lt{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=j("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ct,this._boundsDirty=!0,this._vertexCount=0,this._vertexCountDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this._vertexCountDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}get vertexCount(){if(!this._vertexCountDirty)return this._vertexCount;this._vertexCountDirty=!1;let t=this.attributes;for(let e in t){let r=t[e];if(r.instance)continue;let s=r.buffer;return this._vertexCount=s.data.length/(r.stride/4||r.size),this._vertexCount}return this._vertexCount=0,0}getSize(){return N("8.20.0","Geometry.getSize is deprecated, please use Geometry.vertexCount instead."),this.vertexCount}addAttribute(t,e){let r=dT(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,this._vertexCountDirty=!0}addIndex(t){this.indexBuffer=wc(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,mm(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.unload(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var fT,Pc,ps,xm=p(()=>{P();fm();et();Ar();fs();ce();mt();Sr();Ae();jt();oc();ot();fT=new Be({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Pc=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new ct,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}},ps=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 Vt({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=!1,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let n=e.renderTarget.renderTarget.colorTexture.source,o=n.resolution,a=n.antialias;if(r.every(f=>!f.enabled)){s.skip=!0;return}let l=s.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,o,1),s.skip)return;let c=this._getPreviousFilterData(),h=this._findFilterResolution(o),u=0,d=0;c&&(u=c.bounds.minX,d=c.bounds.minY),this._calculateGlobalFrame(s,u,d,h,n.width,n.height),this._setupFilterTextures(s,l,e,c)}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=e;let s=t.source,n=s.resolution,o=s.antialias;if(e.every(f=>!f.enabled))return r.skip=!0,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,o,n,0),r.skip)return t;let l=n;this._calculateGlobalFrame(r,0,0,l,s.width,s.height),r.outputRenderSurface=Tt.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=U.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);let d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&Tt.returnTexture(e.backTexture),Tt.returnTexture(e.inputTexture))}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,n=Tt.getOptimalTexture(e.width,e.height,s,!1),o=e.minX,a=e.minY;r&&(o-=r.minX,a-=r.minY),o=Math.floor(o*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),c=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,n,{x:o,y:a},{width:l,height:c},{x:0,y:0}),n}applyFilter(t,e,r,s){let n=this.renderer,o=this._activeFilterData,l=o.outputRenderSurface===r,c=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,h=this._findFilterResolution(c),u=0,d=0;if(l){let m=this._findPreviousFilterOffset();u=m.x,d=m.y}this._updateFilterUniforms(e,r,o,u,d,h,l,s);let f=t.enabled?t:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,e,n)}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),n=e.worldTransform.copyTo(B.shared),o=e.renderGroup||e.parentRenderGroup;return o&&o.cacheToLocalTransform&&n.prepend(o.cacheToLocalTransform),n.invert(),s.prepend(n),s.scale(1/e.texture.orig.width,1/e.texture.orig.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new Go),this._passthroughFilter}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:fT,shader:t,state:t._state,topology:"triangle-list"}),r.type===Rt.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(t,e,r,s){if(t.backTexture=U.EMPTY,t.inputTexture=Tt.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),t.blendRequired){r.renderTarget.finishRenderPass();let n=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(n,e,s?.bounds)}r.renderTarget.bind({target:t.inputTexture,clear:!0}),r.globalUniforms.push({offset:e})}_calculateGlobalFrame(t,e,r,s,n,o){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=n*s,a.height=o*s}_updateFilterUniforms(t,e,r,s,n,o,a,l){let c=this._filterGlobalUniforms.uniforms,h=c.uOutputFrame,u=c.uInputSize,d=c.uInputPixel,f=c.uInputClamp,m=c.uGlobalFrame,g=c.uOutputTexture;a?(h[0]=r.bounds.minX-s,h[1]=r.bounds.minY-n):(h[0]=0,h[1]=0),h[2]=t.frame.width,h[3]=t.frame.height,u[0]=t.source.width,u[1]=t.source.height,u[2]=1/u[0],u[3]=1/u[1],d[0]=t.source.pixelWidth,d[1]=t.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],f[0]=.5*d[2],f[1]=.5*d[3],f[2]=t.frame.width*u[2]-.5*d[2],f[3]=t.frame.height*u[3]-.5*d[3];let y=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=s*o,m[1]=n*o,m[2]=y.source.width*o,m[3]=y.source.height*o,e instanceof U&&(e.source.resource=null);let x=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind({target:e,clear:!!l}),e instanceof U?(g[0]=e.frame.width,g[1]=e.frame.height):(g[0]=x.width,g[1]=x.height),g[2]=x.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return{x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?Co(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s)}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,n=t.filters,o=t.firstEnabledIndex,a=t.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o===a)n[o].apply(this,r,t.outputRenderSurface,e);else{let l=t.inputTexture,c=Tt.getOptimalTexture(s.width,s.height,l.source._resolution,!1),h=c;for(let u=o;u<a;u++){let d=n[u];if(!d.enabled)continue;d.apply(this,l,h,!0);let f=l;l=h,h=f}n[a].apply(this,l,t.outputRenderSurface,e),Tt.returnTexture(c)}}_calculateFilterBounds(t,e,r,s,n){let o=this.renderer,a=t.bounds,l=t.filters,c=1/0,h=0,u=!0,d=!1,f=!1,m=!0,g=-1,y=-1;for(let x=0;x<l.length;x++){let b=l[x];if(!b.enabled)continue;if(g===-1&&(g=x),y=x,c=Math.min(c,b.resolution==="inherit"?s:b.resolution),h+=b.padding,b.antialias==="off"?u=!1:b.antialias==="inherit"&&u&&(u=r),b.clipToViewport||(m=!1),!!!(b.compatibleRenderers&o.type)){f=!1;break}if(b.blendRequired&&!(o.backBuffer?.useBackBuffer??!0)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),f=!1;break}f=!0,d||(d=b.blendRequired)}if(!f){t.skip=!0;return}if(m&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(c).ceil().scale(1/c).pad((h|0)*n),!a.isPositive){t.skip=!0;return}t.antialias=u,t.resolution=c,t.blendRequired=d,t.firstEnabledIndex=g,t.lastEnabledIndex=y}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>0&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Pc),this._filterStackIndex++,t}};ps.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"filter"}});var Mc=p(()=>{P();Cp();wp();xm();H.add(ps,cs);H.add(hs)});var pT={};var _m=p(()=>{Ff();Uf();Hf();ho();xo();Mc()});var mT={};var bm=p(()=>{ho();xo();Mc()});async function Tm(i){if(!i)for(let t=0;t<Ac.length;t++){let e=Ac[t];if(e.value.test()){await e.value.load();return}}}var Ac,Sm=p(()=>{P();Ac=[];H.handleByNamedList(_.Environment,Ac)});function ko(){if(typeof ms=="boolean")return ms;try{ms=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ms=!1}return ms}var ms,Rc=p(()=>{"use strict"});function Oo(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length;ys.size&&ys.clear();let n=Pm(i,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;let a=0,l=0,c=0;if(r&&(n=bT(i,t,n,e)),i.length>80*e){a=i[0],l=i[1];let h=a,u=l;for(let d=e;d<s;d+=e){let f=i[d],m=i[d+1];f<a&&(a=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-a,u-l),c=c!==0?32767/c:0}return Gc(n,o,a,l,c),o}function Pm(i,t,e,r,s){let n=null;if(s===kT(i,t,e,r)>0)for(let o=t;o<e;o+=r)n=wm(o/r|0,i[o],i[o+1],n);else for(let o=e-r;o>=t;o-=r)n=wm(o/r|0,i[o],i[o+1],n);return n&&bs(n,n.next)&&(Ts(n),n=n.next),n}function Gr(i,t=i){let e=t===i,r=i,s;do s=!1,r!==r.next&&(ys.size===0||!ys.has(r))&&(bs(r,r.next)||Bt(r.prev,r,r.next)===0)?((e||r===t)&&(t=r.prev),Bc=!0,Ts(r),r=r.prev,s=!0):(e||r!==t)&&(r=r.next,s=!e);while(s||r!==t);return t}function Gc(i,t,e,r,s){s&&PT(i,e,r,s);let n=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Bt(a,i,l)<0&&(s?xT(i,e,r,s):gT(i))){t.push(a.i,i.i,l.i),Ts(i),i=l,n=l;continue}if(i=l,i===n){if(Bc=!1,i=Gr(i),Bc){n=i;continue}if(!o){i=_T(i,t),n=i,o=!0;continue}yT(i,t,e,r,s);break}}}function gT(i){let t=i.prev,e=i,r=i.next,s=t.x,n=e.x,o=r.x,a=t.y,l=e.y,c=r.y,h=Math.min(s,n,o),u=Math.min(a,l,c),d=Math.max(s,n,o),f=Math.max(a,l,c),m=r.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&!(s===m.x&&a===m.y)&&Uo(s,a,n,l,o,c,m.x,m.y)&&Bt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function xT(i,t,e,r){let s=i.prev,n=i,o=i.next,a=s.x,l=n.x,c=o.x,h=s.y,u=n.y,d=o.y,f=Math.min(a,l,c),m=Math.min(h,u,d),g=Math.max(a,l,c),y=Math.max(h,u,d),x=Dc(f,m,t,e,r),b=Dc(g,y,t,e,r),v=i.prevZ;for(;v&&v.z>=x;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=y&&v!==o&&!(a===v.x&&h===v.y)&&Uo(a,h,l,u,c,d,v.x,v.y)&&Bt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let T=i.nextZ;for(;T&&T.z<=b;){if(T.x>=f&&T.x<=g&&T.y>=m&&T.y<=y&&T!==o&&!(a===T.x&&h===T.y)&&Uo(a,h,l,u,c,d,T.x,T.y)&&Bt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function _T(i,t){let e=i,r=!1;do{let s=e.prev,n=e.next.next;Rm(s,e,e.next,n,!1)&&vs(s,n)&&vs(n,s)&&(t.push(s.i,e.i,n.i),Ts(e),Ts(e.next),e=i=n,r=!0),e=e.next}while(e!==i);return r?Gr(e):e}function yT(i,t,e,r,s){let n=i;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&RT(n,o)){let a=Bm(n,o);n=Gr(n,n.next),a=Gr(a,a.next),Gc(n,t,e,r,s),Gc(a,t,e,r,s);return}o=o.next}n=n.next}while(n!==i)}function bT(i,t,e,r){let s=[];for(let n=0,o=t.length;n<o;n++){let a=t[n]*r,l=n<o-1?t[n+1]*r:i.length,c=Pm(i,a,l,r,!1);c===c.next&&ys.add(c),s.push(AT(c))}s.sort(vT),ST(i.length/r,t.length),Am(e,e),kc=!0;for(let n=0;n<s.length;n++)e=TT(s[n],e);return kc=!1,Gr(e)}function vT(i,t){return i.x-t.x||i.y-t.y||(i.next.y-i.y)/(i.next.x-i.x)-(t.next.y-t.y)/(t.next.x-t.x)}function TT(i,t){let e=CT(i,t);if(!e)return t;let r=Bm(e,i),s=r.next;return Am(e,s.next),Gr(r,r.next),Gr(e,e.next)}function ST(i,t){let e=Math.ceil((i+2*t)/Mm)+t+2;Et.length<e*4&&(Et=new Float64Array(e*4)),Do=0}function Am(i,t){let e=i;do{let r=Do++;Ic[r]=e;let s=1/0,n=1/0,o=-1/0,a=-1/0,l=0;do{let h=e.next;e.z=r,e.x<s&&(s=e.x),e.x>o&&(o=e.x),e.y<n&&(n=e.y),e.y>a&&(a=e.y),h.x<s&&(s=h.x),h.x>o&&(o=h.x),h.y<n&&(n=h.y),h.y>a&&(a=h.y),e=h}while(++l<Mm&&e!==t);Fc[r]=e;let c=r*4;Et[c]=s,Et[c+1]=n,Et[c+2]=o,Et[c+3]=a}while(e!==t)}function ET(i,t){let e=i.z*4;t.x<Et[e]&&(Et[e]=t.x),t.y<Et[e+1]&&(Et[e+1]=t.y),t.x>Et[e+2]&&(Et[e+2]=t.x),t.y>Et[e+3]&&(Et[e+3]=t.y)}function Em(i){let t=Fc[i];for(;t.prev.next!==t;)t=t.next;return Fc[i]=t,t}function Cm(i){let t=Ic[i];for(;t.prev.next!==t;)t=t.next;return Ic[i]=t,t}function CT(i,t){let e=t,r=i.x,s=i.y,n=-1/0,o;if(bs(i,e))return e;for(let d=0,f=0;d<Do;d++,f+=4){if(s<Et[f+1]||s>Et[f+3]||Et[f]>r||Et[f+2]<=n)continue;let m=Em(d);e=Cm(d);do{if(e.prev.next===e){if(bs(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let g=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(g<=r&&g>n&&(n=g,o=e.x<e.next.x?e:e.next,g===r))return o}}e=e.next}while(e!==m)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(s,l),h=Math.max(s,l),u=1/0;for(let d=0,f=0;d<Do;d++,f+=4){if(Et[f+2]<a||Et[f]>r||Et[f+3]<c||Et[f+1]>h)continue;let m=Em(d);e=Cm(d);do{if(e.prev.next===e&&r>=e.x&&e.x>=a&&r!==e.x&&Uo(s<l?r:n,s,a,l,s<l?n:r,s,e.x,e.y)){let g=Math.abs(s-e.y)/(r-e.x);(vs(e,i)||e.y===s&&e.next.y===s&&e.next.x>r)&&(g<u||g===u&&(e.x>o.x||e.x===o.x&&wT(o,e)))&&(o=e,u=g)}e=e.next}while(e!==m)}return o}function wT(i,t){return Bt(i.prev,i,t.prev)<0&&Bt(t.next,i,i.next)<0}function PT(i,t,e,r){let s=i,n=0;do s.z=Dc(s.x,s.y,t,e,r),he[n++]=s,s=s.next;while(s!==i);MT(n);let o=null;for(let a=0;a<n;a++){let l=he[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function MT(i){if(i<=32){for(let t=1;t<i;t++){let e=he[t],r=e.z,s=t-1;for(;s>=0&&he[s].z>r;)he[s+1]=he[s],s--;he[s+1]=e}return}Br.length<i&&(Br=new Uint32Array(i),xs=new Uint32Array(i),gs=new Array(i));for(let t=0;t<i;t++)Br[t]=he[t].z;Io(i,he,Br,gs,xs,0),Io(i,gs,xs,he,Br,8),Io(i,he,Br,gs,xs,16),Io(i,gs,xs,he,Br,24)}function Io(i,t,e,r,s,n){_s.fill(0);for(let a=0;a<i;a++)_s[e[a]>>>n&255]++;let o=0;for(let a=0;a<256;a++){let l=_s[a];_s[a]=o,o+=l}for(let a=0;a<i;a++){let l=e[a],c=_s[l>>>n&255]++;r[c]=t[a],s[c]=l}}function Dc(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 AT(i){let 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 Uo(i,t,e,r,s,n,o,a){return(s-o)*(t-a)>=(i-o)*(n-a)&&(i-o)*(r-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(r-a)}function RT(i,t){let e=bs(i,t)&&Bt(i.prev,i,i.next)>0&&Bt(t.prev,t,t.next)>0;return i.next.i!==t.i&&(e||vs(i,t)&&vs(t,i)&&(Bt(i.prev,i,t.prev)!==0||Bt(i,t.prev,t)!==0))&&!BT(i,t)&&(e||GT(i,t))}function Bt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function bs(i,t){return i.x===t.x&&i.y===t.y}function Rm(i,t,e,r,s=!0){let n=Bt(i,t,e),o=Bt(i,t,r),a=Bt(e,r,i),l=Bt(e,r,t);return(n>0&&o<0||n<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:s?!!(n===0&&Fo(i,e,t)||o===0&&Fo(i,r,t)||a===0&&Fo(e,i,r)||l===0&&Fo(e,t,r)):!1}function Fo(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 BT(i,t){let e=Math.min(i.x,t.x),r=Math.max(i.x,t.x),s=Math.min(i.y,t.y),n=Math.max(i.y,t.y),o=i;do{let a=o.next;if(o.x>r&&a.x>r||o.x<e&&a.x<e||o.y>n&&a.y>n||o.y<s&&a.y<s){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==t.i&&a.i!==t.i&&Rm(o,a,i,t))return!0;o=a}while(o!==i);return!1}function vs(i,t){return Bt(i.prev,i,i.next)<0?Bt(i,t,i.next)>=0&&Bt(i,i.prev,t)>=0:Bt(i,t,i.prev)<0||Bt(i,i.next,t)<0}function GT(i,t){let e=i,r=!1,s=(i.x+t.x)/2,n=(i.y+t.y)/2;do{let o=e.next;e.y>n!=o.y>n&&s<(o.x-e.x)*(n-e.y)/(o.y-e.y)+e.x&&(r=!r),e=o}while(e!==i);return r}function Bm(i,t){let e=Uc(i.i,i.x,i.y),r=Uc(t.i,t.x,t.y),s=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,n.next=r,r.prev=n,r}function wm(i,t,e,r){let s=Uc(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 Ts(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),kc&&ET(i.prev,i.next)}function Uc(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function kT(i,t,e,r){let s=0;for(let n=t,o=e-r;n<e;n+=r)s+=(i[o]-i[n])*(i[n+1]+i[o+1]),o=n;return s}var ys,Bc,kc,Mm,Et,Do,Ic,Fc,he,gs,Br,xs,_s,Gm=p(()=>{ys=new Set,Bc=!1;kc=!1;Mm=16,Et=new Float64Array(0),Do=0,Ic=[],Fc=[];he=[],gs=[],Br=new Uint32Array(0),xs=new Uint32Array(0),_s=new Uint32Array(256)});var km,Im=p(()=>{Gm();Gt();km=Oo.default||Oo});var yt,mi=p(()=>{"use strict";yt=(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))(yt||{})});var gi,Oc=p(()=>{"use strict";gi=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,n,o,a,l){let{name:c,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][c](t,e,r,s,n,o,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var IT,Fm,ue,kr=p(()=>{Ht();Sm();xe();Rc();Pt();_t();mr();mi();Oc();Gt();IT=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Fm=class Dm extends lt{constructor(t){super(),this.tick=0,this.uid=j("renderer"),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=[...IT,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Tm(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={...Dm.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){this.tick++;let r=t;if(r instanceof ut&&(r={container:r},e&&(N(rt,"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:K.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.visible&&(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=yt.ALL);let{clear:r,clearColor:s,target:n,mipLevel:o,layer:a}=t;K.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(n,r,K.shared.toArray(),o??0,a??0)}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 gi(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,n)=>(s[n.name]=n.value,s),{});t.forEach(s=>{let n=s.value,o=s.name,a=r[o];this.renderPipes[o]=new n(this,a?new a:null),this.runners.destroy.add(this.renderPipes[o])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&oe.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ko())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()}};Fm.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};ue=Fm});function xi(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return Lm[r]||FT(i,t,r,e)}function FT(i,t,e,r){let s={},n=0;for(let a=0;a<r;a++){let l=a<t?i[a]:U.EMPTY.source;s[n++]=l.source,s[n++]=l.style}let o=new Vt(s);return Lm[e]=o,o}var Lm,Ho=p(()=>{Ar();mt();Lm={}});function Lc(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),n=t[s];if(n){let o=i[r];r==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else O(`${r} placement hook does not exist in shader`)}}var Nm=p(()=>{ot()});function Nc(i){let t={};return(i.match(DT)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var DT,Hm=p(()=>{"use strict";DT=/\{\{(.*?)\}\}/g});function Wm(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function Hc(i,t,e=!1){let r=[];Wm(t,r),i.forEach(a=>{a.header&&Wm(a.header,r)});let s=r;e&&s.sort();let n=s.map((a,l)=>` @location(${l}) ${a},`).join(`
118
+ `),o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
119
+ ${n}
120
+ `),o}var Vm=p(()=>{"use strict"});function zm(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function UT(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function OT(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Xm(i,t){let e=[];zm(t,e),i.forEach(l=>{l.header&&zm(l.header,e)});let r=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
121
+ `),n=e.sort().map(l=>` var ${OT(l)};`).join(`
122
+ `),o=`return VSOutput(
123
+ ${e.sort().map(l=>` ${UT(l)}`).join(`,
124
+ `)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
125
+ ${s}
126
+ `),a=a.replace("{{start}}",`
127
+ ${n}
128
+ `),a=a.replace("{{return}}",`
129
+ ${o}
130
+ `),a}var Ym=p(()=>{"use strict"});function Wc(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
131
+ `).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
132
+ ${s.join(`
133
+ `)}
134
+ //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var jm=p(()=>{"use strict"});function $m({template:i,bits:t}){let e=qm(i,t);if(ar[e])return ar[e];let{vertex:r,fragment:s}=NT(i,t);return ar[e]=Zm(r,s,t),ar[e]}function Km({template:i,bits:t}){let e=qm(i,t);return ar[e]||(ar[e]=Zm(i.vertex,i.fragment,t)),ar[e]}function NT(i,t){let e=t.map(o=>o.vertex).filter(o=>!!o),r=t.map(o=>o.fragment).filter(o=>!!o),s=Hc(e,i.vertex,!0);s=Xm(e,s);let n=Hc(r,i.fragment,!0);return{vertex:s,fragment:n}}function qm(i,t){return t.map(e=>(Vc.has(e)||Vc.set(e,LT++),Vc.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function Zm(i,t,e){let r=Nc(i),s=Nc(t);return e.forEach(n=>{Lc(n.vertex,r,n.name),Lc(n.fragment,s,n.name)}),{vertex:Wc(i,r),fragment:Wc(t,s)}}var ar,Vc,LT,Qm=p(()=>{Nm();Hm();Vm();Ym();jm();ar=Object.create(null),Vc=new Map,LT=0});var Jm,tg,eg,rg,ig=p(()=>{"use strict";Jm=`
135
+ @in aPosition: vec2<f32>;
136
+ @in aUV: vec2<f32>;
137
+
138
+ @out @builtin(position) vPosition: vec4<f32>;
139
+ @out vUV : vec2<f32>;
140
+ @out vColor : vec4<f32>;
141
+
142
+ {{header}}
143
+
144
+ struct VSOutput {
145
+ {{struct}}
146
+ };
147
+
148
+ @vertex
149
+ fn main( {{in}} ) -> VSOutput {
150
+
151
+ var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
152
+ var modelMatrix = mat3x3<f32>(
153
+ 1.0, 0.0, 0.0,
154
+ 0.0, 1.0, 0.0,
155
+ 0.0, 0.0, 1.0
156
+ );
157
+ var position = aPosition;
158
+ var uv = aUV;
159
+
160
+ {{start}}
161
+
162
+ vColor = vec4<f32>(1., 1., 1., 1.);
163
+
164
+ {{main}}
165
+
166
+ vUV = uv;
167
+
168
+ var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
169
+
170
+ vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
171
+
172
+ vColor *= globalUniforms.uWorldColorAlpha;
173
+
174
+ {{end}}
175
+
176
+ {{return}}
177
+ };
178
+ `,tg=`
179
+ @in vUV : vec2<f32>;
180
+ @in vColor : vec4<f32>;
181
+
182
+ {{header}}
183
+
184
+ @fragment
185
+ fn main(
186
+ {{in}}
187
+ ) -> @location(0) vec4<f32> {
188
+
189
+ {{start}}
190
+
191
+ var outColor:vec4<f32>;
192
+
193
+ {{main}}
194
+
195
+ var finalColor:vec4<f32> = outColor * vColor;
196
+
197
+ {{end}}
198
+
199
+ return finalColor;
200
+ };
201
+ `,eg=`
202
+ in vec2 aPosition;
203
+ in vec2 aUV;
204
+
205
+ out vec4 vColor;
206
+ out vec2 vUV;
207
+
208
+ {{header}}
209
+
210
+ void main(void){
211
+
212
+ mat3 worldTransformMatrix = uWorldTransformMatrix;
213
+ mat3 modelMatrix = mat3(
214
+ 1.0, 0.0, 0.0,
215
+ 0.0, 1.0, 0.0,
216
+ 0.0, 0.0, 1.0
217
+ );
218
+ vec2 position = aPosition;
219
+ vec2 uv = aUV;
220
+
221
+ {{start}}
222
+
223
+ vColor = vec4(1.);
224
+
225
+ {{main}}
226
+
227
+ vUV = uv;
228
+
229
+ mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
230
+
231
+ gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
232
+
233
+ vColor *= uWorldColorAlpha;
234
+
235
+ {{end}}
236
+ }
237
+ `,rg=`
238
+
239
+ in vec4 vColor;
240
+ in vec2 vUV;
241
+
242
+ out vec4 finalColor;
243
+
244
+ {{header}}
245
+
246
+ void main(void) {
247
+
248
+ {{start}}
249
+
250
+ vec4 outColor;
251
+
252
+ {{main}}
253
+
254
+ finalColor = outColor * vColor;
255
+
256
+ {{end}}
257
+ }
258
+ `});var sg,ng,og=p(()=>{"use strict";sg={name:"global-uniforms-bit",vertex:{header:`
259
+ struct GlobalUniforms {
260
+ uProjectionMatrix:mat3x3<f32>,
261
+ uWorldTransformMatrix:mat3x3<f32>,
262
+ uWorldColorAlpha: vec4<f32>,
263
+ uResolution: vec2<f32>,
264
+ }
265
+
266
+ @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
267
+ `}},ng={name:"global-uniforms-bit",vertex:{header:`
268
+ uniform mat3 uProjectionMatrix;
269
+ uniform mat3 uWorldTransformMatrix;
270
+ uniform vec4 uWorldColorAlpha;
271
+ uniform vec2 uResolution;
272
+ `}}});function _i({bits:i,name:t}){let e=$m({template:{fragment:tg,vertex:Jm},bits:[sg,...i]});return le.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function yi({bits:i,name:t}){return new ae({name:t,...Km({template:{vertex:eg,fragment:rg},bits:[ng,...i]})})}var bi=p(()=>{Mr();fi();Qm();ig();og()});var Wo,Vo,zo=p(()=>{"use strict";Wo={name:"color-bit",vertex:{header:`
273
+ @in aColor: vec4<f32>;
274
+ `,main:`
275
+ vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
276
+ `}},Vo={name:"color-bit",vertex:{header:`
277
+ in vec4 aColor;
278
+ `,main:`
279
+ vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
280
+ `}}});function HT(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(`
281
+ `)}function WT(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(`
282
+ `)}function Xo(i){return zc[i]||(zc[i]={name:"texture-batch-bit",vertex:{header:`
283
+ @in aTextureIdAndRound: vec2<u32>;
284
+ @out @interpolate(flat) vTextureId : u32;
285
+ `,main:`
286
+ vTextureId = aTextureIdAndRound.y;
287
+ `,end:`
288
+ if(aTextureIdAndRound.x == 1)
289
+ {
290
+ vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
291
+ }
292
+ `},fragment:{header:`
293
+ @in @interpolate(flat) vTextureId: u32;
294
+
295
+ ${HT(i)}
296
+ `,main:`
297
+ var uvDx = dpdx(vUV);
298
+ var uvDy = dpdy(vUV);
299
+
300
+ ${WT(i)}
301
+ `}}),zc[i]}function VT(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(`
302
+ `)}function Yo(i){return Xc[i]||(Xc[i]={name:"texture-batch-bit",vertex:{header:`
303
+ in vec2 aTextureIdAndRound;
304
+ out float vTextureId;
305
+
306
+ `,main:`
307
+ vTextureId = aTextureIdAndRound.y;
308
+ `,end:`
309
+ if(aTextureIdAndRound.x == 1.)
310
+ {
311
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
312
+ }
313
+ `},fragment:{header:`
314
+ in float vTextureId;
315
+
316
+ uniform sampler2D uTextures[${i}];
317
+
318
+ `,main:`
319
+
320
+ ${VT(i)}
321
+ `}}),Xc[i]}var zc,Xc,jo=p(()=>{"use strict";zc={};Xc={}});var Ss,ag,$o,Es=p(()=>{"use strict";Ss={name:"local-uniform-bit",vertex:{header:`
322
+
323
+ struct LocalUniforms {
324
+ uTransformMatrix:mat3x3<f32>,
325
+ uColor:vec4<f32>,
326
+ uRound:f32,
327
+ }
328
+
329
+ @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
330
+ `,main:`
331
+ vColor *= localUniforms.uColor;
332
+ modelMatrix *= localUniforms.uTransformMatrix;
333
+ `,end:`
334
+ if(localUniforms.uRound == 1)
335
+ {
336
+ vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
337
+ }
338
+ `}},ag={...Ss,vertex:{...Ss.vertex,header:Ss.vertex.header.replace("group(1)","group(2)")}},$o={name:"local-uniform-bit",vertex:{header:`
339
+
340
+ uniform mat3 uTransformMatrix;
341
+ uniform vec4 uColor;
342
+ uniform float uRound;
343
+ `,main:`
344
+ vColor *= uColor;
345
+ modelMatrix = uTransformMatrix;
346
+ `,end:`
347
+ if(uRound == 1.)
348
+ {
349
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
350
+ }
351
+ `}}});var vi,Ti,Si=p(()=>{"use strict";vi={name:"round-pixels-bit",vertex:{header:`
352
+ fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
353
+ {
354
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
355
+ }
356
+ `}},Ti={name:"round-pixels-bit",vertex:{header:`
357
+ vec2 roundPixels(vec2 position, vec2 targetSize)
358
+ {
359
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
360
+ }
361
+ `}}});var Cs,lg=p(()=>{P();et();Ho();bi();zo();jo();Es();Si();nr();ce();Cs=class{constructor(){this._maxTextures=0}contextChange(t){let e=new St({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;let r=_i({name:"graphics",bits:[Wo,Xo(this._maxTextures),ag,vi]});this.shader=new zt({gpuProgram:r,resources:{localUniforms:e}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(r),c=n.encoder;c.setGeometry(a.geometry,s.gpuProgram);let h=n.globalUniforms.bindGroup;c.setBindGroup(0,h,s.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let m=0;m<l.instructionSize;m++){let g=d[m];if(g.topology!==f&&(f=g.topology,c.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology,s._overrides)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let y=g.textures;g.bindGroup=xi(y.textures,y.count,this._maxTextures),g.gpuBindGroup=n.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,g.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Cs.extension={type:[_.WebGPUPipesAdaptor],name:"graphics"}});var cg,hg,Yc=p(()=>{"use strict";cg={name:"texture-bit",vertex:{header:`
362
+
363
+ struct TextureUniforms {
364
+ uTextureMatrix:mat3x3<f32>,
365
+ }
366
+
367
+ @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
368
+ `,main:`
369
+ uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
370
+ `},fragment:{header:`
371
+ @group(2) @binding(0) var uTexture: texture_2d<f32>;
372
+ @group(2) @binding(1) var uSampler: sampler;
373
+
374
+
375
+ `,main:`
376
+ outColor = textureSample(uTexture, uSampler, vUV);
377
+ `}},hg={name:"texture-bit",vertex:{header:`
378
+ uniform mat3 uTextureMatrix;
379
+ `,main:`
380
+ uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
381
+ `},fragment:{header:`
382
+ uniform sampler2D uTexture;
383
+
384
+
385
+ `,main:`
386
+ outColor = texture(uTexture, vUV);
387
+ `}}});var ws,ug=p(()=>{P();et();bi();Es();Si();Yc();nr();mt();ot();ws=class{init(){let t=_i({name:"mesh",bits:[Ss,cg,vi]});this._shader=new zt({gpuProgram:t,resources:{uTexture:U.EMPTY._source,uSampler:U.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}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 n=s.gpuProgram;if(n.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let o=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ws.extension={type:[_.WebGPUPipesAdaptor],name:"mesh"}});var Ko,Ps,dg=p(()=>{P();Re();Ho();Ko=It.for2d(),Ps=class{start(t,e,r){let s=t.renderer,n=s.encoder,o=r.gpuProgram;this._shader=r,this._geometry=e,n.setGeometry(e,o),Ko.blendMode="normal",s.pipeline.getPipeline(e,o,Ko,void 0,r._overrides);let a=s.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,o)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,n=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=xi(l.textures,l.count,s.limits.maxBatchableTextures)}Ko.blendMode=e.blendMode;let o=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Ko,e.topology,this._shader._overrides);e.bindGroup._touch(s.gc.now,s.tick),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,o),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Ps.extension={type:[_.WebGPUPipesAdaptor],name:"batch"}});var Ir,jc=p(()=>{P();Ir=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}};Ir.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"customRender"}});var lr,qo=p(()=>{"use strict";lr=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}destroy(){this.reset()}}});function Ms(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let n=r[s];t[n.renderPipeId].execute(n)}}var $c=p(()=>{"use strict"});var Fr,Kc=p(()=>{P();et();Ne();qo();$c();Fr=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&&(pt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=pt.get(lr));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.blendMode.pushBlendMode(t,t.root.groupBlendMode,e),this._renderer.renderPipes.batch.addToBatch(r,e),this._renderer.renderPipes.blendMode.popBlendMode(e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=new B().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push({target:t.texture,clear:!0,frame:t.texture.frame}),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295,offset:{x:0,y:0}}),Ms(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}),Ms(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Fr.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"renderGroup"}});function As(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var qc=p(()=>{"use strict"});function Zc(i,t=!1){XT(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let n=Number(s),o=e[s],a=o.list,l=o.index;for(let c=0;c<l;c++){let h=a[c];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===n&&mg(h,r,0)}As(a,l),o.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Zc(i.renderGroupChildren[s],t)}function XT(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=ei(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 mg(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&fg&&pg(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&fg&&pg(i,zT,e)),!i.renderGroup){let n=i.children,o=n.length;for(let c=0;c<o;c++)mg(n[c],t,e);let a=i.parentRenderGroup,l=i;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function pg(i,t,e){if(e&si){i.groupColor=ei(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&Qi&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Cr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var zT,fg,gg=p(()=>{xe();qc();yl();zT=new ut,fg=Cr|si|Qi});function xg(i,t){let{list:e}=i.childrenRenderablesToUpdate,r=!1;for(let s=0;s<i.childrenRenderablesToUpdate.index;s++){let n=e[s];if(r=t[n.renderPipeId].validateRenderable(n),r)break}return i.structureDidChange=r,r}var _g=p(()=>{"use strict"});var YT,Rs,yg=p(()=>{P();et();Sr();xr();jt();qc();$c();gg();_g();YT=new B,Rs=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 n=this._renderer,o=YT;e&&(o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=n.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ms(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t._parentCacheAsTextureRenderGroup=e,t.isCachedAsTexture){if(!t.textureNeedsUpdate)return;e=t}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(),s=this._renderer,n=t.textureOptions.resolution||s.view.resolution,o=t.textureOptions.antialias??s.view.antialias,a=t.textureOptions.scaleMode??"linear",l=t.texture;r.ceil(),t.texture&&Tt.returnTexture(t.texture,!0);let c=Tt.getOptimalTexture(r.width,r.height,n,o);c._source.style=new Qt({scaleMode:a}),t.texture=c,t._textureBounds||(t._textureBounds=new ct),t._textureBounds.copyFrom(r),l!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Tt.returnTexture(t.texture,!0),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?As(t.childrenRenderablesToUpdate.list,0):xg(t,r),Zc(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 n=e[s];n.didViewUpdate&&t.updateRenderable(n)}As(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let n=e.renderPipes?e:e.batch.renderer,o=n.renderPipes;o.batch.buildStart(s),o.blendMode.buildStart(),o.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,n,null),o.batch.buildEnd(s),o.blendMode.buildEnd(s)}};Rs.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"renderGroup"}});var Dr,Qc=p(()=>{P();qo();Dr=class{constructor(t){this._renderer=t}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._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=new lr;return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}};Dr.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"sprite"}});var Ei,Jc=p(()=>{Gt();Ei="8.20.0"});var Bs,Gs,th=p(()=>{P();Jc();Bs=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Ei)}static destroy(){}};Bs.extension=_.Application;Gs=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Ei)}destroy(){this._renderer=null}};Gs.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"initHook",priority:-10}});var Ge,eh=p(()=>{"use strict";Ge=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.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=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 ks(i,t,e,r){if(e??(e=0),r??(r=Math.min(i.byteLength-e,t.byteLength)),!(e&7)&&!(r&7)){let s=r/8;new Float64Array(t,0,s).set(new Float64Array(i,e,s))}else if(!(e&3)&&!(r&3)){let s=r/4;new Float32Array(t,0,s).set(new Float32Array(i,e,s))}else new Uint8Array(t).set(new Uint8Array(i,e,r))}var rh=p(()=>{"use strict"});var bg,gt,Ur=p(()=>{"use strict";bg={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},gt=(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))(gt||{})});function ih(i,t){return t.alphaMode==="no-premultiply-alpha"&&bg[i]||i}var vg=p(()=>{Ur()});function $T(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
388
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Zo(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=jT.replace(/%forloop%/gi,$T(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 jT,sh=p(()=>{"use strict";jT=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
389
+ `)});function Tg(){if(Ci)return Ci;let i=Mo();return Ci=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Ci=Zo(Ci,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Ci}var Ci,Sg=p(()=>{hc();sh();Ci=null});var Qo,Eg=p(()=>{"use strict";Qo=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 Cg(){return Jo>0?Fs[--Jo]:new nh}function wg(i){i.elements=null,Fs[Jo++]=i}var nh,Fs,Jo,Is,Pg,Ag,Rg=p(()=>{Pt();eh();_t();mr();rh();vg();Sg();Eg();nh=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Qo,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}},Fs=[],Jo=0;oe.register({clear:()=>{if(Fs.length>0)for(let i of Fs)i&&i.destroy();Fs.length=0,Jo=0}});Is=0,Pg=class Mg{constructor(t){this.uid=j("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...Mg.defaultOptions,...t},t.maxTextures||(N("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Tg());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ge(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++)wg(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=Cg(),s=r.textures;s.clear();let n=e[this.elementStart],o=ih(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=[],g=this.maxTextures;for(let y=this.elementStart;y<this.elementSize;++y){let x=e[y];e[y]=null;let v=x.texture._source,T=ih(x.blendMode,v),S=o!==T||a!==x.topology;if(v._batchTick===Is&&!S){x._textureId=v._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(h,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,h,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r,m.push(x);continue}v._batchTick=Is,(s.count>=g||S)&&(this._finishBatch(r,d,u-d,s,o,a,t,f,m),f="renderBatch",d=u,o=T,a=x.topology,r=Cg(),s=r.textures,s.clear(),m=[],++Is),x._textureId=v._textureBindLocation=s.count,s.ids[v.uid]=s.count,s.textures[s.count++]=v,x._batch=r,m.push(x),u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(h,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,h,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,o,a,t,f,m),d=u,++Is),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,n,o,a,l,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=n,t.topology=o,t.start=e,t.size=r,t.elements=c,++Is,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 Ge(e);ks(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 n=0;n<e.length;n++)s[n]=e[n];else ks(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 n=t.indices,o=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let c=0;c<o;c++)e[r++]=s+n[c+a]-l}destroy(t={}){if(this.batches!==null){for(let e=0;e<this.batchIndex;e++)wg(this.batches[e]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&(this.shader?.destroy(),this.shader=null);for(let e=0;e<this._elements.length;e++)this._elements[e]&&(this._elements[e]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};Pg.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ag=Pg});var KT,qT,ta,Bg=p(()=>{Rr();or();fs();KT=new Float32Array(1),qT=new Uint32Array(1),ta=class extends Be{constructor(){let e=new Ft({data:KT,label:"attribute-batch-buffer",usage:it.VERTEX|it.COPY_DST,shrinkToFit:!1}),r=new Ft({data:qT,label:"index-batch-buffer",usage:it.INDEX|it.COPY_DST,shrinkToFit:!1}),s=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:20}},indexBuffer:r})}}});function ea(i){let t=Gg[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Gg[i]=new St({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var Gg,oh=p(()=>{ce();Gg={}});var Ds,kg=p(()=>{bi();zo();jo();Si();oh();nr();Ds=class extends zt{constructor(t){let e=yi({name:"batch",bits:[Vo,Yo(t),Ti]}),r=_i({name:"batch",bits:[Wo,Xo(t),vi]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ea(t)}}),this.maxTextures=t}}});var Us,Ig,Os,ah=p(()=>{P();Rg();Bg();kg();Us=null,Ig=class Fg extends Ag{constructor(t){super(t),this.geometry=new ta,this.name=Fg.extension.name,this.vertexSize=6,Us??(Us=new Ds(t.maxTextures)),this.shader=Us}packAttributes(t,e,r,s,n){let o=n<<16|t.roundPixels&65535,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:g}=t,y=t.color,x=t.attributeOffset,b=x+t.attributeSize;for(let v=x;v<b;v++){let T=v*2,S=m[T],E=m[T+1];e[s++]=l*S+h*E+d,e[s++]=u*E+c*S+f,e[s++]=g[T],e[s++]=g[T+1],r[s++]=y,r[s++]=o}}packQuadAttributes(t,e,r,s,n){let o=t.texture,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,m=t.bounds,g=m.maxX,y=m.minX,x=m.maxY,b=m.minY,v=o.uvs,T=t.color,S=n<<16|t.roundPixels&65535;e[s+0]=l*y+h*b+d,e[s+1]=u*b+c*y+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=S,e[s+6]=l*g+h*b+d,e[s+7]=u*b+c*g+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=S,e[s+12]=l*g+h*x+d,e[s+13]=u*x+c*g+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=S,e[s+18]=l*y+h*x+d,e[s+19]=u*x+c*y+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=S}_updateMaxTextures(t){this.shader.maxTextures!==t&&(Us=new Ds(t),this.shader=Us)}destroy(){this.shader=null,super.destroy()}};Ig.extension={type:[_.Batcher],name:"default"};Os=Ig});var lh,Ls,ch=p(()=>{P();Re();ah();lh=class Dg{constructor(t,e){this.state=It.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t,e){return new this._availableBatchers[t]({maxTextures:e})}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Os({maxTextures:this.renderer.limits.maxBatchableTextures}))),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]=Dg.getBatcher(t.batcherName,this.renderer.limits.maxBatchableTextures),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],n=s.geometry;n.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),n.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],n=s.geometry;s.dirty&&(s.dirty=!1,n.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}};lh.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"batch"};lh._availableBatchers=Object.create(null);Ls=lh;H.handleByMap(_.Batcher,Ls._availableBatchers);H.add(Os)});var Ug,Og=p(()=>{Ug=`in vec2 vMaskCoord;
390
+ in vec2 vTextureCoord;
391
+
392
+ uniform sampler2D uTexture;
393
+ uniform sampler2D uMaskTexture;
394
+
395
+ uniform float uAlpha;
396
+ uniform vec4 uMaskClamp;
397
+ uniform float uInverse;
398
+ uniform float uChannel;
399
+
400
+ out vec4 finalColor;
401
+
402
+ void main(void)
403
+ {
404
+ float clip = step(3.5,
405
+ step(uMaskClamp.x, vMaskCoord.x) +
406
+ step(uMaskClamp.y, vMaskCoord.y) +
407
+ step(vMaskCoord.x, uMaskClamp.z) +
408
+ step(vMaskCoord.y, uMaskClamp.w));
409
+
410
+ // TODO look into why this is needed
411
+ float npmAlpha = uAlpha;
412
+ vec4 original = texture(uTexture, vTextureCoord);
413
+ vec4 masky = texture(uMaskTexture, vMaskCoord);
414
+
415
+ float a;
416
+ if (uChannel == 1.0) {
417
+ a = masky.a * npmAlpha * clip;
418
+ } else {
419
+ float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
420
+ a = alphaMul * masky.r * npmAlpha * clip;
421
+ }
422
+
423
+ if (uInverse == 1.0) {
424
+ a = 1.0 - a;
425
+ }
426
+
427
+ finalColor = original * a;
428
+ }
429
+ `});var Lg,Ng=p(()=>{Lg=`in vec2 aPosition;
430
+
431
+ out vec2 vTextureCoord;
432
+ out vec2 vMaskCoord;
433
+
434
+
435
+ uniform vec4 uInputSize;
436
+ uniform vec4 uOutputFrame;
437
+ uniform vec4 uOutputTexture;
438
+ uniform mat3 uFilterMatrix;
439
+
440
+ vec4 filterVertexPosition( vec2 aPosition )
441
+ {
442
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
443
+
444
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
445
+ position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
446
+
447
+ return vec4(position, 0.0, 1.0);
448
+ }
449
+
450
+ vec2 filterTextureCoord( vec2 aPosition )
451
+ {
452
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
453
+ }
454
+
455
+ vec2 getFilterCoord( vec2 aPosition )
456
+ {
457
+ return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
458
+ }
459
+
460
+ void main(void)
461
+ {
462
+ gl_Position = filterVertexPosition(aPosition);
463
+ vTextureCoord = filterTextureCoord(aPosition);
464
+ vMaskCoord = getFilterCoord(aPosition);
465
+ }
466
+ `});var hh,Hg=p(()=>{hh=`struct GlobalFilterUniforms {
467
+ uInputSize:vec4<f32>,
468
+ uInputPixel:vec4<f32>,
469
+ uInputClamp:vec4<f32>,
470
+ uOutputFrame:vec4<f32>,
471
+ uGlobalFrame:vec4<f32>,
472
+ uOutputTexture:vec4<f32>,
473
+ };
474
+
475
+ struct MaskUniforms {
476
+ uFilterMatrix:mat3x3<f32>,
477
+ uMaskClamp:vec4<f32>,
478
+ uAlpha:f32,
479
+ uInverse:f32,
480
+ uChannel:f32,
481
+ };
482
+
483
+ @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
484
+ @group(0) @binding(1) var uTexture: texture_2d<f32>;
485
+ @group(0) @binding(2) var uSampler : sampler;
486
+
487
+ @group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
488
+ @group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
489
+
490
+ struct VSOutput {
491
+ @builtin(position) position: vec4<f32>,
492
+ @location(0) uv : vec2<f32>,
493
+ @location(1) filterUv : vec2<f32>,
494
+ };
495
+
496
+ fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
497
+ {
498
+ var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
499
+
500
+ position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
501
+ position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
502
+
503
+ return vec4(position, 0.0, 1.0);
504
+ }
505
+
506
+ fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
507
+ {
508
+ return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
509
+ }
510
+
511
+ fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
512
+ {
513
+ return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
514
+ }
515
+
516
+ fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
517
+ {
518
+ return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
519
+ }
520
+
521
+ fn getSize() -> vec2<f32>
522
+ {
523
+ return gfu.uGlobalFrame.zw;
524
+ }
525
+
526
+ @vertex
527
+ fn mainVertex(
528
+ @location(0) aPosition : vec2<f32>,
529
+ ) -> VSOutput {
530
+ return VSOutput(
531
+ filterVertexPosition(aPosition),
532
+ filterTextureCoord(aPosition),
533
+ getFilterCoord(aPosition)
534
+ );
535
+ }
536
+
537
+ @fragment
538
+ fn mainFragment(
539
+ @location(0) uv: vec2<f32>,
540
+ @location(1) filterUv: vec2<f32>,
541
+ @builtin(position) position: vec4<f32>
542
+ ) -> @location(0) vec4<f32> {
543
+
544
+ var maskClamp = filterUniforms.uMaskClamp;
545
+ var uAlpha = filterUniforms.uAlpha;
546
+
547
+ var clip = step(3.5,
548
+ step(maskClamp.x, filterUv.x) +
549
+ step(maskClamp.y, filterUv.y) +
550
+ step(filterUv.x, maskClamp.z) +
551
+ step(filterUv.y, maskClamp.w));
552
+
553
+ var mask = textureSample(uMaskTexture, uSampler, filterUv);
554
+ var source = textureSample(uTexture, uSampler, uv);
555
+
556
+ var a: f32;
557
+ if (filterUniforms.uChannel == 1.0) {
558
+ a = mask.a * uAlpha * clip;
559
+ } else {
560
+ var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
561
+ a = alphaMul * mask.r * uAlpha * clip;
562
+ }
563
+
564
+ if (filterUniforms.uInverse == 1.0) {
565
+ a = 1.0 - a;
566
+ }
567
+
568
+ return source * a;
569
+ }
570
+ `});var ra,Wg=p(()=>{et();Mr();fi();ce();mt();wl();ot();Ec();Og();Ng();Hg();ra=class extends Bo{constructor(t){let{sprite:e,...r}=t,s=new ii(e.texture),n=new St({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"},uChannel:{value:t.channel==="alpha"?1:0,type:"f32"}}),o=le.from({vertex:{source:hh,entryPoint:"mainVertex"},fragment:{source:hh,entryPoint:"mainFragment"}}),a=ae.from({vertex:Lg,fragment:Ug,name:"mask-filter"});super({...r,gpuProgram:o,glProgram:a,clipToViewport:!1,resources:{filterUniforms:n,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}setSprite(t){this.sprite=t;let e=this._getSafeTexture();this._textureMatrix.texture=e,this.resources.uMaskTexture=e.source}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}set channel(t){this.resources.filterUniforms.uniforms.uChannel=t==="alpha"?1:0}get channel(){return this.resources.filterUniforms.uniforms.uChannel===1?"alpha":"red"}apply(t,e,r,s){let n=this._getSafeTexture();this._textureMatrix.texture=n,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=n.source,t.applyFilter(this,e,r,s)}_getSafeTexture(){let t=this.sprite.texture;return t.destroyed||!t.source||t.source.destroyed?(O("[MaskFilter] The mask texture was destroyed while the mask is still in use. Remove the mask before destroying its texture."),U.EMPTY):t}destroy(t=!1){this._textureMatrix.destroy(),super.destroy(t)}}});var ZT,uh,Or,dh=p(()=>{P();jn();Wg();jt();$i();fo();Ne();mt();Sr();Ae();ZT=new ct,uh=class extends He{constructor(){super(),this._placeholderSprite=new Me(U.EMPTY),this.filters=[new ra({sprite:this._placeholderSprite,inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].setSprite(t)}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}get channel(){return this.filters[0].channel}set channel(t){this.filters[0].channel=t}reset(){this._placeholderSprite.texture=U.EMPTY,this.sprite=this._placeholderSprite}},Or=class{constructor(t){this._activeMaskStage=[],this._usedEffects=[],this._renderer=t,t.runners.postrender.add(this)}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.channel=e._maskOptions.channel??"red",t.renderMaskToTexture){let n=t.mask;n.includeInBuild=!0,n.collectRenderables(r,s,null),n.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=pt.get(uh);if(s.inverse=t.inverse,s.channel=t.mask.channel,r){t.mask.mask.measurable=!0;let n=ti(t.mask.mask,!0,ZT);t.mask.mask.measurable=!1,n.ceil();let o=e.renderTarget.renderTarget.colorTexture.source,a=Tt.getOptimalTexture(n.width,n.height,o._resolution,o.antialias);e.renderTarget.push({target:a,clear:!0}),e.globalUniforms.push({offset:n,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=n.minX,l.worldTransform.ty=n.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===Rt.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&&Tt.returnTexture(s.filterTexture),this._usedEffects.push(s.filterEffect)}}postrender(){let t=this._usedEffects;for(let e=0;e<t.length;e++)pt.return(t[e]);t.length=0}destroy(){this.postrender(),this._renderer.runners.postrender.remove(this),this._renderer=null,this._activeMaskStage=null,this._usedEffects=null}};Or.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"alphaMask"}});var Ns,Vg=p(()=>{P();Ns=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 n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&t.mask;let o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,r.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let n=this._colorStack;this._colorStackIndex--;let o=n[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,r.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._renderer=null,this._colorStack=null}};Ns.extension={type:[_.WebGLPipes,_.WebGPUPipes],name:"colorMask"}});var Hs,zg=p(()=>{P();mi();Ur();Hs=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let n=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(n);l.instructionsStart=r.instructionSize,a.collectRenderables(r,o,null),a.includeInBuild=!1,o.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let c=r.instructionSize-l.instructionsStart-1;l.instructionsLength=c;let h=o.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let o=this._maskHash.get(t);for(let a=0;a<o.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[o.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r,n=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[n]??(e[n]=0);t.action==="pushMaskBegin"?(s.renderTarget.ensureDepthStencil(),s.stencil.setStencilMode(gt.RENDERING_MASK_ADD,o),o++,s.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?s.stencil.setStencilMode(gt.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(gt.MASK_ACTIVE,o),s.colorMask.setMask(15)):t.action==="popMaskBegin"?(s.colorMask.setMask(0),o!==0?s.stencil.setStencilMode(gt.RENDERING_MASK_REMOVE,o):(s.renderTarget.clear(null,yt.STENCIL),s.stencil.setStencilMode(gt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?s.stencil.setStencilMode(gt.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(gt.MASK_ACTIVE,o),s.colorMask.setMask(15)),this._maskStackHash[n]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Hs.extension={type:[_.WebGLPipes,_.WebGPUPipes],name:"stencilMask"}});var fh,Yg,jg=p(()=>{Ht();P();ot();fh=class Xg{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new K(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...Xg.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){K.shared.setValue(t).alpha<1&&this._backgroundColor.alpha===1&&O("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};fh.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"background",priority:0};fh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};Yg=fh});var Ws,Lr,ph=p(()=>{P();jn();Ml();ot();Ws={};H.handle(_.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");Ws[i.name]=i.ref},i=>{delete Ws[i.name]});Lr=class{constructor(t){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(t,e,r){this._blendModeStack.push(e),this.setBlendMode(t,e,r)}popBlendMode(t){this._blendModeStack.pop();let e=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,e,t)}setBlendMode(t,e,r){let s=t instanceof Er;if(this._activeBlendMode===e){this._isAdvanced&&t&&!s&&this._renderableList?.push(t);return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=e,t&&(this._isAdvanced=!!Ws[e],this._isAdvanced&&this._beginAdvancedBlendMode(t,r))}_beginAdvancedBlendMode(t,e){this._renderer.renderPipes.batch.break(e);let r=this._activeBlendMode;if(!Ws[r]){O(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let s=this._ensureFilterEffect(r),n=t instanceof Er,o={renderPipeId:"filter",action:"pushFilter",filterEffect:s,renderables:n?null:[t],container:n?t.root:null,canBundle:!1};this._renderableList=o.renderables,e.add(o)}_ensureFilterEffect(t){let e=this._filterHash[t];return e||(e=this._filterHash[t]=new He,e.filters=[new Ws[t]]),e}_endAdvancedBlendMode(t){this._isAdvanced=!1,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}};Lr.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"blendMode"}});var mh,gh,Kg,qg=p(()=>{dt();P();xe();mt();mh={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},gh=class $g{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof ut||t instanceof U?{target:t,...e}:{...e,...t}}async image(t){let e=W.get().createImage();return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,$g.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,o)=>{s.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},mh[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(mh[e],r);if(s.convertToBlob!==void 0){let n=await s.convertToBlob({type:mh[e],quality:r});return new Promise((o,a)=>{let l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}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 U)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),n=r.texture.generateCanvas(s);return s.destroy(!0),n}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof U?e:r.textureGenerator.generateTexture(t),n=r.texture.getPixels(s);return e instanceof ut&&s.destroy(!0),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof U?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 n=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}destroy(){this._renderer=null}};gh.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"extract"};gh.defaultImageOptions={format:"png",quality:1};Kg=gh});var ia,Zg=p(()=>{Ot();mt();ia=class i extends U{static create(t){let{dynamic:e,textureOptions:r,...s}=t;return new i({...r,source:new J(s),dynamic:e??!1})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var QT,JT,tS,Vs,Qg=p(()=>{Ht();P();et();Ut();jt();Qn();xe();Zg();QT=new q,JT=new ct,tS=[0,0,0,0],Vs=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof ut&&(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,n=t.clearColor;n?n=Array.isArray(n)&&n.length===4?n:K.shared.setValue(n).toArray():n=tS;let o=t.frame?.copyTo(QT)||ri(s,JT).rectangle,a=t.defaultAnchor&&{defaultAnchor:t.defaultAnchor};o.width=Math.max(o.width,1/e)|0,o.height=Math.max(o.height,1/e)|0;let l=ia.create({...t.textureSourceOptions,width:o.width,height:o.height,resolution:e,antialias:r,textureOptions:a}),c=B.shared.translate(-o.x,-o.y);return this._renderer.render({container:s,transform:c,target:l,clearColor:n}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}};Vs.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"textureGenerator"}});function Jg(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 tx(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 ex=p(()=>{"use strict"});var xh,ix,sx=p(()=>{P();ex();xh=class rx{constructor(t){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=t}init(t){t={...rx.defaultOptions,...t},this.maxUnusedTime=t.gcMaxUnusedTime,this._frequency=t.gcFrequency,this.enabled=t.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedCollections){let{context:r,collection:s,type:n}=e;n==="hash"?r[s]=Jg(r[s]):r[s]=tx(r[s])}},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:t}){this.now=performance.now(),t.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e,t.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}addCollection(t,e,r){this._managedCollections.push({context:t,collection:e,type:r})}addResource(t,e){if(t._gcLastUsed!==-1){t._gcLastUsed=this.now,t._onTouch?.(this.now);return}let r=this._managedResources.length;t._gcData={index:r,type:e},t._gcLastUsed=this.now,t._onTouch?.(this.now),t.once("unload",this.removeResource,this),this._managedResources.push(t)}removeResource(t){let e=t._gcData;if(!e)return;let r=e.index,s=this._managedResources.length-1;if(r!==s){let n=this._managedResources[s];this._managedResources[r]=n,n._gcData.index=r}this._managedResources.length--,t._gcData=null,t._gcLastUsed=-1}addResourceHash(t,e,r,s=0){this._managedResourceHashes.push({context:t,hash:e,type:r,priority:s}),this._managedResourceHashes.sort((n,o)=>n.priority-o.priority)}run(){let t=performance.now(),e=this._managedResourceHashes;for(let s of e)this.runOnHash(s,t);let r=0;for(let s=0;s<this._managedResources.length;s++){let n=this._managedResources[s];r=this.runOnResource(n,t,r)}this._managedResources.length=r}updateRenderableGCTick(t,e){let r=t.renderGroup??t.parentRenderGroup,s=r?.instructionSet?.gcTick??-1;(r?.gcTick??0)===s&&(t._gcLastUsed=e,t._onTouch?.(e))}runOnResource(t,e,r){let s=t._gcData;return s.type==="renderable"&&this.updateRenderableGCTick(t,e),e-t._gcLastUsed<this.maxUnusedTime||!t.autoGarbageCollect?(this._managedResources[r]=t,s.index=r,r++):(t.unload(),t._gcData=null,t._gcLastUsed=-1,t.off("unload",this.removeResource,this)),r}_createHashClone(t,e){let r=Object.create(null);for(let s in t){if(s===e)break;t[s]!==null&&(r[s]=t[s])}return r}runOnHash(t,e){let{context:r,hash:s,type:n}=t,o=r[s],a=null,l=0;for(let c in o){let h=o[c];if(h===null){l++,l===1e4&&!a&&(a=this._createHashClone(o,c));continue}if(h._gcLastUsed===-1){h._gcLastUsed=e,h._onTouch?.(e),a&&(a[c]=h);continue}if(n==="renderable"&&this.updateRenderableGCTick(h,e),!(e-h._gcLastUsed<this.maxUnusedTime)&&h.autoGarbageCollect){if(n==="renderable"){let d=h,f=d.renderGroup??d.parentRenderGroup;f&&(f.structureDidChange=!0)}h.unload(),h._gcData=null,h._gcLastUsed=-1,a||(l+1!==1e4?(o[c]=null,l++):a=this._createHashClone(o,c))}else a&&(a[c]=h)}a&&(r[s]=a)}destroy(){this.enabled=!1,this._managedResources.forEach(t=>{t.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};xh.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"gc",priority:0};xh.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};ix=xh});function sa(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 _h=p(()=>{"use strict"});var zs,nx=p(()=>{P();et();ge();_h();Ar();Ae();ce();zs=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:n}){let o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new B,worldColor:4294967295,offset:new tt},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:n||a.offset,bindGroup:null},c=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(c);let h=c.uniforms;h.uProjectionMatrix=l.projectionMatrix,h.uResolution=l.resolution,h.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),h.uWorldTransformMatrix.tx-=l.offset.x,h.uWorldTransformMatrix.ty-=l.offset.y,sa(l.worldColor,h.uWorldColorAlpha,0),c.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(c,!1):(u=this._bindGroupPool.pop()||new Vt,this._activeBindGroups.push(u),u.setResource(c,0)),l.bindGroup=u,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Rt.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 B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}};zs.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"globalUniforms"}});var eS,Xs,ox=p(()=>{P();oi();eS=1,Xs=class{constructor(){this._tasks=[],this._offset=0}init(){Lt.system.add(this._update,this)}repeat(t,e,r=!0){let s=eS++,n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,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(){Lt.system.remove(this._update,this),this._tasks.length=0}};Xs.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"scheduler",priority:0}});function lx(i){if(!ax){if(W.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Ei} (${i}) http://www.pixijs.com/
571
+
572
+ `,"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 ${Ei} - ${i} - http://www.pixijs.com/`);ax=!0}}var ax,cx=p(()=>{dt();Jc();ax=!1});var wi,hx=p(()=>{P();cx();Ae();wi=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Rt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),lx(e)}}};wi.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"hello",priority:-2};wi.defaultOptions={hello:!1}});var yh,dx,fx=p(()=>{P();_t();yh=class ux{constructor(t){this._renderer=t}init(t){t={...ux.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime}get enabled(){return N("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(t){N("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=t}addManagedHash(t,e){N("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(t,e,"hash")}addManagedArray(t,e){N("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(t,e,"array")}addRenderable(t){N("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(t,"renderable")}run(){N("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};yh.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"renderableGC",priority:0};yh.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};dx=yh});var bh,px,mx=p(()=>{P();_t();bh=class na{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(t){N("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=t}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(t){N("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=t/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(t){N("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(t){N("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=t}constructor(t){this._renderer=t,this._checkCount=0}init(t){t.textureGCActive!==na.defaultOptions.textureGCActive&&(this.active=t.textureGCActive),t.textureGCMaxIdle!==na.defaultOptions.textureGCMaxIdle&&(this.maxIdle=t.textureGCMaxIdle),t.textureGCCheckCountMax!==na.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=t.textureGCCheckCountMax)}run(){N("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};bh.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"textureGC"};bh.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};px=bh});var gx,Pi,vh=p(()=>{Pt();Ot();mt();gx=class xx{constructor(t={}){this.uid=j("renderTarget"),this.colorAttachments=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,this._depth=!1,this._stencil=!1,this._colorTextures=null;let e="colorAttachments"in t?t:this._normalizeOptions(t);if(this.isRoot=e.isRoot??!1,this.label=e.label,this.colorAttachments=e.colorAttachments,this.depthStencilAttachment=e.depthStencilAttachment,this.depthStencilAttachment){let r=this.depthStencilAttachment.texture.format;this._depth||(this._depth=r.includes("depth")),this._stencil||(this._stencil=r.includes("stencil"))}if(this.colorAttachments.length===0&&!this.depthStencilAttachment)throw new Error("[RenderTarget] no color textures or depth textures were provided. Provide a depthStencilTexture or set depth/stencil to true when using colorTextures: 0.");if(this.colorAttachments.length>0){let r=this.colorTexture;this.resize(r.width,r.height,r._resolution)}this.sizeSource&&this.sizeSource.on("resize",this.onSourceResize,this)}_normalizeOptions(t){let e={...xx.defaultOptions,...t},r=[],s;if(typeof e.colorTextures=="number"){if(e.colorTextures>0){this._managedColorTextures=!0;for(let o=0;o<e.colorTextures;o++)r.push({texture:new J({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}),loadOp:"clear",storeOp:"store"})}}else e.colorTextures.forEach(o=>{r.push({texture:o.source,loadOp:"clear",storeOp:"store"})});let n=e.depthStencilTexture===!0;if(this._depth=!!(e.depth||n),this._stencil=!!(e.stencil||n),e.depthStencilTexture instanceof U||e.depthStencilTexture instanceof J){if(e.isRoot)throw new Error("[RenderTarget] cannot attach a depth-stencil texture to the screen \u2014 the canvas owns its own depth/stencil buffers. Render to a texture target instead.");s={texture:e.depthStencilTexture.source}}else(n&&!e.isRoot||(e.stencil||e.depth)&&r.length===0)&&(s=this._createDepthStencilTexture(e.width,e.height,e.resolution));return{colorAttachments:r,depthStencilAttachment:s,isRoot:e.isRoot,label:e.label}}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.sizeSource.width}get height(){return this.sizeSource.height}get pixelWidth(){return this.sizeSource.pixelWidth}get pixelHeight(){return this.sizeSource.pixelHeight}get resolution(){return this.sizeSource._resolution}get colorTextures(){return this._colorTextures||(this._colorTextures=this.colorAttachments.map(t=>t.texture)),this._colorTextures}get depthStencilTexture(){return this.depthStencilAttachment?.texture??null}get depth(){return this._depth}get stencil(){return this._stencil}get colorTexture(){return this.colorAttachments[0]?.texture}get sizeSource(){return this.colorAttachments[0]?.texture??this.depthStencilAttachment?.texture}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this._createDepthStencilTexture(this.sizeSource.width,this.sizeSource.height,this.sizeSource._resolution),this._depth=!0,this._stencil=!0}resize(t,e,r=this.resolution,s=!1){if(this.dirtyId++,this.colorAttachments.forEach((n,o)=>{s&&o===0||n.texture.resize(t,e,r)}),this.depthStencilAttachment){if(s&&this.colorAttachments.length===0)return;this.depthStencilAttachment.texture.resize(t,e,r)}}destroy(){!this.colorAttachments&&!this.depthStencilAttachment||(this.sizeSource.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorAttachments.forEach(t=>{t.texture.destroy()}),this.depthStencilAttachment&&(this.depthStencilAttachment.texture.destroy(),delete this.depthStencilAttachment),this.colorAttachments=null,this._colorTextures=null)}_createDepthStencilTexture(t,e,r){return this.depthStencilAttachment??(this.depthStencilAttachment={texture:new J({width:t,height:e,resolution:r,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1})}),this.depthStencilAttachment}};gx.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Pi=gx});function oa(i,t){if(!Mi.has(i)){let e=new U({source:new vt({resource:i,...t})}),r=()=>{Mi.get(i)===e&&Mi.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Mi.set(i,e)}return Mi.get(i)}var Mi,Th=p(()=>{mr();rr();mt();Mi=new Map;oe.register(Mi)});var Sh,yx,bx=p(()=>{dt();P();Ut();_t();vh();Th();Sh=class _x{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={..._x.defaultOptions,...t},t.view&&(N(rt,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new q(0,0,t.width,t.height),this.canvas=t.canvas||W.get().createCanvas(),this.antialias=!!t.antialias,this.texture=oa(this.canvas,t),this.renderTarget=new Pi({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),this.texture.destroy()}};Sh.extension={type:[_.WebGLSystem,_.WebGPUSystem,_.CanvasSystem],name:"view",priority:0};Sh.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};yx=Sh});var Ai,aa,la=p(()=>{jc();Kc();yg();Qc();th();ch();dh();Vg();zg();jg();ph();qg();Qg();sx();nx();ox();hx();fx();mx();bx();Ai=[Yg,zs,wi,yx,Rs,ix,px,Vs,Kg,Gs,dx,Xs],aa=[Lr,Ls,Dr,Fr,Or,Hs,Ns,Ir]});var Ys,vx=p(()=>{P();Ys=class{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,r){let s=`${t._key}:${e._layoutKey<<4|r}`;return this._hash[s]||this._createBindGroup(s,t,e,r)}_createBindGroup(t,e,r,s){let n=this._gpu.device,o=r.layout[s],a=[],l=this._renderer;for(let u in o){let d=e.resources[u]??e.resources[o[u]];if(!d||d.destroyed)throw new Error(`[BindGroup] the resource bound as '${u}' was destroyed while a shader still uses it. Remove it from the shader before destroying it.`);let f;if(d._resourceType==="uniformGroup"){let m=d;l.ubo.updateUniformGroup(m);let g=m.buffer;f={buffer:l.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){let m=d;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(d._resourceType==="bufferResource"){let m=d;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size??m.buffer.descriptor.size}}else if(d._resourceType==="textureSampler"){let m=d;f=l.texture.getGpuSampler(m)}else if(d._resourceType==="textureSource"){let m=d;f=l.texture.getTextureView(m)}else if(d._resourceType==="textureView"){let m=d;f=l.texture.getTextureView(m.source,m.viewDescriptor)}a.push({binding:o[u],resource:f})}let c=l.shader.getProgramData(r).bindGroups[s],h=n.createBindGroup({layout:c,entries:a});return this._hash[t]=h,h}destroy(){this._hash=null,this._renderer=null}};Ys.extension={type:[_.WebGPUSystem],name:"bindGroup"}});var Ct,ve=p(()=>{"use strict";Ct=class{constructor(t){this.items=Object.create(null);let{renderer:e,type:r,onUnload:s,priority:n,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",r,n??0),this._onUnload=s,this.name=o}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;let r=t._gpuData[this._renderer.uid];r&&(this._onUnload?.(t,...e),r.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}});var Eh,js,Tx=p(()=>{P();ve();rh();Eh=class{constructor(t){this.gpuBuffer=t}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}},js=class{constructor(t){this._renderer=t,this._managedBuffers=new Ct({renderer:t,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(t){this._gpu=t}getGPUBuffer(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(t)}updateBuffer(t){let e=this.getGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,t._updateOffset,r.buffer,r.byteOffset+t._updateOffset,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(t){t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this)}createGPUBuffer(t){let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(ks(t.data.buffer,e.getMappedRange(),t.data.byteOffset,t.data.byteLength),e.unmap()),t._gpuData[this._renderer.uid]=new Eh(e),this._managedBuffers.add(t)&&(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this)),e}onBufferChange(t){this._managedBuffers.remove(t),t._updateID=0,this.createGPUBuffer(t)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}};js.extension={type:[_.WebGPUSystem],name:"buffer"}});var $s,Sx=p(()=>{P();$s=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}};$s.extension={type:[_.WebGPUSystem],name:"colorMask"}});var Ri,Ex=p(()=>{dt();P();Ri=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=(t.gpu?Promise.resolve(t.gpu):this._createDeviceAndAdaptor(t)).then(e=>{this.gpu=e,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await W.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter});if(!e)throw new Error("WebGPU not supported. No GPU adapter was returned by navigator.gpu.requestAdapter().");let r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2","indirect-first-instance"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:r,requiredLimits:{maxSampledTexturesPerShaderStage:e.limits.maxSampledTexturesPerShaderStage,maxSamplersPerShaderStage:e.limits.maxSamplersPerShaderStage}});return{adapter:e,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}};Ri.extension={type:[_.WebGPUSystem],name:"device"};Ri.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ks,Cx=p(()=>{P();Ks=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t;for(let e=0;e<16;e++)this._boundBindGroup[e]={bindGroup:null,program:null,key:null}}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this._passEncoder=this.commandEncoder.beginRenderPass(t.descriptor),this.renderPassEncoder=this._passEncoder}endRenderPass(){this._passEncoder&&this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null}beginBundle(){if(this._passEncoder!==this.renderPassEncoder)throw new Error("Cannot begin a new render bundle while one is already being recorded.");this._clearCache();let t=this._renderer.pipeline.getBundleDescriptor();this.renderPassEncoder=this._gpu.device.createRenderBundleEncoder(t)}endBundle(){let t=this.renderPassEncoder;if(!t||!("finish"in t))throw new Error("endBundle called without an active render bundle.");let e=t.finish();return this.renderPassEncoder=this._passEncoder,this._clearCache(),e}executeBundle(t){this._clearCache(),this._passEncoder.executeBundles([t])}setViewport(t){this._passEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setStencilReference(t){this._passEncoder.setStencilReference(t)}setPipelineFromGeometryProgramAndState(t,e,r,s,n){let o=this._renderer.pipeline.getPipeline(t,e,r,s,n);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){let e=this._boundBindGroup[t];e.bindGroup=null,e.program=null,e.key=null}setBindGroup(t,e,r){let s=this._boundBindGroup[t];if(s.bindGroup===e&&s.program===r&&s.key===e._key)return;s.bindGroup=e,s.program=r,s.key=e._key,e._touch(this._renderer.gc.now,this._renderer.tick);let n=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,n)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(parseInt(s,10),t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){let r=t.gpuProgram;for(let s in t.groups){if(!r.layout[s])continue;let n=t.groups[s];e||this._syncBindGroup(n),this.setBindGroup(s,n,r)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r&&r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:n,size:o,start:a,baseVertex:l,instanceCount:c,skipSync:h,firstInstance:u}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,n,r._overrides),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,c??e.instanceCount,a||0,l||0,u||0):this.renderPassEncoder.draw(o||e.vertexCount,c??e.instanceCount,a||0,u||0)}drawIndirect(t){let{geometry:e,shader:r,state:s,topology:n,skipSync:o,indirectBuffer:a,indirectOffset:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,n,r._overrides),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,o),e.indexBuffer?this.renderPassEncoder.drawIndexedIndirect(a,l):this.renderPassEncoder.drawIndirect(a,l)}finishRenderPass(){this._passEncoder&&(this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}_clearCache(){for(let t=0;t<16;t++){let e=this._boundBindGroup[t];e.bindGroup=null,e.program=null,e.key=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,this.renderPassEncoder=null,this._passEncoder=null}contextChange(t){this._gpu=t}};Ks.extension={type:[_.WebGPUSystem],name:"encoder",priority:1}});var qs,wx=p(()=>{P();qs=class{constructor(t){this.supportsOverrideConstants=!1,this._renderer=t}contextChange(){let t=this._renderer.device.gpu.device;this.maxTextures=Math.min(t.limits.maxSampledTexturesPerShaderStage,t.limits.maxSamplersPerShaderStage),this.maxBatchableTextures=this.maxTextures,this._detectOverrideConstantsSupport(t)}_detectOverrideConstantsSupport(t){t.pushErrorScope("validation");let e=t.createShaderModule({code:`override TEST_VALUE: f32 = 0.0;
573
+ @compute @workgroup_size(1) fn main() {}`});t.createComputePipeline({layout:"auto",compute:{module:e,entryPoint:"main",constants:{TEST_VALUE:1}}}),t.popErrorScope().then(r=>{this.supportsOverrideConstants=!r})}destroy(){}};qs.extension={type:[_.WebGPUSystem],name:"limits"}});var Zs,Px=p(()=>{P();Ur();Zs=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:gt.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.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Zs.extension={type:[_.WebGPUSystem],name:"stencil"}});var cr,ca=p(()=>{Rc();Rr();or();cr=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!ko())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 Ft({data:new Float32Array(e.layout.size/4),usage:it.UNIFORM|it.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]),n=this._adaptor.createUboElements(s),o=this._generateUboSync(n.uboElements);r=this._syncFunctionHash[e]={layout:n,syncFunction:o}}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 Ft({data:new Float32Array(s.layout.size/4),usage:it.UNIFORM|it.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,n,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 Mx(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],n=Nr[s.data.type].size,o=Nr[s.data.type].align;if(!Nr[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(n=Math.max(n,o)*s.data.size),e=Math.ceil(e/o)*o,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Nr,ha=p(()=>{"use strict";Nr={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 Jt,Qs=p(()=>{"use strict";Jt=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
574
+ var matrix = uv[name].toArray(true);
575
+ data[offset] = matrix[0];
576
+ data[offset + 1] = matrix[1];
577
+ data[offset + 2] = matrix[2];
578
+ data[offset + 4] = matrix[3];
579
+ data[offset + 5] = matrix[4];
580
+ data[offset + 6] = matrix[5];
581
+ data[offset + 8] = matrix[6];
582
+ data[offset + 9] = matrix[7];
583
+ data[offset + 10] = matrix[8];
584
+ `,uniform:`
585
+ gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
586
+ `},{type:"vec4<f32>",test:i=>i.type==="vec4<f32>"&&i.size===1&&i.value.width!==void 0,ubo:`
587
+ v = uv[name];
588
+ data[offset] = v.x;
589
+ data[offset + 1] = v.y;
590
+ data[offset + 2] = v.width;
591
+ data[offset + 3] = v.height;
592
+ `,uniform:`
593
+ cv = ud[name].value;
594
+ v = uv[name];
595
+ if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
596
+ cv[0] = v.x;
597
+ cv[1] = v.y;
598
+ cv[2] = v.width;
599
+ cv[3] = v.height;
600
+ gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
601
+ }
602
+ `},{type:"vec2<f32>",test:i=>i.type==="vec2<f32>"&&i.size===1&&i.value.x!==void 0,ubo:`
603
+ v = uv[name];
604
+ data[offset] = v.x;
605
+ data[offset + 1] = v.y;
606
+ `,uniform:`
607
+ cv = ud[name].value;
608
+ v = uv[name];
609
+ if (cv[0] !== v.x || cv[1] !== v.y) {
610
+ cv[0] = v.x;
611
+ cv[1] = v.y;
612
+ gl.uniform2f(ud[name].location, v.x, v.y);
613
+ }
614
+ `},{type:"vec4<f32>",test:i=>i.type==="vec4<f32>"&&i.size===1&&i.value.red!==void 0,ubo:`
615
+ v = uv[name];
616
+ data[offset] = v.red;
617
+ data[offset + 1] = v.green;
618
+ data[offset + 2] = v.blue;
619
+ data[offset + 3] = v.alpha;
620
+ `,uniform:`
621
+ cv = ud[name].value;
622
+ v = uv[name];
623
+ if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
624
+ cv[0] = v.red;
625
+ cv[1] = v.green;
626
+ cv[2] = v.blue;
627
+ cv[3] = v.alpha;
628
+ gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
629
+ }
630
+ `},{type:"vec3<f32>",test:i=>i.type==="vec3<f32>"&&i.size===1&&i.value.red!==void 0,ubo:`
631
+ v = uv[name];
632
+ data[offset] = v.red;
633
+ data[offset + 1] = v.green;
634
+ data[offset + 2] = v.blue;
635
+ `,uniform:`
636
+ cv = ud[name].value;
637
+ v = uv[name];
638
+ if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
639
+ cv[0] = v.red;
640
+ cv[1] = v.green;
641
+ cv[2] = v.blue;
642
+ gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
643
+ }
644
+ `}]});function ua(i,t,e){let r=[`
645
+ var v = null;
646
+ var v2 = null;
647
+ var t = 0;
648
+ var index = 0;
649
+ var name = null;
650
+ var arrayOffset = null;
651
+ `],s=0;for(let o=0;o<i.length;o++){let a=i[o],l=a.data.name,c=!1,h=0;for(let u=0;u<Jt.length;u++)if(Jt[u].test(a.data)){h=a.offset/4,r.push(`name = "${l}";`,`offset += ${h-s};`,Jt[u].ubo),c=!0;break}if(!c)if(a.data.size>1)h=a.offset/4,r.push(e(a,h-s));else{let u=t[a.data.type];h=a.offset/4,r.push(`
652
+ v = uv.${l};
653
+ offset += ${h-s};
654
+ ${u};
655
+ `)}s=h}let n=r.join(`
656
+ `);return new Function("uv","data","dataInt32","offset",n)}var Ch=p(()=>{Qs()});function Bi(i,t){return`
657
+ for (let i = 0; i < ${i*t}; i++) {
658
+ data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
659
+ }
660
+ `}var wh,Ax,Ph=p(()=>{"use strict";wh={f32:`
661
+ data[offset] = v;`,i32:`
662
+ dataInt32[offset] = v;`,u32:`
663
+ dataInt32[offset] = v;`,"vec2<f32>":`
664
+ data[offset] = v[0];
665
+ data[offset + 1] = v[1];`,"vec3<f32>":`
666
+ data[offset] = v[0];
667
+ data[offset + 1] = v[1];
668
+ data[offset + 2] = v[2];`,"vec4<f32>":`
669
+ data[offset] = v[0];
670
+ data[offset + 1] = v[1];
671
+ data[offset + 2] = v[2];
672
+ data[offset + 3] = v[3];`,"vec2<i32>":`
673
+ dataInt32[offset] = v[0];
674
+ dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
675
+ dataInt32[offset] = v[0];
676
+ dataInt32[offset + 1] = v[1];
677
+ dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
678
+ dataInt32[offset] = v[0];
679
+ dataInt32[offset + 1] = v[1];
680
+ dataInt32[offset + 2] = v[2];
681
+ dataInt32[offset + 3] = v[3];`,"vec2<u32>":`
682
+ dataInt32[offset] = v[0];
683
+ dataInt32[offset + 1] = v[1];`,"vec3<u32>":`
684
+ dataInt32[offset] = v[0];
685
+ dataInt32[offset + 1] = v[1];
686
+ dataInt32[offset + 2] = v[2];`,"vec4<u32>":`
687
+ dataInt32[offset] = v[0];
688
+ dataInt32[offset + 1] = v[1];
689
+ dataInt32[offset + 2] = v[2];
690
+ dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
691
+ data[offset] = v[0];
692
+ data[offset + 1] = v[1];
693
+ data[offset + 4] = v[2];
694
+ data[offset + 5] = v[3];`,"mat3x3<f32>":`
695
+ data[offset] = v[0];
696
+ data[offset + 1] = v[1];
697
+ data[offset + 2] = v[2];
698
+ data[offset + 4] = v[3];
699
+ data[offset + 5] = v[4];
700
+ data[offset + 6] = v[5];
701
+ data[offset + 8] = v[6];
702
+ data[offset + 9] = v[7];
703
+ data[offset + 10] = v[8];`,"mat4x4<f32>":`
704
+ for (let i = 0; i < 16; i++) {
705
+ data[offset + i] = v[i];
706
+ }`,"mat3x2<f32>":Bi(3,2),"mat4x2<f32>":Bi(4,2),"mat2x3<f32>":Bi(2,3),"mat4x3<f32>":Bi(4,3),"mat2x4<f32>":Bi(2,4),"mat3x4<f32>":Bi(3,4)},Ax={...wh,"mat2x2<f32>":`
707
+ data[offset] = v[0];
708
+ data[offset + 1] = v[1];
709
+ data[offset + 2] = v[2];
710
+ data[offset + 3] = v[3];
711
+ `}});function Rx(i,t){let{size:e,align:r}=Nr[i.data.type],s=(r-e)/4,n=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
712
+ v = uv.${i.data.name};
713
+ ${t!==0?`offset += ${t};`:""}
714
+
715
+ arrayOffset = offset;
716
+
717
+ t = 0;
718
+
719
+ for(var i=0; i < ${i.data.size*(e/4)}; i++)
720
+ {
721
+ for(var j = 0; j < ${e/4}; j++)
722
+ {
723
+ ${n}[arrayOffset++] = v[t++];
724
+ }
725
+ ${s!==0?`arrayOffset += ${s};`:""}
726
+ }
727
+ `}var Bx=p(()=>{ha()});function Gx(i){return ua(i,Ax,Rx)}var kx=p(()=>{Ch();Ph();Bx()});var Hr,Mh=p(()=>{P();ca();ha();kx();Hr=class extends cr{constructor(){super({createUboElements:Mx,generateUboSync:Gx})}};Hr.extension={type:[_.WebGPUSystem],name:"ubo"}});var ke,Js=p(()=>{Gt();Pt();ke=class extends lt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=j("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=j("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}get _gcLastUsed(){return this.buffer?._gcLastUsed??-1}set _gcLastUsed(t){this.buffer&&(this.buffer._gcLastUsed=t)}onBufferChange(){this._resourceId=j("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}});var da,Ix=p(()=>{"use strict";da=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 hr,tn,Fx=p(()=>{P();Rr();Js();or();Ix();Ar();hr=128,tn=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new da({minUniformOffsetAlignment:hr});let e=256/hr;for(let r=0;r<e;r++){let s=it.UNIFORM|it.COPY_DST;r===0&&(s|=it.COPY_SRC),this._buffers.push(new Ft({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(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/hr),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/hr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/hr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/hr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new ke({buffer:e,offset:(t/2|0)*256,size:hr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Vt({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 n=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),hr,t.getGPUBuffer(n),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._renderer=null}};tn.extension={type:[_.WebGPUPipes],name:"uniformBatch"}});function en(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.`)}rS(i)}function rS(i){let{buffers:t,attributes:e}=i,r={},s={};for(let n in t){let o=t[n];r[o.uid]=0,s[o.uid]=0}for(let n in e){let o=e[n];r[o.buffer.uid]+=Wt(o.format).stride}for(let n in e){let o=e[n];o.stride??(o.stride=r[o.buffer.uid]),o.start??(o.start=s[o.buffer.uid]),s[o.buffer.uid]+=Wt(o.format).stride}}var Ah=p(()=>{ot();sr()});var Ie,Rh=p(()=>{Ur();Ie=[];Ie[gt.NONE]=void 0;Ie[gt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Ie[gt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Ie[gt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Ie[gt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Ie[gt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}});function Ox(i,t){for(let[e,r]of Object.entries(t)){let s=new RegExp(`override\\s+${e}\\s*:\\s*(\\w+)\\s*(?:=[^;]*)?;`);i=i.replace(s,(n,o)=>{let a;return o==="u32"?a=`${Math.trunc(r)}u`:o==="i32"?a=`${Math.trunc(r)}`:a=Number.isInteger(r)?`${r}.0`:`${r}`,`const ${e}: ${o} = ${a};`})}return i}function Lx(i,t,e,r,s,n){return i*35184372088832+t*536870912+n*16384+(e<<8)+(r<<3)+s}function Hx(i){let t=Nx[i];return t===void 0&&(t=Nx[i]=nS++),t}function oS(i,t,e,r,s,n,o,a){return a<<20|n<<16|s<<13|e<<9|i<<6|o<<5|r<<1|t}var Dx,iS,sS,Ux,Nx,nS,rn,Wx=p(()=>{P();ot();Ah();fc();Ur();di();Rh();Dx={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},iS=new pi({}),sS={"depth24plus-stencil8":{depth:!0,stencil:!0,index:1},depth24plus:{depth:!0,stencil:!1,index:2},depth32float:{depth:!0,stencil:!1,index:3},"depth32float-stencil8":{depth:!0,stencil:!0,index:4},depth16unorm:{depth:!0,stencil:!1,index:5},stencil8:{depth:!1,stencil:!0,index:6}},Ux={depth:!1,stencil:!1,index:0};Nx=Object.create(null),nS=0;rn=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=new Map,this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._colorFormat="bgra8unorm",this._colorFormatId=Hx("bgra8unorm"),this._depthStencilFormat="depth24plus-stencil8",this._depthStencilFormatData=Ux,this._depthReadOnly=!1,this._invertFrontFace=!1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(gt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){let e=t.colorAttachments[0]?.texture;this._multisampleCount=e?.source.antialias?4:1,this._colorTargetCount=t.colorAttachments.length,this._colorFormat=e?.format??"bgra8unorm",this._colorFormatId=Hx(this._colorFormat),this._depthStencilFormat=t.depthStencilAttachment?.texture.format,this._depthStencilFormatData=sS[this._depthStencilFormat]||Ux,this._depthReadOnly=t.depthStencilAttachment?.depthReadOnly??!1,this._invertFrontFace=!!t.flipY,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Ie[t],this._updatePipeHash())}getBundleDescriptor(){let t=[];for(let r=0;r<this._colorTargetCount;r++)t.push(this._colorFormat);let e={colorFormats:t,sampleCount:this._multisampleCount};return(this._depthStencilFormatData.depth||this._depthStencilFormatData.stencil)&&(e.depthStencilFormat=this._depthStencilFormat),e}setPipeline(t,e,r,s){let n=this.getPipeline(t,e,r);s.setPipeline(n)}getPipelineKey(t,e,r,s,n){return t._layoutKey||(en(t,e.attributeData),this._generateBufferKey(t)),Lx(t._layoutKey,e._layoutKey,r.data,r._blendModeId,Dx[s],n.id)}getPipeline(t,e,r,s,n){t._layoutKey||(en(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology),n||(n=iS);let o=Lx(t._layoutKey,e._layoutKey,r.data,r._blendModeId,Dx[s],n.id),a=this._pipeCache.get(o);return a||(a=this._createPipeline(t,e,r,s,n),this._pipeCache.set(o,a)),a}_createPipeline(t,e,r,s,n){let o=this._gpu.device,a=this._createVertexBufferLayouts(t,e),l=this._renderer.state.getColorTargets(r,this._colorTargetCount,this._colorFormat),c=this._stencilMode===gt.RENDERING_MASK_ADD?0:this._colorMask;for(let x=0;x<l.length;x++)l[x].writeMask=c;let h=this._renderer.shader.getProgramData(e).pipeline,u=Object.keys(n.data).length>0,d=e.vertex.source,f=e.fragment.source,m;u&&(this._renderer.limits.supportsOverrideConstants?m=n.data:(d=Ox(d,n.data),f=Ox(f,n.data)));let g={vertex:{module:this._getModule(d),entryPoint:e.vertex.entryPoint,constants:m,buffers:a},fragment:{module:this._getModule(f),entryPoint:e.fragment.entryPoint,targets:l,constants:m},primitive:{topology:s,cullMode:r.culling?"back":"none",frontFace:r.clockwiseFrontFace!==this._invertFrontFace?"cw":"ccw"},layout:h,multisample:{count:this._multisampleCount},label:e.name?`PIXI Pipeline (${e.name})`:"PIXI Pipeline"};if(this._depthStencilFormatData.depth||this._depthStencilFormatData.stencil){let x=this._depthStencilFormatData;g.depthStencil={...this._stencilState,format:this._depthStencilFormat,depthWriteEnabled:x.depth?r.depthMask&&!this._depthReadOnly:!1,depthCompare:x.depth&&r.depthTest?"less":"always"}}return o.createRenderPipeline(g)}_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 o=0;o<s.length;o++){let a=t.attributes[s[o]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let n=e.join("|");return t._layoutKey=be(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let o=0;o<s.length;o++){let a=t.attributeData[s[o]];e[r++]=a.location}let n=e.join("|");return t._attributeLocationsKey=be(n,"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),n=Object.create(null),o=e.attributeData;for(let a=0;a<s.length;a++){let c=Object.values(s[a].attributes)[0].shaderLocation;for(let h in o)if(o[h].location===c){n[a]=h;break}}return this._bindingNamesCache[r]=n,n}_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(n=>{let o={arrayStride:0,stepMode:"vertex",attributes:[]},a=o.attributes;for(let l in e.attributeData){let c=t.attributes[l];(c.divisor??1)!==1&&O(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(o.arrayStride=c.stride,o.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(o)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){var t;let e=oS(this._stencilMode,this._multisampleCount===1?0:1,this._colorMask,this._colorTargetCount,this._depthStencilFormatData.index,this._colorFormatId,this._depthReadOnly?1:0,this._invertFrontFace?1:0);this._pipeCache=(t=this._pipeStateCaches)[e]??(t[e]=new Map)}destroy(){this._bufferLayoutsCache=null,this._pipeCache=null,this._gpu=null,this._renderer=null,this._bindingNamesCache=null,this._pipeStateCaches=null,this._moduleCache=null}};rn.extension={type:[_.WebGPUSystem],name:"pipeline"}});function Vx(i,t,e,r,s,n){let o=n?1:-1;return i.identity(),i.a=1/r*2,i.d=o*(1/s*2),i.tx=-1-t*i.a,i.ty=-o-e*i.d,i}var zx=p(()=>{"use strict"});function Xx(i){if(i.colorAttachments.length===0)return!1;let t=i.colorTexture.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Yx=p(()=>{"use strict"});var ur,fa=p(()=>{et();Ut();_t();ot();mi();zx();Ae();Oc();rr();Ot();mt();Th();Yx();vh();ur=class{constructor(t){this.rootViewPort=new q,this.viewport=new q,this.onRenderTargetChange=new gi("onRenderTargetChange"),this.projectionMatrix=new B,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._bindState={target:null,frame:void 0,mipLevel:0,layer:0,flipY:!1},this._bindFrame=new q,this._renderer=t,t.gc.addCollection(this,"_gpuRenderTargetHash","hash")}get renderSurface(){return this._bindState.target}get mipLevel(){return this._bindState.mipLevel}get layer(){return this._bindState.layer}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart(t){this._renderTargetStack.length=0,this.push(t),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Xx(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s,n=0,o=0,a){let l;"target"in t?l=t:(N("8.20.0","RenderTargetSystem.bind: positional arguments are deprecated, please use an options object instead: bind({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),l={target:t,clear:e,clearColor:r,frame:s,mipLevel:n,layer:o,flipY:a});let c=l.target;e=l.clear??!0,r=l.clearColor,n=(l.mipLevel??0)|0,o=(l.layer??0)|0,a=l.flipY,s=l.frame;let h=this.getRenderTarget(c),u=this.renderTarget!==h;this.renderTarget=h;let d=this.getGpuRenderTarget(h);(h.pixelWidth!==d.width||h.pixelHeight!==d.height)&&(this.adaptor.resizeGpuRenderTarget(h),d.width=h.pixelWidth,d.height=h.pixelHeight);let f=h.colorAttachments[0]?.texture||h.depthStencilAttachment?.texture,m=this.viewport,g=f.arrayLayerCount||1;if(o<0||o>=g)throw new Error(`[RenderTargetSystem] layer ${o} is out of bounds (arrayLayerCount=${g}).`);let y=this._bindState;y.target=c,y.frame=s?this._bindFrame.copyFrom(s):void 0,y.mipLevel=n,y.layer=o,y.flipY=a;let x=Math.max(f.pixelWidth>>n,1),b=Math.max(f.pixelHeight>>n,1);if(!s&&c instanceof U&&(s=c.frame),s){let v=f._resolution,T=1<<Math.max(n,0),S=s.x*v+.5|0,E=s.y*v+.5|0,w=s.width*v+.5|0,I=s.height*v+.5|0,G=Math.floor(S/T),M=Math.floor(E/T),C=Math.ceil(w/T),R=Math.ceil(I/T);G<0&&(C+=G,G=0),M<0&&(R+=M,M=0),G=Math.min(G,x-1),M=Math.min(M,b-1),C=Math.min(C,x-G),R=Math.min(R,b-M),C=Math.max(C,1),R=Math.max(R,1),m.x=G,m.y=M,m.width=C,m.height=R}else m.x=0,m.y=0,m.width=x,m.height=b;return h.flipY=a,Vx(this.projectionMatrix,0,0,m.width/f.resolution,m.height/f.resolution,!h.isRoot!=!!h.flipY),this.adaptor.startRenderPass(h,e,r,m,n,o),u&&this.onRenderTargetChange.emit(h),h}getBindState(t){if(!this.renderTarget)throw new Error("[RenderTargetSystem] getBindState is only valid while a render surface is bound");let e=this._bindState;return t??(t={}),t.target=e.target,t.clear=yt.NONE,t.clearColor=void 0,e.frame?t.frame?t.frame.copyFrom(e.frame):t.frame=e.frame.clone():t.frame=void 0,t.mipLevel=e.mipLevel,t.layer=e.layer,t.flipY=!!e.flipY,t}get frontFaceInverted(){let t=this.renderTarget;if(!t)return!1;let e=this._renderer.type===Rt.WEBGL&&!t.isRoot;return!!t.flipY!==e}clear(t,e=yt.ALL,r,s=this.mipLevel,n=this.layer){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport,s,n))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=yt.ALL,r,s,n=0,o=0,a){let l;"target"in t?l=t:(N("8.20.0","RenderTargetSystem.push: positional arguments are deprecated, please use an options object instead: push({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),l={target:t,clear:e,clearColor:r,frame:s,mipLevel:n,layer:o,flipY:a});let c=this.bind(l);return this._renderTargetStack.push({target:l.target,clear:!1,clearColor:void 0,frame:l.frame?l.frame.clone():void 0,mipLevel:l.mipLevel,layer:l.layer,flipY:l.flipY}),c}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];if(!t)throw new Error("[RenderTargetSystem] pop: no previous binding to restore (unbalanced pop)");return this.bind(t)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,n){let o=this.getRenderTarget(t);r.x<0&&(s.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,n.y-=r.y,r.y=0);let{pixelWidth:a,pixelHeight:l}=o;return s.width=Math.min(s.width,a-r.x),s.height=Math.min(s.height,l-r.y),this.adaptor.copyToTexture(o,e,r,s,n)}copyDepthTexture(t,e,r,s,n={x:0,y:0}){let o=this.getRenderTarget(t);if(!o.depthStencilAttachment){O("[RenderTargetSystem] copyDepthTexture: the source render target has no depth attachment to copy from");return}let a=e.source;if(!a.format.includes("depth")&&!a.format.includes("stencil")){O(`[RenderTargetSystem] copyDepthTexture: the destination texture must have a depth/stencil format (got '${a.format}')`);return}let l=r.x,c=r.y,h=n.x,u=n.y,d=s.width,f=s.height;l<0&&(d+=l,h-=l,l=0),c<0&&(f+=c,u-=c,c=0),d=Math.min(d,o.pixelWidth-l),f=Math.min(f,o.pixelHeight-c),d=Math.min(d,a.pixelWidth-h),f=Math.min(f,a.pixelHeight-u),!(d<=0||f<=0)&&this.adaptor.copyDepthTexture(o,e,{x:l,y:c},{width:d,height:f},{x:h,y:u})}ensureDepthStencil(){if(!this.renderTarget.stencil){if(this.renderTarget.depthStencilTexture){O(`[RenderTargetSystem] a stencil mask is being used, but the render target's depthStencilTexture format '${this.renderTarget.depthStencilTexture.format}' has no stencil aspect, so masking cannot work here. Use a 'depth24plus-stencil8' texture instead.`);return}this.renderTarget._depth=!0,this.renderTarget._stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer)}}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&this._releaseRenderTarget(e,t)}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;if(vt.test(t)&&(t=oa(t).source),t instanceof Pi)e=t;else if(t instanceof J){let r=t.format;e=r.includes("depth")||r.includes("stencil")?new Pi({colorTextures:0,depthStencilTexture:t}):new Pi({colorTextures:[t]}),t.source instanceof vt&&(e.isRoot=!0),t.once("destroy",this._onRenderSurfaceDestroy,this)}return this._renderSurfaceToRenderTargetHash.set(t,e),e}_onRenderSurfaceDestroy(t){let e=this._renderSurfaceToRenderTargetHash.get(t);e&&this._releaseRenderTarget(t,e)}_releaseRenderTarget(t,e){e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t),t.off("destroy",this._onRenderSurfaceDestroy,this);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this._bindState.target=null}}});var pa,jx=p(()=>{"use strict";pa=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});function lS(i){if(aS[i])return i;let t=navigator.gpu.getPreferredCanvasFormat();return O(`[WebGPU] CanvasSource format '${i}' is not a valid GPUCanvasContext format. Falling back to '${t}'. Allowed formats are: bgra8unorm, rgba8unorm, rgba16float.`),t}var aS,ma,$x=p(()=>{ot();mi();rr();Ot();jx();aS={bgra8unorm:!0,rgba8unorm:!0,rgba16float:!0};ma=class{constructor(){this._activePass=null}init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,n){let o=this._renderer;this.finishRenderPass();let a=this._getGpuColorTexture(t),l=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:l,origin:n},s),e}copyDepthTexture(t,e,r,s,n){let o=this._renderer;this.finishRenderPass();let a=t.depthStencilAttachment.texture,l=o.texture.getGpuSource(a),c=o.texture.getGpuSource(e.source),h=o.encoder.commandEncoder===null,u=h?o.gpu.device.createCommandEncoder():o.encoder.commandEncoder;u.copyTextureToTexture({texture:l,origin:r},{texture:c,origin:n},{width:s.width,height:s.height}),h&&o.gpu.device.queue.submit([u.finish()])}startRenderPass(t,e=!0,r,s,n=0,o=0){let l=this._renderTargetSystem.getGpuRenderTarget(t);if(o!==0&&l.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(n>0&&l.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");let c=e;typeof c=="boolean"&&(c=c?yt.ALL:yt.NONE),(t.stencil||t.depth)&&!t.depthStencilAttachment&&t.ensureDepthStencilTexture();let h=!!t.depthStencilAttachment,u=this._activePass;if(u!==null&&u.renderTarget===t&&u.mipLevel===n&&u.layer===o&&u.depthStencil===h&&this._renderer.encoder.renderPassEncoder!==null&&c===yt.NONE){this._renderer.encoder.setViewport(s);return}let f=this.getDescriptor(t,e,r,n,o);l.descriptor=f,this._renderer.pipeline.setRenderTarget(t),this._renderer.encoder.beginRenderPass(l),this._renderer.encoder.setViewport(s),this._activePass={renderTarget:t,mipLevel:n,layer:o,depthStencil:h}}finishRenderPass(){this._renderer.encoder.endRenderPass(),this._activePass=null}_getGpuColorTexture(t){if(t.colorAttachments.length===0)throw new Error("[GpuRenderTargetAdaptor] cannot get gpu color texture from a depth-only render target");let e=t.colorAttachments[0].texture;return e instanceof vt&&e._gpuContext?e._gpuContext.getCurrentTexture():this._renderer.texture.getGpuSource(e)}getDescriptor(t,e,r,s=0,n=0){typeof e=="boolean"&&(e=e?yt.ALL:yt.NONE);let o=this._renderTargetSystem,a=o.getGpuRenderTarget(t),l=t.colorAttachments.map((u,d)=>{let f=u.texture,m=f instanceof vt?f._gpuContext:null,g,y;if(m){if(n!==0)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");g=m.getCurrentTexture().createView(u.viewDescriptor)}else g=this._renderer.texture.getTextureRenderTargetView(u.texture,s,n,u.viewDescriptor);let x=!1;a.msaaTextures[d]&&(y=g,g=this._renderer.texture.getTextureView(a.msaaTextures[d]),x=a.msaaTextures[d].transient);let b=u.loadOp;e!==void 0&&(b=e&yt.COLOR?"clear":"load"),r??(r=o.defaultClearColor);let v=u.storeOp??"store",T={view:g,resolveTarget:y,storeOp:x?"discard":v,loadOp:b};b==="clear"&&(r??(r=u.clearValue??o.defaultClearColor),T.clearValue=r);for(let S in u)S!=="texture"&&S!=="viewDescriptor"&&S!=="clearValue"&&S!=="loadOp"&&S!=="storeOp"&&(T[S]=u[S]);return T}),c;if(t.depthStencilAttachment){a.msaa&&(t.depthStencilAttachment.texture.sampleCount=4),t.depthStencilAttachment.texture.transient=!!a.msaaTextures[0]?.transient;let u=t.depthStencilAttachment,d=u.texture.format.includes("stencil"),f=u.texture.format.includes("depth"),m=u.texture.transient?"discard":"store";c={view:this._renderer.texture.getTextureRenderTargetView(u.texture,s,n,u.viewDescriptor)};let g=u.depthReadOnly??!1,y=u.stencilReadOnly??g;d&&!y?(c.stencilLoadOp=e&yt.STENCIL?"clear":u.stencilLoadOp??"load",c.stencilStoreOp=u.stencilStoreOp??m,c.stencilLoadOp==="clear"&&(c.stencilClearValue=u.stencilClearValue??0)):d&&y&&(c.stencilReadOnly=!0),f&&!g?(c.depthLoadOp=e&yt.DEPTH?"clear":u.depthLoadOp??"load",c.depthStoreOp=u.depthStoreOp??m,c.depthLoadOp==="clear"&&(c.depthClearValue=u.depthClearValue??1)):f&&g&&(c.depthReadOnly=!0);for(let x in u)x!=="texture"&&x!=="viewDescriptor"&&x!=="stencilLoadOp"&&x!=="stencilStoreOp"&&x!=="stencilClearValue"&&x!=="stencilReadOnly"&&x!=="depthLoadOp"&&x!=="depthStoreOp"&&x!=="depthClearValue"&&x!=="depthReadOnly"&&(c[x]=u[x])}return{colorAttachments:l,depthStencilAttachment:c,label:t.label}}clear(t,e=!0,r,s,n=0,o=0){if(!e)return;let{gpu:a,encoder:l}=this._renderer,c=a.device;if(l.commandEncoder===null){let u=c.createCommandEncoder(),d=this.getDescriptor(t,e,r,n,o),f=u.beginRenderPass(d);f.setViewport(s.x,s.y,s.width,s.height,0,1),f.end();let m=u.finish();c.queue.submit([m])}else this.startRenderPass(t,e,r,s,n,o)}initGpuRenderTarget(t){t.isRoot=!0;let e=new pa;return t.colorAttachments.forEach((r,s)=>{let n=r.texture;if(n instanceof vt){if(!n._gpuContext){let o=n.resource.getContext("webgpu"),a=n.transparent?"premultiplied":"opaque",l=lS(n.format);try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:l,alphaMode:a,...l==="rgba16float"?{toneMapping:{mode:"extended"}}:{}})}catch(c){console.error(c)}n._gpuContext=o}e.contexts[s]=n._gpuContext}if(e.msaa=n.source.antialias,n.antialias){let o=new J({width:0,height:0,sampleCount:4,transient:n.transient,arrayLayerCount:n.arrayLayerCount,format:n.format});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilAttachment&&(t.depthStencilAttachment.texture.sampleCount=4,t.depthStencilAttachment.texture.transient=!!e.msaaTextures[0]?.transient)),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.depthStencilAttachment&&e.msaa&&(t.depthStencilAttachment.texture.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorAttachments.forEach((r,s)=>{let n=r.texture;e.msaaTextures[s]?.resize(n.width,n.height,n._resolution)})}}});var sn,Kx=p(()=>{P();fa();$x();sn=class extends ur{constructor(t){super(t),this.adaptor=new ma,this.adaptor.init(t,this)}};sn.extension={type:[_.WebGPUSystem],name:"renderTarget"}});var nn,qx=p(()=>{P();nn=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),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}};nn.extension={type:[_.WebGPUSystem],name:"shader"}});var Kt,Zx=p(()=>{"use strict";Kt={};Kt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Kt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Kt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Kt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Kt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Kt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Kt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Kt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Kt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Kt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Kt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Kt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var on,Qx=p(()=>{P();Re();Zx();on=class{constructor(){this.defaultState=new It,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t,e,r){let s=t.blend?Kt[t.blendMode]||Kt.normal:void 0,n=[];for(let o=0;o<e;o++)n[o]={format:r,writeMask:0,blend:s};return n}destroy(){this.gpu=null}};on.extension={type:[_.WebGPUSystem],name:"state"}});var Jx,t_=p(()=>{"use strict";Jx={type:"image",upload(i,t,e,r=0){let s=i.resource,n=(i.pixelWidth|0)*(i.pixelHeight|0),o=s.byteLength/n;e.device.queue.writeTexture({texture:t,origin:{x:0,y:0,z:r}},s,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelWidth*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var Bh,cS,e_,r_=p(()=>{"use strict";Bh={"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}},cS={blockBytes:4,blockWidth:1,blockHeight:1},e_={type:"compressed",upload(i,t,e,r=0){let s=i.pixelWidth,n=i.pixelHeight,o=Bh[i.format]||cS;for(let a=0;a<i.resource.length;a++){let l=i.resource[a],c=Math.ceil(s/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:r}},l,{offset:0,bytesPerRow:c},{width:Math.ceil(s/o.blockWidth)*o.blockWidth,height:Math.ceil(n/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),n=Math.max(n>>1,1)}}}});function s_(i){return{type:"cube",upload(t,e,r){let s=t.faces;for(let n=0;n<i_.length;n++){let o=i_[n],a=s[o];(i[a.uploadMethodId]||i.image).upload(a,e,r,n)}}}}var i_,n_=p(()=>{"use strict";i_=["right","left","top","bottom","front","back"]});var ga,Gh=p(()=>{dt();ot();ga={type:"image",upload(i,t,e,r=0){let s=i.resource;if(!s)return;if(globalThis.HTMLImageElement&&s instanceof HTMLImageElement){let l=W.get().createCanvas(s.width,s.height);l.getContext("2d").drawImage(s,0,0,s.width,s.height),i.resource=l,O("ImageSource: Image element passed, converting to canvas and replacing resource.")}let n=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),a=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:s},{texture:t,origin:{x:0,y:0,z:r},premultipliedAlpha:a},{width:n,height:o})}}});var o_,a_=p(()=>{Gh();o_={type:"video",upload(i,t,e,r){ga.upload(i,t,e,r)}}});var xa,l_=p(()=>{"use strict";xa=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:`
728
+ var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
729
+ vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
730
+
731
+ struct VertexOutput {
732
+ @builtin(position) position : vec4<f32>,
733
+ @location(0) texCoord : vec2<f32>,
734
+ };
735
+
736
+ @vertex
737
+ fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
738
+ var output : VertexOutput;
739
+ output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
740
+ output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
741
+ return output;
742
+ }
743
+
744
+ @group(0) @binding(0) var imgSampler : sampler;
745
+ @group(0) @binding(1) var img : texture_2d<f32>;
746
+
747
+ @fragment
748
+ fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
749
+ return textureSample(img, imgSampler, texCoord);
750
+ }
751
+ `})),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,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(l)}let o=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let c=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),h=n?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=o.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),c=d}}if(!n){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let c=1;c<t.mipLevelCount;++c)o.copyTextureToTexture({texture:r,mipLevel:c-1},{texture:t,mipLevel:c},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([o.finish()]),n||r.destroy(),t}}});function c_(i){return`${i.format||""}.${i.dimension||""}.${i.aspect||""}.${i.baseMipLevel||0}.${i.mipLevelCount||""}.${i.baseArrayLayer||0}.${i.arrayLayerCount||""}`}var kh,Ih,Fh,u_=p(()=>{dt();P();ve();ce();yo();Ar();t_();r_();n_();Gh();a_();l_();kh=class{constructor(t){this.textureView=null,this.textureViews=Object.create(null),this.gpuTexture=t}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.textureViews=null,this.gpuTexture=null}};Ih=class h_{constructor(t){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=t,t.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new Ct({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});let e={image:ga,buffer:Jx,video:o_,compressed:e_,...h_.uploadExtensions};this._uploads={...e,cube:s_(e)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gpu=t}initSource(t){return t._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(t)}_initSource(t){if(t.autoGenerateMipmaps){let c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e;t.sampleCount>1?(e=GPUTextureUsage.RENDER_ATTACHMENT,t.transient&&this._renderer.device.extensions.transientAttachment&&(e|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC));let r=Bh[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,n=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,o={label:t.label,size:{width:s,height:n,depthOrArrayLayers:t.arrayLayerCount},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(o);return t._gpuData[this._renderer.uid]=new kh(a),this._managedTextures.add(t)&&(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("updateMipmaps",this.onUpdateMipmaps,this)),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))}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new xa(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceUnload(t){t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(t){t._gcLastUsed=this._renderer.gc.now;let e=t._gpuData[this._renderer.uid],r=e?.gpuTexture;r?(r.width!==t.pixelWidth||r.height!==t.pixelHeight)&&(e.destroy(),this._bindGroupHash[t.uid]=null,t._gpuData[this._renderer.uid]=null,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 t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]?.gpuTexture||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 Vt({0:e,1:e.style,2:new St({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t,e){var r;let s=t.source;s._gcLastUsed=this._renderer.gc.now;let n=s._gpuData[this._renderer.uid];n||(this.initSource(s),n=s._gpuData[this._renderer.uid]);let o=e?c_(e):0;return(r=n.textureViews)[o]||(r[o]=n.gpuTexture.createView({dimension:s.viewDimension,...e})),n.textureViews[o]}getTextureRenderTargetView(t,e=0,r=0,s){var n;let o=t.source;o._gcLastUsed=this._renderer.gc.now;let a=o._gpuData[this._renderer.uid];a||(this.initSource(o),a=o._gpuData[this._renderer.uid]);let l=r*(o.mipLevelCount||1)+e+1;return s&&(l=`${l}.${c_(s)}`),(n=a.textureViews)[l]||(n[l]=a.gpuTexture.createView({dimension:"2d",baseMipLevel:e,mipLevelCount:1,baseArrayLayer:r,arrayLayerCount:1,...s})),a.textureViews[l]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=W.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let n=s.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:W.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Ye.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:n,height:o}=e,a=s.getImageData(0,0,n,o),l=new Uint8ClampedArray(a.data.buffer);return Ye.returnCanvasAndContext(r),{pixels:l,width:n,height:o}}destroy(){this._managedTextures.destroy();for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};Ih.extension={type:[_.WebGPUSystem],name:"texture"};Ih.uploadExtensions=Object.create(null);Fh=Ih;H.handleByMap(_.TextureUploaderWebGPU,Fh.uploadExtensions)});var m_={};sl(m_,{WebGPURenderer:()=>Dh});var hS,uS,dS,d_,f_,p_,Dh,g_=p(()=>{P();lg();ug();dg();kr();la();Ae();vx();Tx();Sx();Ex();Cx();wx();Px();Mh();Fx();Wx();Kx();qx();Qx();u_();hS=[...Ai,Hr,Ks,Ri,qs,js,Fh,sn,nn,on,rn,$s,Zs,Ys],uS=[...aa,tn],dS=[Ps,ws,Cs],d_=[],f_=[],p_=[];H.handleByNamedList(_.WebGPUSystem,d_);H.handleByNamedList(_.WebGPUPipes,f_);H.handleByNamedList(_.WebGPUPipesAdaptor,p_);H.add(...hS,...uS,...dS);Dh=class extends ue{constructor(){let t={name:"webgpu",type:Rt.WEBGPU,systems:d_,renderPipes:f_,renderPipeAdaptors:p_};super(t)}}});var an,x_=p(()=>{P();et();bi();zo();jo();Es();Si();oh();nr();ce();an=class{contextChange(t){let e=new St({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=t.limits.maxBatchableTextures,s=yi({name:"graphics",bits:[Vo,Yo(r),$o,Ti]});this.shader=new zt({glProgram:s,resources:{localUniforms:e,batchSamplers:ea(r)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(r);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(a.geometry,s.glProgram);let c=l.instructions;for(let h=0;h<l.instructionSize;h++){let u=c[h];if(u.size){for(let d=0;d<u.textures.count;d++)n.texture.bind(u.textures.textures[d],d);n.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};an.extension={type:[_.WebGLPipesAdaptor],name:"graphics"}});var ln,__=p(()=>{P();et();bi();Es();Si();Yc();nr();mt();ot();ln=class{init(){let t=yi({name:"mesh",bits:[$o,hg,Ti]});this._shader=new zt({glProgram:t,resources:{uTexture:U.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}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 n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.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}};ln.extension={type:[_.WebGLPipesAdaptor],name:"mesh"}});var cn,y_=p(()=>{P();Re();cn=class{constructor(){this._tempState=It.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,n=this._didUploadHash[r.uid];s.shader.bind(r,n),n||(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 n=0;n<e.textures.count;n++)r.texture.bind(s[n],n);r.geometry.draw(e.topology,e.size,e.start)}};cn.extension={type:[_.WebGLPipesAdaptor],name:"batch"}});var hn,b_=p(()=>{"use strict";hn=(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))(hn||{})});var _a,v_=p(()=>{"use strict";_a=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}});var un,T_=p(()=>{P();ve();or();b_();v_();un=class{constructor(t){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._managedBuffers=new Ct({renderer:t,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.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 n=this._boundBufferBases[s];if(n&&n._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:n}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,n.bindBufferRange(n.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,n=t.descriptor.usage&it.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,t._updateOffset,s,t._updateOffset/s.BYTES_PER_ELEMENT,(t._updateSize||s.byteLength)/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,n)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,n)),r}destroyAll(t=!1){this._managedBuffers.removeAll(t)}onBufferUnload(t,e=!1){let r=t._gpuData[this._renderer.uid];r&&(e||this._gl.deleteBuffer(r.buffer))}createGLBuffer(t){let{_gl:e}=this,r=hn.ARRAY_BUFFER;t.descriptor.usage&it.INDEX?r=hn.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&it.UNIFORM&&(r=hn.UNIFORM_BUFFER);let s=new _a(e.createBuffer(),r);return t._gpuData[this._renderer.uid]=s,this._managedBuffers.add(t),s}resetState(){this._boundBufferBases=Object.create(null)}};un.extension={type:[_.WebGLSystem],name:"buffer"}});var Uh,E_,C_=p(()=>{dt();P();ot();Uh=class S_{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={...S_.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=W.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,n=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:n,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 W.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,n=this.extensions;r.uint32Indices=s||!!n.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!n.vertexArrayObject,r.srgbTextures=s||!!n.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")}};Uh.extension={type:[_.WebGLSystem],name:"context"};Uh.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};E_=Uh});var ya,dn,nt,ba=p(()=>{"use strict";ya=(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))(ya||{}),dn=(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))(dn||{}),nt=(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))(nt||{})});function P_(i){return w_[i]??w_.float32}var w_,M_=p(()=>{ba();w_={uint8x2:nt.UNSIGNED_BYTE,uint8x4:nt.UNSIGNED_BYTE,sint8x2:nt.BYTE,sint8x4:nt.BYTE,unorm8x2:nt.UNSIGNED_BYTE,unorm8x4:nt.UNSIGNED_BYTE,snorm8x2:nt.BYTE,snorm8x4:nt.BYTE,uint16x2:nt.UNSIGNED_SHORT,uint16x4:nt.UNSIGNED_SHORT,sint16x2:nt.SHORT,sint16x4:nt.SHORT,unorm16x2:nt.UNSIGNED_SHORT,unorm16x4:nt.UNSIGNED_SHORT,snorm16x2:nt.SHORT,snorm16x4:nt.SHORT,float16x2:nt.HALF_FLOAT,float16x4:nt.HALF_FLOAT,float32:nt.FLOAT,float32x2:nt.FLOAT,float32x3:nt.FLOAT,float32x4:nt.FLOAT,uint32:nt.UNSIGNED_INT,uint32x2:nt.UNSIGNED_INT,uint32x3:nt.UNSIGNED_INT,uint32x4:nt.UNSIGNED_INT,sint32:nt.INT,sint32x2:nt.INT,sint32x3:nt.INT,sint32x4:nt.INT}});var fS,Oh,fn,A_=p(()=>{P();ve();sr();Ah();M_();fS={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Oh=class{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}},fn=class{constructor(t){this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new Ct({renderer:t,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}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");this.destroyAll(!0);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,n,o,a)=>{r.drawArraysInstancedANGLE(s,n,o,a)},t.drawElementsInstanced=(s,n,o,a,l)=>{r.drawElementsInstancedANGLE(s,n,o,a,l)},t.vertexAttribDivisor=(s,n)=>r.vertexAttribDivisorANGLE(s,n)),this._activeGeometry=null,this._activeVao=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)}t._gcLastUsed=this._renderer.gc.now}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let n in s)if(!r[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,n=["g",t.uid];for(let o in r)s[o]&&n.push(o,s[o].location);return n.join("-")}getVao(t,e){return t._gpuData[this._renderer.uid]?.vaoCache[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let o=this.getSignature(t,e),a=t._gpuData[this._renderer.uid];a||(a=new Oh,t._gpuData[this._renderer.uid]=a,this._managedGeometries.add(t));let l=a.vaoCache,c=l[o];if(c)return l[e._key]=c,c;en(t,e._attributeData);let h=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let u=0;u<h.length;u++){let d=h[u];n.bind(d)}return this.activateVao(t,e),l[e._key]=c,l[o]=c,s.bindVertexArray(null),c}onGeometryUnload(t,e=!1){let r=t._gpuData[this._renderer.uid];if(!r)return;let s=r.vaoCache;if(!e)for(let n in s)this._activeVao!==s[n]&&this.resetState(),this.gl.deleteVertexArray(s[n])}destroyAll(t=!1){this._managedGeometries.removeAll(t)}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,n=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let o=null;for(let a in n){let l=n[a],c=l.buffer,h=s.getGlBuffer(c),u=e._attributeData[a];if(u){o!==h&&(s.bind(c),o=h);let d=u.location;r.enableVertexAttribArray(d);let f=Wt(l.format),m=P_(l.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,m,l.stride,l.offset):r.vertexAttribPointer(d,f.size,m,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let g=l.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:n}=this._renderer,o=this._activeGeometry,a=fS[t||o.topology];if(s??(s=o.instanceCount),o.indexBuffer){let l=o.indexBuffer.data.BYTES_PER_ELEMENT,c=l===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;s!==1?n.drawElementsInstanced(a,e||o.indexBuffer.data.length,c,(r||0)*l,s):n.drawElements(a,e||o.indexBuffer.data.length,c,(r||0)*l)}else s!==1?n.drawArraysInstanced(a,r||0,e||o.vertexCount,s):n.drawArrays(a,r||0,e||o.vertexCount);return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};fn.extension={type:[_.WebGLSystem],name:"geometry"}});var pS,Lh,B_,G_=p(()=>{P();ot();fs();nr();Re();Ot();mt();Mr();pS=new Be({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Lh=class R_{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...R_.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=It.for2d();let s=new ae({vertex:`
752
+ attribute vec2 aPosition;
753
+ out vec2 vUv;
754
+
755
+ void main() {
756
+ gl_Position = vec4(aPosition, 0.0, 1.0);
757
+
758
+ vUv = (aPosition + 1.0) / 2.0;
759
+
760
+ // flip dem UVs
761
+ vUv.y = 1.0 - vUv.y;
762
+ }`,fragment:`
763
+ in vec2 vUv;
764
+ out vec4 finalColor;
765
+
766
+ uniform sampler2D uTexture;
767
+
768
+ void main() {
769
+ finalColor = texture(uTexture, vUv);
770
+ }`,name:"big-triangle"});this._bigTriangleShader=new zt({glProgram:s,resources:{uTexture:U.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({target:this._targetTexture,clear:!1}),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:pS,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new U({source:new J({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)}};Lh.extension={type:[_.WebGLSystem],name:"backBuffer",priority:1};Lh.defaultOptions={useBackBuffer:!1};B_=Lh});var pn,k_=p(()=>{P();pn=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)))}};pn.extension={type:[_.WebGLSystem],name:"colorMask"}});var mn,I_=p(()=>{P();mn=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:n,skipSync:o,topology:a,size:l,start:c,instanceCount:h}=t;e.shader.bind(s,o),e.geometry.bind(r,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,l,c,h??r.instanceCount)}destroy(){this._renderer=null}};mn.extension={type:[_.WebGLSystem],name:"encoder"}});var gn,F_=p(()=>{P();sh();gn=class{constructor(t){this._renderer=t}contextChange(){let t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Zo(this.maxTextures,t);let e=this._renderer.context.webGLVersion===2;this.maxUniformBindings=e?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}};gn.extension={type:[_.WebGLSystem],name:"limits"}});var xn,D_=p(()=>{P();Rh();Ur();xn=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:gt.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:gt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=gt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=Ie[t],o=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===gt.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!==o.stencilMode||o.stencilReference!==e)&&(o.stencilMode=t,o.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}};xn.extension={type:[_.WebGLSystem],name:"stencil"}});function U_(i){let t=i.map(n=>({data:n,offset:0,size:0})),e=16,r=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];if(r=_n[o.data.type],!r)throw new Error(`Unknown type ${o.data.type}`);o.data.size>1&&(r=Math.max(r,e)*o.data.size);let a=r===12?16:r;o.size=r;let l=s%e;l>0&&e-l<a?s+=(e-l)%16:s+=(r-l%r)%r,o.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var _n,va=p(()=>{"use strict";_n={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,u32:4,"vec2<u32>":8,"vec3<u32>":12,"vec4<u32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function O_(i,t){let e=Math.max(_n[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,n=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
771
+ v = uv.${i.data.name};
772
+ offset += ${t};
773
+
774
+ arrayOffset = offset;
775
+
776
+ t = 0;
777
+
778
+ for(var i=0; i < ${i.data.size*e}; i++)
779
+ {
780
+ for(var j = 0; j < ${r}; j++)
781
+ {
782
+ ${n}[arrayOffset++] = v[t++];
783
+ }
784
+ ${s!==0?`arrayOffset += ${s};`:""}
785
+ }
786
+ `}var L_=p(()=>{va()});function N_(i){return ua(i,wh,O_)}var H_=p(()=>{Ch();Ph();L_()});var Wr,Nh=p(()=>{P();ca();va();H_();Wr=class extends cr{constructor(){super({createUboElements:U_,generateUboSync:N_})}};Wr.extension={type:[_.WebGLSystem],name:"ubo"}});var Ta,W_=p(()=>{"use strict";Ta=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this._attachedMipLevel=0,this._attachedLayer=0,this.msaaRenderBuffer=[]}}});var Sa,V_=p(()=>{Ut();ot();rr();mi();W_();Sa=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new q,this._boundFramebuffer=void 0}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new q,this._boundFramebuffer=void 0;let t=this._renderer.gl;this._drawBuffersCache=[];for(let e=1;e<=16;e++)this._drawBuffersCache[e]=Array.from({length:e},(r,s)=>t.COLOR_ATTACHMENT0+s)}copyToTexture(t,e,r,s,n){let o=this._renderTargetSystem,a=this._renderer,l=o.getGpuRenderTarget(t),c=a.gl;return this.finishRenderPass(t),c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),this._boundFramebuffer=l.resolveTargetFramebuffer,a.texture.bind(e,0),c.copyTexSubImage2D(c.TEXTURE_2D,0,n.x,n.y,r.x,r.y,s.width,s.height),e}copyDepthTexture(t,e,r,s,n){let o=this._renderTargetSystem,a=this._renderer.gl;this.finishRenderPass(t);let l=o.getRenderTarget(e),c=o.getGpuRenderTarget(t),h=o.getGpuRenderTarget(l);a.bindFramebuffer(a.READ_FRAMEBUFFER,c.framebuffer),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,h.framebuffer),this._boundFramebuffer=void 0,a.blitFramebuffer(r.x,r.y,r.x+s.width,r.y+s.height,n.x,n.y,n.x+s.width,n.y+s.height,a.DEPTH_BUFFER_BIT,a.NEAREST)}startRenderPass(t,e=!0,r,s,n=0,o=0){let l=this._renderTargetSystem.getGpuRenderTarget(t);if(o!==0&&this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to array layers requires WebGL2.");if(n>0){if(l.msaa)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to mip levels requires WebGL2.")}t.colorAttachments.forEach(d=>{this._renderer.texture.unbind(d.texture)});let c=this._renderer.gl;this.bindFramebuffer(l.framebuffer),!t.isRoot&&t.colorAttachments.length>0&&(l._attachedMipLevel!==n||l._attachedLayer!==o)&&(t.colorAttachments.forEach((d,f)=>{let m=d.texture,g=this._renderer.texture.getGlSource(m);if(g.target===c.TEXTURE_2D){if(o!==0)throw new Error("[RenderTargetSystem] layer must be 0 when rendering to 2D textures in WebGL.");c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0+f,c.TEXTURE_2D,g.texture,n)}else if(g.target===c.TEXTURE_2D_ARRAY){if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to 2D array textures requires WebGL2.");c.framebufferTextureLayer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0+f,g.texture,n,o)}else if(g.target===c.TEXTURE_CUBE_MAP){if(o<0||o>5)throw new Error("[RenderTargetSystem] Cube map layer must be between 0 and 5.");c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0+f,c.TEXTURE_CUBE_MAP_POSITIVE_X+o,g.texture,n)}else throw new Error("[RenderTargetSystem] Unsupported texture target for render-to-layer in WebGL.")}),l._attachedMipLevel=n,l._attachedLayer=o),l.framebuffer&&(t.depthStencilAttachment?this._attachDepthStencilTexture(t,n,o):!l.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(l)),t.colorAttachments.length>1&&this._setDrawBuffers(t,c);let h=s.y;t.isRoot&&(h=t.pixelHeight-s.height-s.y);let u=this._viewPortCache;(u.x!==s.x||u.y!==h||u.width!==s.width||u.height!==s.height)&&(u.x=s.x,u.y=h,u.width=s.width,u.height=s.height,c.viewport(s.x,h,s.width,s.height)),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa||t.colorAttachments.length===0)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),this._boundFramebuffer=r.framebuffer}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Ta;s._attachedMipLevel=0,s._attachedLayer=0;let n=t.colorTexture;return n instanceof vt?(this._renderer.context.ensureCanvasSize(n.resource),s.framebuffer=null,s):(s.width=t.pixelWidth,s.height=t.pixelHeight,t.colorAttachments.length===0?this._initDepth(t,s):this._initColor(t,s),t.depthStencilAttachment&&this._attachDepthStencilTexture(t,0,0),r.bindFramebuffer(r.FRAMEBUFFER,null),this._boundFramebuffer=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,s,n=0,o=0){if(!e)return;if(o!==0)throw new Error("[RenderTargetSystem] Clearing array layers is not supported in WebGL renderer.");let a=this._renderTargetSystem;if(typeof e=="boolean"&&(e=e?yt.ALL:yt.NONE),t.colorAttachments.length===0&&(e&=~yt.COLOR,!e))return;let l=this._renderer.gl,c=!!(e&yt.DEPTH)&&!this._renderer.state.depthMaskEnabled;if(e&yt.COLOR){r??(r=a.defaultClearColor);let h=this._clearColorCache,u=r;(h[0]!==u[0]||h[1]!==u[1]||h[2]!==u[2]||h[3]!==u[3])&&(h[0]=u[0],h[1]=u[1],h[2]=u[2],h[3]=u[3],l.clearColor(u[0],u[1],u[2],u[3]))}c&&l.depthMask(!0),l.clear(e),c&&l.depthMask(!1)}resizeGpuRenderTarget(t){if(t.isRoot)return;let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.pixelWidth,e.height=t.pixelHeight,t.colorAttachments.length>0&&this._resizeColor(t,e),e.depthStencilRenderBuffer&&this._resizeStencil(e),this._boundFramebuffer=void 0}_initColor(t,e){let r=this._renderer,s=r.gl,n=s.createFramebuffer();if(e.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorAttachments.forEach((a,l)=>{let c=a.texture;c.antialias&&(r.context.supports.msaa?e.msaa=!0:O("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(c,0);let h=r.texture.getGlSource(c),u=h.texture;if(h.target===s.TEXTURE_2D)s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+l,s.TEXTURE_2D,u,0);else if(h.target===s.TEXTURE_2D_ARRAY){if(r.context.webGLVersion<2)throw new Error("[RenderTargetSystem] TEXTURE_2D_ARRAY requires WebGL2.");s.framebufferTextureLayer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+l,u,0,0)}else if(h.target===s.TEXTURE_CUBE_MAP)s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+l,s.TEXTURE_CUBE_MAP_POSITIVE_X,u,0);else throw new Error("[RenderTargetSystem] Unsupported texture target for framebuffer attachment.")}),e.msaa){let a=s.createFramebuffer();e.framebuffer=a,s.bindFramebuffer(s.FRAMEBUFFER,a),t.colorAttachments.forEach((l,c)=>{let h=s.createRenderbuffer();e.msaaRenderBuffer[c]=h})}else e.framebuffer=n;this._resizeColor(t,e)}_initDepth(t,e){let r=this._renderer;if(r.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Depth-only render targets require WebGL2.");let s=r.gl,n=s.createFramebuffer();e.resolveTargetFramebuffer=n,e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),s.drawBuffers([s.NONE]),s.readBuffer(s.NONE)}_resizeColor(t,e){let r=t.colorAttachments[0].texture;if(e._attachedMipLevel=0,e._attachedLayer=0,t.colorAttachments.forEach((s,n)=>{n!==0&&s.texture.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,n=s.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorAttachments.forEach((a,l)=>{let c=a.texture;s.texture.bindSource(c,0);let u=s.texture.getGlSource(c).internalFormat,d=e.msaaRenderBuffer[l];n.bindRenderbuffer(n.RENDERBUFFER,d),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,u,c.pixelWidth,c.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+l,n.RENDERBUFFER,d)})}}_attachDepthStencilTexture(t,e,r){let s=this._renderer,n=s.gl,o=t.depthStencilAttachment.texture,a=s.texture.getGlSource(o),l=a.texture,c=o.format,h;c==="depth24plus-stencil8"||c==="depth32float-stencil8"?h=n.DEPTH_STENCIL_ATTACHMENT:c==="stencil8"?h=n.STENCIL_ATTACHMENT:h=n.DEPTH_ATTACHMENT,a.target===n.TEXTURE_2D?n.framebufferTexture2D(n.FRAMEBUFFER,h,n.TEXTURE_2D,l,e):a.target===n.TEXTURE_2D_ARRAY?n.framebufferTextureLayer(n.FRAMEBUFFER,h,l,e,r):a.target===n.TEXTURE_CUBE_MAP&&n.framebufferTexture2D(n.FRAMEBUFFER,h,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,l,e)}_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){if(t.colorAttachments.length===0)return;let e=t.colorAttachments[0].texture.resource;this._renderer.context.multiView&&vt.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(!this._renderer.context.multiView||t.colorAttachments.length===0)return;let e=t.colorAttachments[0].texture;if(vt.test(e.resource)){let r=this._renderer.context.canvas,s=e;s.context2D.drawImage(r,0,s.pixelHeight-r.height)}}_setDrawBuffers(t,e){let r=t.colorAttachments.length,s=this._drawBuffersCache[r];if(this._renderer.context.webGLVersion===1){let n=this._renderer.context.extensions.drawBuffers;n?n.drawBuffersWEBGL(s):O("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else e.drawBuffers(s)}resetState(){this._boundFramebuffer=void 0,this._viewPortCache=new q,this._clearColorCache=[0,0,0,0]}bindFramebuffer(t){this._boundFramebuffer!==t&&(this._boundFramebuffer=t,this._renderer.gl.bindFramebuffer(this._renderer.gl.FRAMEBUFFER,t))}}});var yn,z_=p(()=>{P();fa();V_();yn=class extends ur{constructor(t){super(t),this.adaptor=new Sa,this.adaptor.init(t,this)}resetState(){this.adaptor.resetState()}};yn.extension={type:[_.WebGLSystem],name:"renderTarget"}});var Gi,Hh=p(()=>{Gt();Pt();Gi=class extends lt{constructor(t,e){super(),this._resourceType="textureView",this._resourceId=j("resource"),this._touched=0,this.source=t,this.viewDescriptor=e,this._onChange=this._onChange.bind(this),this._onDestroy=this._onDestroy.bind(this),this.source.on("change",this._onChange),this.source.on("destroy",this._onDestroy)}_onChange(){this.emit("change",this)}_onDestroy(){this.destroy()}get destroyed(){return this.source.destroyed}destroy(){this.source&&(this.source.off("change",this._onChange),this.source.off("destroy",this._onDestroy)),this.emit("destroy",this),this.removeAllListeners()}}});function X_(i,t){let e=[],r=[`
787
+ var g = s.groups;
788
+ var sS = r.shader;
789
+ var p = s.glProgram;
790
+ var ugS = r.uniformGroup;
791
+ var resources;
792
+ `],s=!1,n=0,o=t._getProgramData(i.glProgram);for(let l in i.groups){let c=i.groups[l];e.push(`
793
+ resources = g[${l}].resources;
794
+ `);for(let h in c.resources){let u=c.resources[h];if(u instanceof St)if(u.ubo){let d=i._uniformBindMap[l][Number(h)];e.push(`
795
+ sS.bindUniformBlock(
796
+ resources[${h}],
797
+ '${d}',
798
+ ${i.glProgram._uniformBlockData[d].index}
799
+ );
800
+ `)}else e.push(`
801
+ ugS.updateUniformGroup(resources[${h}], p, sD);
802
+ `);else if(u instanceof ke){let d=i._uniformBindMap[l][Number(h)];e.push(`
803
+ sS.bindUniformBlock(
804
+ resources[${h}],
805
+ '${d}',
806
+ ${i.glProgram._uniformBlockData[d].index}
807
+ );
808
+ `)}else if(u instanceof J||u instanceof Gi){let d=i._uniformBindMap[l][h],f=o.uniformData[d];f&&(s||(s=!0,r.push(`
809
+ var tS = r.texture;
810
+ `)),t._gl.uniform1i(f.location,n),e.push(`
811
+ tS.bind(resources[${h}], ${n});
812
+ `),n++)}}}let a=[...r,...e].join(`
813
+ `);return new Function("r","s","sD",a)}var Y_=p(()=>{Js();ce();Ot();Hh()});var Ea,j_=p(()=>{"use strict";Ea=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 Wh(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var $_=p(()=>{"use strict"});function Vh(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Ca(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 Vh(2*t);case"bvec3":return Vh(3*t);case"bvec4":return Vh(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 zh=p(()=>{"use strict"});function Xh(i,t){if(!wa){let e=Object.keys(K_);wa={};for(let r=0;r<e.length;++r){let s=e[r];wa[i[s]]=K_[s]}}return wa[t]}function q_(i,t){let e=Xh(i,t);return mS[e]||"float32"}var wa,K_,mS,Yh=p(()=>{"use strict";wa=null,K_={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_2D_SHADOW:"sampler2DShadow",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_CUBE_SHADOW:"samplerCubeShadow",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray",SAMPLER_2D_ARRAY_SHADOW:"sampler2DArrayShadow"},mS={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 Z_(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let o=0;o<s;o++){let a=t.getActiveAttrib(i,o);if(a.name.startsWith("gl_"))continue;let l=q_(t,a.type);r[a.name]={location:0,format:l,stride:Wt(l).stride,offset:0,instance:!1,start:0}}let n=Object.keys(r);if(e){n.sort((o,a)=>o>a?1:-1);for(let o=0;o<n.length;o++)r[n[o]].location=o,t.bindAttribLocation(i,o,n[o]);t.linkProgram(i)}else for(let o=0;o<n.length;o++)r[n[o]].location=t.getAttribLocation(i,n[o]);return r}var Q_=p(()=>{sr();Yh()});function J_(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 n=t.getActiveUniformBlockName(i,s),o=t.getUniformBlockIndex(i,n),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[n]={name:n,index:o,size:a}}return e}var ty=p(()=>{"use strict"});function ey(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let n=t.getActiveUniform(i,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),l=Xh(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:Ca(l,n.size)}}return e}var ry=p(()=>{zh();Yh()});function iy(i,t){let e=i.getShaderSource(t);if(e===null){console.error("PixiJS Error: Could not retrieve shader source (WebGL context may be lost).");return}let r=e.split(`
814
+ `).map((h,u)=>`${u}: ${h}`),s=i.getShaderInfoLog(t)??"",n=s.split(`
815
+ `),o={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),l=[""];a.forEach(h=>{r[h-1]=`%c${r[h-1]}%c`,l.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let c=r.join(`
816
+ `);l[0]=c,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...l),console.groupEnd()}function sy(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||iy(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||iy(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var ny=p(()=>{"use strict"});function oy(i,t){let e=Wh(i,i.VERTEX_SHADER,t.vertex),r=Wh(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let n=t.transformFeedbackVaryings;n&&(typeof i.transformFeedbackVaryings!="function"?O("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||sy(i,s,e,r),t._attributeData=Z_(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=ey(s,i),t._uniformBlockData=J_(s,i),i.deleteShader(e),i.deleteShader(r);let o={};for(let l in t._uniformData){let c=t._uniformData[l];o[l]={location:i.getUniformLocation(s,l),value:Ca(c.type,c.size)}}return new Ea(s,o)}var ay=p(()=>{ot();j_();$_();zh();Q_();ty();ry();ny()});var Pa,Vr,jh=p(()=>{P();Y_();ay();Pa={textureCount:0,blockIndex:0},Vr=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(t,e){if(this._setProgram(t.glProgram),e)return;Pa.textureCount=0,Pa.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,Pa)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Pa)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource;o||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),c=s.freeLocationForBufferBase(l);if(o){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(l,c):s.bindBufferRange(l,c,u)}else s.getLastBindBaseLocation(l)!==c&&s.bindBufferBase(l,c);let h=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[r]!==c&&(n.uniformBlockBindings[r]=c,this._renderer.gl.uniformBlockBinding(n.program,h,c))}_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]=oy(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(t,e){return X_(t,e)}resetState(){this._activeProgram=null}};Vr.extension={type:[_.WebGLSystem],name:"shader"}});var ly,cy,hy=p(()=>{"use strict";ly={f32:`if (cv !== v) {
817
+ cu.value = v;
818
+ gl.uniform1f(location, v);
819
+ }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
820
+ cv[0] = v[0];
821
+ cv[1] = v[1];
822
+ gl.uniform2f(location, v[0], v[1]);
823
+ }`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
824
+ cv[0] = v[0];
825
+ cv[1] = v[1];
826
+ cv[2] = v[2];
827
+ gl.uniform3f(location, v[0], v[1], v[2]);
828
+ }`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
829
+ cv[0] = v[0];
830
+ cv[1] = v[1];
831
+ cv[2] = v[2];
832
+ cv[3] = v[3];
833
+ gl.uniform4f(location, v[0], v[1], v[2], v[3]);
834
+ }`,i32:`if (cv !== v) {
835
+ cu.value = v;
836
+ gl.uniform1i(location, v);
837
+ }`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
838
+ cv[0] = v[0];
839
+ cv[1] = v[1];
840
+ gl.uniform2i(location, v[0], v[1]);
841
+ }`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
842
+ cv[0] = v[0];
843
+ cv[1] = v[1];
844
+ cv[2] = v[2];
845
+ gl.uniform3i(location, v[0], v[1], v[2]);
846
+ }`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
847
+ cv[0] = v[0];
848
+ cv[1] = v[1];
849
+ cv[2] = v[2];
850
+ cv[3] = v[3];
851
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
852
+ }`,u32:`if (cv !== v) {
853
+ cu.value = v;
854
+ gl.uniform1ui(location, v);
855
+ }`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
856
+ cv[0] = v[0];
857
+ cv[1] = v[1];
858
+ gl.uniform2ui(location, v[0], v[1]);
859
+ }`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
860
+ cv[0] = v[0];
861
+ cv[1] = v[1];
862
+ cv[2] = v[2];
863
+ gl.uniform3ui(location, v[0], v[1], v[2]);
864
+ }`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
865
+ cv[0] = v[0];
866
+ cv[1] = v[1];
867
+ cv[2] = v[2];
868
+ cv[3] = v[3];
869
+ gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
870
+ }`,bool:`if (cv !== v) {
871
+ cu.value = v;
872
+ gl.uniform1i(location, v);
873
+ }`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
874
+ cv[0] = v[0];
875
+ cv[1] = v[1];
876
+ gl.uniform2i(location, v[0], v[1]);
877
+ }`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
878
+ cv[0] = v[0];
879
+ cv[1] = v[1];
880
+ cv[2] = v[2];
881
+ gl.uniform3i(location, v[0], v[1], v[2]);
882
+ }`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
883
+ cv[0] = v[0];
884
+ cv[1] = v[1];
885
+ cv[2] = v[2];
886
+ cv[3] = v[3];
887
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
888
+ }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},cy={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 uy(i,t){let e=[`
889
+ var v = null;
890
+ var cv = null;
891
+ var cu = null;
892
+ var t = 0;
893
+ var gl = renderer.gl;
894
+ var name = null;
895
+ `];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof St?i.uniforms[r].ubo?e.push(`
896
+ renderer.shader.bindUniformBlock(uv.${r}, "${r}");
897
+ `):e.push(`
898
+ renderer.shader.updateUniformGroup(uv.${r});
899
+ `):i.uniforms[r]instanceof ke&&e.push(`
900
+ renderer.shader.bindBufferResource(uv.${r}, "${r}");
901
+ `);continue}let s=i.uniformStructures[r],n=!1;for(let o=0;o<Jt.length;o++){let a=Jt[o];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,Jt[o].uniform),n=!0;break}}if(!n){let a=(s.size===1?ly:cy)[s.type].replace("location",`ud["${r}"].location`);e.push(`
902
+ cu = ud["${r}"];
903
+ cv = cu.value;
904
+ v = uv["${r}"];
905
+ ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
906
+ `))}var dy=p(()=>{Js();ce();Qs();hy()});var zr,$h=p(()=>{P();dy();zr=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 uy(t,e)}_getSignature(t,e,r){let s=t.uniforms,n=[`${r}-`];for(let o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}};zr.extension={type:[_.WebGLSystem],name:"uniformGroup"}});function fy(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 W.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 py=p(()=>{dt()});var gS,xS,_S,yS,bS,my,gy,xy,_y=p(()=>{P();Re();py();({BLEND:gS,OFFSET:xS,CULLING:_S,DEPTH_TEST:yS,WINDING:bS,DEPTH_MASK:my}=Tc),gy=class Kh{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[gS]=this.setBlend,this.map[xS]=this.setOffset,this.map[_S]=this.setCullFace,this.map[yS]=this.setDepthTest,this.map[bS]=this.setFrontFace,this.map[my]=this.setDepthMask,this.checks=[],this.defaultState=It.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot!=!!t.flipY,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=fy(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(Kh._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Kh._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)}get depthMaskEnabled(){return!!(this.stateId&1<<my)}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}};gy.extension={type:[_.WebGLSystem],name:"state"};xy=gy});var Ma,yy=p(()=>{ba();Ma=class{constructor(t){this.target=dn.TEXTURE_2D,this._layerInitMask=0,this.texture=t,this.width=-1,this.height=-1,this.type=nt.UNSIGNED_BYTE,this.internalFormat=ya.RGBA,this.format=ya.RGBA,this.samplerType=0}destroy(){}}});var by,vy=p(()=>{"use strict";by={id:"buffer",upload(i,t,e,r,s,n=!1){let o=s||t.target;!n&&t.width===i.width&&t.height===i.height?e.texSubImage2D(o,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(o,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var vS,Ty,Sy=p(()=>{"use strict";vS={"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},Ty={id:"compressed",upload(i,t,e,r,s,n){let o=s??t.target;e.pixelStorei(e.UNPACK_ALIGNMENT,4);let a=i.pixelWidth,l=i.pixelHeight,c=!!vS[i.format];for(let h=0;h<i.resource.length;h++){let u=i.resource[h];c?e.compressedTexImage2D(o,h,t.internalFormat,a,l,0,u):e.texImage2D(o,h,t.internalFormat,a,l,0,t.format,t.type,u),a=Math.max(a>>1,1),l=Math.max(l>>1,1)}}}});function Cy(i){return{id:"cube",upload(t,e,r,s){let n=t.faces;for(let o=0;o<Ey.length;o++){let a=Ey[o],l=n[a];if(!l.resource)continue;(i[l.uploadMethodId]||i.image).upload(l,e,r,s,dn.TEXTURE_CUBE_MAP_POSITIVE_X+o,(e._layerInitMask&1<<o)===0),e._layerInitMask|=1<<o}e.width=t.pixelWidth,e.height=t.pixelHeight}}}var Ey,wy=p(()=>{ba();Ey=["right","left","top","bottom","front","back"]});function TS(i,t,e,r,s,n,o,a,l,c){if(!c){l&&i.texImage2D(t,0,e.internalFormat,r,s,0,e.format,e.type,null),i.texSubImage2D(t,0,0,0,n,o,e.format,e.type,a);return}if(!l){i.texSubImage2D(t,0,0,0,e.format,e.type,a);return}i.texImage2D(t,0,e.internalFormat,r,s,0,e.format,e.type,a)}function SS(i,t,e,r,s,n,o,a,l,c){if(!c){l&&i.texImage2D(t,0,e.internalFormat,r,s,0,e.format,e.type,null),i.texSubImage2D(t,0,0,0,e.format,e.type,a);return}if(!l){i.texSubImage2D(t,0,0,0,e.format,e.type,a);return}i.texImage2D(t,0,e.internalFormat,e.format,e.type,a)}var Aa,qh=p(()=>{"use strict";Aa={id:"image",upload(i,t,e,r,s,n=!1){let o=s||t.target,a=i.pixelWidth,l=i.pixelHeight,c=i.resourceWidth,h=i.resourceHeight,u=r===2,d=n||t.width!==a||t.height!==l,f=c>=a&&h>=l,m=i.resource;(u?TS:SS)(e,o,t,a,l,c,h,m,d,f),t.width=a,t.height=l}}});function Py(){let{userAgent:i}=W.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var My=p(()=>{dt()});var ES,Ay,Ry=p(()=>{My();qh();ES=Py(),Ay={id:"video",upload(i,t,e,r,s,n=ES){if(!i.isValid){let o=s??t.target;e.texImage2D(o,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Aa.upload(i,t,e,r,s,n)}}});var Zh,By,Ra,Gy,ky=p(()=>{"use strict";Zh={linear:9729,nearest:9728},By={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ra={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Gy={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Qh(i,t,e,r,s,n,o,a){let l=n;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let c=Ra[o?"clamp-to-edge":i.addressModeU],h=Ra[o?"clamp-to-edge":i.addressModeV],u=Ra[o?"clamp-to-edge":i.addressModeW];t[s](l,t.TEXTURE_WRAP_S,c),t[s](l,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Zh[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let c=By[i.minFilter][i.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,c)}}else t[s](l,t.TEXTURE_MIN_FILTER,Zh[i.minFilter]);if(r&&i.maxAnisotropy>1){let c=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,r.TEXTURE_MAX_ANISOTROPY_EXT,c)}i.compare?(t[s](l,t.TEXTURE_COMPARE_FUNC,Gy[i.compare]),t[s](l,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE)):a||t[s](l,t.TEXTURE_COMPARE_MODE,t.NONE)}var Iy=p(()=>{ky()});function Fy(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 Dy=p(()=>{"use strict"});function Uy(i,t){let e={},r=i.RGBA;return i instanceof W.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 Oy=p(()=>{dt()});function Ly(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 Ny=p(()=>{"use strict"});function Hy(i){return{"2d":i.TEXTURE_2D,cube:i.TEXTURE_CUBE_MAP,"1d":null,"3d":i?.TEXTURE_3D||null,"2d-array":i?.TEXTURE_2D_ARRAY||null,"cube-array":i?.TEXTURE_CUBE_MAP_ARRAY||null}}var Wy=p(()=>{"use strict"});var CS,Jh,tu,zy=p(()=>{dt();P();ve();mt();yy();vy();Sy();wy();qh();Ry();Iy();Dy();Oy();Ny();Wy();CS=4,Jh=class Vy{constructor(t){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._managedTextures=new Ct({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});let e={image:Aa,buffer:by,video:Ay,compressed:Ty,...Vy.uploadExtensions};this._uploads={...e,cube:Cy(e)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Uy(t,this._renderer.context.extensions),this._mapFormatToType=Ly(t),this._mapFormatToFormat=Fy(t),this._mapViewDimensionToGlTarget=Hy(t)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(U.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._gcLastUsed=this._renderer.gc.now,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=U.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 n=0;n<r.length;n++)if(r[n]===e){this._activateLocation(n);let o=this.getGlSource(e);s.bindTexture(o.target,null),r[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ma(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],r.target=this._mapViewDimensionToGlTarget[t.viewDimension],r.target===null)throw new Error(`Unsupported view dimension: ${t.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let n=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(n))+1}return t._gpuData[this._renderer.uid]=r,this._managedTextures.add(t)&&(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("updateMipmaps",this.onUpdateMipmaps,this)),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(s.target,s.texture),this._boundTextures[this._activeTextureLocation]=t,Qh(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.target,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t,e=!1){let r=t._gpuData[this._renderer.uid];r&&(e||(this.unbind(t),this._gl.deleteTexture(r.texture)),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(r.target,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";if(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);else if(r.target===e.TEXTURE_2D)this._initEmptyTexture2D(r,t);else if(r.target===e.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(r,t);else if(r.target===e.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(r,t);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(r,t),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)}_initEmptyTexture2D(t,e){let r=this._gl;r.texImage2D(r.TEXTURE_2D,0,t.internalFormat,e.pixelWidth,e.pixelHeight,0,t.format,t.type,null);let s=Math.max(e.pixelWidth>>1,1),n=Math.max(e.pixelHeight>>1,1);for(let o=1;o<e.mipLevelCount;o++)r.texImage2D(r.TEXTURE_2D,o,t.internalFormat,s,n,0,t.format,t.type,null),s=Math.max(s>>1,1),n=Math.max(n>>1,1)}_initEmptyTexture2DArray(t,e){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");let r=this._gl,s=Math.max(e.arrayLayerCount|0,1);r.texImage3D(r.TEXTURE_2D_ARRAY,0,t.internalFormat,e.pixelWidth,e.pixelHeight,s,0,t.format,t.type,null);let n=Math.max(e.pixelWidth>>1,1),o=Math.max(e.pixelHeight>>1,1);for(let a=1;a<e.mipLevelCount;a++)r.texImage3D(r.TEXTURE_2D_ARRAY,a,t.internalFormat,n,o,s,0,t.format,t.type,null),n=Math.max(n>>1,1),o=Math.max(o>>1,1)}_initEmptyTextureCube(t,e){let r=this._gl,s=6;for(let a=0;a<s;a++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,t.internalFormat,e.pixelWidth,e.pixelHeight,0,t.format,t.type,null);let n=Math.max(e.pixelWidth>>1,1),o=Math.max(e.pixelHeight>>1,1);for(let a=1;a<e.mipLevelCount;a++){for(let l=0;l<s;l++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+l,a,t.internalFormat,n,o,0,t.format,t.type,null);n=Math.max(n>>1,1),o=Math.max(o>>1,1)}}_applyMipRange(t,e){if(this._renderer.context.webGLVersion!==2||e.mipLevelCount<=1)return;let r=this._gl,s=Math.max((e.mipLevelCount|0)-1,0);r.texParameteri(t.target,r.TEXTURE_BASE_LEVEL,0),r.texParameteri(t.target,r.TEXTURE_MAX_LEVEL,s)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Qh(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 t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),n=W.get().createCanvas();n.width=r,n.height=s;let o=n.getContext("2d");if(o){let a=o.createImageData(r,s);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),n=Math.max(Math.round(r.height*e),1),o=new Uint8Array(CS*s*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),c=a.renderTarget.getGpuRenderTarget(l),h=a.gl;return a.renderTarget.adaptor.bindFramebuffer(c.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,n,h.RGBA,h.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:s,height:n}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(U.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Jh.extension={type:[_.WebGLSystem],name:"texture"};Jh.uploadExtensions=Object.create(null);tu=Jh;H.handleByMap(_.TextureUploaderWebGL,tu.uploadExtensions)});var $y={};sl($y,{WebGLRenderer:()=>eu});var wS,PS,MS,Xy,Yy,jy,eu,Ky=p(()=>{P();x_();__();y_();kr();la();Ae();T_();C_();A_();G_();k_();I_();F_();D_();Nh();z_();jh();$h();_y();zy();wS=[...Ai,Wr,B_,E_,gn,un,tu,yn,fn,zr,Vr,mn,xy,xn,pn],PS=[...aa],MS=[cn,ln,an],Xy=[],Yy=[],jy=[];H.handleByNamedList(_.WebGLSystem,Xy);H.handleByNamedList(_.WebGLPipes,Yy);H.handleByNamedList(_.WebGLPipesAdaptor,jy);H.add(...wS,...PS,...MS);eu=class extends ue{constructor(){let t={name:"webgl",type:Rt.WEBGL,systems:Xy,renderPipes:Yy,renderPipeAdaptors:jy};super(t)}}});function qy(i,t,e,r,s,n,o,a){let l=i-e*s,c=t-r*s,h=i+e*n,u=t+r*n,d,f;o?(d=r,f=-e):(d=-r,f=e);let m=l+d,g=c+f,y=h+d,x=u+f;return a.push(m,g),a.push(y,x),2}function Xr(i,t,e,r,s,n,o,a){let l=e-i,c=r-t,h=Math.atan2(l,c),u=Math.atan2(s-i,n-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,m=Math.abs(f),g=Math.sqrt(l*l+c*c),y=(15*m*Math.sqrt(g)/Math.PI>>0)+1,x=f/y;if(d+=x,a){o.push(i,t),o.push(e,r);for(let b=1,v=d;b<y;b++,v+=x)o.push(i,t),o.push(i+Math.sin(v)*g,t+Math.cos(v)*g);o.push(i,t),o.push(s,n)}else{o.push(e,r),o.push(i,t);for(let b=1,v=d;b<y;b++,v+=x)o.push(i+Math.sin(v)*g,t+Math.cos(v)*g),o.push(i,t);o.push(s,n),o.push(i,t)}return y*2}function ki(i,t,e,r,s,n){let o=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let D=bo(i);e&&(D*=-1),l=(l-.5)*D+.5}let c=new tt(i[0],i[1]),h=new tt(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(c.x-h.x)<o&&Math.abs(c.y-h.y)<o;if(u){i=i.slice(),d&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let D=(c.x+h.x)*.5,Z=(h.y+c.y)*.5;i.unshift(D,Z),i.push(D,Z)}let f=s,m=i.length/2,g=i.length,y=f.length/2,x=a.width/2,b=x*x,v=a.miterLimit*a.miterLimit,T=i[0],S=i[1],E=i[2],w=i[3],I=0,G=0,M=-(S-w),C=T-E,R=0,L=0,V=Math.sqrt(M*M+C*C);M/=V,C/=V,M*=x,C*=x;let F=l,A=(1-F)*2,k=F*2;u||(a.cap==="round"?g+=Xr(T-M*(A-k)*.5,S-C*(A-k)*.5,T-M*A,S-C*A,T+M*k,S+C*k,f,!0)+2:a.cap==="square"&&(g+=qy(T,S,M,C,A,k,!0,f))),f.push(T-M*A,S-C*A),f.push(T+M*k,S+C*k);for(let D=1;D<m-1;++D){T=i[(D-1)*2],S=i[(D-1)*2+1],E=i[D*2],w=i[D*2+1],I=i[(D+1)*2],G=i[(D+1)*2+1],M=-(S-w),C=T-E,V=Math.sqrt(M*M+C*C),M/=V,C/=V,M*=x,C*=x,R=-(w-G),L=E-I,V=Math.sqrt(R*R+L*L),R/=V,L/=V,R*=x,L*=x;let Z=E-T,ht=S-w,xt=E-I,st=G-w,at=Z*xt+ht*st,z=ht*xt-st*Z,Dt=z<0;if(Math.abs(z)<.001*Math.abs(at)){f.push(E-M*A,w-C*A),f.push(E+M*k,w+C*k),at>=0&&(a.join==="round"?g+=Xr(E,w,E-M*A,w-C*A,E-R*A,w-L*A,f,!1)+4:g+=2,f.push(E-R*k,w-L*k),f.push(E+R*A,w+L*A));continue}let Nn=(-M+T)*(-C+w)-(-M+E)*(-C+S),Wi=(-R+I)*(-L+w)-(-R+E)*(-L+G),Vi=(Z*Wi-xt*Nn)/z,Ue=(st*Nn-ht*Wi)/z,pr=(Vi-E)*(Vi-E)+(Ue-w)*(Ue-w),fe=E+(Vi-E)*A,te=w+(Ue-w)*A,ee=E-(Vi-E)*k,pe=w-(Ue-w)*k,Ze=Math.min(Z*Z+ht*ht,xt*xt+st*st),Oe=Dt?A:k,zi=Ze+Oe*Oe*b;pr<=zi?a.join==="bevel"||pr/b>v?(Dt?(f.push(fe,te),f.push(E+M*k,w+C*k),f.push(fe,te),f.push(E+R*k,w+L*k)):(f.push(E-M*A,w-C*A),f.push(ee,pe),f.push(E-R*A,w-L*A),f.push(ee,pe)),g+=2):a.join==="round"?Dt?(f.push(fe,te),f.push(E+M*k,w+C*k),g+=Xr(E,w,E+M*k,w+C*k,E+R*k,w+L*k,f,!0)+4,f.push(fe,te),f.push(E+R*k,w+L*k)):(f.push(E-M*A,w-C*A),f.push(ee,pe),g+=Xr(E,w,E-M*A,w-C*A,E-R*A,w-L*A,f,!1)+4,f.push(E-R*A,w-L*A),f.push(ee,pe)):(f.push(fe,te),f.push(ee,pe)):(f.push(E-M*A,w-C*A),f.push(E+M*k,w+C*k),a.join==="round"?Dt?g+=Xr(E,w,E+M*k,w+C*k,E+R*k,w+L*k,f,!0)+2:g+=Xr(E,w,E-M*A,w-C*A,E-R*A,w-L*A,f,!1)+2:a.join==="miter"&&pr/b<=v&&(Dt?(f.push(ee,pe),f.push(ee,pe)):(f.push(fe,te),f.push(fe,te)),g+=2),f.push(E-R*A,w-L*A),f.push(E+R*k,w+L*k),g+=2)}T=i[(m-2)*2],S=i[(m-2)*2+1],E=i[(m-1)*2],w=i[(m-1)*2+1],M=-(S-w),C=T-E,V=Math.sqrt(M*M+C*C),M/=V,C/=V,M*=x,C*=x,f.push(E-M*A,w-C*A),f.push(E+M*k,w+C*k),u||(a.cap==="round"?g+=Xr(E-M*(A-k)*.5,w-C*(A-k)*.5,E-M*A,w-C*A,E+M*k,w+C*k,f,!1)+2:a.cap==="square"&&(g+=qy(E,w,M,C,A,k,!1,f)));let X=1e-4*1e-4;for(let D=y;D<g+y-2;++D)T=f[D*2],S=f[D*2+1],E=f[(D+1)*2],w=f[(D+1)*2+1],I=f[(D+2)*2],G=f[(D+2)*2+1],!(Math.abs(T*(w-G)+E*(G-S)+I*(S-w))<X)&&n.push(D,D+1,D+2)}var Ba=p(()=>{nc();ge()});function Qy(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Jy(i,t){let e=W.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function BS(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(N("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]??Xt.defaultLinearOptions.textureSize}),t}var Zy,iu,Xt,Yr=p(()=>{Ht();dt();et();Ql();mt();Pt();_t();Tl();Zy=[{offset:0,color:"white"},{offset:1,color:"black"}],iu=class ru{constructor(...t){this.uid=j("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=BS(t);e={...e.type==="radial"?ru.defaultRadialOptions:ru.defaultLinearOptions,...to(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:K.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,n=r-t,o=s-e,a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){let y=t;t=r,r=y,n*=-1}if(o<0){let y=e;e=s,s=y,o*=-1}}let l=this.colorStops.length?this.colorStops:Zy,c=this._textureSize,{canvas:h,context:u}=Jy(c,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Qy(d,l),u.fillStyle=d,u.fillRect(0,0,c,1),this.texture=new U({source:new ir({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(n*n+o*o),m=Math.atan2(o,n),g=new B;g.scale(f/c,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(c,c),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Zy,e=this._textureSize,{canvas:r,context:s}=Jy(e,e),{x:n,y:o}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,h=this.outerRadius,u=a-h,d=l-h,f=e/(h*2),m=(n-u)*f,g=(o-d)*f,y=s.createRadialGradient(m,g,c*f,(a-u)*f,(l-d)*f,h*f);Qy(y,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=y,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,e,e),this.texture=new U({source:new ir({resource:r,addressMode:this._wrapMode})});let x=new B;this.textureSpace==="local"?x.scale(2*h,2*h):x.scale(1/f,1/f),x.translate(u,d),this.transform=x}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};iu.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};iu.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xt=iu});function GS(i){return i.texture!==void 0}var tb,Te,bn=p(()=>{et();Pt();tb={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"}},Te=class{constructor(t,e){this.uid=j("fillPattern"),this._tick=0,this.transform=new B;let r=GS(t)?t:{texture:t,repetition:e};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";let s=r.repetition;s&&(this.texture.source.style.addressModeU=tb[s].addressModeU,this.texture.source.style.addressModeV=tb[s].addressModeV)}setTransform(t){if(t){if(this.transform.equals(t))return;this.transform.copyFrom(t)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}});function eb(i,t,e,r,s,n,o,a=null){let l=0;e*=t,s*=n;let c=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,m=a.ty;for(;l<o;){let g=i[e],y=i[e+1];r[s]=c*g+u*y+f,r[s+1]=h*g+d*y+m,s+=n,e+=t,l++}}function rb(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var ib=p(()=>{"use strict"});function su(i,t,e,r,s){let n=t.a,o=t.b,a=t.c,l=t.d,c=t.tx,h=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],m=i[u+1];i[u]=n*f+a*m+c,i[u+1]=o*f+l*m+h,u+=r}}var sb=p(()=>{"use strict"});var kS,jr,nu=p(()=>{et();Ki();kS=new B,jr=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.renderable&&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?Ce(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||kS}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"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}});var Ii,nb,ob,ab=p(()=>{P();Ii={extension:{type:_.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,n,o,a;if(i.type==="circle"){let T=i;if(o=a=T.radius,o<=0)return!1;e=T.x,r=T.y,s=n=0}else if(i.type==="ellipse"){let T=i;if(o=T.halfWidth,a=T.halfHeight,o<=0||a<=0)return!1;e=T.x,r=T.y,s=n=0}else{let T=i,S=T.width/2,E=T.height/2;e=T.x+S,r=T.y+E,o=a=Math.max(0,Math.min(T.radius,Math.min(S,E))),s=S-o,n=E-a}if(s<0||n<0)return!1;let l=Math.ceil(2.3*Math.sqrt(o+a)),c=l*8+(s?4:0)+(n?4:0);if(c===0)return!1;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+n,t[2]=t[4]=e-s,t[5]=t[7]=r-n,!0;let h=0,u=l*4+(s?2:0)+2,d=u,f=c,m=s+o,g=n,y=e+m,x=e-m,b=r+g;if(t[h++]=y,t[h++]=b,t[--u]=b,t[--u]=x,n){let T=r-g;t[d++]=x,t[d++]=T,t[--f]=T,t[--f]=y}for(let T=1;T<l;T++){let S=Math.PI/2*(T/l),E=s+Math.cos(S)*o,w=n+Math.sin(S)*a,I=e+E,G=e-E,M=r+w,C=r-w;t[h++]=I,t[h++]=M,t[--u]=M,t[--u]=G,t[d++]=G,t[d++]=C,t[--f]=C,t[--f]=I}m=s,g=n+a,y=e+m,x=e-m,b=r+g;let v=r-g;return t[h++]=y,t[h++]=b,t[--f]=v,t[--f]=y,s&&(t[h++]=x,t[h++]=b,t[--f]=v,t[--f]=x),!0},triangulate(i,t,e,r,s,n){if(i.length===0)return;let o=0,a=0;for(let h=0;h<i.length;h+=2)o+=i[h],a+=i[h+1];o/=i.length/2,a/=i.length/2;let l=r;t[l*e]=o,t[l*e+1]=a;let c=l++;for(let h=0;h<i.length;h+=2)t[l*e]=i[h],t[l*e+1]=i[h+1],h>0&&(s[n++]=l,s[n++]=c,s[n++]=l-1),l++;s[n++]=c+1,s[n++]=c,s[n++]=l-1}},nb={...Ii,extension:{...Ii.extension,name:"ellipse"}},ob={...Ii,extension:{...Ii.extension,name:"roundedRectangle"}}});function lb(i,t,e,r){let s=1e-4;if(i.length===0)return;let n=i[0],o=i[1],a=i[i.length-2],l=i[i.length-1],c=t||Math.abs(n-a)<s&&Math.abs(o-l)<s,h=e,u=i.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(i[f*2]),h.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);c&&r.push(d+u-1,d)}var cb=p(()=>{});function Ga(i,t,e,r,s,n,o){let a=km(i,t,2);if(!a)return;for(let c=0;c<a.length;c+=3)n[o++]=a[c]+s,n[o++]=a[c+1]+s,n[o++]=a[c+2]+s;let l=s*r;for(let c=0;c<i.length;c+=2)e[l]=i[c],e[l+1]=i[c+1],l+=r}var ou=p(()=>{Im()});var IS,hb,ub=p(()=>{P();ou();IS=[],hb={extension:{type:_.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return!0},triangulate(i,t,e,r,s,n){Ga(i,IS,t,e,r,s,n)}}});var db,fb=p(()=>{P();db={extension:{type:_.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,n=e.width,o=e.height;return n>0&&o>0?(t[0]=r,t[1]=s,t[2]=r+n,t[3]=s,t[4]=r+n,t[5]=s+o,t[6]=r,t[7]=s+o,!0):!1},triangulate(i,t,e,r,s,n){let o=0;r*=e,t[r+o]=i[0],t[r+o+1]=i[1],o+=e,t[r+o]=i[2],t[r+o+1]=i[3],o+=e,t[r+o]=i[6],t[r+o+1]=i[7],o+=e,t[r+o]=i[4],t[r+o+1]=i[5],o+=e;let a=r/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2,s[n++]=a+1,s[n++]=a+3,s[n++]=a+2}}});var pb,mb=p(()=>{P();pb={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,!0},triangulate(i,t,e,r,s,n){let o=0;r*=e,t[r+o]=i[0],t[r+o+1]=i[1],o+=e,t[r+o]=i[2],t[r+o+1]=i[3],o+=e,t[r+o]=i[4],t[r+o+1]=i[5];let a=r/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2}}});function ka(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let o=e.getBounds(DS);t.width&&o.pad(t.width);let{x:a,y:l}=o,c=1/o.width,h=1/o.height,u=-a*c,d=-l*h,f=s.a,m=s.b,g=s.c,y=s.d;s.a*=c,s.b*=c,s.c*=h,s.d*=h,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*y+s.ty}else if(t.texture.rotate){let{uvs:o,orig:a}=t.texture;s.scale(1/a.width,1/a.height),s.prepend(US.set(o.x1-o.x0,o.y1-o.y0,o.x3-o.x0,o.y3-o.y0,o.x0,o.y0))}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let n=t.texture.source.style;return!(t.fill instanceof Xt)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),r&&s.append(FS.copyFrom(r).invert()),s}var FS,DS,US,au=p(()=>{et();Ut();Yr();FS=new B,DS=new q,US=new B});function xb(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 n=i.instructions[s];if(n.action==="texture")NS(n.data,r,e);else if(n.action==="fill"||n.action==="stroke"){let o=n.action==="stroke",a=n.data.path.shapePath,l=n.data.style,c=n.data.hole;o&&c&&gb(c.shapePath,l,!0,r,e),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),gb(a,l,o,r,e)}}}function NS(i,t,e){let r=[],s=dr.rectangle,n=OS;n.x=i.dx,n.y=i.dy,n.width=i.dw,n.height=i.dh;let o=i.transform;if(!s.build(n,r))return;let{vertices:a,uvs:l,indices:c}=e,h=c.length,u=a.length/2;o&&su(r,o),s.triangulate(r,a,2,u,c,h);let d=i.image,f=d.uvs;l.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=pt.get(jr);m.indexOffset=h,m.indexSize=c.length-h,m.attributeOffset=u,m.attributeSize=a.length/2-u,m.baseColor=i.style,m.alpha=i.alpha,m.texture=d,m.geometryData=e,t.push(m)}function gb(i,t,e,r,s){let{vertices:n,uvs:o,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:c,holes:h})=>{let u=[],d=dr[l.type];if(!d.build(l,u))return;let f=a.length,m=n.length/2,g="triangle-list";if(c&&su(u,c),e){let v=l.closePath??!0,T=t;T.pixelLine?(lb(u,v,n,a),g="line-list"):ki(u,T,!1,v,n,a)}else if(h){let v=[],T=u.slice();HS(h).forEach(E=>{v.push(T.length/2),T.push(...E)}),Ga(T,v,n,2,m,a,f)}else d.triangulate(u,n,2,m,a,f);let y=o.length/2,x=t.texture;if(x!==U.WHITE){let v=ka(LS,t,l,c);eb(n,2,m,o,y,2,n.length/2-m,v)}else rb(o,y,2,n.length/2-m);let b=pt.get(jr);b.indexOffset=f,b.indexSize=a.length-f,b.attributeOffset=m,b.attributeSize=n.length/2-m,b.baseColor=t.color,b.alpha=t.alpha,b.texture=x,b.geometryData=s,b.topology=g,r.push(b)})}function HS(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];dr[r.type].build(r,s)&&t.push(s)}return t}var dr,OS,LS,Ia=p(()=>{P();et();Ut();ib();sb();mt();Ne();nu();ab();Ba();cb();ub();fb();mb();au();ou();dr={};H.handleByMap(_.ShapeBuilder,dr);H.add(db,hb,pb,Ii,nb,ob);OS=new q,LS=new B});function YS(i,t,e){i.beginPath();for(let r=0;r<e.length;r+=3){let s=e[r]*2,n=e[r+1]*2,o=e[r+2]*2;i.moveTo(t[s],t[s+1]),i.lineTo(t[n],t[n+1]),i.lineTo(t[o],t[o+1]),i.closePath()}i.fill()}function jS(i){return`#${(i&16777215).toString(16).padStart(6,"0")}`}function $S(i,t,e,r,s,n){n=Math.max(0,Math.min(n,Math.min(r,s)/2)),i.moveTo(t+n,e),i.lineTo(t+r-n,e),i.quadraticCurveTo(t+r,e,t+r,e+n),i.lineTo(t+r,e+s-n),i.quadraticCurveTo(t+r,e+s,t+r-n,e+s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t,e+s,t,e+s-n),i.lineTo(t,e+n),i.quadraticCurveTo(t,e,t+n,e)}function Da(i,t){switch(t.type){case"rectangle":{let e=t;i.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{let e=t;$S(i,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{let e=t;i.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{let e=t;i.ellipse?i.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2):(i.save(),i.translate(e.x,e.y),i.scale(e.halfWidth,e.halfHeight),i.arc(0,0,1,0,Math.PI*2),i.restore());break}case"triangle":{let e=t;i.moveTo(e.x,e.y),i.lineTo(e.x2,e.y2),i.lineTo(e.x3,e.y3),i.closePath();break}case"polygon":default:{let e=t,r=e.points;if(!r?.length)break;i.moveTo(r[0],r[1]);for(let s=2;s<r.length;s+=2)i.lineTo(r[s],r[s+1]);e.closePath&&i.closePath();break}}}function KS(i,t){if(!t?.length)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!r?.shape)continue;let s=r.transform,n=s&&!s.isIdentity();n&&(i.save(),i.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),Da(i,r.shape),n&&i.restore()}return!0}function qS(i,t,e,r){let s=i.fill;if(s instanceof Xt){s.buildGradient();let o=s.texture;if(o){let a=$.getTintedPattern(o,t),l=e?lu.copyFrom(e).scale(o.source.pixelWidth,o.source.pixelHeight):lu.copyFrom(s.transform);return r&&!i.textureSpace&&l.append(r),$.applyPatternTransform(a,l),a}}if(s instanceof Te){let o=$.getTintedPattern(s.texture,t);return $.applyPatternTransform(o,s.transform,!1),o}let n=i.texture;if(n&&n!==U.WHITE){if(!n.source.resource)return WS;let o=$.getTintedPattern(n,t),a=i.matrix;if(e){let{resolution:l}=n.source;if(a=lu.copyFrom(e),n.rotate){let{uvs:c,orig:h}=n;a.prepend(XS.set(c.x1-c.x0,c.y1-c.y0,c.x3-c.x0,c.y3-c.y0,c.x0,c.y0).invert()).scale(h.width*l,h.height*l)}else a.scale(n.source.pixelWidth,n.source.pixelHeight).translate(-n.frame.x*l,-n.frame.y*l)}return $.applyPatternTransform(o,a),o}return jS(t)}var WS,Fa,VS,zS,lu,XS,vn,_b=p(()=>{P();Zi();et();hi();mt();Zn();Ki();Ba();Yr();bn();Ia();au();WS="#808080",Fa=new B,VS=new B,zS=new B,lu=new B,XS=new B;vn=class{constructor(){this.shader=null}contextChange(t){}execute(t,e){let r=t.renderer,s=r.canvasContext,n=s.activeContext,o=e.groupTransform,a=r.globalUniforms.globalUniformData?.worldColor??4294967295,l=e.groupColorAlpha,c=(a>>>24&255)/255,h=(l>>>24&255)/255,u=r.filter?.alphaMultiplier??1,d=c*h*u;if(d<=0)return;let f=a&16777215,m=l&16777215,g=We(Ce(m,f)),y=r._roundPixels|e._roundPixels;n.save(),s.setContextTransform(o,y===1),s.setBlendMode(e.groupBlendMode);let x=e.context.instructions;for(let b=0;b<x.length;b++){let v=x[b];if(v.action==="texture"){let C=v.data,R=C.image,L=R?$.getCanvasSource(R):null;if(!L)continue;let V=C.alpha*d;if(V<=0)continue;let F=Ce(C.style,g);n.globalAlpha=V;let A=L;F!==16777215&&(A=$.getTintedCanvas({texture:R},F));let k=R.frame,X=R.source._resolution??R.source.resolution??1,D=k.x*X,Z=k.y*X,ht=k.width*X,xt=k.height*X;A!==L&&(D=0,Z=0);let st=C.transform,at=st&&!st.isIdentity(),z=R.rotate;at||z?(Fa.copyFrom(o),at&&Fa.append(st),z&&Q.matrixAppendRotationInv(Fa,z,C.dx,C.dy,C.dw,C.dh),s.setContextTransform(Fa,y===1)):s.setContextTransform(o,y===1),n.drawImage(A,D,Z,A===L?ht:A.width,A===L?xt:A.height,z?0:C.dx,z?0:C.dy,C.dw,C.dh),(at||z)&&s.setContextTransform(o,y===1);continue}let T=v.data,S=T?.path?.shapePath;if(!S?.shapePrimitives?.length)continue;let E=T.style,w=Ce(E.color,g),I=E.alpha*d;if(I<=0)continue;let G=v.action==="stroke";if(n.globalAlpha=I,G){let C=E;n.lineWidth=C.width,n.lineCap=C.cap,n.lineJoin=C.join,n.miterLimit=C.miterLimit}let M=S.shapePrimitives;if(!G&&T.hole?.shapePath?.shapePrimitives?.length){let C=M[M.length-1];C.holes=T.hole.shapePath.shapePrimitives}for(let C=0;C<M.length;C++){let R=M[C];if(!R?.shape)continue;let L=R.transform,V=L&&!L.isIdentity(),F=E.texture&&E.texture!==U.WHITE,A=E.textureSpace==="global"?L:null,k=F?ka(VS,E,R.shape,A):null,X=V?zS.copyFrom(o).append(L):o,D=qS(E,w,k,X);if(V&&(n.save(),n.transform(L.a,L.b,L.c,L.d,L.tx,L.ty)),G){let Z=E;if(Z.alignment!==.5&&!Z.pixelLine){let xt=[],st=[],at=[];if(dr[R.shape.type]?.build(R.shape,xt)){let Dt=R.shape.closePath??!0;ki(xt,Z,!1,Dt,st,at),n.fillStyle=D,YS(n,st,at)}else n.strokeStyle=D,n.beginPath(),Da(n,R.shape),n.stroke()}else n.strokeStyle=D,n.beginPath(),Da(n,R.shape),n.stroke()}else n.fillStyle=D,n.beginPath(),Da(n,R.shape),KS(n,R.holes)?n.fill("evenodd"):n.fill();V&&n.restore()}}n.restore()}destroy(){this.shader=null}};vn.extension={type:[_.CanvasPipesAdaptor],name:"graphics"}});var cu,yb,bb=p(()=>{P();Zi();et();Zn();Ki();hi();cu=class $r{static _getPatternRepeat(t,e){let r=t&&t!=="clamp-to-edge",s=e&&e!=="clamp-to-edge";return r&&s?"repeat":r?"repeat-x":s?"repeat-y":"no-repeat"}start(t,e,r){}execute(t,e){let r=e.elements;if(!r||!r.length)return;let s=t.renderer,n=s.canvasContext,o=n.activeContext;for(let a=0;a<r.length;a++){let l=r[a];if(!l.packAsQuad)continue;let c=l,h=c.texture,u=h?$.getCanvasSource(h):null;if(!u)continue;let d=h.source.style,f=n.smoothProperty,m=d.scaleMode!=="nearest";o[f]!==m&&(o[f]=m),n.setBlendMode(e.blendMode);let g=s.globalUniforms.globalUniformData?.worldColor??4294967295,y=c.color,x=(g>>>24&255)/255,b=(y>>>24&255)/255,v=s.filter?.alphaMultiplier??1,T=x*b*v;if(T<=0)continue;o.globalAlpha=T;let S=g&16777215,E=y&16777215,w=We(Ce(E,S)),I=h.frame,G=d.addressModeU??d.addressMode,M=d.addressModeV??d.addressMode,C=$r._getPatternRepeat(G,M),R=h.source._resolution??h.source.resolution??1,L=c.renderable?.renderGroup?.isCachedAsTexture,V=I.x*R,F=I.y*R,A=I.width*R,k=I.height*R,X=c.bounds,D=s.renderTarget.renderTarget.isRoot,Z=X.minX,ht=X.minY,xt=X.maxX-X.minX,st=X.maxY-X.minY,at=h.rotate,z=h.uvs,Dt=Math.min(z.x0,z.x1,z.x2,z.x3,z.y0,z.y1,z.y2,z.y3),Nn=Math.max(z.x0,z.x1,z.x2,z.x3,z.y0,z.y1,z.y2,z.y3),Wi=C!=="no-repeat"&&(Dt<0||Nn>1),Ue=at&&!(!Wi&&(w!==16777215||at));Ue?($r._tempPatternMatrix.copyFrom(c.transform),Q.matrixAppendRotationInv($r._tempPatternMatrix,at,Z,ht,xt,st),n.setContextTransform($r._tempPatternMatrix,c.roundPixels===1,void 0,L&&D)):n.setContextTransform(c.transform,c.roundPixels===1,void 0,L&&D);let pr=xt,fe=st,te=Ue?0:Z,ee=Ue?0:ht;if(!Ue&&c.roundPixels===1&&(te|=0,ee|=0),Wi){let pe=u,Ze=w!==16777215&&!at,Oe=I.width<=h.source.width&&I.height<=h.source.height;Ze&&Oe&&(pe=$.getTintedCanvas({texture:h},w));let zi=o.createPattern(pe,C);if(!zi)continue;let tl=pr,$u=fe;if(tl===0||$u===0)continue;let Ku=1/tl,qu=1/$u,Zu=(z.x1-z.x0)*Ku,Qu=(z.y1-z.y0)*Ku,Ju=(z.x3-z.x0)*qu,td=(z.y3-z.y0)*qu,fv=z.x0-Zu*te-Ju*ee,pv=z.y0-Qu*te-td*ee,el=h.source.pixelWidth,rl=h.source.pixelHeight;$r._tempPatternMatrix.set(Zu*el,Qu*rl,Ju*el,td*rl,fv*el,pv*rl),$.applyPatternTransform(zi,$r._tempPatternMatrix),o.fillStyle=zi,o.fillRect(te,ee,pr,fe)}else{let Ze=w!==16777215||at?$.getTintedCanvas({texture:h},w):u,Oe=Ze!==u;o.drawImage(Ze,Oe?0:V,Oe?0:F,Oe?Ze.width:A,Oe?Ze.height:k,te,ee,pr,fe)}}}};cu._tempPatternMatrix=new B;cu.extension={type:[_.CanvasPipesAdaptor],name:"batch"};yb=cu});var Tn,vb=p(()=>{P();Tn=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 s=this._colorStack;s[this._colorStackIndex]=s[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 s=this._colorStack;this._colorStackIndex--;let n=s[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){}destroy(){this._renderer=null,this._colorStack=null}};Tn.extension={type:[_.CanvasPipes],name:"colorMask"}});function Tb(i){let t=[];return i.replace(ZS,(e,r,s)=>{let n=r.toLowerCase(),o=r,a=JS(s);for(n==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),n="l",o=o==="m"?"l":"L");;){if(a.length===hu[n])return t.push([o,...a]),"";if(a.length<hu[n])throw new Error("malformed path data");t.push([o,...a.splice(0,hu[n])])}}),t}function JS(i){let t=i.match(QS);return t?t.map(Number):[]}var hu,ZS,QS,Sb=p(()=>{hu={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ZS=/([astvzqmhlc])([^astvzqmhlc]*)/gi,QS=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi});function Eb(i,t){let e=Tb(i),r=[],s=null,n=0,o=0;for(let a=0;a<e.length;a++){let l=e[a],c=l[0],h=l;switch(c){case"M":n=h[1],o=h[2],t.moveTo(n,o);break;case"m":n+=h[1],o+=h[2],t.moveTo(n,o);break;case"H":n=h[1],t.lineTo(n,o);break;case"h":n+=h[1],t.lineTo(n,o);break;case"V":o=h[1],t.lineTo(n,o);break;case"v":o+=h[1],t.lineTo(n,o);break;case"L":n=h[1],o=h[2],t.lineTo(n,o);break;case"l":n+=h[1],o+=h[2],t.lineTo(n,o);break;case"C":n=h[5],o=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],n,o);break;case"c":t.bezierCurveTo(n+h[1],o+h[2],n+h[3],o+h[4],n+h[5],o+h[6]),n+=h[5],o+=h[6];break;case"S":n=h[3],o=h[4],t.bezierCurveToShort(h[1],h[2],n,o);break;case"s":t.bezierCurveToShort(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"Q":n=h[3],o=h[4],t.quadraticCurveTo(h[1],h[2],n,o);break;case"q":t.quadraticCurveTo(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"T":n=h[1],o=h[2],t.quadraticCurveToShort(n,o);break;case"t":n+=h[1],o+=h[2],t.quadraticCurveToShort(n,o);break;case"A":n=h[6],o=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"a":n+=h[6],o+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(n=s.startX,o=s.startY):(n=0,o=0)),s=null;break;default:O(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:n,startY:o},r.push(s))}return t}var Cb=p(()=>{Sb();ot()});var uu,du,pu,Fi,Ua=p(()=>{P();Ho();ah();Jn();ve();_t();Ne();Ia();uu=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{pt.return(t)}),this.graphicsData&&pt.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}},du=class{constructor(){this.instructions=new Qe}init(t){let e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Os({maxTextures:e}),this.instructions.reset()}get geometry(){return N(Ed,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}},pu=class fu{constructor(t){this._renderer=t,this._managedContexts=new Ct({renderer:t,type:"resource",name:"graphicsContext"})}init(t){fu.defaultOptions.bezierSmoothness=t?.bezierSmoothness??fu.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){let e=!!t._gpuData[this._renderer.uid],r=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&r.reset(),xb(t,r);let s=t.batchMode;t.customShader||s==="no-batch"?r.isBatchable=!1:s==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,t.dirty=!1}return r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){let e=pt.get(du,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=t._gpuData[this._renderer.uid],{batches:s,geometryData:n}=r;r.graphicsData=e;let o=n.vertices.length,a=n.indices.length;for(let u=0;u<s.length;u++)s[u].applyTransform=!1;let l=e.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let u=0;u<s.length;u++){let d=s[u];l.add(d)}l.finish(e.instructions);let c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);let h=l.batches;for(let u=0;u<h.length;u++){let d=h[u];d.bindGroup=xi(d.textures.textures,d.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){let e=new uu;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};pu.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"graphicsContext"};pu.defaultOptions={bezierSmoothness:.5};Fi=pu});function La(i,t,e,r,s,n,o,a,l,c){let u=Math.min(.99,Math.max(0,c??Fi.defaultOptions.bezierSmoothness)),d=(eE-u)/1;return d*=d,rE(t,e,r,s,n,o,a,l,i,d),i}function rE(i,t,e,r,s,n,o,a,l,c){gu(i,t,e,r,s,n,o,a,l,c,0),l.push(o,a)}function gu(i,t,e,r,s,n,o,a,l,c,h){if(h>tE)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,g=(r+n)/2,y=(s+o)/2,x=(n+a)/2,b=(d+m)/2,v=(f+g)/2,T=(m+y)/2,S=(g+x)/2,E=(b+T)/2,w=(v+S)/2;if(h>0){let I=o-i,G=a-t,M=Math.abs((e-o)*G-(r-a)*I),C=Math.abs((s-o)*G-(n-a)*I),R,L;if(M>Oa&&C>Oa){if((M+C)*(M+C)<=c*(I*I+G*G)){if(Di<mu){l.push(E,w);return}let V=Math.atan2(n-r,s-e);if(R=Math.abs(V-Math.atan2(r-t,e-i)),L=Math.abs(Math.atan2(a-n,o-s)-V),R>=u&&(R=2*u-R),L>=u&&(L=2*u-L),R+L<Di){l.push(E,w);return}if(Kr!==0){if(R>Kr){l.push(e,r);return}if(L>Kr){l.push(s,n);return}}}}else if(M>Oa){if(M*M<=c*(I*I+G*G)){if(Di<mu){l.push(E,w);return}if(R=Math.abs(Math.atan2(n-r,s-e)-Math.atan2(r-t,e-i)),R>=u&&(R=2*u-R),R<Di){l.push(e,r),l.push(s,n);return}if(Kr!==0&&R>Kr){l.push(e,r);return}}}else if(C>Oa){if(C*C<=c*(I*I+G*G)){if(Di<mu){l.push(E,w);return}if(R=Math.abs(Math.atan2(a-n,o-s)-Math.atan2(n-r,s-e)),R>=u&&(R=2*u-R),R<Di){l.push(e,r),l.push(s,n);return}if(Kr!==0&&R>Kr){l.push(s,n);return}}}else if(I=E-(i+o)/2,G=w-(t+a)/2,I*I+G*G<=c){l.push(E,w);return}}gu(i,t,d,f,b,v,E,w,l,c,h+1),gu(E,w,T,S,y,x,o,a,l,c,h+1)}var tE,Oa,eE,mu,Di,Kr,xu=p(()=>{Ua();tE=8,Oa=11920929e-14,eE=1,mu=.01,Di=0,Kr=0});function Pb(i,t,e,r,s,n,o,a){let c=Math.min(.99,Math.max(0,a??Fi.defaultOptions.bezierSmoothness)),h=(nE-c)/1;return h*=h,aE(t,e,r,s,n,o,i,h),i}function aE(i,t,e,r,s,n,o,a){_u(o,i,t,e,r,s,n,a,0),o.push(s,n)}function _u(i,t,e,r,s,n,o,a,l){if(l>iE)return;let c=Math.PI,h=(t+r)/2,u=(e+s)/2,d=(r+n)/2,f=(s+o)/2,m=(h+d)/2,g=(u+f)/2,y=n-t,x=o-e,b=Math.abs((r-n)*x-(s-o)*y);if(b>sE){if(b*b<=a*(y*y+x*x)){if(wb<oE){i.push(m,g);return}let v=Math.abs(Math.atan2(o-s,n-r)-Math.atan2(s-e,r-t));if(v>=c&&(v=2*c-v),v<wb){i.push(m,g);return}}}else if(y=m-(t+n)/2,x=g-(e+o)/2,y*y+x*x<=a){i.push(m,g);return}_u(i,t,e,h,u,m,g,a,l+1),_u(i,m,g,d,f,n,o,a,l+1)}var iE,sE,nE,oE,wb,Mb=p(()=>{Ua();iE=8,sE=11920929e-14,nE=1,oE=.01,wb=0});function Na(i,t,e,r,s,n,o,a){let l=Math.abs(s-n);(!o&&s>n||o&&n>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,h=s;c*=o?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),m=t+d*r,g=e+f*r;i.push(m,g),h+=c}}var yu=p(()=>{"use strict"});function Ab(i,t,e,r,s,n){let o=i[i.length-2],l=i[i.length-1]-e,c=o-t,h=s-e,u=r-t,d=Math.abs(l*u-c*h);if(d<1e-8||n===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=l*l+c*c,m=h*h+u*u,g=l*h+c*u,y=n*Math.sqrt(f)/d,x=n*Math.sqrt(m)/d,b=y*g/f,v=x*g/m,T=y*u+x*c,S=y*h+x*l,E=c*(x+b),w=l*(x+b),I=u*(y+v),G=h*(y+v),M=Math.atan2(w-S,E-T),C=Math.atan2(G-S,I-T);Na(i,T+t,S+e,n,M,C,c*h>u*l)}var Rb=p(()=>{yu()});function lE(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),n=Math.sin(i),o=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-n*r,y:n+s*r},{x:o+a*r,y:a-o*r},{x:o,y:a}]}function Gb(i,t,e,r,s,n,o,a=0,l=0,c=0){if(n===0||o===0)return;let h=Math.sin(a*Sn/360),u=Math.cos(a*Sn/360),d=u*(t-r)/2+h*(e-s)/2,f=-h*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;n=Math.abs(n),o=Math.abs(o);let m=Math.pow(d,2)/Math.pow(n,2)+Math.pow(f,2)/Math.pow(o,2);m>1&&(n*=Math.sqrt(m),o*=Math.sqrt(m)),cE(t,e,r,s,n,o,l,c,h,u,d,f,bu);let{ang1:g,ang2:y}=bu,{centerX:x,centerY:b}=bu,v=Math.abs(y)/(Sn/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);y/=T;let S=i[i.length-2],E=i[i.length-1],w={x:0,y:0};for(let I=0;I<T;I++){let G=lE(g,y),{x:M,y:C}=vu(G[0],n,o,u,h,x,b,w),{x:R,y:L}=vu(G[1],n,o,u,h,x,b,w),{x:V,y:F}=vu(G[2],n,o,u,h,x,b,w);La(i,S,E,M,C,R,L,V,F),S=V,E=F,g+=y}}var Sn,bu,vu,Bb,cE,kb=p(()=>{xu();Sn=Math.PI*2,bu={centerX:0,centerY:0,ang1:0,ang2:0},vu=({x:i,y:t},e,r,s,n,o,a,l)=>{i*=e,t*=r;let c=s*i-n*t,h=n*i+s*t;return l.x=c+o,l.y=h+a,l};Bb=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,n=i*e+t*r;return n>1&&(n=1),n<-1&&(n=-1),s*Math.acos(n)},cE=(i,t,e,r,s,n,o,a,l,c,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(n,2),g=Math.pow(h,2),y=Math.pow(u,2),x=f*m-f*y-m*g;x<0&&(x=0),x/=f*y+m*g,x=Math.sqrt(x)*(o===a?-1:1);let b=x*s/n*u,v=x*-n/s*h,T=c*b-l*v+(i+e)/2,S=l*b+c*v+(t+r)/2,E=(h-b)/s,w=(u-v)/n,I=(-h-b)/s,G=(-u-v)/n,M=Bb(1,0,E,w),C=Bb(E,w,I,G);a===0&&C>0&&(C-=Sn),a===1&&C<0&&(C+=Sn),d.centerX=T,d.centerY=S,d.ang1=M,d.ang2=C}});function Ib(i,t,e){let r=(o,a)=>{let l=a.x-o.x,c=a.y-o.y,h=Math.sqrt(l*l+c*c),u=l/h,d=c/h;return{len:h,nx:u,ny:d}},s=(o,a)=>{o===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},n=t[t.length-1];for(let o=0;o<t.length;o++){let a=t[o%t.length],l=a.radius??e;if(l<=0){s(o,a),n=a;continue}let c=t[(o+1)%t.length],h=r(a,n),u=r(a,c);if(h.len<1e-4||u.len<1e-4){s(o,a),n=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,m=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let g=d/2,y,x=Math.abs(Math.cos(g)*l/Math.sin(g));x>Math.min(h.len/2,u.len/2)?(x=Math.min(h.len/2,u.len/2),y=Math.abs(x*Math.sin(g)/Math.cos(g))):y=l;let b=a.x+u.nx*x+-u.ny*y*f,v=a.y+u.ny*x+u.nx*y*f,T=Math.atan2(h.ny,h.nx)+Math.PI/2*f,S=Math.atan2(u.ny,u.nx)-Math.PI/2*f;o===0&&i.moveTo(b+Math.cos(T)*y,v+Math.sin(T)*y),i.arc(b,v,y,T,S,m),n=a}}function Fb(i,t,e,r){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),n=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),o=t.length;for(let a=0;a<o;a++){let l=t[(a+1)%o],c=l.radius??e;if(c<=0){a===0?i.moveTo(l.x,l.y):i.lineTo(l.x,l.y);continue}let h=t[a],u=t[(a+2)%o],d=s(h,l),f;if(d<1e-4)f=l;else{let y=Math.min(d/2,c);f=n(l,h,y/d)}let m=s(u,l),g;if(m<1e-4)g=l;else{let y=Math.min(m/2,c);g=n(l,u,y/m)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(l.x,l.y,g.x,g.y,r)}}var Db=p(()=>{"use strict"});var hE,Ha,Ub=p(()=>{yp();bp();vp();Ut();Tp();jt();xu();Mb();yu();Rb();kb();Db();hE=new q,Ha=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ct,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],n=r[r.length-1];return(s!==t||n!==e)&&r.push(t,e),this}arc(t,e,r,s,n,o){this._ensurePoly(!1);let a=this._currentPoly.points;return Na(a,t,e,r,s,n,o),this}arcTo(t,e,r,s,n){this._ensurePoly();let o=this._currentPoly.points;return Ab(o,t,e,r,s,n),this}arcToSvg(t,e,r,s,n,o,a){let l=this._currentPoly.points;return Gb(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,r,s,n),this}bezierCurveTo(t,e,r,s,n,o,a){this._ensurePoly();let l=this._currentPoly;return La(this._currentPoly.points,l.lastX,l.lastY,t,e,r,s,n,o,a),this}quadraticCurveTo(t,e,r,s,n){this._ensurePoly();let o=this._currentPoly;return Pb(this._currentPoly.points,o.lastX,o.lastY,t,e,r,s,n),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 n=0;n<t.instructions.length;n++){let o=t.instructions[n];this[o.action](...o.data)}if(t.checkForHoles&&r.length-s>1){let n=null;for(let o=s;o<r.length;o++){let a=r[o];if(a.shape.type==="polygon"){let l=a.shape,c=n?.shape;c&&c.containsPolygon(l)?(n.holes||(n.holes=[]),n.holes.push(a),r.copyWithin(o,o+1),r.length--,o--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,n){return this.drawShape(new q(t,e,r,s),n),this}circle(t,e,r,s){return this.drawShape(new vo(t,e,r),s),this}poly(t,e,r){let s=new ui(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,n=0,o){s=Math.max(s|0,3);let a=-1*Math.PI/2+n,l=Math.PI*2/s,c=[];for(let h=0;h<s;h++){let u=a-h*l;c.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(c,!0,o),this}roundPoly(t,e,r,s,n,o=0,a){if(s=Math.max(s|0,3),n<=0)return this.regularPoly(t,e,r,s,o);let l=r*Math.sin(Math.PI/s)-.001;n=Math.min(n,l);let c=-1*Math.PI/2+o,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*h+c,m=t+r*Math.cos(f),g=e+r*Math.sin(f),y=f+Math.PI+u,x=f-Math.PI-u,b=m+n*Math.cos(y),v=g+n*Math.sin(y),T=m+n*Math.cos(x),S=g+n*Math.sin(x);d===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(m,g,T,S,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?Fb(this,t,e,s):Ib(this,t,e),this.closePath())}filletRect(t,e,r,s,n){if(n===0)return this.rect(t,e,r,s);let o=Math.min(r,s)/2,a=Math.min(o,Math.max(-o,n)),l=t+r,c=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(l-u,e).arcTo(l-h,e+h,l,e+u,u).lineTo(l,c-u).arcTo(l-h,c-h,t+r-u,c,u).lineTo(t+u,c).arcTo(t+h,c-h,t,c-u,u).closePath()}chamferRect(t,e,r,s,n,o){if(n<=0)return this.rect(t,e,r,s);let a=Math.min(n,Math.min(r,s)/2),l=t+r,c=e+s,h=[t+a,e,l-a,e,l,e+a,l,c-a,l-a,c,t+a,c,t,c-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,o)}ellipse(t,e,r,s,n){return this.drawShape(new To(t,e,r,s),n),this}roundRect(t,e,r,s,n,o){return this.drawShape(new Eo(t,e,r,s,n),o),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 ui,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 ui,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 n=e.transform,o=r;r=n.a*r+n.c*s+n.tx,s=n.b*o+n.d*s+n.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],n=s.shape.getBounds(hE);s.transform?t.addRect(n,s.transform):t.addRect(n)}return t}}});function Ui(i,t){return i?i.prepend(t):t.clone()}var de,Wa=p(()=>{ge();Pt();ot();Cb();Ub();de=class i{constructor(t,e=!1){this.instructions=[],this.uid=j("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Eb(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ha(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,n){let o=this.instructions[this.instructions.length-1],a=this.getLastPoint(tt.shared),l=0,c=0;if(!o||o.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=o.data[2],c=o.data[3];let h=a.x,u=a.y;l=h+(h-l),c=u+(u-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,r,s,n]}),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],n=this.getLastPoint(tt.shared),o=0,a=0;if(!s||s.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=s.data[0],a=s.data[1];let l=n.x,c=n.y;o=l+(l-o),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,n){return this.instructions.push({action:"rect",data:[t,e,r,s,n]}),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,n,o,a){n||(n=s/2);let l=-1*Math.PI/2+o,c=r*2,h=Math.PI*2/c,u=[];for(let d=0;d<c;d++){let f=d%2?n:s,m=d*h+l;u.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){let e=new 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,n=t.d,o=t.tx,a=t.ty,l=0,c=0,h=0,u=0,d=0,f=0,m=0,g=0;for(let y=0;y<this.instructions.length;y++){let x=this.instructions[y],b=x.data;switch(x.action){case"moveTo":case"lineTo":l=b[0],c=b[1],b[0]=e*l+s*c+o,b[1]=r*l+n*c+a;break;case"bezierCurveTo":h=b[0],u=b[1],d=b[2],f=b[3],l=b[4],c=b[5],b[0]=e*h+s*u+o,b[1]=r*h+n*u+a,b[2]=e*d+s*f+o,b[3]=r*d+n*f+a,b[4]=e*l+s*c+o,b[5]=r*l+n*c+a;break;case"quadraticCurveTo":h=b[0],u=b[1],l=b[2],c=b[3],b[0]=e*h+s*u+o,b[1]=r*h+n*u+a,b[2]=e*l+s*c+o,b[3]=r*l+n*c+a;break;case"arcToSvg":l=b[5],c=b[6],m=b[0],g=b[1],b[0]=e*m+s*g,b[1]=r*m+n*g,b[5]=e*l+s*c+o,b[6]=r*l+n*c+a;break;case"circle":b[4]=Ui(b[3],t);break;case"rect":b[4]=Ui(b[4],t);break;case"ellipse":b[8]=Ui(b[8],t);break;case"roundRect":b[5]=Ui(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=Ui(b[2],t);break;case"regularPoly":case"chamferRect":b[5]=Ui(b[5],t);break;case"closePath":break;default:O("unknown transform action",x.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 Tu=p(()=>{"use strict"});function Ob(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let n=0;n<s.children.length;n++){let o=s.children[n];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=uE(o);break;case"radialgradient":t.defs[o.id]=dE(o);break;default:break}}}}function uE(i){let t=bt(i,"x1",0),e=bt(i,"y1",0),r=bt(i,"x2",1),s=bt(i,"y2",0),n=i.getAttribute("gradientUnits")||"objectBoundingBox",o=new Xt(t,e,r,s,n==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let l=i.children[a],c=bt(l,"offset",0),h=K.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(c,h)}return o}function dE(i){return O("[SVG Parser] Radial gradients are not yet supported"),new Xt(0,0,1,0)}var Lb=p(()=>{Ht();ot();Yr();Tu()});function Su(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Nb=p(()=>{"use strict"});function Eu(i,t){let e=i.getAttribute("style"),r={},s={},n={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let o in Hb){let a=i.getAttribute(o);a&&Wb(t,n,o,a.trim())}if(e){let o=e.split(";");for(let a=0;a<o.length;a++){let l=o[a].trim(),[c,h]=l.split(":");Hb[c]&&Wb(t,n,c,h.trim())}}return{strokeStyle:n.useStroke?r:null,fillStyle:n.useFill?s:null,useFill:n.useFill,useStroke:n.useStroke}}function Wb(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Su(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=K.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=Su(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=K.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 Hb,Vb=p(()=>{Ht();Nb();Hb={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 zb(i){if(i.length<=2)return!0;let t=i.map(a=>a.area).sort((a,l)=>l-a),[e,r]=t,s=t[t.length-1],n=e/r,o=r/s;return!(n>3&&o<2)}var Xb=p(()=>{"use strict"});function Yb(i){return i.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function jb(i){let t=i.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;let e=t.map(Number),r=[],s=[];for(let h=0;h<e.length;h+=2)h+1<e.length&&(r.push(e[h]),s.push(e[h+1]));if(r.length===0||s.length===0)return 0;let n=Math.min(...r),o=Math.max(...r),a=Math.min(...s),l=Math.max(...s);return(o-n)*(l-a)}function Cu(i,t){let e=new de(i,!1);for(let r of e.instructions)t.instructions.push(r)}var $b=p(()=>{Wa()});function Kb(i,t){if(typeof i=="string"){let o=document.createElement("div");o.innerHTML=i.trim(),i=o.querySelector("svg")}let e={context:t,defs:{},path:new de};Ob(i,e);let r=i.children,{fillStyle:s,strokeStyle:n}=Eu(i,e);for(let o=0;o<r.length;o++){let a=r[o];a.nodeName.toLowerCase()!=="defs"&&qb(a,e,s,n)}return t}function qb(i,t,e,r){let s=i.children,{fillStyle:n,strokeStyle:o}=Eu(i,t);n&&e?e={...e,...n}:n&&(e=n),o&&r?r={...r,...o}:o&&(r=o);let a=!e&&!r;a&&(e={color:0});let l,c,h,u,d,f,m,g,y,x,b,v,T,S,E,w,I;switch(i.nodeName.toLowerCase()){case"path":{S=i.getAttribute("d");let G=i.getAttribute("fill-rule"),M=Yb(S),C=G==="evenodd",R=M.length>1;if(C&&R){let V=M.map(A=>({path:A,area:jb(A)}));if(V.sort((A,k)=>k.area-A.area),M.length>3||!zb(V))for(let A=0;A<V.length;A++){let k=V[A],X=A===0;t.context.beginPath();let D=new de(void 0,!0);Cu(k.path,D),t.context.path(D),X?(e&&t.context.fill(e),r&&t.context.stroke(r)):t.context.cut()}else for(let A=0;A<V.length;A++){let k=V[A],X=A%2===1;t.context.beginPath();let D=new de(void 0,!0);Cu(k.path,D),t.context.path(D),X?t.context.cut():(e&&t.context.fill(e),r&&t.context.stroke(r))}}else{let V=G?G==="evenodd":!0;E=new de(S,V),t.context.path(E),e&&t.context.fill(e),r&&t.context.stroke(r)}break}case"circle":m=bt(i,"cx",0),g=bt(i,"cy",0),y=bt(i,"r",0),t.context.ellipse(m,g,y,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":l=bt(i,"x",0),c=bt(i,"y",0),w=bt(i,"width",0),I=bt(i,"height",0),x=bt(i,"rx",0),b=bt(i,"ry",0),x||b?t.context.roundRect(l,c,w,I,x||b):t.context.rect(l,c,w,I),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=bt(i,"cx",0),g=bt(i,"cy",0),x=bt(i,"rx",0),b=bt(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,x,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=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(h,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/-?\d+/g).map(G=>parseInt(G,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/-?\d+/g).map(G=>parseInt(G,10)),t.context.poly(v,!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 G=0;G<s.length;G++)qb(s[G],t,e,r)}var Zb=p(()=>{ot();Wa();Lb();Tu();Vb();Xb();$b()});function fE(i){return K.isColorLike(i)}function Qb(i){return i instanceof Te}function Jb(i){return i instanceof Xt}function pE(i){return i instanceof U}function mE(i,t,e){let r=K.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=U.WHITE,{...e,...i}}function gE(i,t,e){return i.texture=t,{...e,...i}}function t0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function e0(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 xE(i,t){let e={...t,...i},r=K.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function je(i,t){if(i==null)return null;let e={},r=i;return fE(i)?mE(e,i,t):pE(i)?gE(e,i,t):Qb(i)?t0(e,i,t):Jb(i)?e0(e,i,t):r.fill&&Qb(r.fill)?t0(r,r.fill,t):r.fill&&Jb(r.fill)?e0(r,r.fill,t):xE(r,t)}function Oi(i,t){let{width:e,alignment:r,miterLimit:s,cap:n,join:o,pixelLine:a,...l}=t,c=je(i,l);return c?{width:e,alignment:r,miterLimit:s,cap:n,join:o,pixelLine:a,...c}:null}var wu=p(()=>{Ht();mt();Yr();bn()});function r0(i,t){let e=1,r=i.shapePath.shapePrimitives;for(let s=0;s<r.length;s++){let n=r[s].shape;if(n.type!=="polygon")continue;let o=n.points,a=o.length;if(a<6)continue;let l=n.closePath;for(let c=0;c<a;c+=2){if(!l&&(c===0||c===a-2))continue;let h=(c-2+a)%a,u=(c+2)%a,d=o[h],f=o[h+1],m=o[c],g=o[c+1],y=o[u],x=o[u+1],b=d-m,v=f-g,T=y-m,S=x-g,E=b*b+v*v,w=T*T+S*S;if(E<1e-12||w<1e-12)continue;let M=(b*T+v*S)/Math.sqrt(E*w);M<-1?M=-1:M>1&&(M=1);let C=Math.sqrt((1-M)*.5);if(C<1e-6)continue;let R=Math.min(1/C,t);R>e&&(e=R)}}return e}var i0=p(()=>{"use strict"});var _E,s0,Pu,se,Mu=p(()=>{Gt();Ht();et();ge();mt();Pt();_t();jt();Wa();Zb();wu();i0();_E=new tt,s0=new B,Pu=class Fe extends lt{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=j("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new de,this._transform=new B,this._fillStyle={...Fe.defaultFillStyle},this._strokeStyle={...Fe.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ct,this._boundsDirty=!0}clone(){let t=new Fe;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=je(t,Fe.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Oi(t,Fe.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=je(t,Fe.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=je(t,Fe.defaultStrokeStyle),this}texture(t,e,r,s,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?K.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new de,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s?.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(N(rt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=je(t,Fe.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(tt.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?.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Oi(t,Fe.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,n,o){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,n,o),this}arcTo(t,e,r,s,n){this._tick++;let o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,n),this}arcToSvg(t,e,r,s,n,o,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,r,s,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,r,s,n,o,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.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,n=r.a*t+r.c*e+r.tx,o=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=n,s[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,r,s,n){this._tick++;let o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,n),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,n){return this._tick++,this._activePath.roundRect(t,e,r,s,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,r,s,n,o),this}roundPoly(t,e,r,s,n,o){return this._tick++,this._activePath.roundPoly(t,e,r,s,n,o),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,n){return this._tick++,this._activePath.filletRect(t,e,r,s,n),this}chamferRect(t,e,r,s,n,o){return this._tick++,this._activePath.chamferRect(t,e,r,s,n,o),this}star(t,e,r,s,n=0,o=0){return this._tick++,this._activePath.star(t,e,r,s,n,o,this._transform.clone()),this}svg(t){return this._tick++,Kb(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,n,o){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,n,o),this)}transform(t,e,r,s,n,o){return t instanceof B?(this._transform.append(t),this):(s0.set(t,e,r,s,n,o),this._transform.append(s0),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._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;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 n=r.data;t.addBounds(n.path.bounds)}else if(s==="texture"){let n=r.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(s==="stroke"){let n=r.data,o=n.style.alignment,a=n.style.width*(1-o);n.style.join==="miter"&&(a*=r0(n.path,n.style.miterLimit));let l=n.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t.isValid||t.set(0,0,0,0),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 n=e[s],o=n.data,a=o.path;if(!n.action||!a)continue;let l=o.style,c=a.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){let u=c[h].shape;if(!l||!u)continue;let d=c[h].transform,f=d?d.applyInverse(t,_E):t;if(n.action==="fill")r=u.contains(f.x,f.y);else{let g=l;r=u.strokeContains(f.x,f.y,g.width,g.alignment)}let m=o.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let y=0;y<g.length;y++)g[y].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),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.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():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}};Pu.defaultFillStyle={color:16777215,alpha:1,texture:U.WHITE,matrix:null,fill:null,textureSpace:"local"};Pu.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:U.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};se=Pu});var Au,Ru,Gu,n0,o0=p(()=>{P();Jn();ve();Au=class{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}},Ru=class{constructor(){this.instructions=new Qe}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}},Gu=class Bu{constructor(t){this._renderer=t,this._managedContexts=new Ct({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Bu.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Bu.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){let e=t._gpuData,r=!!e[this._renderer.uid],s=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!r)&&(r&&s.reset(),s.isBatchable=!1,t.dirty=!1),s}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){let e=new Ru,r=this.getGpuContext(t);return r.graphicsData=e,e.init(),e}_initContext(t){let e=new Au;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Gu.extension={type:[_.CanvasSystem],name:"graphicsContext"};Gu.defaultOptions={bezierSmoothness:.5};n0=Gu});var En,a0=p(()=>{P();Re();ve();En=class{constructor(t,e){this.state=It.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ct({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}};En.extension={type:[_.CanvasPipes],name:"graphics"}});var ku,Cn,l0=p(()=>{P();Re();ve();Ne();_h();nu();ku=class{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{pt.return(t)}),this.batches.length=0}},Cn=class{constructor(t,e){this.state=It.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ct({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){let e=t.context,r=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!!(n.isBatchable||r!==n.isBatchable)}addRenderable(t,e){let s=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),s.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let n=r[s];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let n=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let o=n.resources.localUniforms.uniforms;o.uTransformMatrix=t.groupTransform,o.uRound=e._roundPixels|t._roundPixels,sa(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=this._getGpuDataForRenderable(t),s=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),s.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let n=0;n<s.length;n++){let o=s[n];r.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new ku;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){let r=t.context,n=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map(a=>{let l=pt.get(jr);return a.copyTo(l),l.renderable=t,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}};Cn.extension={type:[_.WebGLPipes,_.WebGPUPipes],name:"graphics"}});var c0=p(()=>{P();o0();a0();Ua();l0();H.add(En);H.add(Cn);H.add(n0);H.add(Fi)});var Se,Iu=p(()=>{_t();oo();Mu();c0();Se=class i extends tr{constructor(t){t instanceof se&&(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 se,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,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._context?.off("update",this.onViewUpdate,this),this._context?.off("unload",this.unload,this),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=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){N(rt,"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){N(rt,"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(){N(rt,"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!==se.defaultStrokeStyle.width||t.color!==se.defaultStrokeStyle.color||t.alpha!==se.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return N(rt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return N(rt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return N(rt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return N(rt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return N(rt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return N(rt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});function yE(i,t,e,r,s,n){n=Math.max(0,Math.min(n,Math.min(r,s)/2)),i.moveTo(t+n,e),i.lineTo(t+r-n,e),i.quadraticCurveTo(t+r,e,t+r,e+n),i.lineTo(t+r,e+s-n),i.quadraticCurveTo(t+r,e+s,t+r-n,e+s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t,e+s,t,e+s-n),i.lineTo(t,e+n),i.quadraticCurveTo(t,e,t+n,e)}function h0(i,t){switch(t.type){case"rectangle":{let e=t;i.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{let e=t;yE(i,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{let e=t;i.moveTo(e.x+e.radius,e.y),i.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{let e=t;i.ellipse?(i.moveTo(e.x+e.halfWidth,e.y),i.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2)):(i.save(),i.translate(e.x,e.y),i.scale(e.halfWidth,e.halfHeight),i.moveTo(1,0),i.arc(0,0,1,0,Math.PI*2),i.restore());break}case"triangle":{let e=t;i.moveTo(e.x,e.y),i.lineTo(e.x2,e.y2),i.lineTo(e.x3,e.y3),i.closePath();break}case"polygon":default:{let e=t,r=e.points;if(!r?.length)break;i.moveTo(r[0],r[1]);for(let s=2;s<r.length;s+=2)i.lineTo(r[s],r[s+1]);e.closePath&&i.closePath();break}}}function bE(i,t,e){let r=[],s=[],n=[];if(!dr[t.type]?.build(t,r))return!1;let a=t.closePath??!0;ki(r,e,!1,a,s,n);for(let l=0;l<n.length;l+=3){let c=n[l]*2,h=n[l+1]*2,u=n[l+2]*2;i.moveTo(s[c],s[c+1]),i.lineTo(s[h],s[h+1]),i.lineTo(s[u],s[u+1]),i.closePath()}return!0}function vE(i,t){if(!t?.length)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!r?.shape)continue;let s=r.transform,n=s&&!s.isIdentity();n&&(i.save(),i.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),h0(i,r.shape),n&&i.restore()}return!0}var wn,u0=p(()=>{P();Ba();Iu();Ia();ot();wn=class{constructor(t){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){if(t.action!=="pushMaskBegin"&&t.action!=="popMaskEnd")return;let e=this._renderer,r=e.canvasContext,s=r?.activeContext;if(!s)return;if(t.action==="popMaskEnd"){this._canvasMaskStack.pop()&&s.restore();return}t.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");let n=t.mask.mask;if(!(n instanceof Se)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}let o=n,a=o.context?.instructions;if(!a?.length){this._canvasMaskStack.push(!1);return}s.save(),r.setContextTransform(o.groupTransform,(e._roundPixels|o._roundPixels)===1),s.beginPath();let l=!1,c=!1;for(let h=0;h<a.length;h++){let u=a[h],d=u.action;if(d!=="fill"&&d!=="stroke")continue;let f=u.data,m=f?.path?.shapePath;if(!m?.shapePrimitives?.length)continue;let g=d==="stroke",y=m.shapePrimitives;for(let x=0;x<y.length;x++){let b=y[x];if(!b?.shape)continue;let v=b.transform,T=v&&!v.isIdentity();T&&(s.save(),s.transform(v.a,v.b,v.c,v.d,v.tx,v.ty)),g&&f.style?l=bE(s,b.shape,f.style)||l:(h0(s,b.shape),c=vE(s,b.holes)||c,l=!0),T&&s.restore()}}if(!l){s.restore(),this._canvasMaskStack.push(!1);return}c?s.clip("evenodd"):s.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(t,e){this._warnedMaskTypes.has(t)||(this._warnedMaskTypes.add(t),O(e))}};wn.extension={type:[_.CanvasPipes],name:"stencilMask"}});function d0(){let i=_o(),t=Object.create(null);return t.inherit=ft,t.none=ft,t.normal="source-over",t.add="lighter",t.multiply=i?"multiply":ft,t.screen=i?"screen":ft,t.overlay=i?"overlay":ft,t.darken=i?"darken":ft,t.lighten=i?"lighten":ft,t["color-dodge"]=i?"color-dodge":ft,t["color-burn"]=i?"color-burn":ft,t["hard-light"]=i?"hard-light":ft,t["soft-light"]=i?"soft-light":ft,t.difference=i?"difference":ft,t.exclusion=i?"exclusion":ft,t.saturation=i?"saturation":ft,t.color=i?"color":ft,t.luminosity=i?"luminosity":ft,t["linear-burn"]=i?"color-burn":ft,t["linear-dodge"]=i?"color-dodge":ft,t["linear-light"]=i?"hard-light":ft,t["pin-light"]=i?"hard-light":ft,t["vivid-light"]=i?"hard-light":ft,t["hard-mix"]=ft,t.negation=i?"difference":ft,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=ft,t.divide=ft,t.min=ft,t.max=ft,t}var ft,f0=p(()=>{ic();ft="source-over"});var TE,Pn,p0=p(()=>{Ht();P();et();f0();TE=new B,Pn=class{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=d0(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=t}resolutionChange(t){this.activeResolution=t}init(){let t=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:t}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){let e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(t,e,r,s){let n=s?B.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||B.IDENTITY,o=TE;o.copyFrom(n),o.append(t);let a=this._projTransform,l=this.activeResolution;if(r=r||l,a){let c=B.shared;c.copyFrom(o),c.prepend(a),o=c}e?this.activeContext.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*l|0,o.ty*l|0):this.activeContext.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*l,o.ty*l)}clear(t,e){let r=this.activeContext,s=this._renderer;if(r.clearRect(0,0,s.width,s.height),t){let n=K.shared.setValue(t);r.globalAlpha=e??n.alpha,r.fillStyle=n.toHex(),r.fillRect(0,0,s.width,s.height),r.globalAlpha=1}}setBlendMode(t){if(this._activeBlendMode===t)return;this._activeBlendMode=t,this._outerBlend=!1;let e=this.blendModes[t];if(!e){this._warnedBlendModes.has(t)||(console.warn(`CanvasRenderer: blend mode "${t}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(t)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=e}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}};Pn.extension={type:[_.CanvasSystem],name:"canvasContext"}});var Mn,m0=p(()=>{P();Mn=class{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}};Mn.extension={type:[_.CanvasSystem],name:"limits"}});var Va,g0=p(()=>{Ht();dt();ot();rr();Va=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}initGpuRenderTarget(t){let e=t.colorTexture,{canvas:r,context:s}=this._ensureCanvas(e);return{canvas:r,context:s,width:r.width,height:r.height}}resizeGpuRenderTarget(t){let e=t.colorTexture,{canvas:r}=this._ensureCanvas(e);r.width=t.pixelWidth,r.height=t.pixelHeight}startRenderPass(t,e,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t);this._renderer.canvasContext.activeContext=n.context,this._renderer.canvasContext.activeResolution=t.resolution,e&&this.clear(t,e,r,s)}clear(t,e,r,s){let o=this._renderTargetSystem.getGpuRenderTarget(t).context,a=s||{x:0,y:0,width:t.pixelWidth,height:t.pixelHeight};if(o.setTransform(1,0,0,1,0,0),o.clearRect(a.x,a.y,a.width,a.height),r){let l=K.shared.setValue(r);l.alpha>0&&(o.globalAlpha=l.alpha,o.fillStyle=l.toHex(),o.fillRect(a.x,a.y,a.width,a.height),o.globalAlpha=1)}}finishRenderPass(){}copyToTexture(t,e,r,s,n){let a=this._renderTargetSystem.getGpuRenderTarget(t).canvas,l=e.source,{context:c}=this._ensureCanvas(l),h=n?.x??0,u=n?.y??0;return c.drawImage(a,r.x,r.y,s.width,s.height,h,u,s.width,s.height),l.update(),e}copyDepthTexture(t,e,r,s,n){O("[CanvasRenderTargetAdaptor] copyDepthTexture is not supported in the canvas renderer")}destroyGpuRenderTarget(t){}_ensureCanvas(t){let e=t.resource;(!e||!vt.test(e))&&(e=W.get().createCanvas(t.pixelWidth,t.pixelHeight),t.resource=e),(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(e.width=t.pixelWidth,e.height=t.pixelHeight);let r=e.getContext("2d");return{canvas:e,context:r}}}});var An,x0=p(()=>{P();fa();g0();An=class extends ur{constructor(t){super(t),this.adaptor=new Va,this.adaptor.init(t,this)}};An.extension={type:[_.CanvasSystem],name:"renderTarget"}});var Rn,_0=p(()=>{dt();P();hi();Rn=class{constructor(t){}init(){}initSource(t){}generateCanvas(t){let e=W.get().createCanvas(),r=e.getContext("2d"),s=$.getCanvasSource(t);if(!s)return e;let n=t.frame,o=t.source._resolution??t.source.resolution??1,a=n.x*o,l=n.y*o,c=n.width*o,h=n.height*o;return e.width=Math.ceil(c),e.height=Math.ceil(h),r.drawImage(s,a,l,c,h,0,0,c,h),e}getPixels(t){let e=this.generateCanvas(t);return{pixels:e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e.width,e.height).data,width:e.width,height:e.height}}destroy(){}};Rn.extension={type:[_.CanvasSystem],name:"texture"}});var T0={};sl(T0,{CanvasRenderer:()=>Fu});var SE,EE,CE,y0,b0,v0,Fu,S0=p(()=>{P();jc();Kc();_b();Qc();bb();ch();dh();vb();u0();ph();kr();la();Ae();p0();m0();x0();_0();SE=[...Ai,Pn,Mn,Rn,An],EE=[Lr,Ls,Dr,Fr,Or,wn,Tn,Ir],CE=[yb,vn],y0=[],b0=[],v0=[];H.handleByNamedList(_.CanvasSystem,y0);H.handleByNamedList(_.CanvasPipes,b0);H.handleByNamedList(_.CanvasPipesAdaptor,v0);H.add(...SE,...EE,...CE);Fu=class extends ue{constructor(){let t={name:"canvas",type:Rt.CANVAS,systems:y0,renderPipes:b0,renderPipeAdaptors:v0};super(t)}}});function B0(i=1e3,t=0,e=!1){if(isNaN(i)||i<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new Uu(i,t,e)}var Uu,G0=p(()=>{Uu=class{constructor(t=0,e=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=r,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){let e=new Array(t.length);for(let r=0;r<t.length;r++){let s=t[r];e[r]=[s,this.get(s)]}return e}evict(t=!1){if(t||this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){let t=new Array(this.size),e=this.first,r=0;for(;e!==null;)t[r++]=e.key,e=e.next;return t}setWithEvicted(t,e,r=this.resetTtl){let s=null;if(this.has(t))this.set(t,e,!0,r);else{this.max>0&&this.size===this.max&&(s={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return s}set(t,e,r=!1,s=this.resetTtl){let n=this.items[t];return r||n!==void 0?(n.value=e,r===!1&&s&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=this.get(t[r]);return e}}});function Ou(i){return!!i.tagStyles&&Object.keys(i.tagStyles).length>0}function Lu(i){return i.includes("<")}function PE(i,t){return i.clone().assign(t)}function k0(i,t){let e=[],r=t.tagStyles;if(!Ou(t)||!Lu(i))return e.push({text:i,style:t}),e;let s=[t],n=[],o="",a=0;for(;a<i.length;){let l=i[a];if(l==="<"){let c=i.indexOf(">",a);if(c===-1){o+=l,a++;continue}let h=i.indexOf("<",a+1);if(h!==-1&&h<c){o+=l,a++;continue}let u=i.slice(a+1,c);if(u.startsWith("/")){let d=u.slice(1).trim();if(n.length>0&&n[n.length-1]===d){o.length>0&&(e.push({text:o,style:s[s.length-1]}),o=""),s.pop(),n.pop(),a=c+1;continue}else{o+=i.slice(a,c+1),a=c+1;continue}}else{let d=u.trim();if(r[d]){o.length>0&&(e.push({text:o,style:s[s.length-1]}),o="");let f=s[s.length-1],m=PE(f,r[d]);s.push(m),n.push(d),a=c+1;continue}else{o+=i.slice(a,c+1),a=c+1;continue}}}else o+=l,a++}return o.length>0&&e.push({text:o,style:s[s.length-1]}),e}var Nu=p(()=>{"use strict"});function Li(i){return typeof i!="string"?!1:AE.has(i.charCodeAt(0))}function qt(i,t){return typeof i!="string"?!1:BE.has(i.charCodeAt(0))}function FE(i){return typeof i!="string"?!1:IE.has(i.charCodeAt(0))}function Ya(i){return i==="normal"||i==="pre-line"}function ja(i){return i==="normal"}function Ee(i){if(typeof i!="string")return"";let t=i.length-1;for(;t>=0&&qt(i[t]);)t--;return t<i.length-1?i.slice(0,t+1):i}function $a(i){let t=[],e=[];if(typeof i!="string")return t;for(let r=0;r<i.length;r++){let s=i[r],n=i[r+1];if(qt(s,n)||Li(s)){e.length>0&&(t.push(e.join("")),e.length=0),s==="\r"&&n===`
907
+ `?(t.push(`\r
908
+ `),r++):t.push(s);continue}e.push(s),FE(s)&&n&&!qt(n)&&!Li(n)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function Ka(i,t,e,r){let s=e(i),n=[];for(let o=0;o<s.length;o++){let a=s[o],l=a,c=1;for(;s[o+c];){let h=s[o+c];if(!r(l,h,i,o,t))a+=h,l=h,c++;else break}o+=c-1,n.push(a)}return n}var ME,AE,RE,BE,GE,Bz,kE,IE,I0,F0,qa=p(()=>{"use strict";ME=[10,13],AE=new Set(ME),RE=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],BE=new Set(RE),GE=[9,32],Bz=new Set(GE),kE=[45,8208,8211,8212,173],IE=new Set(kE),I0=/(\r\n|\r|\n)/,F0=/(?:\r\n|\r|\n)/});function D0(i,t,e,r,s,n,o,a,l){let c=k0(i,t);if(ja(t.whiteSpace))for(let V=0;V<c.length;V++){let F=c[V];c[V]={text:F.text.replace(DE," "),style:F.style}}let u=[],d=[];for(let V of c){let F=V.text.split(I0);for(let A=0;A<F.length;A++){let k=F[A];k===`\r
909
+ `||k==="\r"||k===`
910
+ `?(u.push(d),d=[]):k.length>0&&d.push({text:k,style:V.style})}}(d.length>0||u.length===0)&&u.push(d);let f=e?UE(u,t,r,n,a,l):u,m=[],g=[],y=[],x=[],b=[],v=0,T=t._fontString,S=o(T);S.fontSize===0&&(S.fontSize=t.fontSize,S.ascent=t.fontSize);let E="",w=!!t.dropShadow,I=t._stroke?.width||0;for(let V of f){let F=0,A=S.ascent,k=S.descent,X="";for(let Z of V){let ht=Z.style._fontString,xt=o(ht);ht!==E&&(r.font=ht,E=ht);let st=s(Z.text,Z.style.letterSpacing,r);F+=st,A=Math.max(A,xt.ascent),k=Math.max(k,xt.descent),X+=Z.text;let at=Z.style._stroke?.width||0;at>I&&(I=at),!w&&Z.style.dropShadow&&(w=!0)}V.length===0&&(A=S.ascent,k=S.descent),m.push(F),g.push(A),y.push(k),b.push(X);let D=t.lineHeight||A+k;x.push(D+t.leading),v=Math.max(v,F)}let G=I,M=v+G+(t.dropShadow?t.dropShadow.distance:0),C=0;for(let V=0;V<x.length;V++)C+=x[V];C=Math.max(C,x[0]+G);let R=C+(t.dropShadow?t.dropShadow.distance:0),L=t.lineHeight||S.fontSize;return{width:M,height:R,lines:b,lineWidths:m,lineHeight:L+t.leading,maxLineWidth:v,fontProperties:S,runsByLine:f,lineAscents:g,lineDescents:y,lineHeights:x,hasDropShadow:w}}function UE(i,t,e,r,s,n){let{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:c}=t,h=Ya(a),u=l+o,d={},f="",m=(y,x)=>{let b=`${y}|${x.styleKey}`,v=d[b];if(v===void 0){let T=x._fontString;T!==f&&(e.font=T,f=T),v=r(y,x.letterSpacing,e)+x.letterSpacing,d[b]=v}return v},g=[];for(let y of i){let x=OE(y),b=g.length,v=C=>{let R=0,L=C;do{let{token:V,style:F}=x[L];R+=m(V,F),L++}while(L<x.length&&x[L].continuesFromPrevious);return R},T=C=>{let R=[],L=C;do R.push({token:x[L].token,style:x[L].style}),L++;while(L<x.length&&x[L].continuesFromPrevious);return R},S=[],E=0,w=!h,I=null,G=()=>{I&&I.text.length>0&&S.push(I),I=null},M=()=>{if(G(),S.length>0){let C=S[S.length-1];C.text=Ee(C.text),C.text.length===0&&S.pop()}g.push(S),S=[],E=0,w=!1};for(let C=0;C<x.length;C++){let{token:R,style:L,continuesFromPrevious:V}=x[C],F=m(R,L);if(h){let X=qt(R),D=I?.text[I.text.length-1]??S[S.length-1]?.text.slice(-1)??"",Z=D?qt(D):!1;if(X&&Z)continue}let A=!V,k=A?v(C):F;if(k>u&&A)if(E>0&&M(),c){let X=T(C);for(let D=0;D<X.length;D++){let Z=X[D].token,ht=X[D].style,xt=Ka(Z,c,n,s);for(let st of xt){let at=m(st,ht);at+E>u&&M(),!I||I.style!==ht?(G(),I={text:st,style:ht}):I.text+=st,E+=at}}C+=X.length-1}else{let X=T(C);G(),g.push(X.map(D=>({text:D.token,style:D.style}))),w=!1,C+=X.length-1}else if(k+E>u&&A){if(qt(R)){w=!1;continue}M(),I={text:R,style:L},E=F}else if(V&&!c)!I||I.style!==L?(G(),I={text:R,style:L}):I.text+=R,E+=F;else{let X=qt(R);if(E===0&&X&&!w)continue;!I||I.style!==L?(G(),I={text:R,style:L}):I.text+=R,E+=F}}if(G(),S.length>0){let C=S[S.length-1];C.text=Ee(C.text),C.text.length===0&&S.pop()}(S.length>0||g.length===b)&&g.push(S)}return g}function OE(i){let t=[],e=!1;for(let r of i){let s=$a(r.text),n=!0;for(let o of s){let a=qt(o)||Li(o),l=n&&e&&!a;t.push({token:o,style:r.style,continuesFromPrevious:l}),e=!a,n=!1}}return t}var DE,U0=p(()=>{Nu();qa();DE=/\r\n|\r|\n/g});function O0(i,t,e,r,s){let n=e[i];return typeof n!="number"&&(n=s(i,t,r)+t,e[i]=n),n}function L0(i,t,e,r,s,n,o){let a=e.getContext("2d",LE);a.font=t._fontString;let l=0,c="",h=[],u=Object.create(null),{letterSpacing:d,whiteSpace:f}=t,m=Ya(f),g=ja(f),y=!m,x=t.wordWrapWidth+d,b=$a(i);for(let T=0;T<b.length;T++){let S=b[T];if(Li(S)){if(!g){h.push(Ee(c)),y=!m,c="",l=0;continue}S=" "}if(m){let w=qt(S),I=qt(c[c.length-1]);if(w&&I)continue}let E=O0(S,d,u,a,r);if(E>x)if(c!==""&&(h.push(Ee(c)),c="",l=0),s(S,t.breakWords)){let w=Ka(S,t.breakWords,o,n);for(let I of w){let G=O0(I,d,u,a,r);G+l>x&&(h.push(Ee(c)),y=!1,c="",l=0),c+=I,l+=G}}else c.length>0&&(h.push(Ee(c)),c="",l=0),h.push(Ee(S)),y=!1,c="",l=0;else E+l>x&&(y=!1,h.push(Ee(c)),c="",l=0),(c.length>0||!qt(S)||y)&&(c+=S,l+=E)}let v=Ee(c);return v.length>0&&h.push(v),h.join(`
911
+ `)}var LE,N0=p(()=>{qa();LE={willReadFrequently:!0}});var H0,Ke,De,Hu=p(()=>{G0();dt();U0();Nu();qa();N0();H0={willReadFrequently:!0},Ke=class Y{static get experimentalLetterSpacingSupported(){let t=Y._experimentalLetterSpacingSupported;if(t===void 0){let e=W.get().getCanvasRenderingContext2D().prototype;t=Y._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,n,o,a,l,c,h){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c,h&&(this.runsByLine=h.runsByLine,this.lineAscents=h.lineAscents,this.lineDescents=h.lineDescents,this.lineHeights=h.lineHeights,this.hasDropShadow=h.hasDropShadow)}static measureText(t=" ",e,r=Y._canvas,s=e.wordWrap){let n=`${t}-${e.styleKey}-wordWrap-${s}`;if(Y._measurementCache.has(n))return Y._measurementCache.get(n);if(Ou(e)&&Lu(t)){let T=D0(t,e,s,Y._context,Y._measureText,Y._measureTextAdvance,Y.measureFont,Y.canBreakChars,Y.wordWrapSplit),S=new Y(t,e,T.width,T.height,T.lines,T.lineWidths,T.lineHeight,T.maxLineWidth,T.fontProperties,{runsByLine:T.runsByLine,lineAscents:T.lineAscents,lineDescents:T.lineDescents,lineHeights:T.lineHeights,hasDropShadow:T.hasDropShadow});return Y._measurementCache.set(n,S),S}let a=e._fontString,l=Y.measureFont(a);l.fontSize===0&&(l.fontSize=e.fontSize,l.ascent=e.fontSize,l.descent=0);let c=Y._context;c.font=a;let u=(s?Y._wordWrap(t,e,r):t).split(F0),d=new Array(u.length),f=0;for(let T=0;T<u.length;T++){let S=Y._measureText(u[T],e.letterSpacing,c);d[T]=S,f=Math.max(f,S)}let m=e._stroke?.width??0,g=e.lineHeight||l.fontSize,y=Y._adjustWidthForStyle(f,e),x=Math.max(g,l.fontSize+m)+(u.length-1)*(g+e.leading),b=Y._adjustHeightForStyle(x,e),v=new Y(t,e,y,b,u,d,g+e.leading,f,l);return Y._measurementCache.set(n,v),v}static _adjustWidthForStyle(t,e){let r=e._stroke?.width||0,s=t+r;return e.dropShadow&&(s+=e.dropShadow.distance),s}static _adjustHeightForStyle(t,e){let r=t;return e.dropShadow&&(r+=e.dropShadow.distance),r}static _measureText(t,e,r){let{metricWidth:s,metrics:n,letterSpacingVal:o}=Y._measureTextCore(t,e,r),a=-(n.actualBoundingBoxLeft??0),c=(n.actualBoundingBoxRight??0)-a;return n.width>0&&(c+=o),Math.max(s,c)}static _measureTextAdvance(t,e,r){return Y._measureTextCore(t,e,r).metricWidth}static _measureTextCore(t,e,r){let s=!1;Y.experimentalLetterSpacingSupported&&(Y.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let n=r.measureText(t),o=n.width,a=0;return o>0&&(s?a=-e:a=(Y.graphemeSegmenter(t).length-1)*e,o+=a),{metricWidth:o,metrics:n,letterSpacingVal:a}}static _wordWrap(t,e,r=Y._canvas){return L0(t,e,r,Y._measureTextAdvance,Y.canBreakWords,Y.canBreakChars,Y.wordWrapSplit)}static isBreakingSpace(t,e){return qt(t,e)}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,n){return!0}static wordWrapSplit(t){return Y.graphemeSegmenter(t)}static measureFont(t){if(Y._fonts[t])return Y._fonts[t];let e=Y._context;e.font=t;let r=e.measureText(Y.METRICS_STRING+Y.BASELINE_SYMBOL),s=r.actualBoundingBoxAscent??0,n=r.actualBoundingBoxDescent??0,o={ascent:s,descent:n,fontSize:s+n};return Y._fonts[t]=o,o}static clearMetrics(t=""){t?delete Y._fonts[t]:Y._fonts={}}static get _canvas(){if(!Y.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",H0)?.measureText)return Y.__canvas=e,e;t=W.get().createCanvas()}catch{t=W.get().createCanvas()}t.width=t.height=10,Y.__canvas=t}return Y.__canvas}static get _context(){return Y.__context||(Y.__context=Y._canvas.getContext("2d",H0)),Y.__context}};Ke.METRICS_STRING="|\xC9q\xC5";Ke.BASELINE_SYMBOL="M";Ke.BASELINE_MULTIPLIER=1.4;Ke.HEIGHT_MULTIPLIER=2;Ke.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>{let e=i.segment(t),r=[],s=0;for(let n of e)r[s++]=n.segment;return r}}return i=>[...i]})();Ke.experimentalLetterSpacing=!1;Ke._fonts={};Ke._measurementCache=B0(1e3);De=Ke});function kn(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)&&!NE.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var NE,Wu=p(()=>{"use strict";NE=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});function In(i,t,e,r=0,s=0,n=0){if(i.texture===U.WHITE&&!i.fill)return K.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Te){let o=i.fill,a=t.createPattern(o.texture.source.resource,"repeat");return $.applyPatternTransform(a,o.transform,!1),a}else if(i.fill instanceof Xt){let o=i.fill,a=o.type==="linear",l=o.textureSpace==="local",c=1,h=1;l&&e&&(c=e.width+r,h=e.height+r);let u,d=!1;if(a){let{start:f,end:m}=o;u=t.createLinearGradient(f.x*c+s,f.y*h+n,m.x*c+s,m.y*h+n),d=Math.abs(m.x-f.x)<Math.abs((m.y-f.y)*.1)}else{let{center:f,innerRadius:m,outerCenter:g,outerRadius:y}=o;u=t.createRadialGradient(f.x*c+s,f.y*h+n,m*c,g.x*c+s,g.y*h+n,y*c)}if(d&&l&&e){let f=e.lineHeight/h;for(let m=0;m<e.lines.length;m++){let g=(m*e.lineHeight+r/2)/h;o.colorStops.forEach(y=>{let x=g+y.offset*f;x=Math.max(0,Math.min(1,x)),u.addColorStop(Math.floor(x*W0)/W0,K.shared.setValue(y.color).toHex())})}}else o.colorStops.forEach(f=>{u.addColorStop(f.offset,K.shared.setValue(f.color).toHex())});return u}}else{let o=t.createPattern(i.texture.source.resource,"repeat"),a=i.matrix.copyTo(B.shared);return a.scale(i.texture.source.pixelWidth,i.texture.source.pixelHeight),o.setTransform(a),o}return O("FillStyle not recognised",i),"red"}var W0,V0=p(()=>{Ht();et();hi();mt();ot();Yr();bn();W0=1e5});function HE(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=qe.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){N(rt,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(K.isColorLike(e))r.color=e;else if(e instanceof Xt||e instanceof Te)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)){if(N(rt,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&O("The number of fill colors must match the number of fill gradient stops.");let e=new Xt({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=t.fillGradientStops.slice(),s=t.fill.map(n=>K.shared.setValue(n).toNumber());r.forEach((n,o)=>{e.addColorStop(n,s[o])}),i.fill={fill:e}}}var zu,qe,Za=p(()=>{Gt();Ht();Pt();_t();ot();Yr();bn();Mu();wu();Wu();zu=class Zr extends lt{constructor(t={}){super(),this.uid=j("textStyle"),this._tick=0,this._cachedFontString=null,HE(t),t instanceof Zr&&(t=t._toObject());let s={...Zr.defaultTextStyle,...t};for(let n in s){let o=n;this[o]=s[n]}this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Zr.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Zr.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._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&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._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({...se.defaultFillStyle,...t},()=>{this._fill=je({...this._originalFill},se.defaultFillStyle)})),this._fill=je(t===0?"black":t,se.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...se.defaultStrokeStyle,...t},()=>{this._stroke=Oi({...this._originalStroke},se.defaultStrokeStyle)})),this._stroke=Oi(t,se.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let t=Zr.defaultTextStyle;for(let e in t)this[e]=t[e]}assign(t){for(let e in t){let r=e;this[r]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=kn(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,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?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new Zr(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}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,n)=>(r[s]===n||(r[s]=n,e?.(s,n),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(K.isColorLike(t)||t instanceof Xt||t instanceof Te)}};zu.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};zu.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};qe=zu});P();var ym={extension:{type:_.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(_m(),pT))}};P();var vm={extension:{type:_.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(bm(),mT))}};P();xo();ho();P();dt();kr();var Lo;function Um(i){return Lo!==void 0||(Lo=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??ue.defaultOptions.failIfMajorPerformanceCaveat};try{if(!W.get().getWebGLRenderingContext())return!1;let r=W.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,s}catch{return!1}})()),Lo}dt();var No;async function Om(i={}){return No!==void 0||(No=await(async()=>{let t=W.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),No}kr();var E0=["webgl","webgpu","canvas"];async function C0(i){let t=[];i.preference?Array.isArray(i.preference)?t=i.preference.slice():(t.push(i.preference),E0.forEach(n=>{n!==i.preference&&t.push(n)})):t=E0.slice();let e,r={};for(let n=0;n<t.length;n++){let o=t[n];if(o==="webgpu"&&await Om()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(g_(),m_));e=a,r={...i,...i.webgpu};break}else if(o==="webgl"&&Um(i.failIfMajorPerformanceCaveat??ue.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(Ky(),$y));e=a,r={...i,...i.webgl};break}else if(o==="canvas"){let{CanvasRenderer:a}=await Promise.resolve().then(()=>(S0(),T0));e=a,r={...i,...i.canvasOptions};break}}if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}xe();th();_t();P();P();var Bn=class{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,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:n}=this._resizeTo;e=s,r=n}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}};Bn.extension=_.Application;P();Ji();oi();var Gn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,we.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Lt.shared:new Lt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Gn.extension=_.Application;H.add(Bn);H.add(Gn);var w0=class Du{constructor(...t){this.stage=new ut,t[0]!==void 0&&N(rt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new ut),this.renderer=await C0(t),Du._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return N(rt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(t=!1,e=!1){let r=Du._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}};w0._plugins=[];var za=w0;H.handleByList(_.Application,za._plugins);H.add(Bs);Ot();xr();zn();_t();oo();var Xa=class extends tr{constructor(t,e){let{text:r,resolution:s,style:n,anchor:o,width:a,height:l,roundPixels:c,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=n,this.resolution=s??null,this.allowChildren=!1,this._anchor=new wt({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,n=0;return t.x>=s&&t.x<=s+e&&(n=-r*this.anchor.y,t.y>=n&&t.y<=n+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}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}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}};function P0(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(N(rt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ht();Ut();yo();dt();qi();Ut();var qr=null,$e=null;function wE(i,t){qr||(qr=W.get().createCanvas(256,128),$e=qr.getContext("2d",{willReadFrequently:!0}),$e.globalCompositeOperation="copy",$e.globalAlpha=1),(qr.width<i||qr.height<t)&&(qr.width=Ve(i),qr.height=Ve(t))}function M0(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 A0(i,t,e,r,s){let n=4*t;for(let o=r,a=r*n+4*e;o<=s;++o,a+=n)if(i[a+3]!==0)return!1;return!0}function R0(...i){let t=i[0];t.canvas||(t={canvas:i[0],resolution:i[1]});let{canvas:e}=t,r=Math.min(t.resolution??1,1),s=t.width??e.width,n=t.height??e.height,o=t.output;if(wE(s,n),!$e)throw new TypeError("Failed to get canvas 2D context");$e.drawImage(e,0,0,s,n,0,0,s*r,n*r);let l=$e.getImageData(0,0,s,n).data,c=0,h=0,u=s-1,d=n-1;for(;h<n&&M0(l,s,h);)++h;if(h===n)return q.EMPTY;for(;M0(l,s,d);)--d;for(;A0(l,s,c,h,d);)++c;for(;A0(l,s,u,h,d);)--u;return++u,++d,$e.globalCompositeOperation="source-over",$e.strokeRect(c,h,u-c,d-h),$e.globalCompositeOperation="copy",o??(o=new q),o.set(c/r,h/r,(u-c)/r,(d-h)/r),o}Hu();Wu();V0();var z0=new q;function Ni(i){let t=0;for(let e=0;e<i.length;e++)i.charCodeAt(e)===32&&t++;return t}var Vu=class{getCanvasAndContext(t){let{text:e,style:r,resolution:s=1}=t,n=r._getFinalPadding(),o=De.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,o.width)+n*2)*s),l=Math.ceil(Math.ceil(Math.max(1,o.height)+n*2)*s),c=Ye.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(r,n,s,c,o);let h=r.trim?R0({canvas:c.canvas,width:a,height:l,resolution:1,output:z0}):z0.set(0,0,a,l);return{canvasAndContext:c,frame:h}}returnCanvasAndContext(t){Ye.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,r,s,n){if(n.runsByLine&&n.runsByLine.length>0){this._renderTaggedTextToCanvas(n,t,e,r,s);return}let{canvas:o,context:a}=s,l=kn(t),c=n.lines,h=n.lineHeight,u=n.lineWidths,d=n.maxLineWidth,f=n.fontProperties,m=o.height;if(a.resetTransform(),a.scale(r,r),a.textBaseline=t.textBaseline,t._stroke?.width){let S=t._stroke;a.lineWidth=S.width,a.miterLimit=S.miterLimit,a.lineJoin=S.join,a.lineCap=S.cap}a.font=l;let g,y,x=t.dropShadow?2:1,v=(t._stroke?.width??0)/2,T=(h-f.fontSize)/2;h-f.fontSize<0&&(T=0);for(let S=0;S<x;++S){let E=t.dropShadow&&S===0,w=E?Math.ceil(Math.max(1,m)+e*2):0,I=w*r;if(E)this._setupDropShadow(a,t,r,I);else{let G=t._gradientBounds,M=t._gradientOffset;if(G){let C={width:G.width,height:G.height,lineHeight:G.height,lines:n.lines};this._setFillAndStrokeStyles(a,t,C,e,v,M?.x??0,M?.y??0)}else M?this._setFillAndStrokeStyles(a,t,n,e,v,M.x,M.y):this._setFillAndStrokeStyles(a,t,n,e,v);a.shadowColor="rgba(0,0,0,0)"}for(let G=0;G<c.length;G++){g=v,y=v+G*h+f.ascent+T,g+=this._getAlignmentOffset(u[G],d,t.align);let M=0;if(t.align==="justify"&&t.wordWrap&&G<c.length-1){let C=Ni(c[G]);C>0&&(M=(d-u[G])/C)}t._stroke?.width&&this._drawLetterSpacing(c[G],t,s,g+e,y+e-w,!0,M),t._fill!==void 0&&this._drawLetterSpacing(c[G],t,s,g+e,y+e-w,!1,M)}}}_renderTaggedTextToCanvas(t,e,r,s,n){let{canvas:o,context:a}=n,{runsByLine:l,lineWidths:c,maxLineWidth:h,lineAscents:u,lineHeights:d,hasDropShadow:f}=t,m=o.height;a.resetTransform(),a.scale(s,s),a.textBaseline=e.textBaseline;let g=f?2:1,y=e._stroke?.width??0;for(let v of l)for(let T of v){let S=T.style._stroke?.width??0;S>y&&(y=S)}let x=y/2,b=[];for(let v=0;v<l.length;v++){let T=l[v],S=[];for(let E of T){let w=kn(E.style);a.font=w,S.push({width:De._measureText(E.text,E.style.letterSpacing,a),font:w})}b.push(S)}for(let v=0;v<g;++v){let T=f&&v===0,S=T?Math.ceil(Math.max(1,m)+r*2):0,E=S*s;T||(a.shadowColor="rgba(0,0,0,0)");let w=x;for(let I=0;I<l.length;I++){let G=l[I],M=c[I],C=u[I],R=d[I],L=b[I],V=x;V+=this._getAlignmentOffset(M,h,e.align);let F=0;if(e.align==="justify"&&e.wordWrap&&I<l.length-1){let X=0;for(let D of G)X+=Ni(D.text);X>0&&(F=(h-M)/X)}let A=w+C,k=V+r;for(let X=0;X<G.length;X++){let D=G[X],{width:Z,font:ht}=L[X];if(a.font=ht,a.textBaseline=D.style.textBaseline,D.style._stroke?.width){let st=D.style._stroke;if(a.lineWidth=st.width,a.miterLimit=st.miterLimit,a.lineJoin=st.join,a.lineCap=st.cap,T)if(D.style.dropShadow)this._setupDropShadow(a,D.style,s,E);else{let at=Ni(D.text);k+=Z+at*F;continue}else{let at=De.measureFont(ht),z=D.style.lineHeight||at.fontSize,Dt={width:Z,height:z,lineHeight:z,lines:[D.text]};a.strokeStyle=In(st,a,Dt,r*2,k-r,w)}this._drawLetterSpacing(D.text,D.style,n,k,A+r-S,!0,F)}let xt=Ni(D.text);k+=Z+xt*F}k=V+r;for(let X=0;X<G.length;X++){let D=G[X],{width:Z,font:ht}=L[X];if(a.font=ht,a.textBaseline=D.style.textBaseline,D.style._fill!==void 0){if(T)if(D.style.dropShadow)this._setupDropShadow(a,D.style,s,E);else{let st=Ni(D.text);k+=Z+st*F;continue}else{let st=De.measureFont(ht),at=D.style.lineHeight||st.fontSize,z={width:Z,height:at,lineHeight:at,lines:[D.text]};a.fillStyle=In(D.style._fill,a,z,r*2,k-r,w)}this._drawLetterSpacing(D.text,D.style,n,k,A+r-S,!1,F)}let xt=Ni(D.text);k+=Z+xt*F}w+=R}}}_setFillAndStrokeStyles(t,e,r,s,n,o=0,a=0){if(t.fillStyle=e._fill?In(e._fill,t,r,s*2,o,a):null,e._stroke?.width){let l=n+s*2;t.strokeStyle=In(e._stroke,t,r,l,o,a)}}_setupDropShadow(t,e,r,s){t.fillStyle="black",t.strokeStyle="black";let n=e.dropShadow,o=n.color,a=n.alpha;t.shadowColor=K.shared.setValue(o).setAlpha(a).toRgbaString();let l=n.blur*r,c=n.distance*r;t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*c,t.shadowOffsetY=Math.sin(n.angle)*c+s}_getAlignmentOffset(t,e,r){return r==="right"?e-t:r==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,r,s,n,o=!1,a=0){let{context:l}=r,c=e.letterSpacing,h=!1;if(De.experimentalLetterSpacingSupported&&(De.experimentalLetterSpacing?(l.letterSpacing=`${c}px`,l.textLetterSpacing=`${c}px`,h=!0):(l.letterSpacing="0px",l.textLetterSpacing="0px")),(c===0||h)&&a===0){o?l.strokeText(t,s,n):l.fillText(t,s,n);return}if(a!==0&&(c===0||h)){let g=t.split(" "),y=s,x=l.measureText(" ").width;for(let b=0;b<g.length;b++)o?l.strokeText(g[b],y,n):l.fillText(g[b],y,n),y+=l.measureText(g[b]).width+x+a;return}let u=s,d=De.graphemeSegmenter(t),f=l.measureText(t).width,m=0;for(let g=0;g<d.length;++g){let y=d[g];o?l.strokeText(y,u,n):l.fillText(y,u,n);let x="";for(let b=g+1;b<d.length;++b)x+=d[b];m=l.measureText(x).width,u+=f-m+c,y===" "&&(u+=a),f=m}}},fr=new Vu;Hu();Za();P();P();ve();Kl();function X0(i,t){let{texture:e,bounds:r}=i,s=t._style._getFinalPadding();uo(r,t._anchor,e);let n=t._anchor._x*s*2,o=t._anchor._y*s*2;r.minX-=s-n,r.minY-=s-o,r.maxX-=s-n,r.maxY-=s-o}qo();var Qa=class extends lr{};var Fn=class{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ct({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let t in this._managedTexts.items){let e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){let e=this._getGpuText(t),r=t.styleKey;return e.currentKey!==r?!0:t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);if(t._didTextUpdate){let s=t._autoResolution?this._renderer.resolution:t.resolution;(r.currentKey!==t.styleKey||t._resolution!==s)&&this._updateGpuText(t),t._didTextUpdate=!1,X0(r,t)}this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new Qa;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){let e=t._gpuData[this._renderer.uid];if(!e)return;let{canvasText:r}=this._renderer;r.getReferenceCount(e.currentKey)>0?r.decreaseReferenceCount(e.currentKey):e.texture&&r.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}};Fn.extension={type:[_.WebGLPipes,_.WebGPUPipes,_.CanvasPipes],name:"text"};P();Sr();xr();_t();Za();ac();var Hi=class{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,r,s){typeof t=="string"&&(N("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof qe||(t.style=new qe(t.style)),t.textureStyle instanceof Qt||(t.textureStyle=new Qt(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:n,style:o,textureStyle:a,autoGenerateMipmaps:l}=t,c=t.resolution??this._renderer.resolution,{frame:h,canvasAndContext:u}=fr.getCanvasAndContext({text:n,style:o,resolution:c}),d=wo(u.canvas,h.width,h.height,c,l);if(a&&(d.source.style=a),o.trim&&(h.pad(o.padding),d.frame.copyFrom(h),d.frame.scale(1/c),d.updateUvs()),o.filters){let f=this._applyFilters(d,o.filters);return this.returnTexture(d),fr.returnCanvasAndContext(u),f}return this._renderer.texture.initSource(d._source),this._retainCanvasContext||fr.returnCanvasAndContext(u),d}returnTexture(t){let e=t.source,r=e.resource;if(this._retainCanvasContext&&r?.getContext){let s=r.getContext("2d");s&&fr.returnCanvasAndContext({canvas:r,context:s})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Tt.returnTexture(t,!0)}renderTextToCanvas(){N("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let r=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:r,usageCount:1},r}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind({target:r,clear:!1}),s}destroy(){this._renderer=null;for(let t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}};var Dn=class extends Hi{constructor(t){super(t,!0)}};Dn.extension={type:[_.CanvasSystem],name:"canvasText"};P();var Un=class extends Hi{constructor(t){super(t,!1)}};Un.extension={type:[_.WebGLSystem,_.WebGPUSystem],name:"canvasText"};H.add(Dn);H.add(Un);H.add(Fn);var On=class extends Xa{constructor(...t){let e=P0(t,"Text");super(e,qe),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Qt?e.textureStyle:new Qt(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??J.defaultOptions.autoGenerateMipmaps}updateBounds(){let t=this._bounds,e=this._anchor,r=0,s=0;if(this._style.trim){let{frame:n,canvasAndContext:o}=fr.getCanvasAndContext({text:this.text,style:this._style,resolution:1});fr.returnCanvasAndContext(o),r=n.width,s=n.height}else{let n=De.measureText(this._text,this._style);r=n.width,s=n.height}t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*s,t.maxY=t.minY+s}};Rr();or();fs();sr();eh();function Xu(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}sr();function j0(i){return{dynamicUpdate:Y0(i,!0),staticUpdate:Y0(i,!1)}}function Y0(i,t){let e=[];e.push(`
912
+
913
+ var index = 0;
914
+
915
+ for (let i = 0; i < ps.length; ++i)
916
+ {
917
+ const p = ps[i];
918
+
919
+ `);let r=0;for(let n in i){let o=i[n];if(t!==o.dynamic)continue;e.push(`offset = index + ${r}`),e.push(o.code);let a=Wt(o.format);r+=a.stride/4}e.push(`
920
+ index += stride * 4;
921
+ }
922
+ `),e.unshift(`
923
+ var stride = ${r};
924
+ `);let s=e.join(`
925
+ `);return new Function("ps","f32v","u32v",s)}var Ja=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,n=0;for(let h in r){let u=r[h],d=Wt(u.format);u.dynamic?n+=d.stride:s+=d.stride}this._dynamicStride=n/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ge(e*4*s),this.dynamicAttributeBuffer=new Ge(e*4*n),this.indexBuffer=Xu(e);let o=new Be,a=0,l=0;this._staticBuffer=new Ft({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:it.VERTEX|it.COPY_DST}),this._dynamicBuffer=new Ft({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:it.VERTEX|it.COPY_DST});for(let h in r){let u=r[h],d=Wt(u.format);u.dynamic?(o.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(o.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:u.format}),l+=d.size)}o.addIndex(this.indexBuffer);let c=this.getParticleUpdate(r);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=o}getParticleUpdate(t){let e=WE(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return j0(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ge(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ge(this._size*this._dynamicStride*4*4),this.indexBuffer=Xu(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()}};function WE(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}dt();et();rr();mt();rc();xe();Iu();fo();Za();Gt();H.add(ym,vm);function $0(i,t,e){if(i.fillType!=="Horizontal"&&i.fillType!=="Vertical")return null;let r=Number(i.fillAmount??1),s=Number.isFinite(r)?Math.max(0,Math.min(1,r)):1;if(i.fillType==="Horizontal"){let o=t*s;return{x:i.fillHorizontalType==="Right"?t/2-o:-t/2,y:-e/2,width:o,height:e}}let n=e*s;return{x:-t/2,y:i.fillVerticalType==="Top"?-e/2:e/2-n,width:t,height:n}}Nh();jh();$h();Mh();ca();kr();sr();var K0={aVertex:(i,t,e,r,s)=>{let n=0,o=0,a=0,l=0;for(let c=0;c<i.length;++c){let h=i[c],u=h.texture,d=h.scaleX,f=h.scaleY,m=h.anchorX,g=h.anchorY,y=u.trim,x=u.orig;y?(o=y.x-m*x.width,n=o+y.width,l=y.y-g*x.height,a=l+y.height):(n=x.width*(1-m),o=x.width*-m,a=x.height*(1-g),l=x.height*-g),t[r]=o*d,t[r+1]=l*f,t[r+s]=n*d,t[r+s+1]=l*f,t[r+s*2]=n*d,t[r+s*2+1]=a*f,t[r+s*3]=o*d,t[r+s*3+1]=a*f,r+=s*4}},aPosition:(i,t,e,r,s)=>{for(let n=0;n<i.length;++n){let o=i[n],a=o.x,l=o.y;t[r]=a,t[r+1]=l,t[r+s]=a,t[r+s+1]=l,t[r+s*2]=a,t[r+s*2+1]=l,t[r+s*3]=a,t[r+s*3+1]=l,r+=s*4}},aRotation:(i,t,e,r,s)=>{for(let n=0;n<i.length;++n){let o=i[n].rotation;t[r]=o,t[r+s]=o,t[r+s*2]=o,t[r+s*3]=o,r+=s*4}},aUV:(i,t,e,r,s)=>{for(let n=0;n<i.length;++n){let o=i[n].texture.uvs;t[r]=o.x0,t[r+1]=o.y0,t[r+s]=o.x1,t[r+s+1]=o.y1,t[r+s*2]=o.x2,t[r+s*2+1]=o.y2,t[r+s*3]=o.x3,t[r+s*3+1]=o.y3,r+=s*4}},aColor:(i,t,e,r,s)=>{for(let n=0;n<i.length;++n){let o=i[n].color;e[r]=o,e[r+s]=o,e[r+s*2]=o,e[r+s*3]=o,r+=s*4}}};function Z0(i){let t=Object.values(i),e=t.filter(s=>s.dynamic),r=t.filter(s=>!s.dynamic);return{dynamicUpdate:q0(e),staticUpdate:q0(r)}}function q0(i){let t=0,e=[];for(let r=0;r<i.length;r++){let s=i[r],n=Wt(s.format).stride/4;t+=n,e.push({stride:n,updateFunction:s.updateFunction||K0[s.attributeName]})}return(r,s,n)=>{let o=0;for(let a=0;a<e.length;a++){let l=e[a];l.updateFunction(r,s,n,o,t),o+=l.stride}}}Js();ce();Ot();xr();Hh();function Q0(){return VE}function VE(i,t,e){let r=i.gl,s=i.shader,n=s._getProgramData(t.glProgram);for(let o in t.groups){let a=t.groups[o];for(let l in a.resources){let c=a.resources[l];if(c instanceof St)c.ubo?s.bindUniformBlock(c,t._uniformBindMap[o][l],e.blockIndex++):s.updateUniformGroup(c);else if(c instanceof ke)s.bindUniformBlock(c,t._uniformBindMap[o][l],e.blockIndex++);else if(c instanceof J||c instanceof Gi){i.texture.bind(c,e.textureCount);let h=t._uniformBindMap[o][l],u=n.uniformData[h];u&&(u.value!==e.textureCount&&r.uniform1i(u.location,e.textureCount),e.textureCount++)}else c instanceof Qt}}}va();ha();Qs();var J0=[(i,t,e,r,s)=>{let n=r[i].toArray(!0);t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+4]=n[3],t[e+5]=n[4],t[e+6]=n[5],t[e+8]=n[6],t[e+9]=n[7],t[e+10]=n[8]},(i,t,e,r,s)=>{s=r[i],t[e]=s.x,t[e+1]=s.y,t[e+2]=s.width,t[e+3]=s.height},(i,t,e,r,s)=>{s=r[i],t[e]=s.x,t[e+1]=s.y},(i,t,e,r,s)=>{s=r[i],t[e]=s.red,t[e+1]=s.green,t[e+2]=s.blue,t[e+3]=s.alpha},(i,t,e,r,s)=>{s=r[i],t[e]=s.red,t[e+1]=s.green,t[e+2]=s.blue}],tv={f32:(i,t,e,r,s)=>{t[e]=s},i32:(i,t,e,r,s)=>{t[e]=s},"vec2<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1]},"vec3<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2]},"vec4<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3]},"mat2x2<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3]},"mat3x3<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+4]=s[3],t[e+5]=s[4],t[e+6]=s[5],t[e+8]=s[6],t[e+9]=s[7],t[e+10]=s[8]},"mat4x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<16;n++)t[e+n]=s[n]},"mat3x2<f32>":(i,t,e,r,s)=>{for(let n=0;n<6;n++)t[e+(n/3|0)*4+n%3]=s[n]},"mat4x2<f32>":(i,t,e,r,s)=>{for(let n=0;n<8;n++)t[e+(n/4|0)*4+n%4]=s[n]},"mat2x3<f32>":(i,t,e,r,s)=>{for(let n=0;n<6;n++)t[e+(n/2|0)*4+n%2]=s[n]},"mat4x3<f32>":(i,t,e,r,s)=>{for(let n=0;n<12;n++)t[e+(n/4|0)*4+n%4]=s[n]},"mat2x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<8;n++)t[e+(n/2|0)*4+n%2]=s[n]},"mat3x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<12;n++)t[e+(n/3|0)*4+n%3]=s[n]}},ev={f32:(i,t,e,r,s)=>{t[e]=s},i32:(i,t,e,r,s)=>{t[e]=s},"vec2<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1]},"vec3<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2]},"vec4<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3]},"mat2x2<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+4]=s[2],t[e+5]=s[3]},"mat3x3<f32>":(i,t,e,r,s)=>{t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+4]=s[3],t[e+5]=s[4],t[e+6]=s[5],t[e+8]=s[6],t[e+9]=s[7],t[e+10]=s[8]},"mat4x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<16;n++)t[e+n]=s[n]},"mat3x2<f32>":(i,t,e,r,s)=>{for(let n=0;n<6;n++)t[e+(n/3|0)*4+n%3]=s[n]},"mat4x2<f32>":(i,t,e,r,s)=>{for(let n=0;n<8;n++)t[e+(n/4|0)*4+n%4]=s[n]},"mat2x3<f32>":(i,t,e,r,s)=>{for(let n=0;n<6;n++)t[e+(n/2|0)*4+n%2]=s[n]},"mat4x3<f32>":(i,t,e,r,s)=>{for(let n=0;n<12;n++)t[e+(n/4|0)*4+n%4]=s[n]},"mat2x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<8;n++)t[e+(n/2|0)*4+n%2]=s[n]},"mat3x4<f32>":(i,t,e,r,s)=>{for(let n=0;n<12;n++)t[e+(n/3|0)*4+n%3]=s[n]}};function rv(i){return sv(i,ev,t=>{let e=Math.max(_n[t.data.type]/16,1),r=t.data.value.length/t.data.size,s=(4-r%4)%4;return(n,o,a,l,c)=>{let h=0;for(let u=0;u<t.data.size*e;u++){for(let d=0;d<r;d++)o[a++]=c[h++];a+=s}}})}function iv(i){return sv(i,tv,t=>{let{size:e,align:r}=Nr[t.data.type],s=(e-r)/4;return(n,o,a,l,c)=>{let h=0;for(let u=0;u<t.data.size*(e/4);u++){for(let d=0;d<e/4;d++)o[a++]=c[h++];a+=s}}})}function sv(i,t,e){let r={};for(let s in i){let n=i[s],o=n.data,a=!1;r[o.name]={offset:n.offset/4,func:null};for(let l=0;l<Jt.length;l++){let c=Jt[l];if(o.type===c.type&&c.test(o)){r[o.name].func=J0[l],a=!0;break}}a||(o.size===1?r[o.name].func=t[o.type]:r[o.name].func=e(n))}return(s,n,o)=>{for(let a in r)r[a].func(a,n,o+r[a].offset,s,s[a])}}Qs();var nv={f32(i,t,e,r,s,n,o){e!==r&&(t.value=r,o.uniform1f(s[i].location,r))},"vec2<f32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1])&&(e[0]=r[0],e[1]=r[1],o.uniform2f(s[i].location,r[0],r[1]))},"vec3<f32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],o.uniform3f(s[i].location,r[0],r[1],r[2]))},"vec4<f32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],o.uniform4f(s[i].location,r[0],r[1],r[2],r[3]))},i32(i,t,e,r,s,n,o){e!==r&&(t.value=r,o.uniform1i(s[i].location,r))},"vec2<i32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1])&&(e[0]=r[0],e[1]=r[1],o.uniform2i(s[i].location,r[0],r[1]))},"vec3<i32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],o.uniform3i(s[i].location,r[0],r[1],r[2]))},"vec4<i32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],o.uniform4i(s[i].location,r[0],r[1],r[2],r[3]))},u32(i,t,e,r,s,n,o){e!==r&&(t.value=r,o.uniform1ui(s[i].location,r))},"vec2<u32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1])&&(e[0]=r[0],e[1]=r[1],o.uniform2ui(s[i].location,r[0],r[1]))},"vec3<u32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],o.uniform3ui(s[i].location,r[0],r[1],r[2]))},"vec4<u32>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],o.uniform4ui(s[i].location,r[0],r[1],r[2],r[3]))},bool(i,t,e,r,s,n,o){e!==r&&(t.value=r,o.uniform1i(s[i].location,r))},"vec2<bool>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1])&&(e[0]=r[0],e[1]=r[1],o.uniform2i(s[i].location,r[0],r[1]))},"vec3<bool>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],o.uniform3i(s[i].location,r[0],r[1],r[2]))},"vec4<bool>"(i,t,e,r,s,n,o){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],o.uniform4i(s[i].location,r[0],r[1],r[2],r[3]))},"mat2x2<f32>"(i,t,e,r,s,n,o){o.uniformMatrix2fv(s[i].location,!1,r)},"mat3x3<f32>"(i,t,e,r,s,n,o){o.uniformMatrix3fv(s[i].location,!1,r)},"mat4x4<f32>"(i,t,e,r,s,n,o){o.uniformMatrix4fv(s[i].location,!1,r)}},ov={f32(i,t,e,r,s,n,o){o.uniform1fv(s[i].location,r)},"vec2<f32>"(i,t,e,r,s,n,o){o.uniform2fv(s[i].location,r)},"vec3<f32>"(i,t,e,r,s,n,o){o.uniform3fv(s[i].location,r)},"vec4<f32>"(i,t,e,r,s,n,o){o.uniform4fv(s[i].location,r)},"mat2x2<f32>"(i,t,e,r,s,n,o){o.uniformMatrix2fv(s[i].location,!1,r)},"mat3x3<f32>"(i,t,e,r,s,n,o){o.uniformMatrix3fv(s[i].location,!1,r)},"mat4x4<f32>"(i,t,e,r,s,n,o){o.uniformMatrix4fv(s[i].location,!1,r)},i32(i,t,e,r,s,n,o){o.uniform1iv(s[i].location,r)},"vec2<i32>"(i,t,e,r,s,n,o){o.uniform2iv(s[i].location,r)},"vec3<i32>"(i,t,e,r,s,n,o){o.uniform3iv(s[i].location,r)},"vec4<i32>"(i,t,e,r,s,n,o){o.uniform4iv(s[i].location,r)},u32(i,t,e,r,s,n,o){o.uniform1iv(s[i].location,r)},"vec2<u32>"(i,t,e,r,s,n,o){o.uniform2iv(s[i].location,r)},"vec3<u32>"(i,t,e,r,s,n,o){o.uniform3iv(s[i].location,r)},"vec4<u32>"(i,t,e,r,s,n,o){o.uniform4iv(s[i].location,r)},bool(i,t,e,r,s,n,o){o.uniform1iv(s[i].location,r)},"vec2<bool>"(i,t,e,r,s,n,o){o.uniform2iv(s[i].location,r)},"vec3<bool>"(i,t,e,r,s,n,o){o.uniform3iv(s[i].location,r)},"vec4<bool>"(i,t,e,r,s,n,o){o.uniform4iv(s[i].location,r)}},av=[(i,t,e,r,s,n,o)=>{o.uniformMatrix3fv(s[i].location,!1,n[i].toArray(!0))},(i,t,e,r,s,n,o)=>{e=s[i].value,r=n[i],(e[0]!==r.x||e[1]!==r.y||e[2]!==r.width||e[3]!==r.height)&&(e[0]=r.x,e[1]=r.y,e[2]=r.width,e[3]=r.height,o.uniform4f(s[i].location,r.x,r.y,r.width,r.height))},(i,t,e,r,s,n,o)=>{e=s[i].value,r=n[i],(e[0]!==r.x||e[1]!==r.y)&&(e[0]=r.x,e[1]=r.y,o.uniform2f(s[i].location,r.x,r.y))},(i,t,e,r,s,n,o)=>{e=s[i].value,r=n[i],(e[0]!==r.red||e[1]!==r.green||e[2]!==r.blue||e[3]!==r.alpha)&&(e[0]=r.red,e[1]=r.green,e[2]=r.blue,e[3]=r.alpha,o.uniform4f(s[i].location,r.red,r.green,r.blue,r.alpha))},(i,t,e,r,s,n,o)=>{e=s[i].value,r=n[i],(e[0]!==r.red||e[1]!==r.green||e[2]!==r.blue)&&(e[0]=r.red,e[1]=r.green,e[2]=r.blue,o.uniform3f(s[i].location,r.red,r.green,r.blue))}];function lv(i,t){let e={};for(let r in i.uniformStructures){if(!t[r])continue;let s=i.uniformStructures[r],n=!1;for(let o=0;o<Jt.length;o++){let a=Jt[o];if(s.type===a.type&&a.test(s)){e[r]=av[o],n=!0;break}}if(!n){let o=s.size===1?nv:ov;e[r]=o[s.type]}}return(r,s,n)=>{let o=n.gl;for(let a in e){let l=s[a],c=r[a],h=r[a].value;e[a](a,c,h,l,r,s,o)}}}function zE(){Object.assign(ue.prototype,{_unsafeEvalCheck(){}}),Object.assign(cr.prototype,{_systemCheck(){}}),Object.assign(zr.prototype,{_generateUniformsSync:lv}),Object.assign(Wr.prototype,{_generateUboSync:rv}),Object.assign(Hr.prototype,{_generateUboSync:iv}),Object.assign(Vr.prototype,{_generateShaderSync:Q0}),Object.assign(Ja.prototype,{generateParticleUpdate:Z0})}zE();var cv=33;function Yu(i,t){let e=i.code&&String(i.code).startsWith("Digit")?String(i.code).slice(5):"";return e&&Number(e)>=1&&Number(e)<=9?`KeyboardCraftspersonKey${e}${t}`:""}function hv(i,t,e,r){return{x:(i.clientX-t.left)*e/t.width,y:(t.bottom-i.clientY)*r/t.height}}function uv({renderer:i,api:t,onSnapshot:e,onStatus:r,onError:s,isActive:n}={}){let o=null,a=!1,l=!1,c=null,h=null,u=0,d=null,f=null,m=[];function g(F){s&&s(F)}async function y(F){o=F,a=F?.running!==!1,F?.scene&&F.scene.format==="tree-v1"?(F.scene.reset&&(u=0),await i.applyScene(F.scene,F.canvasWidth,F.canvasHeight),u=F.scene.revision||u):Array.isArray(F?.paint)&&await i.render(F.paint,F.canvasWidth,F.canvasHeight),e&&await e(F)}async function x(){if(!(!a||l)&&!(n&&!n())){l=!0;try{await y(await t("get",{view:!0,sceneRev:u,compact:!0}))}catch(F){a=!1,v(),g(F)}finally{l=!1}}}function b(){c||(c=setInterval(()=>{x()},33))}function v(){c&&clearInterval(c),c=null,h&&clearTimeout(h),h=null}function T(F=30){h||(h=setTimeout(()=>{h=null,x()},F))}function S(){a=!1,u=0,v()}async function E(F,A){if(n&&!n())return null;try{let k=await t(F,{light:!0,...A||{}});return k&&typeof k=="object"&&k.frame!==void 0&&r&&r(k),T(30),k}catch(k){return g(k),null}}async function w(F={}){u=0;let A=await t("start",{view:!0,compact:!0,...F});return await y({...A,running:!0}),a=!0,v(),b(),A}async function I(){u=0,v();let F=await t("get",{view:!0,compact:!0,sceneRev:0});return await y(F),a&&b(),F}async function G(F={}){u=0,v();let A=await t("device",{view:!0,compact:!0,...F});return await y({...A,running:!0}),a=!0,b(),A}async function M(F={}){u=0;let A=await t("view",{view:!0,compact:!0,...F});return await y({...A,running:!0}),A}async function C(){return S(),t("stop")}function R(F,A){return hv(F,A.getBoundingClientRect(),o.canvasWidth,o.canvasHeight)}function L(F,{keysOn:A}={}){let k=A||F,X=z=>{!o||!a||n&&!n()||(F.setPointerCapture?.(z.pointerId),E("pointer",{type:"down",...R(z,F)}))},D=z=>{!o||!a||n&&!n()||E("pointer",{type:"up",...R(z,F)})},Z=z=>{!o||!a||n&&!n()||(f=R(z,F),!d&&(d=setTimeout(()=>{d=null,f&&E("pointer",{type:"move",...f})},60)))},ht=()=>{o&&a&&(!n||n())&&E("pointer",{type:"move",x:-1,y:-1})},xt=z=>{if(!o||!a||n&&!n())return;let Dt=Yu(z,"Down");Dt&&(z.preventDefault(),E("key",{key:Dt}))},st=z=>{if(!o||!a||n&&!n())return;let Dt=Yu(z,"Up");Dt&&(z.preventDefault(),E("key",{key:Dt}))};F.addEventListener("pointerdown",X),F.addEventListener("pointerup",D),F.addEventListener("pointermove",Z),F.addEventListener("pointerleave",ht),k.addEventListener("keydown",xt),k.addEventListener("keyup",st);let at=()=>{F.removeEventListener("pointerdown",X),F.removeEventListener("pointerup",D),F.removeEventListener("pointermove",Z),F.removeEventListener("pointerleave",ht),k.removeEventListener("keydown",xt),k.removeEventListener("keyup",st),d&&clearTimeout(d),d=null};return m.push(at),at}function V(){for(S();m.length;)m.pop()();i?.destroy?.()}return{get snapshot(){return o},get running(){return a},get sceneRev(){return u},applyScene:y,poll:x,pollSoon:T,startPolling:b,stopPolling:v,reset:S,act:E,start:w,attach:I,device:G,view:M,stop:C,bindInput:L,destroy:V}}var XE=[0,-.5,.5,.5,-.5,.5],YE=[0,-.5,.12,-.12,.5,0,.12,.12,0,.5,-.12,.12,-.5,0,-.12,-.12],jE=[0,-.5,.11,-.15,.48,-.15,.18,.07,.29,.41,0,.2,-.29,.41,-.18,.07,-.48,-.15,-.11,-.15],$E=new Set(["image","textbox","textwindow","button"]);function Ln(i,t=4294967295){let e=Number(i??t)>>>0;return{color:e&16777215,alpha:(e>>>24&255)/255}}function Zt(i,t=0){let e=Number(i);return Number.isFinite(e)?e:t}function KE(i){let t=i?.matrix;if(!t||typeof t!="object")return null;let e=[t.a,t.b,t.c,t.d,t.tx,t.ty].map(Number);return e.every(Number.isFinite)?e:null}function qE(i){let t=i.horizontalAlignment==="Right"?1:i.horizontalAlignment==="Middle"?.5:0,e=i.verticalAlignment==="Bottom"?1:i.verticalAlignment==="Middle"?.5:0;return{x:t,y:e}}function ZE(i,t,e){let r=i.primitive==="triangle"?XE:i.primitive==="fourstar"?YE:jE,s=[];for(let n=0;n<r.length;n+=2)s.push(r[n]*t,r[n+1]*e);return s}function QE(i,t,e){return dv(i)?[i.kind,i.primitive,i.imageId,"sprite"].join(" "):[i.kind,i.primitive,t,e,i.imageColor,i.imageId,i.fillType,i.fillHorizontalType,i.fillVerticalType,i.fillAmount,i.text,i.fontSize,i.fontColor,i.bgColor,i.enableOutline,i.outlineColor,i.horizontalAlignment,i.verticalAlignment,i.pressed].join(" ")}function dv(i){return i.kind==="image"&&i.primitive==="circle"&&(!i.fillType||i.fillType==="Unused")}function JE(i){let t=W.get().createCanvas(i,i);t.width=t.height=i;let e=t.getContext("2d");return e.fillStyle="#ffffff",e.beginPath(),e.arc(i/2,i/2,i/2,0,Math.PI*2),e.fill(),new U({source:new vt({resource:t,width:i,height:i,resolution:1})})}var ju=class{constructor(t){this.canvas=t,this.app=null,this.nodes=new Map,this.circleTextures=new Map,this.canvasWidth=0,this.canvasHeight=0,this.scratch=new B,this.ready=this.initialize()}async initialize(){let t=new za;await t.init({canvas:this.canvas,width:1,height:1,autoStart:!1,autoDensity:!1,resolution:Math.min(2,window.devicePixelRatio||1),antialias:!0,backgroundAlpha:0,preference:"webgl",powerPreference:"high-performance"}),t.ticker.stop(),t.stage.eventMode="none",t.stage.sortableChildren=!0,this.app=t}resize(t,e){let r=Math.max(1,Math.round(Zt(t,1))),s=Math.max(1,Math.round(Zt(e,1)));r===this.canvasWidth&&s===this.canvasHeight||(this.canvasWidth=r,this.canvasHeight=s,this.app.renderer.resize(r,s))}createNode(t,{group:e=!1}={}){let r=new ut({isRenderGroup:!!e});return r.label=`runtime:${t.id}`,r.eventMode="none",r.sortableChildren=!0,r.__runtimeId=t.id,r.__group=!!e,this.nodes.set(t.id,r),this.app.stage.addChild(r),r}clearVisual(t){t.__visual&&(t.removeChild(t.__visual),t.__visual.destroy({children:!0,context:!0}),t.__visual=null,t.__visualKey="")}circleTexture(t){let e=this.app?.renderer.resolution||2,r=Math.min(4096,Math.max(256,2**Math.ceil(Math.log2(Math.max(1,t*e)))));this.circleTextures||=new Map;let s=this.circleTextures.get(r);return s||(s=JE(r),this.circleTextures.set(r,s)),s}replaceVisual(t,e,r,s){if(this.clearVisual(t),!$E.has(e.kind))return;let n=new ut;if(n.eventMode="none",n.label=`visual:${e.id}`,e.kind==="textbox"||e.kind==="textwindow"){let o=new Se,a=Ln(e.bgColor,16777215);o.rect(-r/2,-s/2,r,s).fill(a),n.addChild(o);let l=Math.max(8,Zt(e.fontSize,12)),c=qE(e),h=new On({text:String(e.text||""),style:new qe({fontFamily:'Inter, "Microsoft YaHei UI", "Microsoft YaHei", sans-serif',fontSize:l,fill:Ln(e.fontColor,4294967295),stroke:e.enableOutline?{color:Ln(e.outlineColor,4278190080).color,width:Math.max(2,l*.12),join:"round"}:void 0,wordWrap:!0,wordWrapWidth:Math.max(4,r-4),breakWords:!0,align:c.x===1?"right":c.x===.5?"center":"left",lineHeight:l*1.2})});h.anchor.set(c.x,c.y),h.x=c.x===0?-r/2+2:c.x===1?r/2-2:0,h.y=c.y===0?-s/2:c.y===1?s/2:0;let u=new Se().rect(-r/2,-s/2,r,s).fill({color:16777215,alpha:1});h.mask=u,n.addChild(u,h)}else if(e.kind==="button"){let o=new Se;o.roundRect(-r/2,-s/2,r,s,6).fill({color:3303631,alpha:1}),o.roundRect(-r/2,-s/2,r,s,6).stroke({color:7381247,alpha:.8,width:1}),e.pressed&&o.roundRect(-r/2,-s/2,r,s,6).fill({color:0,alpha:.28}),n.addChild(o)}else if(dv(e)){let o=new Me({texture:this.circleTexture(Math.min(r,s)),anchor:.5});n.__circle=o,n.addChild(o)}else{let o=new Se,a=Ln(e.imageColor,4294967295);e.primitive==="missing"?(o.rect(-r/2,-s/2,r,s).fill({color:4727336,alpha:.36}),o.rect(-r/2+.5,-s/2+.5,Math.max(0,r-1),Math.max(0,s-1)).stroke({color:16741505,alpha:1,width:1})):e.primitive==="circle"?o.circle(0,0,Math.min(r,s)/2).fill(a):e.primitive==="ring"?o.circle(0,0,Math.max(1,Math.min(r,s)/2-3.5)).stroke({...a,width:7}):e.primitive==="triangle"||e.primitive==="fourstar"||e.primitive==="fivestar"?o.poly(ZE(e,r,s)).fill(a):o.rect(-r/2,-s/2,r,s).fill(a);let l=$0(e,r,s);if(l&&(o.visible=l.width>0&&l.height>0,o.visible)){let c=new Se().rect(l.x,l.y,l.width,l.height).fill({color:16777215,alpha:1});o.mask=c,n.addChild(c)}n.addChild(o)}n.scale.set(e.pressed?.98:1),t.addChildAt(n,0),t.__visual=n}applyMatrix(t,e,r){let s=KE(e);if(!s){let u=Math.max(0,Zt(e.sourceWidth,Zt(e.width))),d=Math.max(0,Zt(e.sourceHeight,Zt(e.height)));t.x=Zt(e.left)+u/2,t.y=this.canvasHeight-Zt(e.bottom)-d/2,t.rotation=-Zt(e.rotationZ)*Math.PI/180,t.scale.set(1);return}let[n,o,a,l,c,h]=s;this.scratch.set(n,-o,-a,l,c,r?-h:this.canvasHeight-h),t.setFromMatrix(this.scratch)}updateNode(t,e,{nested:r=!1}={}){let s=Math.max(0,Zt(e.sourceWidth,Zt(e.width))),n=Math.max(0,Zt(e.sourceHeight,Zt(e.height))),o=QE(e,s,n);t.__visualKey!==o&&(this.replaceVisual(t,e,s,n),t.__visualKey=o),t.__visual&&t.__visual.scale.set(e.pressed?.98:1);let a=t.__visual?.__circle;if(a){let l=Math.min(s,n),c=Ln(e.imageColor,4294967295);a.texture=this.circleTexture(l),a.width=a.height=l,a.tint=c.color,a.alpha=c.alpha,a.visible=l>0}this.applyMatrix(t,e,r)}attachNode(t,e){let r=e.parent,n=(r==null?this.app.stage:this.nodes.get(r))||this.app.stage;t.parent!==n&&n.addChild(t),n.sortableChildren=!0,t.zIndex=-Zt(e.z)}upsertSceneNode(t){if(!t||t.id===void 0||t.id===null)return;let e=t.group===!0,r=this.nodes.get(t.id);r?r.__group!==e&&(e?r.enableRenderGroup?.():r.disableRenderGroup?.(),r.__group=e):r=this.createNode(t,{group:e}),this.updateNode(r,t,{nested:t.parent!=null}),this.attachNode(r,t)}removeNode(t){let e=this.nodes.get(t);if(e){for(let r of[...e.children])r.__runtimeId!=null&&e.removeChild(r);e.parent?.removeChild(e),this.clearVisual(e),e.destroy({children:!1}),this.nodes.delete(t)}}clearNodes(){for(let t of[...this.nodes.keys()])this.removeNode(t)}async applyScene(t,e,r){if(await this.ready,this.resize(e,r),!t||t.format!=="tree-v1"){this.app.render();return}t.reset&&this.clearNodes();for(let n of t.removed||[])this.removeNode(n);let s=t.reset?t.nodes:t.changed;for(let n=0;n<(s||[]).length;n+=1){let o=s[n];!o||o.id===void 0||o.id===null||this.nodes.has(o.id)||this.createNode(o,{group:o.group===!0})}for(let n=0;n<(s||[]).length;n+=1)this.upsertSceneNode(s[n]);this.app.render()}async render(t,e,r){await this.ready,this.resize(e,r);let s=new Set,n=Array.isArray(t)?t:[];for(let o=0;o<n.length;o+=1){let a=n[o];if(!a||a.id===void 0||a.id===null)continue;s.add(a.id);let l=this.nodes.get(a.id)||this.createNode(a);this.updateNode(l,a),l.zIndex=o,l.parent!==this.app.stage&&this.app.stage.addChild(l)}for(let[o]of this.nodes)s.has(o)||this.removeNode(o);this.app.render()}destroy(){this.clearNodes();for(let t of this.circleTextures.values())t.destroy(!0);this.circleTextures.clear(),this.app?.destroy({removeView:!1},{children:!0,texture:!0,textureSource:!0}),this.app=null}};export{cv as PLAY_POLL_INTERVAL_MS,ju as PixiPlayRenderer,uv as createPlaySession};
926
+ /*! Bundled license information:
927
+
928
+ tiny-lru/dist/tiny-lru.js:
929
+ (**
930
+ * tiny-lru
931
+ *
932
+ * @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
933
+ * @license BSD-3-Clause
934
+ * @version 11.4.7
935
+ *)
936
+ */