PageSourceSearch

https://firework-frenzy.netlify.app/assets/index-DecHlY3e.js

js firework-frenzy.netlify.app collected 2026-10-03 10:44:08 UTC 844,210 bytes, 438 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browserAll-BmeDkJLL.js","./webworkerAll-CnrnC_FB.js","./Filter-B_ECkl6U.js","./WebGPURenderer-BSIRpe8q.js","./BufferResource-CO1AdX6Y.js","./RenderTargetSystem-BKjcyKDs.js","./WebGLRenderer-pcqO-dd_.js","./CanvasRenderer-fd6cvy9-.js"])))=>i.map(i=>d[i]);
2(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function e(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=e(i);fetch(i.href,r)}})();const Dy="modulepreload",Ny=function(n,t){return new URL(n,t).href},vu={},ci=function(t,e,s){let i=Promise.resolve();if(e&&e.length>0){let l=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),h=a?.nonce||a?.getAttribute("nonce");i=l(e.map(c=>{if(c=Ny(c,s),c in vu)return;vu[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(s)for(let g=o.length-1;g>=0;g--){const p=o[g];if(p.href===c&&(!u||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Dy,u||(f.as="script"),f.crossOrigin="",f.href=c,h&&f.setAttribute("nonce",h),document.head.appendChild(f),u)return new Promise((g,p)=>{f.addEventListener("load",g),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};var X=(n=>(n.Application="application",n.WebGLPipes="webgl-pipes",n.WebGLPipesAdaptor="webgl-pipes-adaptor",n.WebGLSystem="webgl-system",n.WebGPUPipes="webgpu-pipes",n.WebGPUPipesAdaptor="webgpu-pipes-adaptor",n.WebGPUSystem="webgpu-system",n.CanvasSystem="canvas-system",n.CanvasPipesAdaptor="canvas-pipes-adaptor",n.CanvasPipes="canvas-pipes",n.Asset="asset",n.LoadParser="load-parser",n.ResolveParser="resolve-parser",n.CacheParser="cache-parser",n.DetectionParser="detection-parser",n.MaskEffect="mask-effect",n.BlendMode="blend-mode",n.TextureSource="texture-source",n.TextureUploaderWebGL="texture-uploader-webgl",n.TextureUploaderWebGPU="texture-uploader-webgpu",n.Environment="environment",n.ShapeBuilder="shape-builder",n.Batcher="batcher",n))(X||{});const nl=n=>{if(typeof n=="function"||typeof n=="object"&&n.extension){if(!n.extension)throw new Error("Extension class must have an extension object");n={...typeof n.extension!="object"?{type:n.extension}:n.extension,ref:n}}if(typeof n=="object")n={...n};else throw new Error("Invalid extension type");return typeof n.type=="string"&&(n.type=[n.type]),n},co=(n,t)=>nl(n).priority??t,yt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...n){return n.map(nl).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...n){return n.map(nl).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,i=this._queue;s[e]?s[e]?.(t):(i[e]=i[e]||[],i[e]?.push(t))})}),this},handle(n,t,e){const s=this._addHandlers,i=this._removeHandlers;if(s[n]||i[n])throw new Error(`Extension type ${n} already has a handler`);s[n]=t,i[n]=e;const r=this._queue;return r[n]&&(r[n]?.forEach(o=>t(o)),delete r[n]),this},handleByMap(n,t){return this.handle(n,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(n,t,e=-1){return this.handle(n,s=>{t.findIndex(r=>r.name===s.name)>=0||(t.push({name:s.name,value:s.ref}),t.sort((r,o)=>co(o.value,e)-co(r.value,e)))},s=>{const i=t.findIndex(r=>r.name===s.name);i!==-1&&t.splice(i,1)})},handleByList(n,t,e=-1){return this.handle(n,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,r)=>co(r,e)-co(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})},mixin(n,...t){for(const e of t)Object.defineProperties(n.prototype,Object.getOwnPropertyDescriptors(e))}}
vendor: 4,505 bytes, line 2
2,Wy={extension:{type:X.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await ci(()=>import("./browserAll-BmeDkJLL.js"),__vite__mapDeps([0,1,2]),import.meta.url)}},zy={extension:{type:X.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await ci(()=>import("./webworkerAll-CnrnC_FB.js"),__vite__mapDeps([1,2]),import.meta.url)}};class Vt{constructor(t,e,s){this._x=e||0,this._y=s||0,this._observer=t}clone(t){return new Vt(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 Yy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nh={exports:{}},Tu;function Vy(){return Tu||(Tu=1,(function(n){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function r(h,l,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new i(c,u||h,d),g=e?e+l:l;return h._events[g]?h._events[g].fn?h._events[g]=[h._events[g],f]:h._events[g].push(f):(h._events[g]=f,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,g=new Array(f);d<f;d++)g[d]=u[d].fn;return g},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,f,g){var p=e?e+l:l;if(!this._events[p])return!1;var m=this._events[p],y=arguments.length,x,_;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),y){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,u),!0;case 4:return m.fn.call(m.context,c,u,d),!0;case 5:return m.fn.call(m.context,c,u,d,f),!0;case 6:return m.fn.call(m.context,c,u,d,f,g),!0}for(_=1,x=new Array(y-1);_<y;_++)x[_-1]=arguments[_];m.fn.apply(m.context,x)}else{var b=m.length,w;for(_=0;_<b;_++)switch(m[_].once&&this.removeListener(l,m[_].fn,void 0,!0),y){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,c);break;case 3:m[_].fn.call(m[_].context,c,u);break;case 4:m[_].fn.call(m[_].context,c,u,d);break;default:if(!x)for(w=1,x=new Array(y-1);w<y;w++)x[w-1]=arguments[w];m[_].fn.apply(m[_].context,x)}}return!0},a.prototype.on=function(l,c,u){return r(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return r(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var g=this._events[f];if(g.fn)g.fn===c&&(!d||g.once)&&(!u||g.context===u)&&o(this,f);else{for(var p=0,m=[],y=g.length;p<y;p++)(g[p].fn!==c||d&&!g[p].once||u&&g[p].context!==u)&&m.push(g[p]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,n.exports=a})(nh)),nh.exports}var Uy=Vy();const re=Yy(Uy),Gy=Math.PI*2,Xy=180/Math.PI,$y=Math.PI/180;class It{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new It(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 rh.x=0,rh.y=0,rh}}const rh=new It;
vendor: 4,532 bytes, line 2
2class ot{constructor(t=1,e=0,s=0,i=1,r=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,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,s,i,r,o){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new It;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new It;const s=this.a,i=this.b,r=this.c,o=this.d,a=this.tx,h=this.ty,l=1/(s*o+r*-i),c=t.x,u=t.y;return e.x=o*l*c+-r*l*u+(h*r-a*o)*l,e.y=s*l*u+-i*l*c+(-h*s+a*i)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,r=this.c,o=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=r*e-this.d*s,this.d=r*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,r=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*r,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*r,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*r+this.ty,this}appendFrom(t,e){const s=t.a,i=t.b,r=t.c,o=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=s*l+i*u,this.b=s*c+i*d,this.c=r*l+o*u,this.d=r*c+o*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,s,i,r,o,a,h,l){return this.a=Math.cos(a+l)*r,this.b=Math.sin(a+l)*r,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*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){const e=this.a,s=this.b,i=this.c,r=this.d,o=t.pivot,a=-Math.atan2(-i,r),h=Math.atan2(s,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Gy-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+r*r),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*s+o.y*r),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,r=this.tx,o=t*i-e*s;return this.a=i/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-i*r)/o,this.ty=-(t*this.ty-e*r)/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(){const t=new ot;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 jy.identity()}static get shared(){return Hy.identity()}}const Hy=new ot,jy=new ot,Bi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ri=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Li=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Oi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rl=[],rp=[],uo=Math.sign;function qy(){for(let n=0;n<16;n++){const t=[];rl.push(t);for(let e=0;e<16;e++){const s=uo(Bi[n]*Bi[e]+Li[n]*Ri[e]),i=uo(Ri[n]*Bi[e]+Oi[n]*Ri[e]),r=uo(Bi[n]*Li[e]+Li[n]*Oi[e]),o=uo(Ri[n]*Li[e]+Oi[n]*Oi[e]);for(let a=0;a<16;a++)if(Bi[a]===s&&Ri[a]===i&&Li[a]===r&&Oi[a]===o){t.push(a);break}}}for(let n=0;n<16;n++){const t=new ot;t.set(Bi[n],Ri[n],Li[n],Oi[n],0,0),rp.push(t)}}qy();const gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:n=>Bi[n],uY:n=>Ri[n],vX:n=>Li[n],vY:n=>Oi[n],inv:n=>n&8?n&15:-n&7,add:(n,t)=>rl[n][t],sub:(n,t)=>rl[n][gt.inv(t)],rotate180:n=>n^4,isVertical:n=>(n&3)===2,byDirection:(n,t)=>Math.abs(n)*2<=Math.abs(t)?t>=0?gt.S:gt.N:Math.abs(t)*2<=Math.abs(n)?n>0?gt.E:gt.W:t>0?n>0?gt.SE:gt.SW:n>0?gt.NE:gt.NW,matrixAppendRotationInv:(n,t,e=0,s=0,i=0,r=0)=>{const o=rp[gt.inv(t)],a=o.a,h=o.b,l=o.c,c=o.d,u=e-Math.min(0,a*i,l*r,a*i+l*r),d=s-Math.min(0,h*i,
2c*r,h*i+c*r),f=n.a,g=n.b,p=n.c,m=n.d;n.a=a*f+h*p,n.b=a*g+h*m,n.c=l*f+c*p,n.d=l*g+c*m,n.tx=u*f+d*p+n.tx,n.ty=u*g+d*m+n.ty},transformRectCoords:(n,t,e,s)=>{const{x:i,y:r,width:o,height:a}=n,{x:h,y:l,width:c,height:u}=t;return e===gt.E?(s.set(i+h,r+l,o,a),s):e===gt.S?s.set(c-r-a+h,i+l,a,o):e===gt.W?s.set(c-i-o+h,u-r-a+l,o,a):e===gt.N?s.set(r+h,u-i-o+l,a,o):s.set(i+h,r+l,o,a)}},fo=[new It,new It,new It,new It];class qt{constructor(t=0,e=0,s=0,i=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i)}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 qt(0,0,0,0)}clone(){return new qt(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,s,i=.5){const{width:r,height:o}=this;if(r<=0||o<=0)return!1;const a=this.x,h=this.y,l=s*(1-i),c=s-l,u=a-l,d=a+r+l,f=h-l,g=h+o+l,p=a+c,m=a+r-c,y=h+c,x=h+o-c;return t>=u&&t<=d&&e>=f&&e<=g&&!(t>p&&t<m&&e>y&&e<x)}intersects(t,e){if(!e){const T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const s=this.left,i=this.right,r=this.top,o=this.bottom;if(i<=s||o<=r)return!1;const a=fo[0].set(t.left,t.top),h=fo[1].set(t.left,t.bottom),l=fo[2].set(t.right,t.top),c=fo[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=s||Math.min(a.x,h.x,l.x,c.x)>=i||Math.max(a.y,h.y,l.y,c.y)<=r||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),f=u*(a.x-h.x),g=d*s+f*r,p=d*i+f*r,m=d*s+f*o,y=d*i+f*o;if(Math.max(g,p,m,y)<=d*a.x+f*a.y||Math.min(g,p,m,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-l.y),_=u*(l.x-a.x),b=x*s+_*r,w=x*i+_*r,S=x*s+_*o,v=x*i+_*o;return!(Math.max(b,w,S,v)<=x*a.x+_*a.y||Math.min(b,w,S,v)>=x*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),r=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(r-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=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=s-this.x,this.height=i-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=r-i,this}getBounds(t){return t||(t=new qt),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,s=t.y,i=t.x+t.width,r=t.y+t.height;return e>=this.x&&e<this.x+this.width&&s>=this.y&&s<this.y+this.height&&i>=this.x&&i<this.x+this.width&&r>=this.y&&r<this.y+this.height}set(t,e,s,i){return this.x=t,this.y=e,this.width=s,this.height=i,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const oh={default:-1};function Kt(n="default"){return oh[n]===void 0&&(oh[n]=-1),++oh[n]}const Au=new Set,Ct="8.0.0",Ky="8.3.4",_n={quiet:!1,noColor:!1},ut=((n,t,e=3)=>{if(_n.quiet||Au.has(t))return;let s=new Error().stack;const i=`${t}
3Deprecated since v${n}`,r=typeof console.groupCollapsed=="function"&&!_n.noColor;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",i):(s=s.split(`
4`).splice(e).join(`
5`),r?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",i),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",i),console.warn(s))),Au.add(t)});
5Object.defineProperties(ut,{quiet:{get:()=>_n.quiet,set:n=>{_n.quiet=n},enumerable:!0,configurable:!1},noColor:{get:()=>_n.noColor,set:n=>{_n.noColor=n},enumerable:!0,configurable:!1}});const op=()=>{};function Yn(n){return n+=n===0?1:0,--n,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n+1}function Cu(n){return!(n&n-1)&&!!n}function ap(n){const t={};for(const e in n)n[e]!==void 0&&(t[e]=n[e]);return t}const Pu=Object.create(null);function Zy(n){const t=Pu[n];return t===void 0&&(Pu[n]=Kt("resource")),t}const hp=class lp extends re{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...lp.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){ut(Ct,"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(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Zy(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};hp.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Vn=hp;const cp=class up extends re{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Kt("textureSource"),this._resourceType="textureSource",this._resourceId=Kt("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.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...up.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 Vn(ap(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}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}
vendor: 9,493 bytes, line 5
5_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const 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._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Kt("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{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,s){s||(s=this._resolution),t||(t=this.width),e||(e=this.height);const i=Math.round(t*s),r=Math.round(e*s);return this.width=i/s,this.height=r/s,this._resolution=s,this.pixelWidth===i&&this.pixelHeight===r?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=r,this.emit("resize",this),this._resourceId=Kt("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=Cu(this.pixelWidth)&&Cu(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};cp.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};let Pe=cp;class dc extends Pe{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let s=t.format;s||(e instanceof Float32Array?s="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?s="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?s="rgba16uint":(e instanceof Int8Array,s="bgra8unorm")),super({...t,resource:e,format:s}),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}}dc.extension=X.TextureSource;const Mu=new ot;class Qy{constructor(t,e){this.mapCoord=new ot,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()}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const r=t[i],o=t[i+1];e[i]=r*s.a+o*s.c+s.tx,e[i+1]=r*s.b+o*s.d+s.ty}return e}update(){const t=this._texture;this._updateID++;const 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);const s=t.orig,i=t.trim;i&&(Mu.set(s.width/i.width,0,0,s.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Mu));const r=t.source,o=this.uClampFrame,a=this.clampMargin/r._resolution,h=this.clampOffset/r._resolution;return o[0]=(t.frame.x+a+h)/r.width,o[1]=(t.frame.y+a+h)/r.height,o[2]=(t.frame.x+t.frame.width-a+h)/r.width,o[3]=(t.frame.y+t.frame.height-a+h)/r.height,this.uClampOffset[0]=this.clampOffset/r.pixelWidth,this.uClampOffset[1]=this.clampOffset/r.pixelHeight,this.isSimple=t.frame.width===r.width&&t.frame.height===r.height&&t.rotate===0,!0}}let $=class extends re{constructor({source:t,label:e,frame:s,orig:i,trim:r,defaultAnchor:o,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=Kt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new qt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Pe,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=i||this.frame,this.trim=r,this.rotate=h??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Qy(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:s,height:i}=this._source,r=e.x/s,o=e.y/i,a=e.width/s,h=e.height/i;let l=this.rotate;if(l){const c=a/2,u=h/2,d=r+c,f=o+u;l=gt.add(l,gt.NW),t.x0=d+c*gt.uX(l),t.y0=f+u*gt.uY(l),l=gt.add(l,2),t.x1=d+c*gt.uX(l),t.y1=f+u*gt.uY(l),l=gt.add(l,2),t.x2=d+c*gt.uX(l),t.y2=f+u*gt.uY(l),l=gt.add(l,2),t.x3=d+c*gt.uX(l),t.y3=f+u*gt.uY(l)}else t.x0=r,t.y0=o,t.x1=r+a,t.y1=o,t.x2=r+a,t.y2=o+h,t.x3=r,t.y3=o+h}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 ut(Ct,"Texture.baseTexture is now Texture.source"),this._source}};$.EMPTY=new $({label:"EMPTY",source:new Pe({label:"EMPTY"})});$.EMPTY.destroy=op;$.WHITE=new $({source:new dc({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});$.WHITE.destroy=op;function dp(n,t,e){const{width:s,height:i}=e.orig,r=e.trim;if(r){const o=r.width,a=r.height;n.minX=r.x-t._x*s,n.maxX=n.minX+o,n.minY=r.y-t._y*i,n.maxY=n.minY+a}else n.minX=-t._x*s,n.maxX=n.minX+s,n.minY=-t._y*i,n.maxY=n.minY+i}const ku=new ot;class ns{constructor(t=1/0,e=1/0,s=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=ku,this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new qt);const 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=ku,this}set(t,e,s,i){this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}addFrame(t,e,s,i,r){r||(r=this.matrix);const o=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;let d=this.minX,f=this.minY,g=this.maxX,p=this.maxY,m=o*t+h*e+c,y=a*t+l*e+u;m<d&&(d=m),y<f&&(f=y),m>g&&(g=m),y>p&&(p=y),m=o*s+h*e+c,y=a*s+l*e+u,m<d&&(d=m),y<f&&(f=y),m>g&&(g=m),y>p&&(p=y),m=o*t+h*i+c,y=a*t+l*i+u,m<d&&(d=m),y<f&&(f=y),m>g&&(g=m),y>p&&(p=y),m=o*s+h*i+c,y=a*s+l*i+u,m<d&&(d=m),y<f&&(f=y),m>g&&(g=m),y>p&&(p=y),this.minX=d,this.minY=f,this.maxX=g,this.maxY=p}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){const e=this.minX,s=this.minY,i=this.maxX,r=this.maxY,{a:o,b:a,c:h,d:l,tx:c,ty:u}=t;let d=o*e+h*s+c,f=a*e+l*s+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=o*i+h*s+c,f=a*i+l*s+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+h*r+c,f=a*e+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=o*i+h*r+c,f=a*i+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}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,s,i){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<s&&(this.minY=s),this.maxY>i&&(this.maxY=i),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 ns(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){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const 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}
vendor: 6,344 bytes, line 5
5addVertexData(t,e,s,i){let r=this.minX,o=this.minY,a=this.maxX,h=this.maxY;i||(i=this.matrix);const l=i.a,c=i.b,u=i.c,d=i.d,f=i.tx,g=i.ty;for(let p=e;p<s;p+=2){const m=t[p],y=t[p+1],x=l*m+u*y+f,_=c*m+d*y+g;r=x<r?x:r,o=_<o?_:o,a=x>a?x:a,h=_>h?_:h}this.minX=r,this.minY=o,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var Jy={grad:.9,turn:360,rad:360/(2*Math.PI)},Es=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},ue=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*n)/e+0},Je=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),n>e?e:n>t?n:t},fp=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},Iu=function(n){return{r:Je(n.r,0,255),g:Je(n.g,0,255),b:Je(n.b,0,255),a:Je(n.a)}},ah=function(n){return{r:ue(n.r),g:ue(n.g),b:ue(n.b),a:ue(n.a,3)}},tx=/^#([0-9a-f]{3,8})$/i,po=function(n){var t=n.toString(16);return t.length<2?"0"+t:t},pp=function(n){var t=n.r,e=n.g,s=n.b,i=n.a,r=Math.max(t,e,s),o=r-Math.min(t,e,s),a=o?r===t?(e-s)/o:r===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:i}},gp=function(n){var t=n.h,e=n.s,s=n.v,i=n.a;t=t/360*6,e/=100,s/=100;var r=Math.floor(t),o=s*(1-e),a=s*(1-(t-r)*e),h=s*(1-(1-t+r)*e),l=r%6;return{r:255*[s,a,o,o,h,s][l],g:255*[h,s,s,a,o,o][l],b:255*[o,o,h,s,s,a][l],a:i}},Eu=function(n){return{h:fp(n.h),s:Je(n.s,0,100),l:Je(n.l,0,100),a:Je(n.a)}},Fu=function(n){return{h:ue(n.h),s:ue(n.s),l:ue(n.l),a:ue(n.a,3)}},Bu=function(n){return gp((e=(t=n).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},Tr=function(n){return{h:(t=pp(n)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},ex=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ix=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ol={string:[[function(n){var t=tx.exec(n);return t?(n=t[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?ue(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?ue(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var t=ix.exec(n)||nx.exec(n);return t?t[2]!==t[4]||t[4]!==t[6]?null:Iu({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(n){var t=ex.exec(n)||sx.exec(n);if(!t)return null;var e,s,i=Eu({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Jy[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Bu(i)},"hsl"]],object:[[function(n){var t=n.r,e=n.g,s=n.b,i=n.a,r=i===void 0?1:i;return Es(t)&&Es(e)&&Es(s)?Iu({r:Number(t),g:Number(e),b:Number(s),a:Number(r)}):null},"rgb"],[function(n){var t=n.h,e=n.s,s=n.l,i=n.a,r=i===void 0?1:i;if(!Es(t)||!Es(e)||!Es(s))return null;var o=Eu({h:Number(t),s:Number(e),l:Number(s),a:Number(r)});return Bu(o)},"hsl"],[function(n){var t=n.h,e=n.s,s=n.v,i=n.a,r=i===void 0?1:i;if(!Es(t)||!Es(e)||!Es(s))return null;var o=(function(a){return{h:fp(a.h),s:Je(a.s,0,100),v:Je(a.v,0,100),a:Je(a.a)}})({h:Number(t),s:Number(e),v:Number(s),a:Number(r)});return gp(o)},"hsv"]]},Ru=function(n,t){for(var e=0;e<t.length;e++){var s=t[e][0](n);if(s)return[s,t[e][1]]}return[null,void 0]},rx=function(n){return typeof n=="string"?Ru(n.trim(),ol.string):typeof n=="object"&&n!==null?Ru(n,ol.object):[null,void 0]},hh=function(n,t){var e=Tr(n);return{h:e.h,s:Je(e.s+100*t,0,100),l:e.l,a:e.a}},lh=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},Lu=function(n,t){var e=Tr(n);return{h:e.h,s:e.s,l:Je(e.l+100*t,0,100),a:e.a}},al=(function(){function n(t){this.parsed=rx(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return ue(lh(this.rgba),2)},n.prototype.isDark=function(){return lh(this.rgba)<.5},n.prototype.isLight=function(){return lh(this.rgba)>=.5},n.prototype.toHex=function(){return t=ah(this.rgba),e=t.r,s=t.g,i=t.b,o=(r=t.a)<1?po(ue(255*r)):"","#"+po(e)+po(s)+po(i)+o;var t,e,s,i,r,o},n.prototype.toRgb=function(){return ah(this.rgba)},n.prototype.toRgbString=function(){return t=ah(this.rgba),e=t.r,s=t.g,i=t.b,(r=t.a)<1?"rgba("+e+", "+s+", "+i+", "+r+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,r},n.prototype.toHsl=function(){return Fu(Tr(this.rgba))},n.prototype.toHslString=function(){return t=Fu(Tr(this.rgba)),e=t.h,s=t.s,i=t.l,(r=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+r+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,r},n.prototype.toHsv=function(){return t=pp(this.rgba),{h:ue(t.h),s:ue(t.s),v:ue(t.v),a:ue(t.a,3)};var t},n.prototype.invert=function(){return ms({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},n.prototype.saturate=function(t){return t===void 0&&(t=.1),ms(hh(this.rgba,t))},n.prototype.desaturate=function(t){return t===void 0&&(t=.1),ms(hh(this.rgba,-t))},n.prototype.grayscale=function(){return ms(hh(this.rgba,-1))},n.prototype.lighten=function(t){return t===void 0&&(t=.1),ms(Lu(this.rgba,t))},n.prototype.darken=function(t){return t===void 0&&(t=.1),ms(Lu(this.rgba,-t))},n.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},n.prototype.alpha=function(t){return typeof t=="number"?ms({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ue(this.rgba.a,3);var e},n.prototype.hue=function(t){var e=Tr(this.rgba);return typeof t=="number"?ms({h:t,s:e.s,l:e.l,a:e.a}):ue(e.h)},n.prototype.isEqual=function(t){return this.toHex()===ms(t).toHex()},n})(),ms=function(n){return n instanceof al?n:new al(n)}
vendor: 8,642 bytes, line 5
5,Ou=[],ox=function(n){n.forEach(function(t){Ou.indexOf(t)<0&&(t(al,ol),Ou.push(t))})};function ax(n,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"},s={};for(var i in e)s[e[i]]=i;var r={};n.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=s[this.toHex()];if(l)return l;if(o?.closest){var c=this.toRgb(),u=1/0,d="black";if(!r.length)for(var f in e)r[f]=new n(e[f]).toRgb();for(var g in e){var p=(a=c,h=r[g],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));p<u&&(u=p,d=g)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new n(h).toRgb():null},"name"])}ox([ax]);const Un=class pr{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 pr)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){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="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((r,o)=>r===e[o]);if(t!==null&&e!==null){const r=Object.keys(t),o=Object.keys(e);return r.length!==o.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,s,i,r]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=r,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toBgrNumber(){const[t,e,s]=this.toUint8RgbArray();return(s<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,r]=pr._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=r,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 s=this._int>>16&255,i=this._int>>8&255,r=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,r=r*t+.5|0),(t*255<<24)+(s<<16)+(i<<8)+r}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const 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,s,i,r;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,i=(o&255)/255,r=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,r=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,r=255]=t,e/=255,s/=255,i/=255,r/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=pr.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=ms(t);o.isValid()&&({r:e,g:s,b:i,a:r}=o.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=r,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((i,r)=>{t[r]=Math.min(Math.max(i,e),s)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof pr||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}};Un.shared=new Un;Un._temp=new Un;Un.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Nt=Un;const hx={cullArea:null,cullable:!1,cullableChildren:!0};let ch=0;const Du=500;function Dt(...n){ch!==Du&&(ch++,ch===Du?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...n))}const so={_registeredResources:new Set,register(n){this._registeredResources.add(n)},unregister(n){this._registeredResources.delete(n)}
5,release(){this._registeredResources.forEach(n=>n.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(n){return this._registeredResources.has(n)},reset(){this._registeredResources.clear()}};let lx=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}};class cx{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 lx(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const s=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[s]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const Re=new cx;so.register(Re);const ux={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(n){typeof n=="boolean"&&n===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(n===!0?{}:n))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(n){ut("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(n)}};function dx(n,t,e){const s=n.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const r=s-e;for(i=t;i<r;++i)n[i]=n[i+e];n.length=r}const fx={allowChildren:!0,removeChildren(n=0,t){const e=t??this.children.length,s=e-n,i=[];if(s>0&&s<=e){for(let o=e-1;o>=n;o--){const a=this.children[o];a&&(i.push(a),a.parent=null)}dx(this.children,n,e);const r=this.renderGroup||this.parentRenderGroup;r&&r.removeChildren(i);for(let o=0;o<i.length;++o){const a=i[o];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,o),i[o].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}else if(s===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(n){const t=this.getChildAt(n);return this.removeChild(t)},getChildAt(n){if(n<0||n>=this.children.length)throw new Error(`getChildAt: Index (${n}) does not exist.`);return this.children[n]},setChildIndex(n,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(n),this.addChildAt(n,t)},getChildIndex(n){const t=this.children.indexOf(n);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(n,t){this.allowChildren||ut(Ct,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${n}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const s=n.parent===this;if(n.parent){const r=n.parent.children.indexOf(n);if(s){if(r===t)return n;n.parent.children.splice(r,1)}else n.removeFromParent()}t===e.length?e.push(n):e.splice(t,0,n),n.parent=this,n.didChange=!0,n._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(n),this.sortableChildren&&(this.sortDirty=!0),s||(this.emit("childAdded",n,this,t),n.emit("added",this)),n},swapChildren(n,t){if(n===t)return;const e=this.getChildIndex(n),s=this.getChildIndex(t);this.children[e]=t,this.children[s]=n;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...n){return n.length===1?this.reparentChildAt(n[0],this.children.length):(n.forEach(t=>this.reparentChildAt(t,this.children.length)),n[0])},reparentChildAt(n,t){if(n.parent===this)return this.setChildIndex(n,t),n;const e=n.worldTransform.clone();n.removeFromParent(),this.addChildAt(n,t);const s=this.worldTransform.clone();return s.invert(),e.prepend(s),n.setFromMatrix(e),n},replaceChild(n,t){n.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(n)),t.setFromMatrix(n.localTransform),t.updateLocalTransform(),this.removeChild(n)}},px={collectRenderables(n,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(n,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,n):this.collectRenderablesWithEffects(n,t,e))},collectRenderablesSimple(n,t,e){const s=this.children,i=s.length;for(let r=0;r<i;r++)s[r].collectRenderables(n,t,e)},collectRenderablesWithEffects(n,t,e){const{renderPipes:s}=t;
vendor: 25,227 bytes, line 5
5for(let i=0;i<this.effects.length;i++){const r=this.effects[i];s[r.pipe].push(r,this,n)}this.collectRenderablesSimple(n,t,e);for(let i=this.effects.length-1;i>=0;i--){const r=this.effects[i];s[r.pipe].pop(r,this,n)}}};class Nu{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}}class gx{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++){const s=this._tests[e];if(s.test(t))return Re.get(s.maskClass,t)}return t}returnMaskEffect(t){Re.return(t)}}const hl=new gx;yt.handleByList(X.MaskEffect,hl._effectClasses);const mx={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0)},addEffect(n){this.effects.indexOf(n)===-1&&(this.effects.push(n),this.effects.sort((e,s)=>e.priority-s.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(n){const t=this.effects.indexOf(n);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(n){const t=this._maskEffect;t?.mask!==n&&(t&&(this.removeEffect(t),hl.returnMaskEffect(t),this._maskEffect=null),n!=null&&(this._maskEffect=hl.getMaskEffect(n),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(n){this._maskOptions={...this._maskOptions,...n},n.mask&&(this.mask=n.mask),this._markStructureAsChanged()},set filters(n){!Array.isArray(n)&&n&&(n=[n]);const t=this._filterEffect||(this._filterEffect=new Nu);n=n;const e=n?.length>0,s=t.filters?.length>0,i=e!==s;n=Array.isArray(n)?n.slice(0):n,t.filters=Object.freeze(n),i&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=n??null))},get filters(){return this._filterEffect?.filters},set filterArea(n){this._filterEffect||(this._filterEffect=new Nu),this._filterEffect.filterArea=n},get filterArea(){return this._filterEffect?.filterArea}},yx={label:null,get name(){return ut(Ct,"Container.name property has been removed, use Container.label instead"),this.label},set name(n){ut(Ct,"Container.name property has been removed, use Container.label instead"),this.label=n},getChildByName(n,t=!1){return this.getChildByLabel(n,t)},getChildByLabel(n,t=!1){const e=this.children;for(let s=0;s<e.length;s++){const i=e[s];if(i.label===n||n instanceof RegExp&&n.test(i.label))return i}if(t)for(let s=0;s<e.length;s++){const r=e[s].getChildByLabel(n,!0);if(r)return r}return null},getChildrenByLabel(n,t=!1,e=[]){const s=this.children;for(let i=0;i<s.length;i++){const r=s[i];(r.label===n||n instanceof RegExp&&n.test(r.label))&&e.push(r)}if(t)for(let i=0;i<s.length;i++)s[i].getChildrenByLabel(n,!0,e);return e}},Ce=Re.getPool(ot),Vs=Re.getPool(ns),xx=new ot,_x={getFastGlobalBounds(n,t){t||(t=new ns),t.clear(),this._getGlobalBoundsRecursive(!!n,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(n,t,e){let s=t;if(n&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(s=Vs.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;s.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const r=this.children;for(let o=0;o<r.length;o++)r[o]._getGlobalBoundsRecursive(n,s,e)}if(i){let r=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(r||(r=!0,s.applyMatrix(o.worldTransform)),this.effects[a].addBounds(s,!0));r&&s.applyMatrix(o.worldTransform.copyTo(xx).invert()),t.addBounds(s),Vs.return(s)}else this.renderGroup&&(t.addBounds(s,this.relativeGroupTransform),Vs.return(s))}};function mp(n,t,e){e.clear();let s,i;return n.parent?t?s=n.parent.worldTransform:(i=Ce.get().identity(),s=fc(n,i)):s=ot.IDENTITY,yp(n,e,s,t),i&&Ce.return(i),e.isValid||e.set(0,0,0,0),e}function yp(n,t,e,s){if(!n.visible||!n.measurable)return;let i;s?i=n.worldTransform:(n.updateLocalTransform(),i=Ce.get(),i.appendFrom(n.localTransform,e));const r=t,o=!!n.effects.length;if(o&&(t=Vs.get().clear()),n.boundsArea)t.addRect(n.boundsArea,i);else{const a=n.bounds;a&&!a.isEmpty()&&(t.matrix=i,t.addBounds(a));for(let h=0;h<n.children.length;h++)yp(n.children[h],t,i,s)}if(o){for(let a=0;a<n.effects.length;a++)n.effects[a].addBounds?.(t);r.addBounds(t,ot.IDENTITY),Vs.return(t)}s||Ce.return(i)}function fc(n,t){const e=n.parent;return e&&(fc(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Ya(n,t){if(n===16777215||!t)return t;if(t===16777215||!n)return n;const e=n>>16&255,s=n>>8&255,i=n&255,r=t>>16&255,o=t>>8&255,a=t&255,h=e*r/255|0,l=s*o/255|0,c=i*a/255|0;return(h<<16)+(l<<8)+c}const Wu=16777215;function zu(n,t){return n===Wu?t:t===Wu?n:Ya(n,t)}function En(n){return((n&255)<<16)+(n&65280)+(n>>16&255)}const bx={getGlobalAlpha(n){if(n)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(n=new ot,t){if(t)return n.copyFrom(this.worldTransform);this.updateLocalTransform();const e=fc(this,Ce.get().identity());return n.appendFrom(this.localTransform,e),Ce.return(e),n},getGlobalTint(n){if(n)return this.renderGroup?En(this.renderGroup.worldColor):this.parentRenderGroup?En(zu(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=zu(t,e.localColor),e=e.parent;return En(t)}};function xp(n,t,e){return t.clear(),e||(e=ot.IDENTITY),_p(n,t,e,n,!0),t.isValid||t.set(0,0,0,0),t}function _p(n,t,e,s,i){let r;if(i)r=Ce.get(),r=e.copyTo(r);else{if(!n.visible||!n.measurable)return;n.updateLocalTransform();const h=n.localTransform;r=Ce.get(),r.appendFrom(h,e)}const o=t,a=!!n.effects.length;if(a&&(t=Vs.get().clear()),n.boundsArea)t.addRect(n.boundsArea,r);else{n.renderPipeId&&(t.matrix=r,t.addBounds(n.bounds));const h=n.children;for(let l=0;l<h.length;l++)_p(h[l],t,r,s,!1)}if(a){for(let h=0;h<n.effects.length;h++)n.effects[h].addLocalBounds?.(t,s);o.addBounds(t,ot.IDENTITY),Vs.return(t)}Ce.return(r)}function bp(n,t){const e=n.children;for(let s=0;s<e.length;s++){const i=e[s],r=i.uid,o=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,a=t.index;(t.data[a]!==r||t.data[a+1]!==o)&&(t.data[t.index]=r,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,i.children.length&&bp(i,t)}return t.didChange}const wx=new ot,Sx={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(n,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=n/t*e:this.scale.x=e},_setHeight(n,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=n/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new ns});const n=this._localBoundsCacheData;return n.index=1,n.didChange=!1,n.data[0]!==this._didViewChangeTick&&(n.didChange=!0,n.data[0]=this._didViewChangeTick),bp(this,n),n.didChange&&xp(this,n.localBounds,wx),n.localBounds},getBounds(n,t){return mp(this,n,t||new ns)}},vx={_onRender:null,set onRender(n){const t=this.renderGroup||this.parentRenderGroup;if(!n){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=n},get onRender(){return this._onRender}},Tx={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(n){this._zIndex!==n&&(this._zIndex=n,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(Ax))}};function Ax(n,t){return n._zIndex-t._zIndex}const Cx={getGlobalPosition(n=new It,t=!1){return this.parent?this.parent.toGlobal(this._position,n,t):(n.x=this._position.x,n.y=this._position.y),n},toGlobal(n,t,e=!1){const s=this.getGlobalTransform(Ce.get(),e);return t=s.apply(n,t),Ce.return(s),t},toLocal(n,t,e,s){t&&(n=t.toGlobal(n,e,s));const i=this.getGlobalTransform(Ce.get(),s);return e=i.applyInverse(n,e),Ce.return(i),e}};class pc{constructor(){this.uid=Kt("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"])}}let Px=0;class Mx{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new Vn(this.textureOptions)}createTexture(t,e,s,i){const r=new Pe({...this.textureOptions,width:t,height:e,resolution:1,antialias:s,autoGarbageCollect:!1,autoGenerateMipmaps:i});return new $({source:r,label:`texturePool_${Px++}`})}getOptimalTexture(t,e,s=1,i,r=!1){let o=Math.ceil(t*s-1e-6),a=Math.ceil(e*s-1e-6);o=Yn(o),a=Yn(a);const h=i?1:0,l=r?1:0,c=(o<<17)+(a<<2)+(l<<1)+h;this._texturePool[c]||(this._texturePool[c]=[]);let u=this._texturePool[c].pop();return u||(u=this.createTexture(o,a,i,r)),u.source._resolution=s,u.source.width=o/s,u.source.height=a/s,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]=c,u}getSameSizeTexture(t,e=!1){const s=t.source;return this.getOptimalTexture(t.width,t.height,s._resolution,e)}returnTexture(t,e=!1){const s=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[s].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const s=this._texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this._texturePool={}}}const Va=new Mx;so.register(Va);class kx{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ot,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 pc,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let s=0;s<e.length;s++){const i=e[s];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Va.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const 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){const 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);const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let s=0;s<e.length;s++)this.removeChild(e[s])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let s=0;s<e.length;s++)this._getChildren(e[s],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const s=t.children;for(let i=0;i<s.length;i++)this._getChildren(s[i],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new ot),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new ot),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;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new ot),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 Ix(n,t,e={}){for(const s in t)!e[s]&&t[s]!==void 0&&(n[s]=t[s])}const uh=new Vt(null),go=new Vt(null),dh=new Vt(null,1,1),mo=new Vt(null),Yu=1,Ex=2,fh=4;class j extends re{constructor(t={}){super(),this.uid=Kt("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 ot,this.relativeGroupTransform=new ot,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Vt(this,0,0),this._scale=dh,this._pivot=go,this._origin=mo,this._skew=uh,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=[],Ix(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){ut("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),yt.mixin(j,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||ut(Ct,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let i=0;i<t.length;i++)this.addChild(t[i]);return t[0]}const e=t[0],s=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),s&&(s.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,s&&s.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 i=0;i<t.length;i++)this.removeChild(t[i]);return t[0]}const e=t[0],s=this.children.indexOf(e);return s>-1&&(this._didViewChangeTick++,this.children.splice(s,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,s),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;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=Re.get(kx,this),this.groupTransform=ot.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),Re.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 ot),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*Xy}set angle(t){this.rotation=t*$y}get pivot(){return this._pivot===go&&(this._pivot=new Vt(this,0,0)),this._pivot}set pivot(t){this._pivot===go&&(this._pivot=new Vt(this,0,0),this._origin!==mo&&Dt("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===uh&&(this._skew=new Vt(this,0,0)),this._skew}set skew(t){this._skew===uh&&(this._skew=new Vt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===dh&&(this._scale=new Vt(this,1,1)),this._scale}set scale(t){this._scale===dh&&(this._scale=new Vt(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===mo&&(this._origin=new Vt(this,0,0)),this._origin}set origin(t){this._origin===mo&&(this._origin=new Vt(this,0,0),this._pivot!==go&&Dt("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){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const 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){const s=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,s.width),e!==void 0&&this._setHeight(e,s.height)}_updateSkew(){const 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(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,s=this._scale,i=this._pivot,r=this._origin,o=this._position,a=s._x,h=s._y,l=i._x,c=i._y,u=-r._x,d=-r._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*h,e.d=this._sy*h,e.tx=o._x-(l*e.a+c*e.c)+(u*e.a+d*e.c)-u,e.ty=o._y-(l*e.b+c*e.d)+(u*e.b+d*e.d)-d}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Yu,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const s=Nt.shared.setValue(t??16777215).toBgrNumber();s!==this.localColor&&(this.localColor=s,this._updateFlags|=Yu,this._onUpdate())}get tint(){return En(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ex,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=fh,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=fh,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=fh,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 i=0;i<e.length;++i)e[i].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}}yt.mixin(j,fx,_x,Cx,vx,Sx,mx,yx,Tx,hx,ux,bx,px);class er extends j{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 ns(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){const e=this.bounds,{x:s,y:i}=t;return s>=e.minX&&s<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}
5unload(){this.emit("unload",this);for(const 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,s){const{renderPipes:i}=e;i.blendMode.pushBlendMode(this,this.groupBlendMode,t);const o=i[this.renderPipeId];o?.addRenderable&&o.addRenderable(this,t),this.didViewUpdate=!1;const a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,s);i.blendMode.popBlendMode(t)}}class it extends er{constructor(t=$.EMPTY){t instanceof $&&(t={texture:t});const{texture:e=$.EMPTY,anchor:s,roundPixels:i,width:r,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 Vt({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=i??!1,r!==void 0&&(this.width=r),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof $?new it(t):new it($.from(t,e))}set texture(t){t||(t=$.EMPTY);const 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 dp(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ut("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,s=this._bounds,{width:i,height:r}=e.orig;s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*r,s.maxY=s.minY+r}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(s)}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)}}const Fx=new ns;function wp(n,t,e){const s=Fx;n.measurable=!0,mp(n,e,s),t.addBoundsMask(s),n.measurable=!1}function Sp(n,t,e){const s=Vs.get();n.measurable=!0;const i=Ce.get().identity(),r=vp(n,e,i);xp(n,s,r),n.measurable=!1,t.addBoundsMask(s),Ce.return(i),Vs.return(s)}function vp(n,t,e){return n?(n!==t&&(vp(n.parent,t,e),n.updateLocalTransform(),e.append(n.localTransform)),e):(Dt("Mask bounds, renderable is not inside the root container"),e)}class Tp{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 it),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||wp(this.mask,t,e)}addLocalBounds(t,e){Sp(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof it}}Tp.extension=X.MaskEffect;class Ap{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"}}Ap.extension=X.MaskEffect;class Cp{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){wp(this.mask,t,e)}addLocalBounds(t,e){Sp(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof j}}Cp.extension=X.MaskEffect;const Bx={createCanvas:(n,t)=>{const e=document.createElement("canvas");return e.width=n,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(n,t)=>fetch(n,t),parseXML:n=>new DOMParser().parseFromString(n,"text/xml")};let Vu=Bx;
vendor: 4,228 bytes, line 5
5const ft={get(){return Vu},set(n){Vu=n}};class Pp extends Pe{constructor(t){t.resource||(t.resource=ft.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,s=this._resolution){const i=super.resize(t,e,s);return i&&this.resizeCanvas(),i}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"))}}Pp.extension=X.TextureSource;class Gn extends Pe{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}}Gn.extension=X.TextureSource;var Wr=(n=>(n[n.INTERACTION=50]="INTERACTION",n[n.HIGH=25]="HIGH",n[n.NORMAL=0]="NORMAL",n[n.LOW=-25]="LOW",n[n.UTILITY=-50]="UTILITY",n))(Wr||{});class ph{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=s,this._once=i}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));const 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);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Mp=class Ne{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 ph(null,null,1/0),this.deltaMS=1/Ne.targetFPMS,this.elapsedMS=1/Ne.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,s=Wr.NORMAL){return this._addListener(new ph(t,e,s))}addOnce(t,e,s=Wr.NORMAL){return this._addListener(new ph(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.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){const r=t-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=t-r%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ne.targetFPMS;const s=this._head;let i=s.next;for(;i;
vendor: 4,894 bytes, line 5
5)i=i.emit(this);s.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){const e=Math.min(Math.max(0,t)/1e3,Ne.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(!Ne._shared){const t=Ne._shared=new Ne;t.autoStart=!0,t._protected=!0}return Ne._shared}static get system(){if(!Ne._system){const t=Ne._system=new Ne;t.autoStart=!0,t._protected=!0}return Ne._system}};Mp.targetFPMS=.06;let Zt=Mp,gh;async function kp(){return gh??(gh=(async()=>{const t=ft.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const 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";const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,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);const r=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,r),t.deleteFramebuffer(i),t.deleteTexture(s),t.getExtension("WEBGL_lose_context")?.loseContext(),r[0]<=r[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),gh}const Ua=class Ip extends Pe{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Ip.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){const t=Zt.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;const 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 kp(),this._load=new Promise((s,i)=>{this.isValid?s(this):(this._resolve=s,this._reject=i,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
vendor: 8,816 bytes, line 5
5("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const 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(){const 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();const 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&&(Zt.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||(Zt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Zt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ua.extension=X.TextureSource;Ua.defaultOptions={...Pe.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ua.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ar=Ua;const ls=(n,t,e=!1)=>(Array.isArray(n)||(n=[n]),t?n.map(s=>typeof s=="string"||e?t(s):s):n);class Rx{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){const e=this._cache.get(t);return e||Dt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=ls(t);let i;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.test(e)){i=l.getCacheableAssets(s,e);break}}const r=new Map(Object.entries(i||{}));i||s.forEach(h=>{r.set(h,e)});const o=[...r.keys()],a={cacheKeys:o,keys:s};s.forEach(h=>{this._cacheMap.set(h,a)}),o.forEach(h=>{const l=i?i[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&Dt("[Cache] already has key:",h),this._cache.set(h,r.get(h))})}remove(t){if(!this._cacheMap.has(t)){Dt(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Bt=new Rx,ll=[];yt.handleByList(X.TextureSource,ll);function Ep(n={}){const t=n&&n.resource,e=t?n.resource:n,s=t?n:{resource:n};for(let i=0;i<ll.length;i++){const r=ll[i];if(r.test(e))return new r(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function Lx(n={},t=!1){const e=n&&n.resource,s=e?n.resource:n,i=e?n:{resource:n};if(!t&&Bt.has(s))return Bt.get(s);const r=new $({source:Ep(i)});return r.on("destroy",()=>{Bt.has(s)&&Bt.remove(s)}),t||Bt.set(s,r),r}function Ox(n,t=!1){return typeof n=="string"?Bt.get(n):n instanceof Pe?new $({source:n}):Lx(n,t)}$.from=Ox;Pe.from=Ep;yt.add(Tp,Ap,Cp,Ar,Gn,Pp,dc);var ds=(n=>(n[n.Low=0]="Low",n[n.Normal=1]="Normal",n[n.High=2]="High",n))(ds||{});function os(n){if(typeof n!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(n)}`)}function rr(n){return n.split("?")[0].split("#")[0]}function Dx(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nx(n,t,e){return n.replace(new RegExp(Dx(t),"g"),e)}function Wx(n,t){let e="",s=0,i=-1,r=0,o=-1;for(let a=0;a<=n.length;++a){if(a<n.length)o=n.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||r===1))if(i!==a-1&&r===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),i=a,r=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=a,r=0;continue}}}else e.length>0?e+=`/${n.slice(i+1,a)}`:e=n.slice(i+1,a),s=a-i-1;i=a,r=0}else o===46&&r!==-1?++r:r=-1}return e}const ie={toPosix(n){return Nx(n,"\\","/")},isUrl(n){return/^https?:/.test(this.toPosix(n))},isDataUrl(n){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(n)},isBlobUrl(n){return n.startsWith("blob:")},hasProtocol(n){return/^[^/:]+:/.test(this.toPosix(n))},getProtocol(n){os(n),n=this.toPosix(n);const t=/^file:\/\/\//.exec(n);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(n);return e?e[0]:""},toAbsolute(n,t,e){if(os(n),this.isDataUrl(n)||this.isBlobUrl(n))return n;const s=rr(this.toPosix(t??ft.get().getBaseUrl())),i=rr(this.toPosix(e??this.rootname(s)));return n=this.toPosix(n),n.startsWith("/")?ie.join(i,n.slice(1)):this.isAbsolute(n)?n:this.join(s,n)},normalize(n){if(os(n),n.length===0)return".";if(this.isDataUrl(n)||this.isBlobUrl(n))return n;n=this.toPosix(n);let t="";const e=n.startsWith("/");this.hasProtocol(n)&&(t=this.rootname(n),n=n.slice(t.length));const s=n.endsWith("/");return n=Wx(n),n.length>0&&s&&(n+="/"),e?`/${n}`:t+n},isAbsolute(n){return os(n),n=this.toPosix(n),this.hasProtocol(n)?!0:n.startsWith("/")},join(...n){if(n.length===0)return".";let t;for(let e=0;e<n.length;++e){const s=n[e];if(os(s),s.length>0)if(t===void 0)t=s;else{const i=n[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(n){if(os(n),n.length===0)return".";n=this.toPosix(n);let t=n.charCodeAt(0);const e=t===47;let s=-1,i=!0;const r=this.getProtocol(n),o=n;n=n.slice(r.length);for(let a=n.length-1;a>=1;--a)if(t=n.charCodeAt(a),t===47){if(!i){s=a;break}}else i=!1;return s===-1?e?"/":this.isUrl(o)?r+n:r:e&&s===1?"//":r+n.slice(0,s)},rootname(n){os(n),n=this.toPosix(n);let t="";if(n.startsWith("/")?t="/":t=this.getProtocol(n),this.isUrl(n)){const e=n.indexOf("/",t.length);e!==-1?t=n.slice(0,e):t=n,t.endsWith("/")||(t+="/")}return t},basename(n,t){os(n),t&&os(t),n=rr(this.toPosix(n));let e=0,s=-1,i=!0,r;if(t!==void 0&&t.length>0&&t.length<=n.length){if(t.length===n.length&&t===n)return"";let o=t.length-1,a=-1;for(r=n.length-1;r>=0;--r){const h=n.charCodeAt(r);if(h===47){if(!i){e=r+1;break}}else a===-1&&(i=!1,a=r+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(s=r):(o=-1,s=a))}return e===s?s=a:s===-1&&(s=n.length),n.slice(e,s)}for(r=n.length-1;r>=0;--r)if(n.charCodeAt(r)===47){if(!i){e=r+1;break}}else s===-1&&(i=!1,s=r+1);return s===-1?"":n.slice(e,s)},extname(n){os(n),n=rr(this.toPosix(n));let t=-1,e=0,s=-1,i=!0,r=0;for(let o=n.length-1;o>=0;--o){const a=n.charCodeAt(o);if(a===47){if(!i){e=o+1;break}continue}s===-1&&(i=!1,s=o+1),a===46?t===-1?t=o:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||s===-1||r===0||r===1&&t===s-1&&t===e+1?"":n.slice(t,s)},parse(n){os(n);const t={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return t;n=rr(this.toPosix(n));let e=n.charCodeAt(0);const s=this.isAbsolute(n);let i;t.root=this.rootname(n),s||this.hasProtocol(n)?i=1:i=0;let r=-1,o=0,a=-1,h=!0,l=n.length-1,c=0;for(;l>=i;
5--l){if(e=n.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||a===-1||c===0||c===1&&r===a-1&&r===o+1?a!==-1&&(o===0&&s?t.base=t.name=n.slice(1,a):t.base=t.name=n.slice(o,a)):(o===0&&s?(t.name=n.slice(1,r),t.base=n.slice(1,a)):(t.name=n.slice(o,r),t.base=n.slice(o,a)),t.ext=n.slice(r,a)),t.dir=this.dirname(n),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function Fp(n,t,e,s,i){const r=t[e];for(let o=0;o<r.length;o++){const a=r[o];e<t.length-1?Fp(n.replace(s[e],a),t,e+1,s,i):i.push(n.replace(s[e],a))}}function zx(n){const t=/\{(.*?)\}/g,e=n.match(t),s=[];if(e){const i=[];e.forEach(r=>{const o=r.substring(1,r.length-1).split(",");i.push(o)}),Fp(n,i,0,e,s)}else s.push(n);return s}const aa=n=>!Array.isArray(n);class tn{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{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,src:s}=t;return ls(e||s,r=>typeof r=="string"?r:Array.isArray(r)?r.map(o=>o?.src??o):r?.src?r.src:r,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&Dt("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];let i=e;Array.isArray(e)||(i=Object.entries(e).map(([r,o])=>typeof o=="string"||Array.isArray(o)?{alias:r,src:o}:{alias:r,...o})),i.forEach(r=>{const o=r.src,a=r.alias;let h;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);s.push(l),h=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));s.push(...l),h=[...a,...l]}this.add({...r,alias:h,src:o})}),this._bundles[t]=s}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let s;s=r=>{this.hasKey(r)&&Dt(`[Resolver] already has key: ${r} overwriting`)},ls(e).forEach(r=>{const{src:o}=r;let{data:a,format:h,loadParser:l,parser:c}=r;const u=ls(o).map(p=>typeof p=="string"?zx(p):Array.isArray(p)?p:[p]),d=this.getAlias(r);Array.isArray(d)?d.forEach(s):s(d);const f=[],g=p=>{const m=this._parsers.find(y=>y.test(p));return{src:p,...m?.parse(p)}};u.forEach(p=>{p.forEach(m=>{let y={};if(typeof m!="object"?y=g(m):(a=m.data??a,h=m.format??h,(m.loadParser||m.parser)&&(l=m.loadParser??l,c=m.parser??c),y={...g(m.src),...m}),!d)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:d,data:a,format:h,loadParser:l,parser:c,progressSize:r.progressSize}),f.push(y)})}),d.forEach(p=>{this._assetMap[p]=f})})}
vendor: 1,162 bytes, line 5
5resolveBundle(t){const e=aa(t);t=ls(t);const s={};return t.forEach(i=>{const r=this._bundles[i];if(r){const o=this.resolve(r),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(i,h)]=l}s[i]=a}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=aa(t);t=ls(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let r=this._assetMap[i];const o=this._getPreferredOrder(r);o?.priority.forEach(a=>{o.params[a].forEach(h=>{const l=r.filter(c=>c[a]?c[a]===h:!1);l.length&&(r=l)})}),this._resolverHash[i]=r[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[e],i=this._preferredOrder.find(r=>r.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}
5_buildResolvedAsset(t,e){const{aliases:s,data:i,loadParser:r,parser:o,format:a,progressSize:h}=e;return(this._basePath||this._rootPath)&&(t.src=ie.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=r??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??Yx(t.src),h!==void 0&&(t.progressSize=h),t}}tn.RETINA_PREFIX=/@([0-9\.]+)x/;function Yx(n){return n.split(".").pop().split("?").shift().split("#").shift()}const ha=(n,t)=>{const e=t.split("?")[1];return e&&(n+=`?${e}`),n},Bp=class gr{constructor(t,e){this.linkedSheets=[];let s=t;t?.source instanceof Pe&&(s={texture:t,data:e});const{texture:i,data:r,cachePrefix:o=""}=s;this.cachePrefix=o,this._texture=i instanceof $?i:null,this.textureSource=i.source,this.textures={},this.animations={},this.data=r;const a=parseFloat(r.meta.scale);a?(this.resolution=a,i.source.resolution=this.resolution):this.resolution=i.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<=gr.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 s=t;const i=e?1/0:gr.BATCH_SIZE;for(;s-t<i&&s<this._frameKeys.length;){const r=this._frameKeys[s],o=this._frames[r],a=o.frame;if(a){let h=null,l=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new qt(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?h=new qt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new qt(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&&(l=new qt(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[r]=new $({source:this.textureSource,frame:h,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:r.toString()})}s++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*gr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*gr.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(const 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=[]}};Bp.BATCH_SIZE=1e3;let Uu=Bp;const Vx=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Rp(n,t,e){const s={};if(n.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=ie.dirname(n[0]);t.linkedSheets.forEach((r,o)=>{const a=Rp([`${i}/${t.data.meta.related_multi_packs[o]}`],r,!0);Object.assign(s,a)})}return s}const Ux={extension:X.Asset,cache:{test:n=>n instanceof Uu,getCacheableAssets:(n,t)=>Rp(n,t,!1)},resolver:{extension:{type:X.ResolveParser,name:"resolveSpritesheet"},test:n=>{const e=n.split("?")[0].split("."),s=e.pop(),i=e.pop();return s==="json"&&Vx.includes(i)},parse:n=>{const t=n.split(".");return{resolution:parseFloat(tn.RETINA_PREFIX.exec(n)?.[1]??"1"),format:t[t.length-2],src:n}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:X.LoadParser,priority:ds.Normal,name:"spritesheetLoader"},async testParse(n,t){return ie.extname(t.src).toLowerCase()===".json"&&!!n.frames},async parse(n,t,e){const{texture:s,imageFilename:i,textureOptions:r,cachePrefix:o}=t?.data??{};let a=ie.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s instanceof $)h=s;else{const u=ha(a+(i??n.meta.image),t.src);h=(await e.load([{src:u,data:r}]))[u]}const l=new Uu({texture:h.source,data:n,cachePrefix:o});await l.parse();const c=n?.meta?.related_multi_packs;if(Array.isArray(c)){const u=[];for(const f of c){if(typeof f!="string")continue;
5let g=a+f;t.data?.ignoreMultiPack||(g=ha(g,t.src),u.push(e.load({src:g,data:{textureOptions:r,ignoreMultiPack:!0}})))}const d=await Promise.all(u);l.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[l].concat(l.linkedSheets.filter(g=>g!==f))})}return l},async unload(n,t,e){await e.unload(n.textureSource._sourceOrigin),n.destroy(!1)}}};yt.add(Ux);const mh=Object.create(null),Gu=Object.create(null);function gc(n,t){let e=Gu[n];return e===void 0&&(mh[t]===void 0&&(mh[t]=1),Gu[n]=e=mh[t]++),e}let yo;function Lp(){return(!yo||yo?.isContextLost())&&(yo=ft.get().createCanvas().getContext("webgl",{})),yo}let xo;function Gx(){if(!xo){xo="mediump";const n=Lp();n&&n.getShaderPrecisionFormat&&(xo=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision?"highp":"mediump")}return xo}function Xx(n,t,e){return t?n:e?(n=n.replace("out vec4 finalColor;",""),`
6
7        #ifdef GL_ES // This checks if it is WebGL1
8        #define in varying
9        #define finalColor gl_FragColor
10        #define texture texture2D
11        #endif
12        ${n}
13        `):`
14
15        #ifdef GL_ES // This checks if it is WebGL1
16        #define in attribute
17        #define out varying
18        #endif
19        ${n}
20        `}function $x(n,t,e){const s=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(n.substring(0,9)!=="precision"){let i=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return i==="highp"&&s!=="highp"&&(i="mediump"),`precision ${i} float;
21${n}`}else if(s!=="highp"&&n.substring(0,15)==="precision highp")return n.replace("precision highp","precision mediump");return n}function Hx(n,t){return t?`#version 300 es
22${n}`:n}const jx={},qx={};function Kx(n,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const s=e?jx:qx;return s[t]?(s[t]++,t+=`-${s[t]}`):s[t]=1,n.indexOf("#define SHADER_NAME")!==-1?n:`${`#define SHADER_NAME ${t}`}
23${n}`}function Zx(n,t){return t?n.replace("#version 300 es",""):n}const yh={stripVersion:Zx,ensurePrecision:$x,addProgramDefines:Xx,setProgramName:Kx,insertVersion:Hx},or=Object.create(null),Op=class cl{constructor(t){t={...cl.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,s={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Gx()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let i=t.fragment,r=t.vertex;Object.keys(yh).forEach(o=>{const a=s[o];i=yh[o](i,a,!0),r=yh[o](r,a,!1)}),this.fragment=i,this.vertex=r,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=gc(`${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,or[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return or[e]||(or[e]=new cl(t),or[e]._cacheKey=e),or[e]}};Op.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Dp=Op;const Xu={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 Qx(n){return Xu[n]??Xu.float32}const Jx={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"},$u=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Hu(n,t){let e;for(;(e=$u.exec(n))!==null;){const s=Jx[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:s,stride:Qx(s).stride,offset:0,instance:!1,start:0}}$u.lastIndex=0}function t_(n){return n.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function e_({source:n,entryPoint:t}){const e={},s=t_(n),i=s.indexOf(`fn ${t}(`);if(i===-1)return e;const r=s.indexOf("->",i);if(r===-1)return e;const o=s.substring(i,r);if(Hu(o,e),Object.keys(e).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const h=a[1],l=new RegExp(`struct\\s+${h}\\s*\\{([^}]+)\\}`,"s"),c=s.match(l);c&&Hu(c[1],e)}}return e}function xh(n){const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,s=/@binding\((\d+)\)/,i=/var(<[^>]+>
23)? (\w+)/,r=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=n.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(s)[1],10),name:u.match(i)[2],isUniform:u.match(i)[1]==="<uniform>",type:u.match(r)[1]}));if(!l)return{groups:[],structs:[]};const c=n.match(o)?.map(u=>{const d=u.match(h)[1],f=u.match(a).reduce((g,p)=>{const[m,y]=p.split(":");return g[m.trim()]=y.trim(),g},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u||d.type.includes(`<${u}>`)))??[];return{groups:l,structs:c}}var Di=(n=>(n[n.VERTEX=1]="VERTEX",n[n.FRAGMENT=2]="FRAGMENT",n[n.COMPUTE=4]="COMPUTE",n))(Di||{});function s_({groups:n}){const t=[];for(let e=0;e<n.length;e++){const s=n[e];t[s.group]||(t[s.group]=[]),s.isUniform?t[s.group].push({binding:s.binding,visibility:Di.VERTEX|Di.FRAGMENT,buffer:{type:"uniform"}}):s.type==="sampler"?t[s.group].push({binding:s.binding,visibility:Di.FRAGMENT,sampler:{type:"filtering"}}):s.type==="texture_2d"||s.type.startsWith("texture_2d<")?t[s.group].push({binding:s.binding,visibility:Di.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):s.type==="texture_2d_array"||s.type.startsWith("texture_2d_array<")?t[s.group].push({binding:s.binding,visibility:Di.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(s.type==="texture_cube"||s.type.startsWith("texture_cube<"))&&t[s.group].push({binding:s.binding,visibility:Di.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function i_({groups:n}){const t=[];for(let e=0;e<n.length;e++){const s=n[e];t[s.group]||(t[s.group]={}),t[s.group][s.name]=s.binding}return t}function n_(n,t){const e=new Set,s=new Set,i=[...n.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),r=[...n.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return s.has(a)?!1:(s.add(a),!0)});return{structs:i,groups:r}}const ar=Object.create(null);class Ga{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:s,layout:i,gpuLayout:r,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=s,e.source===s.source){const a=xh(e.source);this.structsAndGroups=a}else{const a=xh(s.source),h=xh(e.source);this.structsAndGroups=n_(a,h)}this.layout=i??i_(this.structsAndGroups),this.gpuLayout=r??s_(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,s=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=gc(s,"program")}get attributeData(){return this._attributeData??(this._attributeData=e_(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,ar[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return ar[e]||(ar[e]=new Ga(t),ar[e]._cacheKey=e),ar[e]}}const Np=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],r_=Np.reduce((n,t)=>(n[t]=!0,n),{});function o_(n,t){switch(n){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}const Wp=class zp{constructor(t,e){this._touched=0,this.uid=Kt("uniform"),this._resourceType="uniformGroup",this._resourceId=Kt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...zp.defaultOptions,...e},this.uniformStructures=t;const s={};for(const i in t){const r=t[i];if(r.name=i,r.size=r.size??1,!r_[r.type]){const o=r.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,h]=o;throw new Error(`Uniform type ${r.type} is not supported. Use type: '${a}', size: ${h} instead.`)}throw new Error(`Uniform type ${r.type} is not supported. Supported uniform types are: ${Np.join(", ")}`)}r.value??(r.value=o_(r.type,r.size)),s[i]=r.value}this.uniforms=s,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=gc(Object.keys(s).map(i=>`${i}-${t[i].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Wp.defaultOptions={ubo:!1,isStatic:!1};let la=Wp;class Yo{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const s in t){const i=t[s];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const s in this.resources)t[e++]=this.resources[s]._resourceId;this._key=t.join("|")}setResource(t,e){const s=this.resources[e];t!==s&&(s?.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){const s=this.resources;
vendor: 4,228 bytes, line 23
23for(const i in s)s[i]._gcLastUsed=t,s[i]._touched=e}destroy(){const t=this.resources;for(const e in t)t[e]?.off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var Gi=(n=>(n[n.WEBGL=1]="WEBGL",n[n.WEBGPU=2]="WEBGPU",n[n.CANVAS=4]="CANVAS",n[n.BOTH=3]="BOTH",n))(Gi||{});class io extends re{constructor(t){super(),this.uid=Kt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:s,groups:i,resources:r,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=s,o===void 0&&(o=0,e&&(o|=Gi.WEBGPU),s&&(o|=Gi.WEBGL)),this.compatibleRenderers=o;const h={};if(!r&&!i&&(r={}),r&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&i&&a)for(const l in a)for(const c in a[l]){const u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&i&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(r){i={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(const c in r)h[c]||(i[99]||(i[99]=new Yo,this._ownedBindGroups.push(i[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in r){const u=c;let d=r[c];!d.source&&!d._resourceType&&(d=new la(d));const f=h[u];f&&(i[f.group]||(i[f.group]=new Yo,this._ownedBindGroups.push(i[f.group])),i[f.group].setResource(d,f.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,h)}addResource(t,e,s){var i,r;(i=this._uniformBindMap)[e]||(i[e]={}),(r=this._uniformBindMap[e])[s]||(r[s]=t),this.groups[e]||(this.groups[e]=new Yo,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const s={};for(const i in e){const r=e[i];Object.defineProperty(s,r.name,{get(){return t[r.group].getResource(r.binding)},set(o){t[r.group].setResource(o,r.binding)}})}return s}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)}static from(t){const{gpu:e,gl:s,...i}=t;let r,o;return e&&(r=Ga.from(e)),s&&(o=Dp.from(s)),new io({gpuProgram:r,glProgram:o,...i})}}const a_={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},_h=0,bh=1,wh=2,Sh=3,vh=4,Th=5,ul=class Yp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<_h)}set blend(t){!!(this.data&1<<_h)!==t&&(this.data^=1<<_h)}get offsets(){return!!(this.data&1<<bh)}set offsets(t){!!(this.data&1<<bh)!==t&&(this.data^=1<<bh)}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<<wh)}set culling(t){!!(this.data&1<<wh)!==t&&(this.data^=1<<wh)}get depthTest(){return!!(this.data&1<<Sh)}set depthTest(t){!!(this.data&1<<Sh)!==t&&(this.data^=1<<Sh)}get depthMask(){return!!(this.data&1<<Th)}set depthMask(t){!!(this.data&1<<Th)!==t&&(this.data^=1<<Th)}get clockwiseFrontFace(){return!!(this.data&1<<vh)}set clockwiseFrontFace(t){!!(this.data&1<<vh)!==t&&(this.data^=1<<vh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=a_[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(){const t=new Yp;return t.depthTest=!1,t.blend=!0,t}};ul.default2d=ul.for2d();let mc=ul;const dl=[];
vendor: 4,634 bytes, line 23
23yt.handleByNamedList(X.Environment,dl);async function h_(n){if(!n)for(let t=0;t<dl.length;t++){const e=dl[t];if(e.value.test()){await e.value.load();return}}}let hr;function l_(){if(typeof hr=="boolean")return hr;try{hr=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{hr=!1}return hr}function ju(n,t,e=2){const s=t&&t.length,i=s?t[0]*e:n.length;let r=Vp(n,0,i,e,!0);const o=[];if(!r||r.next===r.prev)return o;let a,h,l;if(s&&(r=p_(n,t,r,e)),n.length>80*e){a=n[0],h=n[1];let c=a,u=h;for(let d=e;d<i;d+=e){const f=n[d],g=n[d+1];f<a&&(a=f),g<h&&(h=g),f>c&&(c=f),g>u&&(u=g)}l=Math.max(c-a,u-h),l=l!==0?32767/l:0}return zr(r,o,e,a,h,l,0),o}function Vp(n,t,e,s,i){let r;if(i===A_(n,t,e,s)>0)for(let o=t;o<e;o+=s)r=qu(o/s|0,n[o],n[o+1],r);else for(let o=e-s;o>=t;o-=s)r=qu(o/s|0,n[o],n[o+1],r);return r&&Xn(r,r.next)&&(Vr(r),r=r.next),r}function Qi(n,t){if(!n)return n;t||(t=n);let e=n,s;do if(s=!1,!e.steiner&&(Xn(e,e.next)||Xt(e.prev,e,e.next)===0)){if(Vr(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function zr(n,t,e,s,i,r,o){if(!n)return;!o&&r&&__(n,s,i,r);let a=n;for(;n.prev!==n.next;){const h=n.prev,l=n.next;if(r?u_(n,s,i,r):c_(n)){t.push(h.i,n.i,l.i),Vr(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=d_(Qi(n),t),zr(n,t,e,s,i,r,2)):o===2&&f_(n,t,e,s,i,r):zr(Qi(n),t,e,s,i,r,1);break}}}function c_(n){const t=n.prev,e=n,s=n.next;if(Xt(t,e,s)>=0)return!1;const i=t.x,r=e.x,o=s.x,a=t.y,h=e.y,l=s.y,c=Math.min(i,r,o),u=Math.min(a,h,l),d=Math.max(i,r,o),f=Math.max(a,h,l);let g=s.next;for(;g!==t;){if(g.x>=c&&g.x<=d&&g.y>=u&&g.y<=f&&mr(i,a,r,h,o,l,g.x,g.y)&&Xt(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function u_(n,t,e,s){const i=n.prev,r=n,o=n.next;if(Xt(i,r,o)>=0)return!1;const a=i.x,h=r.x,l=o.x,c=i.y,u=r.y,d=o.y,f=Math.min(a,h,l),g=Math.min(c,u,d),p=Math.max(a,h,l),m=Math.max(c,u,d),y=fl(f,g,t,e,s),x=fl(p,m,t,e,s);let _=n.prevZ,b=n.nextZ;for(;_&&_.z>=y&&b&&b.z<=x;){if(_.x>=f&&_.x<=p&&_.y>=g&&_.y<=m&&_!==i&&_!==o&&mr(a,c,h,u,l,d,_.x,_.y)&&Xt(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=f&&b.x<=p&&b.y>=g&&b.y<=m&&b!==i&&b!==o&&mr(a,c,h,u,l,d,b.x,b.y)&&Xt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=y;){if(_.x>=f&&_.x<=p&&_.y>=g&&_.y<=m&&_!==i&&_!==o&&mr(a,c,h,u,l,d,_.x,_.y)&&Xt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=p&&b.y>=g&&b.y<=m&&b!==i&&b!==o&&mr(a,c,h,u,l,d,b.x,b.y)&&Xt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function d_(n,t){let e=n;do{const s=e.prev,i=e.next.next;!Xn(s,i)&&Gp(s,e,e.next,i)&&Yr(s,i)&&Yr(i,s)&&(t.push(s.i,e.i,i.i),Vr(e),Vr(e.next),e=n=i),e=e.next}while(e!==n);return Qi(e)}function f_(n,t,e,s,i,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&S_(o,a)){let h=Xp(o,a);o=Qi(o,o.next),h=Qi(h,h.next),zr(o,t,e,s,i,r,0),zr(h,t,e,s,i,r,0);return}a=a.next}o=o.next}while(o!==n)}function p_(n,t,e,s){const i=[];for(let r=0,o=t.length;r<o;r++){const a=t[r]*s,h=r<o-1?t[r+1]*s:n.length,l=Vp(n,a,h,s,!1);l===l.next&&(l.steiner=!0),i.push(w_(l))}i.sort(g_);for(let r=0;r<i.length;r++)e=m_(i[r],e);return e}function g_(n,t){let e=n.x-t.x;if(e===0&&(e=n.y-t.y,e===0)){const s=(n.next.y-n.y)/(n.next.x-n.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=s-i}return e}function m_(n,t){const e=y_(n,t);if(!e)return t;const s=Xp(e,n);return Qi(s,s.next),Qi(e,e.next)}function y_(n,t){let e=t;const s=n.x,i=n.y;let r=-1/0,o;if(Xn(n,e))return e;do{if(Xn(n,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const u=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=s&&u>r&&(r=u,o=e.x<e.next.x?e:e.next,u===s))return o}e=e.next}while(e!==t);if(!o)return null;const a=o,h=o.x,l=o.y;let c=1/0;e=o;do{if(s>=e.x&&e.x>=h&&s!==e.x&&Up(i<l?s:r,i,h,l,i<l?r:s,i,e.x,e.y)){const u=Math.abs(i-e.y)/(s-e.x);Yr(e,n)&&(u<c||u===c&&(e.x>o.x||e.x===o.x&&x_(o,e)))&&(o=e,c=u)}e=e.next}while(e!==a);return o}function x_(n,t){return Xt(n.prev,n,t.prev)<0&&Xt(t.next,n,n.next)<0}function __(n,t,e,s){let i=n;do i.z===0&&(i.z=fl(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,b_(i)}function b_(n){let t,e=1;do{let s=n,i;n=null;let r=null;for(t=0;s;){t++;let o=s,a=0;for(let l=0;l<e&&(a++,o=o.nextZ,!!o);l++);let h=e;for(;a>0||h>0&&o;)a!==0&&(h===0||!o||s.z<=o.z)?(i=s,s=s.nextZ,a--):(i=o,o=o.nextZ,h--),r?r.nextZ=i:n=i,i.prevZ=r,r=i;s=o}r.nextZ=null,e*=2}while(t>1);return n}function fl(n,t,e,s,i){return n=(n-e)*i|0,t=(t-s)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function w_(n){let t=n,e=n;
vendor: 4,613 bytes, line 23
23do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function Up(n,t,e,s,i,r,o,a){return(i-o)*(t-a)>=(n-o)*(r-a)&&(n-o)*(s-a)>=(e-o)*(t-a)&&(e-o)*(r-a)>=(i-o)*(s-a)}function mr(n,t,e,s,i,r,o,a){return!(n===o&&t===a)&&Up(n,t,e,s,i,r,o,a)}function S_(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!v_(n,t)&&(Yr(n,t)&&Yr(t,n)&&T_(n,t)&&(Xt(n.prev,n,t.prev)||Xt(n,t.prev,t))||Xn(n,t)&&Xt(n.prev,n,n.next)>0&&Xt(t.prev,t,t.next)>0)}function Xt(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Xn(n,t){return n.x===t.x&&n.y===t.y}function Gp(n,t,e,s){const i=bo(Xt(n,t,e)),r=bo(Xt(n,t,s)),o=bo(Xt(e,s,n)),a=bo(Xt(e,s,t));return!!(i!==r&&o!==a||i===0&&_o(n,e,t)||r===0&&_o(n,s,t)||o===0&&_o(e,n,s)||a===0&&_o(e,t,s))}function _o(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function bo(n){return n>0?1:n<0?-1:0}function v_(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&Gp(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Yr(n,t){return Xt(n.prev,n,n.next)<0?Xt(n,t,n.next)>=0&&Xt(n,n.prev,t)>=0:Xt(n,t,n.prev)<0||Xt(n,n.next,t)<0}function T_(n,t){let e=n,s=!1;const i=(n.x+t.x)/2,r=(n.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&i<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==n);return s}function Xp(n,t){const e=pl(n.i,n.x,n.y),s=pl(t.i,t.x,t.y),i=n.next,r=t.prev;return n.next=t,t.prev=n,e.next=i,i.prev=e,s.next=e,e.prev=s,r.next=s,s.prev=r,s}function qu(n,t,e,s){const i=pl(n,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function Vr(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function pl(n,t,e){return{i:n,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function A_(n,t,e,s){let i=0;for(let r=t,o=e-s;r<e;r+=s)i+=(n[o]-n[r])*(n[r+1]+n[o+1]),o=r;return i}const C_=ju.default||ju;var $p=(n=>(n[n.NONE=0]="NONE",n[n.COLOR=16384]="COLOR",n[n.STENCIL=1024]="STENCIL",n[n.DEPTH=256]="DEPTH",n[n.COLOR_DEPTH=16640]="COLOR_DEPTH",n[n.COLOR_STENCIL=17408]="COLOR_STENCIL",n[n.DEPTH_STENCIL=1280]="DEPTH_STENCIL",n[n.ALL=17664]="ALL",n))($p||{});class P_{constructor(t){this.items=[],this._name=t}emit(t,e,s,i,r,o,a,h){const{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,s,i,r,o,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const 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}}const M_=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Hp=class jp extends re{constructor(t){super(),this.tick=0,this.uid=Kt("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;const e=[...M_,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await h_(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const s in this._systemsHash)t={...this._systemsHash[s].constructor.defaultOptions,...t};t={...jp.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let s=0;s<this.runners.init.items.length;s++)await this.runners.init.items[s].init(t);this._initOptions=t}render(t,e){this.tick++;let s=t;if(s instanceof j&&(s={container:s},e&&(ut(Ct,"passing a second argument is deprecated, please use render options instead"),s.target=e.renderTexture)),s.target||(s.target=this.view.renderTarget),s.target===this.view.renderTarget&&(this._lastObjectRendered=s.container,s.clearColor??(s.clearColor=this.background.colorRgba),s.clear??(s.clear=this.background.clearBeforeRender)),s.clearColor){const i=Array.isArray(s.clearColor)&&s.clearColor.length===4;s.clearColor=i?s.clearColor:Nt.shared.setValue(s.clearColor).toArray()}s.transform||(s.container.updateLocalTransform(),s.transform=s.container.localTransform),s.container.visible&&(s.container.enableRenderGroup(),this.runners.prerender.emit(s),this.runners.renderStart.emit(s),this.runners.render.emit(s),this.runners.renderEnd.emit(s),this.runners.postrender.emit(s))}resize(t,e,s){const i=this.view.resolution;
23this.view.resize(t,e,s),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),s!==void 0&&s!==i&&this.runners.resolutionChange.emit(s)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=$p.ALL);const{clear:s,clearColor:i,target:r,mipLevel:o,layer:a}=t;Nt.shared.setValue(i??this.background.colorRgba),e.renderTarget.clear(r,s,Nt.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 P_(e)})}_addSystems(t){let e;for(e in t){const s=t[e];this._addSystem(s.value,s.name)}}_addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}_addPipes(t,e){const s=e.reduce((i,r)=>(i[r.name]=r.value,i),{});t.forEach(i=>{const r=i.value,o=i.name,a=s[o];this.renderPipes[o]=new r(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)&&so.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(!l_())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()}};Hp.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let qp=Hp,wo;function k_(n){return wo!==void 0||(wo=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:n??qp.defaultOptions.failIfMajorPerformanceCaveat};try{if(!ft.get().getWebGLRenderingContext())return!1;let s=ft.get().createCanvas().getContext("webgl",t);const i=!!s?.getContextAttributes()?.stencil;if(s){const r=s.getExtension("WEBGL_lose_context");r&&r.loseContext()}return s=null,i}catch{return!1}})()),wo}let So;async function I_(n={}){return So!==void 0||(So=await(async()=>{const t=ft.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(n)).requestDevice(),!0}catch{return!1}})()),So}const Ku=["webgl","webgpu","canvas"];async function E_(n){let t=[];n.preference?Array.isArray(n.preference)?t=n.preference.slice():(t.push(n.preference),Ku.forEach(r=>{r!==n.preference&&t.push(r)})):t=Ku.slice();let e,s={};for(let r=0;r<t.length;r++){const o=t[r];if(o==="webgpu"&&await I_()){const{WebGPURenderer:a}=await ci(async()=>{const{WebGPURenderer:h}=await import("./WebGPURenderer-BSIRpe8q.js");return{WebGPURenderer:h}},__vite__mapDeps([3,4,5,2]),import.meta.url);e=a,s={...n,...n.webgpu};break}else if(o==="webgl"&&k_(n.failIfMajorPerformanceCaveat??qp.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await ci(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-pcqO-dd_.js");return{WebGLRenderer:h}},__vite__mapDeps([6,4,5,2]),import.meta.url);e=a,s={...n,...n.webgl};break}else if(o==="canvas"){const{CanvasRenderer:a}=await ci(async()=>{const{CanvasRenderer:h}=await import("./CanvasRenderer-fd6cvy9-.js");return{CanvasRenderer:h}},__vite__mapDeps([7,5,2]),import.meta.url);e=a,s={...n,...n.canvasOptions};break}}if(delete s.webgpu,delete s.webgl,delete s.canvasOptions,!e)throw new Error("No available renderer for the current environment");const i=new e;return await i.init(s),i}const Kp="8.19.0";class Zp{static init(){globalThis.__PIXI_APP_INIT__?.(this,Kp)}static destroy(){}}Zp.extension=X.Application;class F_{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Kp)}destroy(){this._renderer=null}}F_.extension={type:[X.WebGLSystem,X.WebGPUSystem],name:"initHook",priority:-10};class Qp{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,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:r}=this._resizeTo;e=i,s=r}this.renderer.resize(e,s),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}}Qp.extension=X.Application;class Jp{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,Wr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Zt.shared:new Zt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Jp.extension=X.Application;yt.add(Qp);yt.add(Jp);const tg=class gl{constructor(...t){this.stage=new j,t[0]!==void 0&&ut(Ct,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new j),this.renderer=await E_(t),gl._plugins.forEach(e
vendor: 9,019 bytes, line 23
23=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return ut(Ct,"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){const s=gl._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};tg._plugins=[];let yc=tg;yt.handleByList(X.Application,yc._plugins);yt.add(Zp);const Ah={test(n){return typeof n=="string"&&n.startsWith("info face=")},parse(n){const t=n.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const u in t){const d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),g={};for(const p in f){const m=f[p].split("="),y=m[0],x=m[1].replace(/"/gm,""),_=parseFloat(x),b=isNaN(_)?x:_;g[y]=b}e[d].push(g)}const s={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[i]=e.info,[r]=e.common,[o]=e.distanceField??[];o&&(s.distanceField={range:parseInt(o.distanceRange,10),type:o.fieldType}),s.fontSize=parseInt(i.size,10),s.fontFamily=i.face,s.lineHeight=parseInt(r.lineHeight,10);const a=e.page;for(let u=0;u<a.length;u++)s.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});const h={};s.baseLineOffset=s.lineHeight-parseInt(r.base,10);const l=e.char;for(let u=0;u<l.length;u++){const d=l[u],f=parseInt(d.id,10);let g=d.letter??d.char??String.fromCharCode(f);g==="space"&&(g=" "),h[f]=g,s.chars[g]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}const c=e.kerning||[];for(let u=0;u<c.length;u++){const d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),g=parseInt(c[u].amount,10);s.chars[h[f]]&&(s.chars[h[f]].kerning[h[d]]=g)}return s}},Zu={test(n){const t=n;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(n){const t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=n.getElementsByTagName("info")[0],s=n.getElementsByTagName("common")[0],i=n.getElementsByTagName("distanceField")[0];i&&(t.distanceField={type:i.getAttribute("fieldType"),range:parseInt(i.getAttribute("distanceRange"),10)});const r=n.getElementsByTagName("page"),o=n.getElementsByTagName("char"),a=n.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(s.getAttribute("lineHeight"),10);for(let l=0;l<r.length;l++)t.pages.push({id:parseInt(r[l].getAttribute("id"),10)||0,file:r[l].getAttribute("file")});const h={};t.baseLineOffset=t.lineHeight-parseInt(s.getAttribute("base"),10);for(let l=0;l<o.length;l++){const c=o[l],u=parseInt(c.getAttribute("id"),10);let d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){const c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]]&&(t.chars[h[u]].kerning[h[c]]=d)}return t}},Qu={test(n){return typeof n=="string"&&n.match(/<font(\s|>)/)?Zu.test(ft.get().parseXML(n)):!1},parse(n){return Zu.parse(ft.get().parseXML(n))}},B_=[".xml",".fnt"],R_={extension:{type:X.CacheParser,name:"cacheBitmapFont"},test:n=>!!n?.pages&&!!n?.chars&&typeof n?.fontFamily=="string"&&n.fontFamily!=="",getCacheableAssets(n,t){const e={};return n.forEach(s=>{e[s]=t,e[`${s}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},L_={extension:{type:X.LoadParser,priority:ds.Normal},name:"loadBitmapFont",id:"bitmap-font",test(n){return B_.includes(ie.extname(n).toLowerCase())},async testParse(n){return Ah.test(n)||Qu.test(n)},async parse(n,t,e){const s=Ah.test(n)?Ah.parse(n):Qu.parse(n),{src:i}=t,{pages:r}=s,o=[],a=s.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let d=0;d<r.length;++d){const f=r[d].file;let g=ie.join(ie.dirname(i),f);g=ha(g,i),o.push({src:g,data:a})}const[h,{BitmapFont:l}]=await Promise.all([e.load(o),ci(()=>import("./BitmapFont-CnScry8w.js"),[],import.meta.url)]),c=o.map(d=>h[d.src]);return new l({data:s,textures:c},i)},async load(n,t){return await(await ft.get().fetch(n)).text()},async unload(n,t,e){await Promise.all(n.pages.map(s=>e.unload(s.texture.source._sourceOrigin))),n.destroy()}};class O_{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}const D_={extension:{type:X.CacheParser,name:"cacheTextureArray"},test:n=>Array.isArray(n)&&n.every(t=>t instanceof $),getCacheableAssets:(n,t)=>{const e={};return n.forEach(s=>{t.forEach((i,r)=>{e[s+(r===0?"":r+1)]=i})}),e}};async function eg(n){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=n});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(n)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const N_={extension:{type:X.DetectionParser,priority:1},test:async()=>eg("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async n=>[...n,"avif"],remove:async n=>n.filter(t=>t!=="avif")},Ju=["png","jpg","jpeg"],W_={extension:{type:X.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async n=>[...n,...Ju],remove:async n=>n.filter(t=>!Ju.includes(t))},z_="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Xa(n){return z_?!1:document.createElement("video").canPlayType(n)!==""}const Y_={extension:{type:X.DetectionParser,priority:0},test:async()=>Xa("video/mp4"),add:async n=>[...n,"mp4","m4v"],remove:async n=>n.filter(t=>t!=="mp4"&&t!=="m4v")},V_={extension:{type:X.DetectionParser,priority:0},test:async()=>Xa("video/ogg"),add:async n=>[...n,"ogv"],remove:async n=>n.filter(t=>t!=="ogv")},U_={extension:{type:X.DetectionParser,priority:0},test:async()=>Xa("video/webm"),add:async n=>[...n,"webm"],remove:async n=>n.filter(t=>t!=="webm")},G_={extension:{type:X.DetectionParser,priority:0},test:async()=>eg("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async n=>[...n,"webp"],remove:async n=>n.filter(t=>t!=="webp")},sg=class Vo{constructor(){this.loadOptions={...Vo.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{let i=null,r=null;if((e.parser||e.loadParser)&&(r=this._parserHash[e.parser||e.loadParser],e.loadParser&&Dt(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),r||Dt(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!r){for(let o=0;o<this.parsers.length;o++){const a=this.parsers[o];if(a.load&&a.test?.(t,e,this)){r=a;break}}if(!r)return Dt(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await r.load(t,e,this),s.parser=r;for(let o=0;o<this.parsers.length;o++){const a=this.parsers[o];a.parse&&a.parse&&await a.testParse?.(i,e,this)&&(i=await a.parse(i,e,this)||i,s.parser=a)}return i})(),s}
23async load(t,e){this._parsersValidated||this._validateParsers();const s=typeof e=="function"?{...Vo.defaultOptions,...this.loadOptions,onProgress:e}:{...Vo.defaultOptions,...this.loadOptions,...e||{}},{onProgress:i,onError:r,strategy:o,retryCount:a,retryDelay:h}=s;let l=0;const c={},u=aa(t),d=ls(t,p=>({alias:[p],src:p,data:{}})),f=d.reduce((p,m)=>p+(m.progressSize||1),0),g=d.map(async p=>{const m=ie.toAbsolute(p.src);c[p.src]||(await this._loadAssetWithRetry(m,p,{onProgress:i,onError:r,strategy:o,retryCount:a,retryDelay:h},c),l+=p.progressSize||1,i&&i(l/f))});return await Promise.all(g),u?c[d[0].src]:c}async unload(t){const s=ls(t,i=>({alias:[i],src:i})).map(async i=>{const r=ie.toAbsolute(i.src),o=this.promiseCache[r];if(o){const a=await o.promise;delete this.promiseCache[r],await o.parser?.unload?.(a,i,this)}});await Promise.all(s)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?Dt("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&Dt(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,s,i){let r=0;const{onError:o,strategy:a,retryCount:h,retryDelay:l}=s,c=u=>new Promise(d=>setTimeout(d,u));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),i[e.src]=await this.promiseCache[t].promise;return}catch(u){delete this.promiseCache[t],delete i[e.src],r++;const d=a!=="retry"||r>h;if(a==="retry"&&!d){o&&o(u,e),await c(l);continue}if(a==="skip"){o&&o(u,e);return}o&&o(u,e);const f=new Error(`[Loader.load] Failed to load ${t}.
24${u}`);throw u instanceof Error&&u.stack&&(f.stack=u.stack),f}}};sg.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let X_=sg;function sr(n,t){if(Array.isArray(t)){for(const e of t)if(n.startsWith(`data:${e}`))return!0;return!1}return n.startsWith(`data:${t}`)}function is(n,t){const e=n.split("?")[0],s=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const $_=".json",H_="application/json",j_={extension:{type:X.LoadParser,priority:ds.Low},name:"loadJson",id:"json",test(n){return sr(n,H_)||is(n,$_)},async load(n){return await(await ft.get().fetch(n)).json()}},q_=".txt",K_="text/plain",Z_={name:"loadTxt",id:"text",extension:{type:X.LoadParser,priority:ds.Low,name:"loadTxt"},test(n){return sr(n,K_)||is(n,q_)},async load(n){return await(await ft.get().fetch(n)).text()}},Q_=["normal","bold","100","200","300","400","500","600","700","800","900"],J_=[".ttf",".otf",".woff",".woff2"],tb=["font/ttf","font/otf","font/woff","font/woff2"],eb=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function sb(n){const t=ie.extname(n),i=ie.basename(n,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1));let r=i.length>0;for(const a of i)if(!a.match(eb)){r=!1;break}let o=i.join(" ");return r||(o=`"${o.replace(/[\\"]/g,"\\$&")}"`),o}const ib=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function nb(n){return ib.test(n)?n:encodeURI(n)}const rb={extension:{type:X.LoadParser,priority:ds.Low},name:"loadWebFont",id:"web-font",test(n){return sr(n,tb)||is(n,J_)},async load(n,t){const e=ft.get().getFontFaceSet();if(e){const s=[],i=t.data?.family??sb(n),r=t.data?.weights?.filter(a=>Q_.includes(a))??["normal"],o=t.data??{};for(let a=0;a<r.length;a++){const h=r[a],l=new FontFace(i,`url('${nb(n)}')`,{...o,weight:h});await l.load(),e.add(l),s.push(l)}return Bt.has(`${i}-and-url`)?Bt.get(`${i}-and-url`).entries.push({url:n,faces:s}):Bt.set(`${i}-and-url`,{entries:[{url:n,faces:s}]}),s.length===1?s[0]:s}return Dt("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(n){const t=Array.isArray(n)?n:[n],e=t[0].family,s=Bt.get(`${e}-and-url`),i=s.entries.find(r=>r.faces.some(o=>t.indexOf(o)!==-1));i.faces=i.faces.filter(r=>t.indexOf(r)===-1),i.faces.length===0&&(s.entries=s.entries.filter(r=>r!==i)),t.forEach(r=>{ft.get().getFontFaceSet().delete(r)}),s.entries.length===0&&Bt.remove(`${e}-and-url`)}},Ch={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ob=/([astvzqmhlc])([^astvzqmhlc]*)/gi,ab=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function hb(n){const t=[];return n.replace(ob,(e,s,i)=>{let r=s.toLowerCase(),o=s;const a=lb(i);for(r==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),r="l",o=o==="m"?"l":"L");;){if(a.length===Ch[r])return t.push([o,...a]),"";if(a.length<Ch[r])throw new Error("malformed path data");t.push([o,...a.splice(0,Ch[r])])}}),t}function lb(n){const t=n.match(ab);return t?t.map(Number):[]}function cb(n,t){const e=hb(n),s=[];let i=null,r=0,o=0;for(let a=0;a<e.length;a++){const h=e[a],l=h[0],c=h;switch(l){case"M":r=c[1],o=c[2],t.moveTo(r,o);break;case"m":r+=c[1],o+=c[2],t.moveTo(r,o);break;case"H":r=c[1],t.lineTo(r,o);break;case"h":r+=c[1],t.lineTo(r,o);break;case"V":o=c[1],t.lineTo(r,o);break;case"v":o+=c[1],t.lineTo(r,o);break;case"L":r=c[1],o=c[2],t.lineTo(r,o);break;case"l":r+=c[1],o+=c[2],t.lineTo(r,o);break;case"C":r=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],r,o);break;case"c":t.bezierCurveTo(r+c[1],o+c[2],r+c[3],o+c[4],r+c[5],o+c[6]),r+=c[5],o+=c[6];break;case"S":r=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],r,o);break;case"s":t.bezierCurveToShort(r+c[1],o+c[2],r+c[3],o+c[4]),r+=c[3],o+=c[4];break;case"Q":r=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],r,o);break;case"q":t.quadraticCurveTo(r+c[1],o+c[2],r+c[3],o+c[4]),r+=c[3],o+=c[4];break;case"T":r=c[1],o=c[2],t.quadraticCurveToShort(r,o);break;case"t":r+=c[1],o+=c[2],t.quadraticCurveToShort(r,o);break;case"A":r=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],r,o);break;case"a":r+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],r,o);break;case"Z":case"z":t.closePath(),s.length>0&&(i=s.pop(),i?(r=i.startX,o=i.startY):(r=0,o=0)),i=null;break;default:Dt(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&i===null&&(i={startX:r,startY:o},s.push(i))}return t}class no{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new no(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,r=this.y-e;return i*=i,r*=r,i+r<=s}strokeContains(t,e,s,i=.5){if(this.radius===0)return!1;const r=this.x-t,o=this.y-e,a=this.radius,h=(1-i)*s,l=Math.sqrt(r*r+o*o);return l<=a+h&&l>a-(s-h)}getBounds(t){return t||(t=new qt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.he
vendor: 5,062 bytes, line 24
24ight=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}]`}}class xc{constructor(t=0,e=0,s=0,i=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=s,this.halfHeight=i}clone(){return new xc(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let s=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return s*=s,i*=i,s+i<=1}strokeContains(t,e,s,i=.5){const{halfWidth:r,halfHeight:o}=this;if(r<=0||o<=0)return!1;const a=s*(1-i),h=s-a,l=r-h,c=o-h,u=r+a,d=o+a,f=t-this.x,g=e-this.y,p=f*f/(l*l)+g*g/(c*c),m=f*f/(u*u)+g*g/(d*d);return p>1&&m<=1}getBounds(t){return t||(t=new qt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function ub(n,t,e,s,i,r){const o=n-e,a=t-s,h=i-e,l=r-s,c=o*h+a*l,u=h*h+l*l;let d=-1;u!==0&&(d=c/u);let f,g;d<0?(f=e,g=s):d>1?(f=i,g=r):(f=e+d*h,g=s+d*l);const p=n-f,m=t-g;return p*p+m*m}let db,fb;class Cr{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,r=e.length;i<r;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,s=e.length;for(let i=0;i<s;i+=2){const r=e[i],o=e[i+1],a=e[(i+2)%s],h=e[(i+3)%s];t+=(a-r)*(h+o)}return t<0}containsPolygon(t){const e=this.getBounds(db),s=t.getBounds(fb);if(!e.containsRect(s))return!1;const i=t.points;for(let r=0;r<i.length;r+=2){const o=i[r],a=i[r+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new Cr(t);return e.closePath=this.closePath,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let r=0,o=i-1;r<i;o=r++){const a=this.points[r*2],h=this.points[r*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(s=!s)}return s}strokeContains(t,e,s,i=.5){const r=s*s,o=r*(1-i),a=r-o,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){const u=h[c],d=h[c+1],f=h[(c+2)%h.length],g=h[(c+3)%h.length],p=ub(t,e,u,d,f,g),m=Math.sign((f-u)*(e-d)-(g-d)*(t-u));if(p<=(m<0?a:o))return!0}return!1}getBounds(t){t||(t=new qt);const e=this.points;let s=1/0,i=-1/0,r=1/0,o=-1/0;for(let a=0,h=e.length;a<h;a+=2){const l=e[a],c=e[a+1];s=l<s?l:s,i=l>i?l:i,r=c<r?c:r,o=c>o?c:o}return t.x=s,t.width=i-s,t.y=r,t.height=o-r,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 ut("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return ut("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]}}const vo=(n,t,e,s,i,r,o)=>{const a=n-e,h=t-s,l=Math.sqrt(a*a+h*h);return l>=i-r&&l<=i+o};class _c{constructor(t=0,e=0,s=0,i=0,r=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=s,this.height=i,this.radius=r}getBounds(t){return t||(t=new qt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new _c(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),r=e-(this.y+s);const o=s*s;if(i*i+r*r<=o||(i=t-(this.x+this.width-s),i*i+r*r<=o)||(r=e-(this.y+this.height-s),i*i+r*r<=o)||(i=t-(this.x+s),i*i+r*r<=o))return!0}return!1}strokeContains(t,e,s,i=.5){const{x:r,y:o,width:a,height:h,radius:l}=this,c=s*(1-i),u=s-c,d=r+l,f=o+l,g=a-l*2,p=h-l*2,m=r+a,y=o+h;return(t>=r-c&&t<=r+u||t>=m-u&&t<=m+c)&&e>=f&&e<=f+p||(e>=o-c&&e<=o+u||e>=y-u&&e<=y+c)&&t>=d&&t<=d+g?!0:t<d&&e<f&&vo(t,e,d,f,l,u,c)||t>m-l&&e<f&&vo(t,e,m-l,f,l,u,c)||t>m-l&&e>y-l&&vo(t,e,m-l,y-l,l,u,c)||t<d&&e>y-l&&vo(t,e,d,y-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const ig={};function pb(n,t,e){let s=2166136261;for(let i=0;i<t;i++)s^=n[i].uid,s=Math.imul(s,16777619),s>>>=0;return ig[s]||gb(n,t,s,e)}function gb(n,t,e,s){const i={};let r=0;for(let a=0;a<s;
24a++){const h=a<t?n[a]:$.EMPTY.source;i[r++]=h.source,i[r++]=h.style}const o=new Yo(i);return ig[e]=o,o}class td{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 ed(n,t,e,s){if(e??(e=0),s??(s=Math.min(n.byteLength-e,t.byteLength)),!(e&7)&&!(s&7)){const i=s/8;new Float64Array(t,0,i).set(new Float64Array(n,e,i))}else if(!(e&3)&&!(s&3)){const i=s/4;new Float32Array(t,0,i).set(new Float32Array(n,e,i))}else new Uint8Array(t).set(new Uint8Array(n,e,s))}const mb={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var yb=(n=>(n[n.DISABLED=0]="DISABLED",n[n.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",n[n.MASK_ACTIVE=2]="MASK_ACTIVE",n[n.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",n[n.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",n[n.NONE=5]="NONE",n))(yb||{});function ml(n,t){return t.alphaMode==="no-premultiply-alpha"&&mb[n]||n}const xb=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
25`);function _b(n){let t="";for(let e=0;e<n;++e)e>0&&(t+=`
26else `),e<n-1&&(t+=`if(test == ${e}.0){}`);return t}function bb(n,t){if(n===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const s=xb.replace(/%forloop%/gi,_b(n));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))n=n/2|0;else break}}finally{t.deleteShader(e)}return n}let on=null;function wb(){if(on)return on;const n=Lp();return on=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),on=bb(on,n),n.getExtension("WEBGL_lose_context")?.loseContext(),on}class Sb{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class vb{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Sb,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}}const Pr=[];let ca=0;so.register({clear:()=>{if(Pr.length>0)for(const n of Pr)n&&n.destroy();Pr.length=0,ca=0}});function sd(){return ca>0?Pr[--ca]:new vb}function id(n){n.elements=null,Pr[ca++]=n}let lr=0;const ng=class rg{constructor(t){this.uid=Kt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...rg.defaultOptions,...t},t.maxTextures||(ut("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=wb());const{maxTextures:e,attributesInitialSize:s,indicesInitialSize:i}=t;this.attributeBuffer=new td(s*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)id(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){const s=t._batch.textures.ids[e._source.uid];return!s&&s!==0?!1:(t._textureId=s,t.texture=e,!0)}updateElement(t){this.dirty=!0;const 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){const e=this._elements;if(!e[this.elementStart])return;let s=sd(),i=s.textures;i.clear();const r=e[this.elementStart];let o=ml(r.blendMode,r.texture._source),a=r.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",g=[];const p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const y=e[m];e[m]=null;const _=y.texture._source,b=ml(y.blendMode,_),w=o!==b||a!==y.topology;
26if(_._batchTick===lr&&!w){y._textureId=_._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,h,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,h,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=s,g.push(y);continue}_._batchTick=lr,(i.count>=p||w)&&(this._finishBatch(s,d,u-d,i,o,a,t,f,g),f="renderBatch",d=u,o=b,a=y.topology,s=sd(),i=s.textures,i.clear(),g=[],++lr),y._textureId=_._textureBindLocation=i.count,i.ids[_.uid]=i.count,i.textures[i.count++]=_,y._batch=s,g.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,h,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,h,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(s,d,u-d,i,o,a,t,f,g),d=u,++lr),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,s,i,r,o,a,h,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=i,t.blendMode=r,t.topology=o,t.start=e,t.size=s,t.elements=l,++lr,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){const e=Math.max(t,this.attributeBuffer.size*2),s=new td(e);ed(this.attributeBuffer.rawBinaryData,s.rawBinaryData),this.attributeBuffer=s}_resizeIndexBuffer(t){const e=this.indexBuffer;let s=Math.max(t,e.length*1.5);s+=s%2;const i=s>65535?new Uint32Array(s):new Uint16Array(s);if(i.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let r=0;r<e.length;r++)i[r]=e[r];else ed(e.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(t,e,s){t[e]=s+0,t[e+1]=s+1,t[e+2]=s+2,t[e+3]=s+0,t[e+4]=s+2,t[e+5]=s+3}packIndex(t,e,s,i){const r=t.indices,o=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<o;l++)e[s++]=i+r[l+a]-h}destroy(t={}){if(this.batches!==null){for(let e=0;e<this.batchIndex;e++)id(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}}};ng.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let og=ng;var Lt=(n=>(n[n.MAP_READ=1]="MAP_READ",n[n.MAP_WRITE=2]="MAP_WRITE",n[n.COPY_SRC=4]="COPY_SRC",n[n.COPY_DST=8]="COPY_DST",n[n.INDEX=16]="INDEX",n[n.VERTEX=32]="VERTEX",n[n.UNIFORM=64]="UNIFORM",n[n.STORAGE=128]="STORAGE",n[n.INDIRECT=256]="INDIRECT",n[n.QUERY_RESOLVE=512]="QUERY_RESOLVE",n[n.STATIC=1024]="STATIC",
26n))(Lt||{});let Ps=class extends re{constructor(t){let{data:e,size:s}=t;const{usage:i,label:r,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=Kt("buffer"),this._resourceType="buffer",this._resourceId=Kt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,s??(s=e?.byteLength);const a=!!e;this.descriptor={size:s,usage:i,mappedAtCreation:a,label:r},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&Lt.STATIC)}set static(t){t?this.descriptor.usage|=Lt.STATIC:this.descriptor.usage&=~Lt.STATIC}setDataWithSize(t,e,s){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){s&&this.emit("update",this);return}const i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength<i.byteLength?s&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Kt("resource"),this.emit("change",this));return}s&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}};function ag(n,t){if(!(n instanceof Ps)){let e=t?Lt.INDEX:Lt.VERTEX;n instanceof Array&&(t?(n=new Uint32Array(n),e=Lt.INDEX|Lt.COPY_DST):(n=new Float32Array(n),e=Lt.VERTEX|Lt.COPY_DST)),n=new Ps({data:n,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return n}function Tb(n,t,e){const s=n.getAttribute(t);if(!s)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const i=s.buffer.data;let r=1/0,o=1/0,a=-1/0,h=-1/0;const l=i.BYTES_PER_ELEMENT,c=(s.offset||0)/l,u=(s.stride||8)/l;for(let d=c;d<i.length;d+=u){const f=i[d],g=i[d+1];f>a&&(a=f),g>h&&(h=g),f<r&&(r=f),g<o&&(o=g)}return e.minX=r,e.minY=o,e.maxX=a,e.maxY=h,e}function Ab(n){return(n instanceof Ps||Array.isArray(n)||n.BYTES_PER_ELEMENT)&&(n={buffer:n}),n.buffer=ag(n.buffer,!1),n}class bc extends re{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Kt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ns,this._boundsDirty=!0;const{attributes:e,indexBuffer:s,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(const r in e)this.addAttribute(r,e[r]);this.instanceCount=t.instanceCount??1,s&&this.addIndex(s),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const s=Ab(e);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=s}addIndex(t){this.indexBuffer=ag(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Tb(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const 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.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Cb=new Float32Array(1),Pb=new Uint32Array(1);class Mb extends bc{constructor(){const e=new Ps({data:Cb,label:"attribute-batch-buffer",usage:Lt.VERTEX|Lt.COPY_DST,shrinkToFit:!1}),s=new Ps({data:Pb,label:"index-batch-buffer",usage:Lt.INDEX|Lt.COPY_DST,shrinkToFit:!1}),i=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:20}},indexBuffer:s})}}
vendor: 4,266 bytes, lines 26-140
26function nd(n,t,e){if(n)for(const s in n){const i=s.toLocaleLowerCase(),r=t[i];if(r){let o=n[s];s==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&r.push(`//----${e}----//`),r.push(o)}else Dt(`${s} placement hook does not exist in shader`)}}const kb=/\{\{(.*?)\}\}/g;function rd(n){const t={};return(n.match(kb)?.map(s=>s.replace(/[{()}]/g,""))??[]).forEach(s=>{t[s]=[]}),t}function od(n,t){let e;const s=/@in\s+([^;]+);/g;for(;(e=s.exec(n))!==null;)t.push(e[1])}function ad(n,t,e=!1){const s=[];od(t,s),n.forEach(a=>{a.header&&od(a.header,s)});const i=s;e&&i.sort();const r=i.map((a,h)=>`       @location(${h}) ${a},`).join(`
27`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
28${r}
29`),o}function hd(n,t){let e;const s=/@out\s+([^;]+);/g;for(;(e=s.exec(n))!==null;)t.push(e[1])}function Ib(n){const e=/\b(\w+)\s*:/g.exec(n);return e?e[1]:""}function Eb(n){const t=/@.*?\s+/g;return n.replace(t,"")}function Fb(n,t){const e=[];hd(t,e),n.forEach(h=>{h.header&&hd(h.header,e)});let s=0;const i=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${s++}) ${h}`).join(`,
30`),r=e.sort().map(h=>`       var ${Eb(h)};`).join(`
31`),o=`return VSOutput(
32            ${e.sort().map(h=>` ${Ib(h)}`).join(`,
33`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
34${i}
35`),a=a.replace("{{start}}",`
36${r}
37`),a=a.replace("{{return}}",`
38${o}
39`),a}function ld(n,t){let e=n;for(const s in t){const i=t[s];i.join(`
40`).length?e=e.replace(`{{${s}}}`,`//-----${s} START-----//
41${i.join(`
42`)}
43//----${s} FINISH----//`):e=e.replace(`{{${s}}}`,"")}return e}const ni=Object.create(null),Ph=new Map;let Bb=0;function Rb({template:n,bits:t}){const e=hg(n,t);if(ni[e])return ni[e];const{vertex:s,fragment:i}=Ob(n,t);return ni[e]=lg(s,i,t),ni[e]}function Lb({template:n,bits:t}){const e=hg(n,t);return ni[e]||(ni[e]=lg(n.vertex,n.fragment,t)),ni[e]}function Ob(n,t){const e=t.map(o=>o.vertex).filter(o=>!!o),s=t.map(o=>o.fragment).filter(o=>!!o);let i=ad(e,n.vertex,!0);i=Fb(e,i);const r=ad(s,n.fragment,!0);return{vertex:i,fragment:r}}function hg(n,t){return t.map(e=>(Ph.has(e)||Ph.set(e,Bb++),Ph.get(e))).sort((e,s)=>e-s).join("-")+n.vertex+n.fragment}function lg(n,t,e){const s=rd(n),i=rd(t);return e.forEach(r=>{nd(r.vertex,s,r.name),nd(r.fragment,i,r.name)}),{vertex:ld(n,s),fragment:ld(t,i)}}const Db=`
44    @in aPosition: vec2<f32>;
45    @in aUV: vec2<f32>;
46
47    @out @builtin(position) vPosition: vec4<f32>;
48    @out vUV : vec2<f32>;
49    @out vColor : vec4<f32>;
50
51    {{header}}
52
53    struct VSOutput {
54        {{struct}}
55    };
56
57    @vertex
58    fn main( {{in}} ) -> VSOutput {
59
60        var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
61        var modelMatrix = mat3x3<f32>(
62            1.0, 0.0, 0.0,
63            0.0, 1.0, 0.0,
64            0.0, 0.0, 1.0
65          );
66        var position = aPosition;
67        var uv = aUV;
68
69        {{start}}
70
71        vColor = vec4<f32>(1., 1., 1., 1.);
72
73        {{main}}
74
75        vUV = uv;
76
77        var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
78
79        vPosition =  vec4<f32>((modelViewProjectionMatrix *  vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
80
81        vColor *= globalUniforms.uWorldColorAlpha;
82
83        {{end}}
84
85        {{return}}
86    };
87`,Nb=`
88    @in vUV : vec2<f32>;
89    @in vColor : vec4<f32>;
90
91    {{header}}
92
93    @fragment
94    fn main(
95        {{in}}
96      ) -> @location(0) vec4<f32> {
97
98        {{start}}
99
100        var outColor:vec4<f32>;
101
102        {{main}}
103
104        var finalColor:vec4<f32> = outColor * vColor;
105
106        {{end}}
107
108        return finalColor;
109      };
110`,Wb=`
111    in vec2 aPosition;
112    in vec2 aUV;
113
114    out vec4 vColor;
115    out vec2 vUV;
116
117    {{header}}
118
119    void main(void){
120
121        mat3 worldTransformMatrix = uWorldTransformMatrix;
122        mat3 modelMatrix = mat3(
123            1.0, 0.0, 0.0,
124            0.0, 1.0, 0.0,
125            0.0, 0.0, 1.0
126          );
127        vec2 position = aPosition;
128        vec2 uv = aUV;
129
130        {{start}}
131
132        vColor = vec4(1.);
133
134        {{main}}
135
136        vUV = uv;
137
138        mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
139
140        gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0
140)).xy, 0.0, 1.0);
141
142        vColor *= uWorldColorAlpha;
143
144        {{end}}
145    }
146`,zb=`
147
148    in vec4 vColor;
149    in vec2 vUV;
150
151    out vec4 finalColor;
152
153    {{header}}
154
155    void main(void) {
156
157        {{start}}
158
159        vec4 outColor;
160
161        {{main}}
162
163        finalColor = outColor * vColor;
164
165        {{end}}
166    }
167`,Yb={name:"global-uniforms-bit",vertex:{header:`
168        struct GlobalUniforms {
169            uProjectionMatrix:mat3x3<f32>,
170            uWorldTransformMatrix:mat3x3<f32>,
171            uWorldColorAlpha: vec4<f32>,
172            uResolution: vec2<f32>,
173        }
174
175        @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
176        `}},Vb={name:"global-uniforms-bit",vertex:{header:`
177          uniform mat3 uProjectionMatrix;
178          uniform mat3 uWorldTransformMatrix;
179          uniform vec4 uWorldColorAlpha;
180          uniform vec2 uResolution;
181        `}};function wc({bits:n,name:t}){const e=Rb({template:{fragment:Nb,vertex:Db},bits:[Yb,...n]});return Ga.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Sc({bits:n,name:t}){return new Dp({name:t,...Lb({template:{vertex:Wb,fragment:zb},bits:[Vb,...n]})})}const cg={name:"color-bit",vertex:{header:`
182            @in aColor: vec4<f32>;
183        `,main:`
184            vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
185        `}},ug={name:"color-bit",vertex:{header:`
186            in vec4 aColor;
187        `,main:`
188            vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
189        `}},Mh={};function Ub(n){const t=[];if(n===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 s=0;s<n;s++)t.push(`@group(1) @binding(${e++}) var textureSource${s+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${s+1}: sampler;`)}return t.join(`
190`)}function Gb(n){const t=[];if(n===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<n;e++)e===n-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(`
191`)}function dg(n){return Mh[n]||(Mh[n]={name:"texture-batch-bit",vertex:{header:`
192                @in aTextureIdAndRound: vec2<u32>;
193                @out @interpolate(flat) vTextureId : u32;
194            `,main:`
195                vTextureId = aTextureIdAndRound.y;
196            `,end:`
197                if(aTextureIdAndRound.x == 1)
198                {
199                    vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
200                }
201            `},fragment:{header:`
202                @in @interpolate(flat) vTextureId: u32;
203
204                ${Ub(n)}
205            `,main:`
206                var uvDx = dpdx(vUV);
207                var uvDy = dpdy(vUV);
208
209                ${Gb(n)}
210            `}}),Mh[n]}const kh={};function Xb(n){const t=[];for(let e=0;e<n;e++)e>0&&t.push("else"),e<n-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(`	outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
211`)}function fg(n){return kh[n]||(kh[n]={name:"texture-batch-bit",vertex:{header:`
212                in vec2 aTextureIdAndRound;
213                out float vTextureId;
214
215            `,main:`
216                vTextureId = aTextureIdAndRound.y;
217            `,end:`
218                if(aTextureIdAndRound.x == 1.)
219                {
220                    gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
221                }
222            `},fragment:{header:`
223                in float vTextureId;
224
225                uniform sampler2D uTextures[${n}];
226
227            `,main:`
228
229                ${Xb(n)}
230            `}}),kh[n]}const vc={name:"round-pixels-bit",vertex:{header:`
231            fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
232            {
233                return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
234            }
235        `}},Tc={name:"round-pixels-bit",vertex:{header:`
236            vec2 roundPixels(vec2 position, vec2 targetSize)
237            {
238                return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
239            }
240        `}},cd={};function pg(n){let t=cd[n];if(t)return t;const e=new Int32Array(n);for(let s=0;s<n;s++)e[s]=s;return t=cd[n]=new la({uTextures:{value:e,type:"i32",size:n}},{isStatic:!0}),t}class ud extends io{constructor(t){const e=Sc({name:"batch",bits:[ug,fg(t),Tc]}),s=wc({name:"batch",bits:[cg,dg(t),vc]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:pg(t)}}),this.maxTextures=t}}let cr=null;const gg=class mg extends og{constructor(t){super(t),this.geometry=new Mb,this.name=mg.extension.name,this.vertexSize=6,cr??(cr=new ud(t.maxTextures)),this.shader=cr}packAttributes(t,e,s,i,r){const o=r<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:g,uvs:p}=t,m=t.color,y=t.attributeOffset,x=y+t.attributeSize;for(let _=y;_<x;_++){const b=_*2,w=g[b],S=g[b+1];e[i++]=h*w+c*S+d,e[i++]=u*S+l*w+f,e[i++]=p[b],e[i++]=p[b+1],s[i++]=m,s[i++]=o}}packQuadAttributes(t,e,s,i,r){const o=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,g=t.bounds,p=g.maxX,m=g.minX,y=g.maxY,x=g.minY,_=o.uvs,b=t.color,w=r<<16|t.roundPixels&65535;e[i+0]=h*m+c*x+d,e[i+1]=u*x+l*m+f,e[i+2]=_.x0,e[i+3]=_.y0,s[i+4]=b,s[i+5]=w,e[i+6]=h*p+c*x+d,e[i+7]=u*x+l*p+f,e[i+8]=_.x1,e[i+9]=_.y1,s[i+10]=b,s[i+11]=w,e[i+12]=h*p+c*y+d,e[i+13]=u*y+l*p+f,e[i+14]=_.x2,e[i+15]=_.y2,s[i+16]=b,s[i+17]=w,e[i+18]=h*m+c*y+d,e[i+19]=u*y+l*m+f,e[i+20]=_.x3,e[i+21]=_.y3,s[i+22]=b,s[i+23]=w}_updateMaxTextures(t){this.shader.maxTextures!==t&&(cr=new ud(t),this.shader=cr)}destroy(){this.shader=null,super.destroy()}};gg.extension={type:[X.Batcher],name:"default"};let $b=gg;class en{constructor(t){this.items=Object.create(null);const{renderer:e,type:s,onUnload:i,priority:r,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",s,r??0),this._onUnload=i,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;const s=t._gpuData[this._renderer.uid];s&&(this._onUnload?.(t,...e),s.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}}function Hb(n,t,e,s,i,r,o,a=null){let h=0;e*=t,i*=r;const l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,g=a.ty;for(;h<o;){const p=n[e],m=n[e+1];s[i]=l*p+u*m+f,s[i+1]=c*p+d*m+g,i+=r,e+=t,h++}}function jb(n,t,e,s){let i=0;for(t*=e;i<s;)n[t]=0,n[t+1]=0,t+=e,i++}function yg(n,t,e,s,i){const r=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),s||(s=2),i||(i=n.length/s-e);let u=e*s;for(let d=0;d<i;d++){const f=n[u],g=n[u+1];n[u]=r*f+a*g+l,n[u+1]=o*f+h*g+c,u+=s}}const qb=new ot;class Ac{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(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,s=this.renderable;return s?Ya(e,s.groupColor)+(this.alpha*s.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||qb}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}}const Ur={extension:{type:X.ShapeBuilder,name:"circle"},build(n,t){let e,s,i,r,o,a;if(n.type==="circle"){const b=n;if(o=a=b.radius,o<=0)return!1;e=b.x,s=b.y,i=r=0}else if(n.type==="ellipse"){const b=n;if(o=b.halfWidth,a=b.halfHeight,o<=0||a<=0)return!1;e=b.x,s=b.y,i=r=0}else{const b=n,w=b.width/2,S=b.height/2;e=b.x+w,s=b.y+S,o=a=Math.max(0,Math.min(b.radius,Math.min(w,S))),i=w-o,r=S-a}if(i<0||r<0)return!1;const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(i?4:0)+(r?4:0);if(l===0)return!1;if(h===0)return t[0]=t[6]=e+i,t[1]=t[3]=s+r,t[2]=t[4]=e-i,t[5]=t[7]=s-r,!0;let c=0,u=h*4+(i?2:0)+2,d=u,f=l,g=i+o,p=r,m=e+g,y=e-g,x=s+p;if(t[c++]=m,t[c++]=x,t[--u]=x,t[--u]=y,r){const b=s-p;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=m}for(let b=1;b<h;b++){const w=Math.PI/2*(b/h),S=i+Math.cos(w)*o,v=r+Math.sin(w)*a,T=e+S,A=e-S,P=s+v,M=s-v;t[c++]=T,t[c++]=P,t[--u]=P,t[--u]=A,t[d++]=A,t[d++]=M,t[--f]=M,t[--f]=T}g=i,p=r+a,m=e+g,y=e-g,x=s+p;const _=s-p;return t[c++]=m,t[c++]=x,t[--f]=_,t[--f]=m,i&&(t[c++]=y,t[c++]=x,t[--f]=_,t[--f]=y),!0},triangulate(n,t,e,s,i,r){if(n.length===0)return;let o=0,a=0;for(let c=0;c<n.length;c+=2)o+=n[c],a+=n[c+1];o/=n.length/2,a/=n.length/2;let h=s;t[h*e]=o,t[h*e+1]=a;const l=h++;for(let c=0;c<n.length;c+=2)t[h*e]=n[c],t[h*e+1]=n[c+1],c>0&&(i[r++]=h,i[r++]=l,i[r++]=h-1),h++;
vendor: 5,642 bytes, line 240
240i[r++]=l+1,i[r++]=l,i[r++]=h-1}},Kb={...Ur,extension:{...Ur.extension,name:"ellipse"}},Zb={...Ur,extension:{...Ur.extension,name:"roundedRectangle"}},xg=1e-4,dd=1e-4;function Qb(n){const t=n.length;if(t<6)return 1;let e=0;for(let s=0,i=n[t-2],r=n[t-1];s<t;s+=2){const o=n[s],a=n[s+1];e+=(o-i)*(a+r),i=o,r=a}return e<0?-1:1}function fd(n,t,e,s,i,r,o,a){const h=n-e*i,l=t-s*i,c=n+e*r,u=t+s*r;let d,f;o?(d=s,f=-e):(d=-s,f=e);const g=h+d,p=l+f,m=c+d,y=u+f;return a.push(g,p),a.push(m,y),2}function Pi(n,t,e,s,i,r,o,a){const h=e-n,l=s-t;let c=Math.atan2(h,l),u=Math.atan2(i-n,r-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,g=Math.abs(f),p=Math.sqrt(h*h+l*l),m=(15*g*Math.sqrt(p)/Math.PI>>0)+1,y=f/m;if(d+=y,a){o.push(n,t),o.push(e,s);for(let x=1,_=d;x<m;x++,_+=y)o.push(n,t),o.push(n+Math.sin(_)*p,t+Math.cos(_)*p);o.push(n,t),o.push(i,r)}else{o.push(e,s),o.push(n,t);for(let x=1,_=d;x<m;x++,_+=y)o.push(n+Math.sin(_)*p,t+Math.cos(_)*p),o.push(n,t);o.push(i,r),o.push(n,t)}return m*2}function Jb(n,t,e,s,i,r){const o=xg;if(n.length===0)return;const a=t;let h=a.alignment;if(t.alignment!==.5){let O=Qb(n);h=(h-.5)*O+.5}const l=new It(n[0],n[1]),c=new It(n[n.length-2],n[n.length-1]),u=s,d=Math.abs(l.x-c.x)<o&&Math.abs(l.y-c.y)<o;if(u){n=n.slice(),d&&(n.pop(),n.pop(),c.set(n[n.length-2],n[n.length-1]));const O=(l.x+c.x)*.5,R=(c.y+l.y)*.5;n.unshift(O,R),n.push(O,R)}const f=i,g=n.length/2;let p=n.length;const m=f.length/2,y=a.width/2,x=y*y,_=a.miterLimit*a.miterLimit;let b=n[0],w=n[1],S=n[2],v=n[3],T=0,A=0,P=-(w-v),M=b-S,I=0,C=0,k=Math.sqrt(P*P+M*M);P/=k,M/=k,P*=y,M*=y;const E=h,F=(1-E)*2,B=E*2;u||(a.cap==="round"?p+=Pi(b-P*(F-B)*.5,w-M*(F-B)*.5,b-P*F,w-M*F,b+P*B,w+M*B,f,!0)+2:a.cap==="square"&&(p+=fd(b,w,P,M,F,B,!0,f))),f.push(b-P*F,w-M*F),f.push(b+P*B,w+M*B);for(let O=1;O<g-1;++O){b=n[(O-1)*2],w=n[(O-1)*2+1],S=n[O*2],v=n[O*2+1],T=n[(O+1)*2],A=n[(O+1)*2+1],P=-(w-v),M=b-S,k=Math.sqrt(P*P+M*M),P/=k,M/=k,P*=y,M*=y,I=-(v-A),C=S-T,k=Math.sqrt(I*I+C*C),I/=k,C/=k,I*=y,C*=y;const R=S-b,D=w-v,z=S-T,Y=A-v,W=R*z+D*Y,V=D*z-Y*R,H=V<0;if(Math.abs(V)<.001*Math.abs(W)){f.push(S-P*F,v-M*F),f.push(S+P*B,v+M*B),W>=0&&(a.join==="round"?p+=Pi(S,v,S-P*F,v-M*F,S-I*F,v-C*F,f,!1)+4:p+=2,f.push(S-I*B,v-C*B),f.push(S+I*F,v+C*F));continue}const K=(-P+b)*(-M+v)-(-P+S)*(-M+w),tt=(-I+T)*(-C+v)-(-I+S)*(-C+A),xt=(R*tt-z*K)/V,et=(Y*K-D*tt)/V,St=(xt-S)*(xt-S)+(et-v)*(et-v),bt=S+(xt-S)*F,kt=v+(et-v)*F,Jt=S-(xt-S)*B,Ht=v-(et-v)*B,be=Math.min(R*R+D*D,z*z+Y*Y),he=H?F:B,rs=be+he*he*x;St<=rs?a.join==="bevel"||St/x>_?(H?(f.push(bt,kt),f.push(S+P*B,v+M*B),f.push(bt,kt),f.push(S+I*B,v+C*B)):(f.push(S-P*F,v-M*F),f.push(Jt,Ht),f.push(S-I*F,v-C*F),f.push(Jt,Ht)),p+=2):a.join==="round"?H?(f.push(bt,kt),f.push(S+P*B,v+M*B),p+=Pi(S,v,S+P*B,v+M*B,S+I*B,v+C*B,f,!0)+4,f.push(bt,kt),f.push(S+I*B,v+C*B)):(f.push(S-P*F,v-M*F),f.push(Jt,Ht),p+=Pi(S,v,S-P*F,v-M*F,S-I*F,v-C*F,f,!1)+4,f.push(S-I*F,v-C*F),f.push(Jt,Ht)):(f.push(bt,kt),f.push(Jt,Ht)):(f.push(S-P*F,v-M*F),f.push(S+P*B,v+M*B),a.join==="round"?H?p+=Pi(S,v,S+P*B,v+M*B,S+I*B,v+C*B,f,!0)+2:p+=Pi(S,v,S-P*F,v-M*F,S-I*F,v-C*F,f,!1)+2:a.join==="miter"&&St/x<=_&&(H?(f.push(Jt,Ht),f.push(Jt,Ht)):(f.push(bt,kt),f.push(bt,kt)),p+=2),f.push(S-I*F,v-C*F),f.push(S+I*B,v+C*B),p+=2)}b=n[(g-2)*2],w=n[(g-2)*2+1],S=n[(g-1)*2],v=n[(g-1)*2+1],P=-(w-v),M=b-S,k=Math.sqrt(P*P+M*M),P/=k,M/=k,P*=y,M*=y,f.push(S-P*F,v-M*F),f.push(S+P*B,v+M*B),u||(a.cap==="round"?p+=Pi(S-P*(F-B)*.5,v-M*(F-B)*.5,S-P*F,v-M*F,S+P*B,v+M*B,f,!1)+2:a.cap==="square"&&(p+=fd(S,v,P,M,F,B,!1,f)));const N=dd*dd;for(let O=m;O<p+m-2;++O)b=f[O*2],w=f[O*2+1],S=f[(O+1)*2],v=f[(O+1)*2+1],T=f[(O+2)*2],A=f[(O+2)*2+1],!(Math.abs(b*(v-A)+S*(A-w)+T*(w-v))<N)&&r.push(O,O+1,O+2)}function tw(n,t,e,s){const i=xg;if(n.length===0)return;const r=n[0],o=n[1],a=n[n.length-2],h=n[n.length-1],l=t||Math.abs(r-a)<i&&Math.abs(o-h)<i,c=e,u=n.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(n[f*2]),c.push(n[f*2+1]);for(let f=0;f<u-1;f++)s.push(d+f,d+f+1);l&&s.push(d+u-1,d)}function _g(n,t,e,s,i,r,o){const a=C_(n,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)r[o++]=a[l]+i,r[o++]=a[l+1]+i,r[o++]=a[l+2]+i;let h=i*s;for(let l=0;l<n.length;l+=2)e[h]=n[l],e[h+1]=n[l+1],h+=s}const ew=[],sw={extension:{type:X.ShapeBuilder,name:"polygon"},build(n,t){for(let e=0;e<n.points.length;e++)t[e]=n.points[e];return!0},triangulate(n,t,e,s,i,r){_g(n,ew,t,e,s,i,r)}},iw={extension:{type:X.ShapeBuilder,name:"rectangle"},build(n,t){const e=n,s=e.x,i=e.y,r=e.width,o=e.height;return r>0&&o>0?(t[0]=s,t[1]=i,t[2]=s+r,t[3]=i,t[4]=s+r,t[5]=i+o,t[6]=s,t[7]=i+o,!0):!1},triangulate(n,t,e,s,i,r){let o=0;s*=e,t[s+o]=n[0],t[s+o+1]=n[1],o+=e,t[s+o]=n[2],t[s+o+1]=n[3],o+=e,t[s+o]=n[6],t[s+o+1]=n[7],o+=e,t[s+o]=n[4],t[s+o+1]=n[5],o+=e;const a=s/e;i[r++]=a,i[r++]=a+1,i[r++]=a+2,i[r++]=a+1,i[r++]=a+3,i[r++]=a+2}},nw={extension:{type:X.ShapeBuilder,name:"triangle"},build(n,t){return t[0]=n.x,t[1]=n.y,t[2]=n.x2,t[3]=n.y2,t[4]=n.x3,t[5]=n.y3,!0},triangulate(n,t,e,s,i,r){let o=0;s*=e,t[s+o]=n[0],t[s+o+1]=n[1],o+=e,t[s+o]=n[2],t[s+o+1]=n[3],o+=e,t[s+o]=n[4],t[s+o+1]=n[5];const a=s/e;i[r++]=a,i[r++]=a+1,i[r++]=a+2}},pd=[{offset:0,color:"white"},{offset:1,color:"black"}],Cc=class yl{constructor(...t){this.uid=Kt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=rw(t);e={...e.type==="radial"?yl.defaultRadialOptions:yl.defaultLinearOptions,...ap(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
240=e.textureSpace,this.type=e.type,e.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:Nt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:s,y:i}=this.end,r=s-t,o=i-e;const a=r<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(r<0){const m=t;t=s,s=m,r*=-1}if(o<0){const m=e;e=i,i=m,o*=-1}}const h=this.colorStops.length?this.colorStops:pd,l=this._textureSize,{canvas:c,context:u}=md(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);gd(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new $({source:new Gn({resource:c,addressMode:this._wrapMode})});const f=Math.sqrt(r*r+o*o),g=Math.atan2(o,r),p=new ot;p.scale(f/l,1),p.rotate(g),p.translate(t,e),this.textureSpace==="local"&&p.scale(l,l),this.transform=p}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:pd,e=this._textureSize,{canvas:s,context:i}=md(e,e),{x:r,y:o}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),g=(r-u)*f,p=(o-d)*f,m=i.createRadialGradient(g,p,l*f,(a-u)*f,(h-d)*f,c*f);gd(m,t),i.fillStyle=t[t.length-1].color,i.fillRect(0,0,e,e),i.fillStyle=m,i.translate(g,p),i.rotate(this.rotation),i.scale(1,this.scale),i.translate(-g,-p),i.fillRect(0,0,e,e),this.texture=new $({source:new Gn({resource:s,addressMode:this._wrapMode})});const y=new ot;this.textureSpace==="local"?y.scale(2*c,2*c):y.scale(1/f,1/f),y.translate(u,d),this.transform=y}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}`}};Cc.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Cc.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"};let Hs=Cc;function gd(n,t){for(let e=0;e<t.length;e++){const s=t[e];n.addColorStop(s.offset,s.color)}}function md(n,t){const e=ft.get().createCanvas(n,t),s=e.getContext("2d");return{canvas:e,context:s}}function rw(n){let t=n[0]??{};return(typeof t=="number"||n[1])&&(ut("8.5.2","use options object instead"),t={type:"linear",start:{x:n[0],y:n[1]},end:{x:n[2],y:n[3]},textureSpace:n[4],textureSize:n[5]??Hs.defaultLinearOptions.textureSize}),t}const ow=new ot,aw=new qt;function hw(n,t,e,s){const i=t.matrix?n.copyFrom(t.matrix).invert():n.identity();if(t.textureSpace==="local"){const o=e.getBounds(aw);t.width&&o.pad(t.width);const{x:a,y:h}=o,l=1/o.width,c=1/o.height,u=-a*l,d=-h*c,f=i.a,g=i.b,p=i.c,m=i.d;i.a*=l,i.b*=l,i.c*=c,i.d*=c,i.tx=u*f+d*p+i.tx,i.ty=u*g+d*m+i.ty}else i.translate(t.texture.frame.x,t.texture.frame.y),i.scale(1/t.texture.source.width,1/t.texture.source.height);const r=t.texture.source.style;return!(t.fill instanceof Hs)&&r.addressMode==="clamp-to-edge"&&(r.addressMode="repeat",r.update()),s&&i.append(ow.copyFrom(s).invert()),i}const $a={};yt.handleByMap(X.ShapeBuilder,$a);yt.add(iw,sw,nw,Ur,Kb,Zb);const lw=new qt,cw=new ot;function uw(n,t){const{geometryData:e,batches:s}=t;s.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let i=0;i<n.instructions.length;i++){const r=n.instructions[i];if(r.action==="texture")dw(r.data,s,e);else if(r.action==="fill"||r.action==="stroke"){const o=r.action==="stroke",a=r.data.path.shapePath,h=r.data.style,l=r.data.hole;o&&l&&yd(l.shapePath,h,!0,s,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),yd(a,h,o,s,e)}}}function dw(n,t,e){const s=[],i=$a.rectangle,r=lw;r.x=n.dx,r.y=n.dy,r.width=n.dw,r.height=n.dh;const o=n.transform;if(!i.build(r,s))return;const{vertices:a,uvs:h,indices:l}=e,c=l.length,u=a.length/2;o&&yg(s,o),i.triangulate(s,a,2,u,l,c);const d=n.image,f=d.uvs;h.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);const g=Re.get(Ac);g.indexOffset=c,g.indexSize=l.length-c,g.attributeOffset=u,g.attributeSize=a.length/2-u,g.baseColor=n.style,g.alpha=n.alpha,g.texture=d,g.geometryData=e,t.push(g)}function yd(n,t,e,s,i){const{vertices:r,uvs:o,indices:a}=i;
240n.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{const u=[],d=$a[h.type];if(!d.build(h,u))return;const f=a.length,g=r.length/2;let p="triangle-list";if(l&&yg(u,l),e){const _=h.closePath??!0,b=t;b.pixelLine?(tw(u,_,r,a),p="line-list"):Jb(u,b,!1,_,r,a)}else if(c){const _=[],b=u.slice();fw(c).forEach(S=>{_.push(b.length/2),b.push(...S)}),_g(b,_,r,2,g,a,f)}else d.triangulate(u,r,2,g,a,f);const m=o.length/2,y=t.texture;if(y!==$.WHITE){const _=hw(cw,t,h,l);Hb(r,2,g,o,m,2,r.length/2-g,_)}else jb(o,m,2,r.length/2-g);const x=Re.get(Ac);x.indexOffset=f,x.indexSize=a.length-f,x.attributeOffset=g,x.attributeSize=r.length/2-g,x.baseColor=t.color,x.alpha=t.alpha,x.texture=y,x.geometryData=i,x.topology=p,s.push(x)})}function fw(n){const t=[];for(let e=0;e<n.length;e++){const s=n[e].shape,i=[];$a[s.type].build(s,i)&&t.push(i)}return t}class pw{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{Re.return(t)}),this.graphicsData&&Re.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}}class gw{constructor(){this.instructions=new pc}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new $b({maxTextures:e}),this.instructions.reset()}get geometry(){return ut(Ky,"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}}const Pc=class xl{constructor(t){this._renderer=t,this._managedContexts=new en({renderer:t,type:"resource",name:"graphicsContext"})}init(t){xl.defaultOptions.bezierSmoothness=t?.bezierSmoothness??xl.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],s=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&s.reset(),uw(t,s);const i=t.batchMode;t.customShader||i==="no-batch"?s.isBatchable=!1:i==="auto"?s.isBatchable=s.geometryData.vertices.length<400:s.isBatchable=!0,t.dirty=!1}return s}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=Re.get(gw,{maxTextures:this._renderer.limits.maxBatchableTextures}),s=t._gpuData[this._renderer.uid],{batches:i,geometryData:r}=s;s.graphicsData=e;const o=r.vertices.length,a=r.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;const h=e.batcher;h.ensureAttributeBuffer(o),h.ensureIndexBuffer(a),h.begin();for(let u=0;u<i.length;u++){const d=i[u];h.add(d)}h.finish(e.instructions);const l=h.geometry;l.indexBuffer.setDataWithSize(h.indexBuffer,h.indexSize,!0),l.buffers[0].setDataWithSize(h.attributeBuffer.float32View,h.attributeSize,!0);const c=h.batches;for(let u=0;u<c.length;u++){const d=c[u];d.bindGroup=pb(d.textures.textures,d.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new pw;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Pc.extension={type:[X.WebGLSystem,X.WebGPUSystem],name:"graphicsContext"};Pc.defaultOptions={bezierSmoothness:.5};let Mc=Pc;const mw=8,To=11920929e-14,yw=1;function bg(n,t,e,s,i,r,o,a,h,l){const u=Math.min(.99,Math.max(0,l??Mc.defaultOptions.bezierSmoothness));let d=(yw-u)/1;return d*=d,xw(t,e,s,i,r,o,a,h,n,d),n}function xw(n,t,e,s,i,r,o,a,h,l){_l(n,t,e,s,i,r,o,a,h,l,0),h.push(o,a)}function _l(n,t,e,s,i,r,o,a,h,l,c){if(c>mw)return;const u=(n+e)/2,d=(t+s)/2,f=(e+i)/2,g=(s+r)/2,p=(i+o)/2,m=(r+a)/2,y=(u+f)/2,x=(d+g)/2,_=(f+p)/2,b=(g+m)/2,w=(y+_)/2,S=(x+b)/2;if(c>0){let v=o-n,T=a-t;const A=Math.abs((e-o)*T-(s-a)*v),P=Math.abs((i-o)*T-(r-a)*v);if(A>To&&P>To){if((A+P)*(A+P)<=l*(v*v+T*T)){h.push(w,S);return}}else if(A>To){if(A*A<=l*(v*v+T*T)){h.push(w,S);return}}else if(P>To){if(P*P<=l*(v*v+T*T)){h.push(w,S);return}}else if(v=w-(n+o)/2,T=S-(t+a)/2,v*v+T*T<=l){h.push(w,S);return}}_l(n,t,u,d,y,x,w,S,h,l,c+1),_l(w,S,_,b,p,m,o,a,h,l,c+1)}const _w=8,bw=11920929e-14,ww=1;function Sw(n,t,e,s,i,r,o,a){const l=Math.min(.99,Math.max(0,a??Mc.defaultOptions.bezierSmoothness));let c=(ww-l)/1;return c*=c,vw(t,e,s,i,r,o,n,c),n}function vw(n,t,e,s,i,r,o,a){bl(o,n,t,e,s,i,r,a,0),o.push(i,r)}function bl(n,t,e,s,i,r,o,a,h){if(h>_w)return;const l=(t+s)/2,c=(e+i)/2,u=(s+r)/2,d=(i+o)/2,f=(l+u)/2,g=(c+d)/2;let p=r-t,m=o-e;const y=Math.abs((s-r)*m-(i-o)*p);if(y>
vendor: 10,192 bytes, line 240
240bw){if(y*y<=a*(p*p+m*m)){n.push(f,g);return}}else if(p=f-(t+r)/2,m=g-(e+o)/2,p*p+m*m<=a){n.push(f,g);return}bl(n,t,e,l,c,f,g,a,h+1),bl(n,f,g,u,d,r,o,a,h+1)}function wg(n,t,e,s,i,r,o,a){let h=Math.abs(i-r);(!o&&i>r||o&&r>i)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(s,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=i;l*=o?-1:1;for(let u=0;u<a+1;u++){const d=Math.cos(c),f=Math.sin(c),g=t+d*s,p=e+f*s;n.push(g,p),c+=l}}function Tw(n,t,e,s,i,r){const o=n[n.length-2],h=n[n.length-1]-e,l=o-t,c=i-e,u=s-t,d=Math.abs(h*u-l*c);if(d<1e-8||r===0){(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e);return}const f=h*h+l*l,g=c*c+u*u,p=h*c+l*u,m=r*Math.sqrt(f)/d,y=r*Math.sqrt(g)/d,x=m*p/f,_=y*p/g,b=m*u+y*l,w=m*c+y*h,S=l*(y+x),v=h*(y+x),T=u*(m+_),A=c*(m+_),P=Math.atan2(v-w,S-b),M=Math.atan2(A-w,T-b);wg(n,b+t,w+e,r,P,M,l*c>u*h)}const Mr=Math.PI*2,Ih={centerX:0,centerY:0,ang1:0,ang2:0},Eh=({x:n,y:t},e,s,i,r,o,a,h)=>{n*=e,t*=s;const l=i*n-r*t,c=r*n+i*t;return h.x=l+o,h.y=c+a,h};function Aw(n,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),s=t===1.5707963267948966?.551915024494:e,i=Math.cos(n),r=Math.sin(n),o=Math.cos(n+t),a=Math.sin(n+t);return[{x:i-r*s,y:r+i*s},{x:o+a*s,y:a-o*s},{x:o,y:a}]}const xd=(n,t,e,s)=>{const i=n*s-t*e<0?-1:1;let r=n*e+t*s;return r>1&&(r=1),r<-1&&(r=-1),i*Math.acos(r)},Cw=(n,t,e,s,i,r,o,a,h,l,c,u,d)=>{const f=Math.pow(i,2),g=Math.pow(r,2),p=Math.pow(c,2),m=Math.pow(u,2);let y=f*g-f*m-g*p;y<0&&(y=0),y/=f*m+g*p,y=Math.sqrt(y)*(o===a?-1:1);const x=y*i/r*u,_=y*-r/i*c,b=l*x-h*_+(n+e)/2,w=h*x+l*_+(t+s)/2,S=(c-x)/i,v=(u-_)/r,T=(-c-x)/i,A=(-u-_)/r,P=xd(1,0,S,v);let M=xd(S,v,T,A);a===0&&M>0&&(M-=Mr),a===1&&M<0&&(M+=Mr),d.centerX=b,d.centerY=w,d.ang1=P,d.ang2=M};function Pw(n,t,e,s,i,r,o,a=0,h=0,l=0){if(r===0||o===0)return;const c=Math.sin(a*Mr/360),u=Math.cos(a*Mr/360),d=u*(t-s)/2+c*(e-i)/2,f=-c*(t-s)/2+u*(e-i)/2;if(d===0&&f===0)return;r=Math.abs(r),o=Math.abs(o);const g=Math.pow(d,2)/Math.pow(r,2)+Math.pow(f,2)/Math.pow(o,2);g>1&&(r*=Math.sqrt(g),o*=Math.sqrt(g)),Cw(t,e,s,i,r,o,h,l,c,u,d,f,Ih);let{ang1:p,ang2:m}=Ih;const{centerX:y,centerY:x}=Ih;let _=Math.abs(m)/(Mr/4);Math.abs(1-_)<1e-7&&(_=1);const b=Math.max(Math.ceil(_),1);m/=b;let w=n[n.length-2],S=n[n.length-1];const v={x:0,y:0};for(let T=0;T<b;T++){const A=Aw(p,m),{x:P,y:M}=Eh(A[0],r,o,u,c,y,x,v),{x:I,y:C}=Eh(A[1],r,o,u,c,y,x,v),{x:k,y:E}=Eh(A[2],r,o,u,c,y,x,v);bg(n,w,S,P,M,I,C,k,E),w=k,S=E,p+=m}}function Mw(n,t,e){const s=(o,a)=>{const h=a.x-o.x,l=a.y-o.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},i=(o,a)=>{o===0?n.moveTo(a.x,a.y):n.lineTo(a.x,a.y)};let r=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],h=a.radius??e;if(h<=0){i(o,a),r=a;continue}const l=t[(o+1)%t.length],c=s(a,r),u=s(a,l);if(c.len<1e-4||u.len<1e-4){i(o,a),r=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,g=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,g=!0):d>0&&(f=-1,g=!0);const p=d/2;let m,y=Math.abs(Math.cos(p)*h/Math.sin(p));y>Math.min(c.len/2,u.len/2)?(y=Math.min(c.len/2,u.len/2),m=Math.abs(y*Math.sin(p)/Math.cos(p))):m=h;const x=a.x+u.nx*y+-u.ny*m*f,_=a.y+u.ny*y+u.nx*m*f,b=Math.atan2(c.ny,c.nx)+Math.PI/2*f,w=Math.atan2(u.ny,u.nx)-Math.PI/2*f;o===0&&n.moveTo(x+Math.cos(b)*m,_+Math.sin(b)*m),n.arc(x,_,m,b,w,g),r=a}}function kw(n,t,e,s){const i=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),r=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),o=t.length;for(let a=0;a<o;a++){const h=t[(a+1)%o],l=h.radius??e;if(l<=0){a===0?n.moveTo(h.x,h.y):n.lineTo(h.x,h.y);continue}const c=t[a],u=t[(a+2)%o],d=i(c,h);let f;if(d<1e-4)f=h;else{const m=Math.min(d/2,l);f=r(h,c,m/d)}const g=i(u,h);let p;if(g<1e-4)p=h;else{const m=Math.min(g/2,l);p=r(h,u,m/g)}a===0?n.moveTo(f.x,f.y):n.lineTo(f.x,f.y),n.quadraticCurveTo(h.x,h.y,p.x,p.y,s)}}const Iw=new qt;class Ew{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ns,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const s=this._currentPoly.points,i=s[s.length-2],r=s[s.length-1];return(i!==t||r!==e)&&s.push(t,e),this}arc(t,e,s,i,r,o){this._ensurePoly(!1);const a=this._currentPoly.points;return wg(a,t,e,s,i,r,o),this}arcTo(t,e,s,i,r){this._ensurePoly();const o=this._currentPoly.points;return Tw(o,t,e,s,i,r),this}arcToSvg(t,e,s,i,r,o,a){const h=this._currentPoly.points;return Pw(h,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,s,i,r),this}bezierCurveTo(t,e,s,i,r,o,a){this._ensurePoly();const h=this._currentPoly;return bg(this._currentPoly.points,h.lastX,h.lastY,t,e,s,i,r,o,a),this}quadraticCurveTo(t,e,s,i,r){this._ensurePoly();const o=this._currentPoly;return Sw(this._currentPoly.points,o.lastX,o.lastY,t,e,s,i,r),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const s=this.shapePrimitives,i=s.length;for(let r=0;r<t.instructions.length;r++){const o=t.instructions[r];this[o.action](...o.data)}if(t.checkForHoles&&s.length-i>1){let r=null;for(let o=i;o<s.length;o++){const a=s[o];if(a.shape.type==="polygon"){const h=a.shape,l=r?.shape;l&&l.containsPolygon(h)?(r.holes||(r.holes=[]),r.holes.push(a),s.copyWithin(o,o+1),s.length--,o--):r=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,s,i,r){return this.drawShape(new qt(t,e,s,i),r),this}circle(t,e,s,i){return this.drawShape(new no(t,e,s),i),this}poly(t,e,s){const i=new Cr(t);return i.closePath=e,this.drawShape(i,s),this}regularPoly(t,e,s,i,r=0,o){i=Math.max(i|0,3);const a=-1*Math.PI/2+r,h=Math.PI*2/i,l=[];for(let c=0;c<i;c++){const u=a-c*h;l.push(t+s*Math.cos(u),e+s*Math.sin(u))}return this.poly(l,!0,o),this}roundPoly(t,e,s,i,r,o=0,a){if(i=Math.max(i|0,3),r<=0)return this.regularPoly(t,e,s,i,o);const h=s*Math.sin(Math.PI/i)-.001;r=Math.min(r,h);const l=-1*Math.PI/2+o,c=Math.PI*2/i,u=(i-2)*Math.PI/i/2;for(let d=0;d<i;d++){const f=d*c+l,g=t+s*Math.cos(f),p=e+s*Math.sin(f),m=f+Math.PI+u,y=f-Math.PI-u,x=g+r*Math.cos(m),_=p+r*Math.sin(m),b=g+r*Math.cos(y),w=p+r*Math.sin(y);d===0?this.moveTo(x,_):this.lineTo(x,_),this.quadraticCurveTo(g,p,b,w,a)}return this.closePath()}roundShape(t,e,s=!1,i){return t.length<3?this:(s?kw(this,t,e,i):Mw(this,t,e),this.closePath())}filletRect(t,e,s,i,r){if(r===0)return this.rect(t,e,s,i);const o=Math.min(s,i)/2,a=Math.min(o,Math.max(-o,r)),h=t+s,l=e+i,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+s-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,s,i,r,o){if(r<=0)return this.rect(t,e,s,i);const a=Math.min(r,Math.min(s,i)/2),h=t+s,l=e+i,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,o)}ellipse(t,e,s,i,r){return this.drawShape(new xc(t,e,s,i),r),this}roundRect(t,e,s,i,r,o){return this.drawShape(new _c(t,e,s,i,r),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let s=this._currentPoly;return s&&this.endPoly(),s=new Cr,s.points.push(t,e),this._currentPoly=s,this}endPoly(t=!1){const 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 Cr,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let s=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const r=e.transform,o=s;s=r.a*s+r.c*i+r.tx,i=r.b*o+r.d*i+r.ty}this._currentPoly.points.push(s,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const s=t.instructions[e];this[s.action](...s.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let s=0;s<e.length;s++){const i=e[s],r=i.shape.getBounds(Iw);i.transform?t.addRect(r,i.transform):t.addRect(r)}return t}}class Us{constructor(t,e=!1){this.instructions=[],this.uid=Kt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?cb(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ew(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,s,i,r){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(It.shared);let h=0,l=0;if(!o||o.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=o.data[2],l=o.data[3];const c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,s,i,r]}),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,s){const i=this.instructions[this.instructions.length-1],r=this.getLastPoint(It.shared);let o=0,a=0;if(!i||i.action!=="quadraticCurveTo")o=r.x,a=r.y;else{o=i.data[0],a=i.data[1];const h=r.x,l=r.y;o=h+(h-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,s]}),this._dirty=!0,this}rect(t,e,s,i,r){return this.instructions.push({action:"rect",data:[t,e,s,i,r]}),this._dirty=!0,this}circle(t,e,s,i){return this.instructions.push({action:"circle",data:[t,e,s,i]}),this._dirty=!0,this}
240roundRect(...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,s,i,r,o,a){r||(r=i/2);const h=-1*Math.PI/2+o,l=s*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){const f=d%2?r:i,g=d*c+h;u.push(t+f*Math.cos(g),e+f*Math.sin(g))}return this.poly(u,!0,a),this}clone(t=!1){const e=new Us;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let s=0;s<this.instructions.length;s++){const i=this.instructions[s];e.instructions.push({action:i.action,data:i.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,s=t.b,i=t.c,r=t.d,o=t.tx,a=t.ty;let h=0,l=0,c=0,u=0,d=0,f=0,g=0,p=0;for(let m=0;m<this.instructions.length;m++){const y=this.instructions[m],x=y.data;switch(y.action){case"moveTo":case"lineTo":h=x[0],l=x[1],x[0]=e*h+i*l+o,x[1]=s*h+r*l+a;break;case"bezierCurveTo":c=x[0],u=x[1],d=x[2],f=x[3],h=x[4],l=x[5],x[0]=e*c+i*u+o,x[1]=s*c+r*u+a,x[2]=e*d+i*f+o,x[3]=s*d+r*f+a,x[4]=e*h+i*l+o,x[5]=s*h+r*l+a;break;case"quadraticCurveTo":c=x[0],u=x[1],h=x[2],l=x[3],x[0]=e*c+i*u+o,x[1]=s*c+r*u+a,x[2]=e*h+i*l+o,x[3]=s*h+r*l+a;break;case"arcToSvg":h=x[5],l=x[6],g=x[0],p=x[1],x[0]=e*g+i*p,x[1]=s*g+r*p,x[5]=e*h+i*l+o,x[6]=s*h+r*l+a;break;case"circle":x[4]=an(x[3],t);break;case"rect":x[4]=an(x[4],t);break;case"ellipse":x[8]=an(x[8],t);break;case"roundRect":x[5]=an(x[5],t);break;case"addPath":x[0].transform(t);break;case"poly":x[2]=an(x[2],t);break;case"regularPoly":case"chamferRect":x[5]=an(x[5],t);break;case"closePath":break;default:Dt("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,s=this.instructions[e];if(!s)return t.x=0,t.y=0,t;for(;s.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;s=this.instructions[e]}switch(s.action){case"moveTo":case"lineTo":t.x=s.data[0],t.y=s.data[1];break;case"quadraticCurveTo":t.x=s.data[2],t.y=s.data[3];break;case"bezierCurveTo":t.x=s.data[4],t.y=s.data[5];break;case"arc":case"arcToSvg":t.x=s.data[5],t.y=s.data[6];break;case"addPath":s.data[0].getLastPoint(t);break}return t}}function an(n,t){return n?n.prepend(t):t.clone()}function jt(n,t,e){const s=n.getAttribute(t);return s?Number(s):e}function Fw(n,t){const e=n.querySelectorAll("defs");for(let s=0;s<e.length;s++){const i=e[s];for(let r=0;r<i.children.length;r++){const o=i.children[r];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=Bw(o);break;case"radialgradient":t.defs[o.id]=Rw();break}}}}function Bw(n){const t=jt(n,"x1",0),e=jt(n,"y1",0),s=jt(n,"x2",1),i=jt(n,"y2",0),r=n.getAttribute("gradientUnits")||"objectBoundingBox",o=new Hs(t,e,s,i,r==="objectBoundingBox"?"local":"global");for(let a=0;a<n.children.length;a++){const h=n.children[a],l=jt(h,"offset",0),c=Nt.shared.setValue(h.getAttribute("stop-color")).toNumber();o.addColorStop(l,c)}return o}function Rw(n){return Dt("[SVG Parser] Radial gradients are not yet supported"),new Hs(0,0,1,0)}function _d(n){const t=n.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const bd={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 Sg(n,t){const e=n.getAttribute("style"),s={},i={}
240,r={strokeStyle:s,fillStyle:i,useFill:!1,useStroke:!1};for(const o in bd){const a=n.getAttribute(o);a&&wd(t,r,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const h=o[a].trim(),[l,c]=h.split(":");bd[l]&&wd(t,r,l,c.trim())}}return{strokeStyle:r.useStroke?s:null,fillStyle:r.useFill?i:null,useFill:r.useFill,useStroke:r.useStroke}}function wd(n,t,e,s){switch(e){case"stroke":if(s!=="none"){if(s.startsWith("url(")){const i=_d(s);t.strokeStyle.fill=n.defs[i]}else t.strokeStyle.color=Nt.shared.setValue(s).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(s);break;case"fill":if(s!=="none"){if(s.startsWith("url(")){const i=_d(s);t.fillStyle.fill=n.defs[i]}else t.fillStyle.color=Nt.shared.setValue(s).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(s);break;case"stroke-opacity":t.strokeStyle.alpha=Number(s);break;case"opacity":t.fillStyle.alpha=Number(s),t.strokeStyle.alpha=Number(s);break}}function Lw(n){if(n.length<=2)return!0;const t=n.map(a=>a.area).sort((a,h)=>h-a),[e,s]=t,i=t[t.length-1],r=e/s,o=s/i;return!(r>3&&o<2)}function Ow(n){return n.split(/(?=[Mm])/).filter(s=>s.trim().length>0)}function Dw(n){const t=n.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),s=[],i=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(s.push(e[c]),i.push(e[c+1]));if(s.length===0||i.length===0)return 0;const r=Math.min(...s),o=Math.max(...s),a=Math.min(...i),h=Math.max(...i);return(o-r)*(h-a)}function Sd(n,t){const e=new Us(n,!1);for(const s of e.instructions)t.instructions.push(s)}function Nw(n,t){if(typeof n=="string"){const o=document.createElement("div");o.innerHTML=n.trim(),n=o.querySelector("svg")}const e={context:t,defs:{},path:new Us};Fw(n,e);const s=n.children,{fillStyle:i,strokeStyle:r}=Sg(n,e);for(let o=0;o<s.length;o++){const a=s[o];a.nodeName.toLowerCase()!=="defs"&&vg(a,e,i,r)}return t}function vg(n,t,e,s){const i=n.children,{fillStyle:r,strokeStyle:o}=Sg(n,t);r&&e?e={...e,...r}:r&&(e=r),o&&s?s={...s,...o}:o&&(s=o);const a=!e&&!s;a&&(e={color:0});let h,l,c,u,d,f,g,p,m,y,x,_,b,w,S,v,T;switch(n.nodeName.toLowerCase()){case"path":{w=n.getAttribute("d");const A=n.getAttribute("fill-rule"),P=Ow(w),M=A==="evenodd",I=P.length>1;if(M&&I){const k=P.map(F=>({path:F,area:Dw(F)}));if(k.sort((F,B)=>B.area-F.area),P.length>3||!Lw(k))for(let F=0;F<k.length;F++){const B=k[F],N=F===0;t.context.beginPath();const O=new Us(void 0,!0);Sd(B.path,O),t.context.path(O),N?(e&&t.context.fill(e),s&&t.context.stroke(s)):t.context.cut()}else for(let F=0;F<k.length;F++){const B=k[F],N=F%2===1;t.context.beginPath();const O=new Us(void 0,!0);Sd(B.path,O),t.context.path(O),N?t.context.cut():(e&&t.context.fill(e),s&&t.context.stroke(s))}}else{const k=A?A==="evenodd":!0;S=new Us(w,k),t.context.path(S),e&&t.context.fill(e),s&&t.context.stroke(s)}break}case"circle":g=jt(n,"cx",0),p=jt(n,"cy",0),m=jt(n,"r",0),t.context.ellipse(g,p,m,m),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"rect":h=jt(n,"x",0),l=jt(n,"y",0),v=jt(n,"width",0),T=jt(n,"height",0),y=jt(n,"rx",0),x=jt(n,"ry",0),y||x?t.context.roundRect(h,l,v,T,y||x):t.context.rect(h,l,v,T),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"ellipse":g=jt(n,"cx",0),p=jt(n,"cy",0),y=jt(n,"rx",0),x=jt(n,"ry",0),t.context.beginPath(),t.context.ellipse(g,p,y,x),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"line":c=jt(n,"x1",0),u=jt(n,"y1",0),d=jt(n,"x2",0),f=jt(n,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),s&&t.context.stroke(s);break;case"polygon":b=n.getAttribute("points"),_=b.match(/-?\d+/g).map(A=>parseInt(A,10)),t.context.poly(_,!0),e&&t.context.fill(e),s&&t.context.stroke(s);break;case"polyline":b=n.getAttribute("points"),_=b.match(/-?\d+/g).map(A=>parseInt(A,10)),t.context.poly(_,!1),s&&t.context.stroke(s);break;case"g":case"svg":break;default:{Dt(`[SVG parser] <${n.nodeName}> elements unsupported`);break}}a&&(e=null);for(let A=0;A<i.length;A++)vg(i[A],t,e,s)}function Ww(n){return n.texture!==void 0}const vd={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"}};class Ha{constructor(t,e){this.uid=Kt("fillPattern"),this._tick=0,this.transform=new ot;const s=Ww(t)?t:{texture:t,repetition:e};
240this.texture=s.texture,this.textureSpace=s.textureSpace??"global";const i=s.repetition;i&&(this.texture.source.style.addressModeU=vd[i].addressModeU,this.texture.source.style.addressModeV=vd[i].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 zw(n){return Nt.isColorLike(n)}function Td(n){return n instanceof Ha}function Ad(n){return n instanceof Hs}function Yw(n){return n instanceof $}function Vw(n,t,e){const s=Nt.shared.setValue(t??0);return n.color=s.toNumber(),n.alpha=s.alpha===1?e.alpha:s.alpha,n.texture=$.WHITE,{...e,...n}}function Uw(n,t,e){return n.texture=t,{...e,...n}}function Cd(n,t,e){return n.fill=t,n.color=16777215,n.texture=t.texture,n.matrix=t.transform,n.textureSpace=t.textureSpace,{...e,...n}}function Pd(n,t,e){return t.buildGradient(),n.fill=t,n.color=16777215,n.texture=t.texture,n.matrix=t.transform,n.textureSpace=t.textureSpace,{...e,...n}}function Gw(n,t){const e={...t,...n},s=Nt.shared.setValue(e.color);return e.alpha*=s.alpha,e.color=s.toNumber(),e}function Yi(n,t){if(n==null)return null;const e={},s=n;return zw(n)?Vw(e,n,t):Yw(n)?Uw(e,n,t):Td(n)?Cd(e,n,t):Ad(n)?Pd(e,n,t):s.fill&&Td(s.fill)?Cd(s,s.fill,t):s.fill&&Ad(s.fill)?Pd(s,s.fill,t):Gw(s,t)}function ua(n,t){const{width:e,alignment:s,miterLimit:i,cap:r,join:o,pixelLine:a,...h}=t,l=Yi(n,h);return l?{width:e,alignment:s,miterLimit:i,cap:r,join:o,pixelLine:a,...l}:null}function Xw(n,t){let e=1;const s=n.shapePath.shapePrimitives;for(let i=0;i<s.length;i++){const r=s[i].shape;if(r.type!=="polygon")continue;const o=r.points,a=o.length;if(a<6)continue;const h=r.closePath;for(let l=0;l<a;l+=2){if(!h&&(l===0||l===a-2))continue;const c=(l-2+a)%a,u=(l+2)%a,d=o[c],f=o[c+1],g=o[l],p=o[l+1],m=o[u],y=o[u+1],x=d-g,_=f-p,b=m-g,w=y-p,S=x*x+_*_,v=b*b+w*w;if(S<1e-12||v<1e-12)continue;let P=(x*b+_*w)/Math.sqrt(S*v);P<-1?P=-1:P>1&&(P=1);const M=Math.sqrt((1-P)*.5);if(M<1e-6)continue;const I=Math.min(1/M,t);I>e&&(e=I)}}return e}const $w=new It,Md=new ot,kc=class ys extends re{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Kt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new Us,this._transform=new ot,this._fillStyle={...ys.defaultFillStyle},this._strokeStyle={...ys.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ns,this._boundsDirty=!0}clone(){const t=new ys;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=Yi(t,ys.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ua(t,ys.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Yi(t,ys.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Yi(t,ys.defaultStrokeStyle),this}texture(t,e,s,i,r,o){return this.instructions.push({action:"texture",data:{image:t,dx:s||0,dy:i||0,dw:r||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?Nt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Us,this}fill(t,e){let s;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i?.action==="stroke"?s=i.data.path:s=this._activePath.clone(),s?(t!=null&&(e!==void 0&&typeof t=="number"&&(ut(Ct,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Yi(t,ys.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(It.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s?.action==="fill"?e=s.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ua(t,ys.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++){const e=this.instructions[this.instructions.length-1-t],s=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(s);else{e.data.hole=s;break}}return this._initNextPathLocation(),this}arc(t,e,s,i,r,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,s,i,r,o),this}arcTo(t,e,s,i,r){this._tick++;const 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*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,r),this}arcToSvg(t,e,s,i,r,o,a){this._tick++;const h=this._transform;return this._activePath.arcToSvg(t,e,s,i,r,h.a*o+h.c*a+h.tx,h.b*o+h.d*a+h.ty),this}bezierCurveTo(t,e,s,i,r,o,a){this._tick++;const h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*s+h.c*i+h.tx,h.b*s+h.d*i+h.ty,h.a*r+h.c*o+h.tx,h.b*r+h.d*o+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,s,i){return this._tick++,this._activePath.ellipse(t,e,s,i,this._transform.clone()),this}circle(t,e,s){return this._tick++,this._activePath.circle(t,e,s,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const s=this._transform;return this._activePath.lineTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty),this}moveTo(t,e){this._tick++;const s=this._transform,i=this._activePath.instructions,r=s.a*t+s.c*e+s.tx,o=s.b*t+s.d*e+s.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=r,i[0].data[1]=o,this):(this._activePath.moveTo(r,o),this)}quadraticCurveTo(t,e,s,i,r){this._tick++;const 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*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,r),this}rect(t,e,s,i){return this._tick++,this._activePath.rect(t,e,s,i,this._transform.clone()),this}
240roundRect(t,e,s,i,r){return this._tick++,this._activePath.roundRect(t,e,s,i,r,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,s,i,r=0,o){return this._tick++,this._activePath.regularPoly(t,e,s,i,r,o),this}roundPoly(t,e,s,i,r,o){return this._tick++,this._activePath.roundPoly(t,e,s,i,r,o),this}roundShape(t,e,s,i){return this._tick++,this._activePath.roundShape(t,e,s,i),this}filletRect(t,e,s,i,r){return this._tick++,this._activePath.filletRect(t,e,s,i,r),this}chamferRect(t,e,s,i,r,o){return this._tick++,this._activePath.chamferRect(t,e,s,i,r,o),this}star(t,e,s,i,r=0,o=0){return this._tick++,this._activePath.star(t,e,s,i,r,o,this._transform.clone()),this}svg(t){return this._tick++,Nw(t,this),this}restore(){const 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,s,i,r,o){return t instanceof ot?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,s,i,r,o),this)}transform(t,e,s,i,r,o){return t instanceof ot?(this._transform.append(t),this):(Md.set(t,e,s,i,r,o),this._transform.append(Md),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;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const s=this.instructions[e],i=s.action;if(i==="fill"){const r=s.data;t.addBounds(r.path.bounds)}else if(i==="texture"){const r=s.data;t.addFrame(r.dx,r.dy,r.dx+r.dw,r.dy+r.dh,r.transform)}if(i==="stroke"){const r=s.data,o=r.style.alignment;let a=r.style.width*(1-o);r.style.join==="miter"&&(a*=Xw(r.path,r.style.miterLimit));const h=r.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let s=!1;for(let i=0;i<e.length;i++){const r=e[i],o=r.data,a=o.path;if(!r.action||!a)continue;const h=o.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){const u=l[c].shape;if(!h||!u)continue;const d=l[c].transform,f=d?d.applyInverse(t,$w):t;if(r.action==="fill")s=u.contains(f.x,f.y);else{const p=h;s=u.strokeContains(f.x,f.y,p.width,p.alignment)}const g=o.hole;if(g){const p=g.shapePath?.shapePrimitives;if(p)for(let m=0;m<p.length;m++)p[m].shape.contains(f.x,f.y)&&(s=!1)}if(s)return!0}}return s}unload(){this.emit("unload",this);for(const 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){const s=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(s)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(s))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};kc.defaultFillStyle={color:16777215,alpha:1,texture:$.WHITE,matrix:null,fill:null,textureSpace:"local"};kc.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:$.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Ze=kc;function Ic(n,t=1){const e=tn.RETINA_PREFIX?.exec(n);return e?parseFloat(e[1]):t}function Ec(n,t,e){n.label=e,n._sourceOrigin=e;const s=new $({source:n,label:e}),i=()=>{delete t.promiseCache[e],Bt.has(e)&&Bt.remove(e)};return s.source.once("destroy",()=>{t.promiseCache[e]&&(Dt("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),i())}),s.once("destroy",()=>{n.destroyed||(Dt("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}const Hw=".svg",jw="image/svg+xml",qw={extension:{type:X.LoadParser,priority:ds.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(n){return sr(n,jw)||is(n,Hw)},async load(n,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Zw(n):Kw(n,t,e,this.config.crossOrigin)},unload(n){n.destroy(!0)}};async function Kw(n,t,e,s){const i=await ft.get().fetch(n),r=ft.get().createImage();r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await i.text())}`,r.crossOrigin=s,await r.decode();const o=t.data?.width??r.width,a=t.data?.height??r.height,h=t.data?.resolution||Ic(n),l=Math.ceil(o*h),c=Math.ceil(a*h),u=ft.get().createCanvas(l,c),d=u.getContext("2d");d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(r,0,0,o*h,a*h);const{parseAsGraphicsContext:f,...g}=t.data??{},p=new Gn({resource:u,alphaMode:"premultiply-alpha-on-upload",resolution:h,...g});return Ec(p,e,n)}async function Zw(n){const e=await(await ft.get().fetch(n)).text(),s=new Ze;return s.svg(e),s}const Qw=`(function () {
241    'use strict';
242
243    const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
244    async function checkImageBitmap() {
245      try {
246        if (typeof createImageBitmap !== "function") return false;
247        const response = await fetch(WHITE_PNG);
248        const imageBlob = await response.blob();
249        const imageBitmap = await createImageBitmap(imageBlob);
250        return imageBitmap.width === 1 && imageBitmap.height === 1;
251      } catch (_e) {
252        return false;
253      }
254    }
255    void checkImageBitmap().then((result) => {
256      self.postMessage(result);
257    });
258
259})();
260`;let Fn=null,wl=class{constructor(){Fn||(Fn=URL.createObjectURL(new Blob([Qw],{type:"application/javascript"}))),this.worker=new Worker(Fn)}};wl.revokeObjectURL=function(){Fn&&(URL.revokeObjectURL(Fn),Fn=null)};const Jw=`(function () {
261    'use strict';
262
263    async function loadImageBitmap(url, alphaMode) {
264      const response = await fetch(url);
265      if (!response.ok) {
266        throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
267      }
268      const imageBlob = await response.blob();
269      return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob);
270    }
271    self.onmessage = async (event) => {
272      try {
273        const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]);
274        self.postMessage({
275          data: imageBitmap,
276          uuid: event.data.uuid,
277          id: event.data.id
278        }, [imageBitmap]);
279      } catch (e) {
280        self.postMessage({
281          error: e,
282          uuid: event.data.uuid,
283          id: event.data.id
284        });
285      }
286    };
287
288})();
289`;let Bn=null;class Tg{constructor(){Bn||(Bn=URL.createObjectURL(new Blob([Jw],{type:"application/javascript"}))),this.worker=new Worker(Bn)}}Tg.revokeObjectURL=function(){Bn&&(URL.revokeObjectURL(Bn),Bn=null)};let kd=0,Fh;class t1{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new wl;e.addEventListener("message",s=>{e.terminate(),wl.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Fh===void 0&&(Fh=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Fh&&(this._createdWorkers++,t=new Tg().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){this._resolveHash[t.uuid]&&(t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),delete this._resolveHash[t.uuid])}async _run(t,e){await this._initWorkers();const s=new Promise((i,r)=>{this._queue.push({id:t,arguments:e,resolve:i,reject:r})});return this._next(),s}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),s=e.id;this._resolveHash[kd]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:kd++,id:s})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t?.(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}}const Id=new t1,e1=[".jpeg",".jpg",".png",".webp",".avif"],s1=["image/jpeg","image/png","image/webp","image/avif"];async function i1(n,t){const e=await ft.get().fetch(n);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${n}: ${e.status} ${e.statusText}`);const s=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(s,{premultiplyAlpha:"none"}):createImageBitmap(s)}const Ag={name:"loadTextures",id:"texture",extension:{type:X.LoadParser,priority:ds.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(n){return sr(n,s1)||is(n,e1)},async load(n,t,e){let s=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Id.isImageBitmapSupported()?s=await Id.loadImageBitmap(n,t):s=await i1(n,t):s=await new Promise((r,o)=>{s=ft.get().createImage(),s.crossOrigin=this.config.crossOrigin,s.src=n,s.complete?r(s):(s.onload=()=>{r(s)},s.onerror=o)});const i=new Gn({resource:s,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ic(n),...t.data});return Ec(i,e,n)},unload(n){n.destroy(!0)}},n1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let Bh,Rh;function r1(n,t,e){e===void 0&&!t.startsWith("data:")?n.crossOrigin=a1(t):e!==!1&&(n.crossOrigin=typeof e=="string"?e:"anonymous")}function o1(n){return new Promise((t,e)=>{n.addEventListener("canplaythrough",s),n.addEventListener("error",i),n.load();function s(){r(),t()}function i(o){r(),e(o)}function r(){n.removeEventListener("canplaythrough",s),n.removeEventListener("error",i)}})}function a1(n,t=globalThis.location){if(n.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(n,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function h1(){const n=[],t=[];for(const e of n1){const s=Ar.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;Xa(s)&&(n.push(e),t.includes(s)||t.push(s))}return{validVideoExtensions:n,validVideoMime:t}}const l1={name:"loadVideo",id:"video",extension:{type:X.LoadParser,name:"loadVideo"},test(n){if(!Bh||!Rh){const{validVideoExtensions:s,validVideoMime:i}=h1();Bh=s,Rh=i}const t=sr(n,Rh),e=is(n,Bh);return t||e},async load(n,t,e){const s={...Ar.defaultOptions,resolution:t.data?.resolution||Ic(n),alph
289aMode:t.data?.alphaMode||await kp(),...t.data},i=document.createElement("video"),r={preload:s.autoLoad!==!1?"auto":void 0,"webkit-playsinline":s.playsinline!==!1?"":void 0,playsinline:s.playsinline!==!1?"":void 0,muted:s.muted===!0?"":void 0,loop:s.loop===!0?"":void 0,autoplay:s.autoPlay!==!1?"":void 0};Object.keys(r).forEach(h=>{const l=r[h];l!==void 0&&i.setAttribute(h,l)}),s.muted===!0&&(i.muted=!0),r1(i,n,s.crossorigin);const o=document.createElement("source");let a;if(s.mime)a=s.mime;else if(n.startsWith("data:"))a=n.slice(5,n.indexOf(";"));else if(!n.startsWith("blob:")){const h=n.split("?")[0].slice(n.lastIndexOf(".")+1).toLowerCase();a=Ar.MIME_TYPES[h]||`video/${h}`}return o.src=n,a&&(o.type=a),new Promise((h,l)=>{s.preload&&!s.autoPlay&&i.load(),i.addEventListener("canplay",c),i.addEventListener("error",u),o.addEventListener("error",u),i.appendChild(o);async function c(){const f=new Ar({...s,resource:i});d(),t.data.preload&&await o1(i),h(Ec(f,e,n))}function u(f){d(),l(f)}function d(){i.removeEventListener("canplay",c),i.removeEventListener("error",u),o.removeEventListener("error",u)}})},unload(n){n.destroy(!0)}},Cg={extension:{type:X.ResolveParser,name:"resolveTexture"},test:Ag.test,parse:n=>({resolution:parseFloat(tn.RETINA_PREFIX.exec(n)?.[1]??"1"),format:n.split(".").pop(),src:n})},c1={extension:{type:X.ResolveParser,priority:-2,name:"resolveJson"},test:n=>tn.RETINA_PREFIX.test(n)&&n.endsWith(".json"),parse:Cg.parse};class u1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tn,this.loader=new X_,this.cache=Bt,this._backgroundLoader=new O_(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){Dt("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let r=t.manifest;typeof r=="string"&&(r=await this.load(r)),this.resolver.addManifest(r)}const e=t.texturePreference?.resolution??1,s=typeof e=="number"?[e]:e,i=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:s}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...t.loadOptions})}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const s=aa(t),i=ls(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),r=this.resolver.resolve(i),o=await this._mapLoadToResolve(r,e);return s?o[i[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),r={},o=Object.keys(i);let a=0;const h=[],l=()=>{e?.(h.reduce((u,d)=>u+d,0)/a)},c=o.map((u,d)=>{const f=i[u],g=Object.values(f),m=[...new Set(g.flat())].reduce((y,x)=>y+(x.progressSize||1),0);return h.push(0),a+=m,this._mapLoadToResolve(f,y=>{h[d]=y*m,l()}).then(y=>{r[u]=y})});return await Promise.all(c),s?r[t[0]]:r}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Bt.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Bt.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const i=await this.loader.load(s,e);this._backgroundLoader.active=!0;const r={};
289return s.forEach(o=>{const a=i[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{r[l]=a}),Bt.set(h,a)}),r}async unload(t){this._initialized||await this.init();const e=ls(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=ls(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Bt.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const ae=new u1;yt.handleByList(X.LoadParser,ae.loader.parsers).handleByList(X.ResolveParser,ae.resolver.parsers).handleByList(X.CacheParser,ae.cache.parsers).handleByList(X.DetectionParser,ae.detections);yt.add(D_,W_,N_,G_,Y_,V_,U_,j_,Z_,rb,qw,Ag,l1,L_,R_,Cg,c1);const Ed={loader:X.LoadParser,resolver:X.ResolveParser,cache:X.CacheParser,detection:X.DetectionParser};yt.handle(X.Asset,n=>{const t=n.ref;Object.entries(Ed).filter(([e])=>!!t[e]).forEach(([e,s])=>yt.add(Object.assign(t[e],{extension:t[e].extension??s})))},n=>{const t=n.ref;Object.keys(Ed).filter(e=>!!t[e]).forEach(e=>yt.remove(t[e]))});let hn;function Fd(n){const t=ft.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=n,e.fillRect(0,0,6,1),t}function d1(){if(hn!==void 0)return hn;try{const n=Fd("#ff00ff"),t=Fd("#ffff00"),s=ft.get().createCanvas(6,1).getContext("2d");s.globalCompositeOperation="multiply",s.drawImage(n,0,0),s.drawImage(t,2,0);const i=s.getImageData(2,0,1,1);if(!i)hn=!1;else{const r=i.data;hn=r[0]===255&&r[1]===0&&r[2]===0}}catch{hn=!1}return hn}
289const Tt={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:d1(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:n=>{const t=n.source,e=t?.resource;if(!e)return null;const s=t.alphaMode==="premultiplied-alpha",i=t.resourceWidth??t.pixelWidth,r=t.resourceHeight??t.pixelHeight,o=i!==t.pixelWidth||r!==t.pixelHeight;if(s){if((e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)&&!o)return e;const a=Tt._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){const a=Tt._canvasSourceCache.get(t);if(a?.resourceId===t._resourceId)return a.canvas;const h=ft.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d"),c=l.createImageData(t.pixelWidth,t.pixelHeight),u=c.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 l.putImageData(c,0,0),Tt._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}if(s){const a=ft.get().createCanvas(t.pixelWidth,t.pixelHeight),h=a.getContext("2d",{willReadFrequently:!0});a.width=t.pixelWidth,a.height=t.pixelHeight,h.drawImage(e,0,0);const l=h.getImageData(0,0,a.width,a.height),c=l.data;for(let u=0;u<c.length;u+=4){const d=c[u+3];if(d>0){const f=255/d;c[u]=Math.min(255,c[u]*f+.5),c[u+1]=Math.min(255,c[u+1]*f+.5),c[u+2]=Math.min(255,c[u+2]*f+.5)}}return h.putImageData(l,0,0),Tt._unpremultipliedCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(o){const a=Tt._canvasSourceCache.get(t);if(a?.resourceId===t._resourceId)return a.canvas;const h=ft.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d");return h.width=t.pixelWidth,h.height=t.pixelHeight,l.drawImage(e,0,0),Tt._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}return e},getTintedCanvas:(n,t)=>{const e=n.texture,s=Nt.shared.setValue(t).toHex(),i=e.tintCache||(e.tintCache={}),r=i[s],o=e.source._resourceId;if(r?.tintId===o)return r;const a=r&&"getContext"in r?r:ft.get().createCanvas();return Tt.tintMethod(e,t,a),a.tintId=o,i[s]=a,i[s]},getTintedPattern:(n,t)=>{const e=Nt.shared.setValue(t).toHex(),s=n.patternCache||(n.patternCache={}),i=n.source._resourceId;let r=s[e];return r?.tintId===i||(Tt.canvas||(Tt.canvas=ft.get().createCanvas()),Tt.tintMethod(n,t,Tt.canvas),r=Tt.canvas.getContext("2d").createPattern(Tt.canvas,"repeat"),r.tintId=i,s[e]=r),r},applyPatternTransform:(n,t,e=!0)=>{if(!t)return;const s=n;
289if(!s.setTransform)return;const i=globalThis.DOMMatrix;if(!i)return;const r=new i([t.a,t.b,t.c,t.d,t.tx,t.ty]);s.setTransform(e?r.inverse():r)},tintWithMultiply:(n,t,e)=>{const s=e.getContext("2d"),i=n.frame.clone(),r=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=r,i.y*=r,i.width*=r,i.height*=r;const a=gt.isVertical(o),h=a?i.height:i.width,l=a?i.width:i.height;e.width=Math.ceil(h),e.height=Math.ceil(l),s.save(),s.fillStyle=Nt.shared.setValue(t).toHex(),s.fillRect(0,0,h,l),s.globalCompositeOperation="multiply";const c=Tt.getCanvasSource(n);if(!c){s.restore();return}o&&Tt._applyInverseRotation(s,o,i.width,i.height),s.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.globalCompositeOperation="destination-atop",s.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore()},tintWithOverlay:(n,t,e)=>{const s=e.getContext("2d"),i=n.frame.clone(),r=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=r,i.y*=r,i.width*=r,i.height*=r;const a=gt.isVertical(o),h=a?i.height:i.width,l=a?i.width:i.height;e.width=Math.ceil(h),e.height=Math.ceil(l),s.save(),s.globalCompositeOperation="copy",s.fillStyle=Nt.shared.setValue(t).toHex(),s.fillRect(0,0,h,l),s.globalCompositeOperation="destination-atop";const c=Tt.getCanvasSource(n);if(!c){s.restore();return}o&&Tt._applyInverseRotation(s,o,i.width,i.height),s.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore()},tintWithPerPixel:(n,t,e)=>{const s=e.getContext("2d"),i=n.frame.clone(),r=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=r,i.y*=r,i.width*=r,i.height*=r;const a=gt.isVertical(o),h=a?i.height:i.width,l=a?i.width:i.height;e.width=Math.ceil(h),e.height=Math.ceil(l),s.save(),s.globalCompositeOperation="copy";const c=Tt.getCanvasSource(n);if(!c){s.restore();return}o&&Tt._applyInverseRotation(s,o,i.width,i.height),s.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore();const u=t>>16&255,d=t>>8&255,f=t&255,g=s.getImageData(0,0,h,l),p=g.data;for(let m=0;m<p.length;m+=4)p[m]=p[m]*u/255,p[m+1]=p[m+1]*d/255,p[m+2]=p[m+2]*f/255;s.putImageData(g,0,0)},_applyInverseRotation:(n,t,e,s)=>{const i=gt.inv(t),r=gt.uX(i),o=gt.uY(i),a=gt.vX(i),h=gt.vY(i),l=-Math.min(0,r*e,a*s,r*e+a*s),c=-Math.min(0,o*e,h*s,o*e+h*s);n.transform(r,o,a,h,l,c)}};Tt.tintMethod=Tt.canUseMultiply?Tt.tintWithMultiply:Tt.tintWithPerPixel;class f1{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const s=ft.get().createCanvas();s.width=t,s.height=e;const i=s.getContext("2d");return{canvas:s,context:i}}getOptimalCanvasAndContext(t,e,s=1){t=Math.ceil(t*s-1e-6),e=Math.ceil(e*s-1e-6),t=Yn(t),e=Yn(e);const i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let r=this._canvasPool[i].pop();return r||(r=this._createCanvasAndContext(t,e)),r}returnCanvasAndContext(t){const e=t.canvas,{width:s,height:i}=e,r=(s<<17)+(i<<1);t.context.resetTransform(),t.context.clearRect(0,0,s,i),this._canvasPool[r].push(t)}clear(){this._canvasPool={}}}const Sl=new f1;so.register(Sl);const p1=new ns;function g1(n,t,e,s,i=!1){const r=p1;r.minX=0,r.minY=0,r.maxX=n.width/s|0,r.maxY=n.height/s|0;const o=Va.getOptimalTexture(r.width,r.height,s,!1,i);return o.source.uploadMethodId="image",o.source.resource=n,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/s,o.frame.height=e/s,o.source.emit("update",o.source),o.updateUvs(),o}class m1{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class y1{constructor(){this.instructions=new pc}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Fc=class vl{constructor(t){this._renderer=t,this._managedContexts=new en({renderer:t,type:"resource",name:"graphicsContext"})}init(t){vl.defaultOptions.bezierSmoothness=t?.bezierSmoothness??vl.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,s=!!e[this._renderer.uid],i=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!s)&&(s&&i.reset(),i.isBatchable=!1,t.dirty=!1),i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}
289_initContextRenderData(t){const e=new y1,s=this.getGpuContext(t);return s.graphicsData=e,e.init(),e}_initContext(t){const e=new m1;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Fc.extension={type:[X.CanvasSystem],name:"graphicsContext"};Fc.defaultOptions={bezierSmoothness:.5};let x1=Fc;class Pg{constructor(t,e){this.state=mc.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new en({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}}Pg.extension={type:[X.CanvasPipes],name:"graphics"};function Mg(n,t,e){const s=(n>>24&255)/255;t[e++]=(n&255)/255*s,t[e++]=(n>>8&255)/255*s,t[e++]=(n>>16&255)/255*s,t[e++]=s}class _1{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{Re.return(t)}),this.batches.length=0}}class kg{constructor(t,e){this.state=mc.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new en({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,s=!!t._gpuData,r=this.renderer.graphicsContext.updateGpuContext(e);return!!(r.isBatchable||s!==r.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const s=this._getGpuDataForRenderable(t).batches;for(let i=0;i<s.length;i++){const r=s[i];r._batcher.updateElement(r)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,s=t.context;if(!e.graphicsContext.getGpuContext(s).batches.length)return;const r=s.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const o=r.resources.localUniforms.uniforms;o.uTransformMatrix=t.groupTransform,o.uRound=e._roundPixels|t._roundPixels,Mg(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),i=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),i.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const s=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(t).batches;for(let r=0;r<i.length;r++){const o=i[r];s.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new _1;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const s=t.context,r=this.renderer.graphicsContext.getGpuContext(s),o=this.renderer._roundPixels|t._roundPixels;e.batches=r.batches.map(a=>{const h=Re.get(Ac);return a.copyTo(h),h.renderable=t,h.roundPixels=o,h})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.de
289stroy(),this._adaptor=null,this.state=null}}kg.extension={type:[X.WebGLPipes,X.WebGPUPipes],name:"graphics"};yt.add(Pg);yt.add(kg);yt.add(x1);yt.add(Mc);class Wt extends er{constructor(t){t instanceof Ze&&(t={context:t});const{context:e,roundPixels:s,...i}=t||{};super({label:"Graphics",...i}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new Ze,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=s??!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._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 Wt(this._context.clone()):(this._ownedContext=null,new Wt(this._context))}lineStyle(t,e,s){ut(Ct,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return t&&(i.width=t),e&&(i.color=e),s&&(i.alpha=s),this.context.strokeStyle=i,this}beginFill(t,e){ut(Ct,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const s={};return t!==void 0&&(s.color=t),e!==void 0&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){ut(Ct,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==Ze.defaultStrokeStyle.width||t.color!==Ze.defaultStrokeStyle.color||t.alpha!==Ze.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return ut(Ct,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return ut(Ct,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return ut(Ct,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return ut(Ct,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return ut(Ct,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return ut(Ct,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}const Ig=class Eg extends bc{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(ut(Ct,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Eg.defaultOptions,...e};const s=e.positions||new Float32Array([0,0,1,0,1,1,0,1]);let i=e.uvs;i||(e.positions?i=new Float32Array(s.length):i=new Float32Array([0,0,1,0,1,1,0,1]));const r=e.indices||new Uint32Array([0,1,2,0,2,3]),o=e.shrinkBuffersToFit,a=new Ps({data:s,label:"attribute-mesh-positions",shrinkToFit:o,usage:Lt.VERTEX|Lt.COPY_DST}),h=new Ps({data:i,label:"attribute-mesh-uvs",shrinkToFit:o,usage:Lt.VERTEX|Lt.COPY_DST}),l=new Ps({data:r,label:"index-mesh-buffer",shrinkToFit:o,usage:Lt.INDEX|Lt.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:8,offset:0},aUV:{buffer:h,format:"float32x2",stride:8,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};Ig.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let Bc=Ig;class Fg{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){const e=this.geometry.getBuffer("aUV"),s=e.data;let i=s;const r=this.texture.textureMatrix;return r.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==r._updateID||this._uvUpdateId!==e._updateID)&&((!i||i.length<s.length)&&(i=this._transformedUvs=new Float32Array(s.length)),this._textureMatrixUpdateId=r._updateID,this._uvUpdateId=e._updateID,r.multiplyUvs(s,i))),i}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}class da extends it{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const{animationSpeed:s=1,autoPlay:i=!1,autoUpdate:r=!0,loop:o=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof $?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=r,this._isConnectedToTicker=!1,this.animationSpeed=s,this.loop=o,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,i&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Zt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Zt.shared.add(this.update,this,Wr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,s=this.animationSpeed*e,i=this.currentFrame;if(this._durations!==null){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=s/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=s;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t=!1){if(typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;
289this._textures.forEach(i=>{this.texture!==i&&i.destroy(s)})}this._textures=[],this._durations=null,this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;s<t.length;++s)e.push($.from(t[s]));return new da(e)}static fromImages(t){const e=[];for(let s=0;s<t.length;++s)e.push($.from(t[s]));return new da(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof $)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Zt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Zt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class b1{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t??new ot,this.observer=e,this.position=new Vt(this,0,0),this.scale=new Vt(this,1,1),this.pivot=new Vt(this,0,0),this.skew=new Vt(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this.dirty=!1),t}_onUpdate(t){this.dirty=!0,t===this.skew&&this.updateSkew(),this.observer?._onUpdate(this)}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this.dirty=!0}toString(){return`[pixi.js/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}const Ao=new ot,Fs=new ot,ps=[new It,new It,new It,new It];class Bg{constructor(t){this._renderer=t}validateRenderable(t){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){const e=this._renderer,s=e.canvasContext,i=s.activeContext;i.save(),s.setBlendMode(t.groupBlendMode);const r=e.globalUniforms.globalUniformData?.worldColor??4294967295,o=t.groupColorAlpha,a=(r>>>24&255)/255,h=(o>>>24&255)/255,l=e.filter?.alphaMultiplier??1,c=a*h*l;if(c<=0){i.restore();return}i.globalAlpha=c;const u=r&16777215,d=o&16777215,f=En(Ya(d,u)),g=t.texture,p=Tt.getTintedPattern(g,f),m=t.width,y=t.height,x=t.groupTransform,_=g.source._resolution??g.source.resolution??1;Fs.copyFrom(t._tileTransform.matrix),t.applyAnchorToTexture||Fs.translate(-t.anchor.x*m,-t.anchor.y*y);const b=Fs.tx,w=Fs.ty;Fs.scale(1/_,1/_),Fs.tx=b,Fs.ty=w,Ao.identity(),Ao.prepend(Fs),Ao.prepend(x);const S=e._roundPixels|t._roundPixels;s.setContextTransform(Ao,S===1),i.fillStyle=p;const v=t.anchor.x*-m,T=t.anchor.y*-y;ps[0].set(v,T),ps[1].set(v+m,T),ps[2].set(v+m,T+y),ps[3].set(v,T+y);for(let A=0;A<4;A++)Fs.applyInverse(ps[A],ps[A]);i.beginPath(),i.moveTo(ps[0].x,ps[0].y);for(let A=1;A<4;A++)i.lineTo(ps[A].x,ps[A].y);i.closePath(),i.fill(),i.restore()}destroy(){this._renderer=null}}Bg.extension={type:[X.CanvasPipes],name:"tilingSprite"};const Uo={name:"local-uniform-bit",vertex:{header:`
290
291            struct LocalUniforms {
292                uTransformMatrix:mat3x3<f32>,
293                uColor:vec4<f32>,
294                uRound:f32,
295            }
296
297            @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
298        `,main:`
299            vColor *= localUniforms.uColor;
300            modelMatrix *= localUniforms.uTransformMatrix;
301        `,end:`
302            if(localUniforms.uRound == 1)
303            {
304                vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
305            }
306        `}},ik={...Uo,vertex:{...Uo.vertex,header:Uo.vertex.header.replace("group(1)","group(2)")}},w1={name:"local-uniform-bit",vertex:{header:`
307
308            uniform mat3 uTransformMatrix;
309            uniform vec4 uColor;
310            uniform float uRound;
311        `,main:`
312            vColor *= uColor;
313            modelMatrix = uTransformMatrix;
314        `,end:`
315            if(uRound == 1.)
316            {
317                gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
318            }
319        `}},S1={name:"tiling-bit",vertex:{header:`
320            struct TilingUniforms {
321                uMapCoord:mat3x3<f32>,
322                uClampFrame:vec4<f32>,
323                uClampOffset:vec2<f32>,
324                uTextureTransform:mat3x3<f32>,
325                uSizeAnchor:vec4<f32>
326            };
327
328            @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
329            @group(2) @binding(1) var uTexture: texture_2d<f32>;
330            @group(2) @binding(2) var uSampler: sampler;
331        `,main:`
332            uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
333
334            position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
335        `},fragment:{header:`
336            struct TilingUniforms {
337                uMapCoord:mat3x3<f32>,
338                uClampFrame:vec4<f32>,
339                uClampOffset:vec2<f32>,
340                uTextureTransform:mat3x3<f32>,
341                uSizeAnchor:vec4<f32>
342            };
343
344            @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
345            @group(2) @binding(1) var uTexture: texture_2d<f32>;
346            @group(2) @binding(2) var uSampler: sampler;
347        `,main:`
348
349            var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
350            coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
351            var unclamped = coord;
352            coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
353
354            var bias = 0.;
355
356            if(unclamped.x == coord.x && unclamped.y == coord.y)
357            {
358                bias = -32.;
359            }
360
361            outColor = textureSampleBias(uTexture, uSampler, coord, bias);
362        `}},v1={name:"tiling-bit",vertex:{header:`
363            uniform mat3 uTextureTransform;
364            uniform vec4 uSizeAnchor;
365
366        `,main:`
367            uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
368
369            position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
370        `},fragment:{header:`
371            uniform sampler2D uTexture;
372            uniform mat3 uMapCoord;
373            uniform vec4 uClampFrame;
374            uniform vec2 uClampOffset;
375        `,main:`
376
377        vec2 coord = vUV + ceil(uClampOffset - vUV);
378        coord = (uMapCoord * vec3(coord, 1.0)).xy;
379        vec2 unclamped = coord;
380        coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
381
382        outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
383
384        `}};let Lh,Oh;class T1 extends io{constructor(){Lh??(Lh=wc({name:"tiling-sprite-shader",bits:[Uo,S1,vc]})),Oh??(Oh=Sc({name:"tiling-sprite-shader",bits:[w1,v1,Tc]}));const t=new la({uMapCoord:{value:new ot,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new ot,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Oh,gpuProgram:Lh,resources:{localUniforms:new la({uTransformMatrix:{value:new ot,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:$.EMPTY.source,uSampler:$.EMPTY.source.style}})}updateUniforms(t,e,s,i,r,o){const a=this.resources.tilingUniforms,h=o.width,l=o.height,c=o.textureMatrix,u=a.uniforms.uTextureTransform;u.set(s.a*h/t,s.b*h/e,s.c*l/t,s.d*l/e,s.tx/t,s.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=r,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class A1 extends Bc{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function C1(n,t){const e=n.anchor.x,s=n.anchor.y;t[0]=-e*n.width,t[1]=-s*n.height,t[2]=(1-e)*n.width,t[3]=-s*n.height,t[4]=(1-e)*n.width,t[5]=(1-s)*n.height,t[6]=-e*n.width,t[7]=(1-s)*n.height}function P1(n,t,e,s){let i=0;const r=n.length/t,o=s.a,a=s.b,h=s.c,l=s.d,c=s.tx,u=s.ty;for(e*=t;i<r;){const d=n[e],f=n[e+1];n[e]=o*d+h*f+c,n[e+1]=a*d+l*f+u,e+=t,i++}}function M1(n,t){const e=n.texture,s=e.frame.width,i=e.frame.height;let r=0,o=0;n.applyAnchorToTexture&&(r=n.anchor.x,o=n.anchor.y),t[0]=t[6]=-r,t[2]=t[4]=1-r,t[1]=t[3]=-o,t[5]=t[7]=1-o;const a=n._tileTransform.matrix,h=ot.shared;h.set(a.a*s/n.width,a.b*s/n.height,a.c*i/n.width,a.d*i/n.height,a.tx/n.width,a.ty/n.height),h.invert(),P1(t,2,0,h)}const Go=new A1;class k1{constructor(){this.canBatch=!0,this.geometry=new Bc({indices:Go.indices.slice(),positions:Go.positions.slice(),uvs:Go.uvs.slice()})}destroy(){this.geometry.destroy(),this.shader?.destroy()}}class Rg{constructor(t){this._state=mc.default2d,this._renderer=t,this._managedTilingSprites=new en({renderer:t,type:"renderable",name:"tilingSprite"})}validateRenderable(t){const e=this._getTilingSpriteData(t),s=e.canBatch;this._updateCanBatch(t);const i=e.canBatch;if(i&&i===s){const{batchableMesh:r}=e;return!r._batcher.checkAndUpdateTexture(r,t.texture)}return s!==i}addRenderable(t,e){const s=this._renderer.renderPipes.batch;this._updateCanBatch(t);const i=this._getTilingSpriteData(t),{geometry:r,canBatch:o}=i;if(o){i.batchableMesh||(i.batchableMesh=new Fg);const a=i.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=r,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,s.addToBatch(a,e)}else s.break(e),i.shader||(i.shader=new T1),this.updateRenderable(t),e.add(t)}execute(t){const e=this._renderer,{shader:s}=this._getTilingSpriteData(t);s.groups[0]=e.globalUniforms.bindGroup;const i=s.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=e._roundPixels|t._roundPixels,Mg(t.groupColorAlpha,i.uColor,0),this._state.blendMode=ml(t.groupBlendMode,t.texture._source),e.encoder.draw({geometry:Go,shader:s,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:s}=e;if(s){const{batchableMesh:i}=e;t.didViewUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t.didViewUpdate){const{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new k1;return e.renderable=t,t._gpuData[this._renderer.uid]=e,this._managedTilingSprites.add(t),e}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:s}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),M1(t,s.uvs),C1(t,s.positions)}destroy(){this._managedTilingSprites.destroy(),this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),s=t.texture;let i=!0;return this._renderer.type===Gi.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=s.textureMatrix.isSimple&&(i||s.source.isPowerOfTwo),e.canBatch}}Rg.extension={type:[X.WebGLPipes,X.WebGPUPipes],name:"tilingSprite"};yt.add(Bg);yt.add(Rg);const Lg=class Xo extends er{constructor(...t){let e=t[0]||{};e instanceof $&&(e={texture:e}),t.length>1&&(ut(Ct,"use new TilingSprite({ texture, width:100, height:100 }) instead"),e.width=t[1],e.height=t[2]),e={...Xo.defaultOptions,...e};const{texture:s,anchor:i,tilePosition:r,tileScale:o,tileRotation:a,width:h,height:l,applyAnchorToTexture:c,roundPixels:u,...d}=e??{};super({label:"TilingSprite",...d}),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new Vt({_onUpdate:()=>{this.onViewUpdate()}}),this.applyAnchorToTexture=c,this.texture=s,this._width=h??s.width,this._height=l??s.height,this._tileTransform=new b1({observer:{_onUpdate:()=>this.onViewUpdate()}}),i&&(this.anchor=i),this.tilePosition=r,this.tileScale=o,this.tileRotation=a,this.roundPixels=u??!1}static from(t,e={}){return typeof t=="string"?new Xo({texture:Bt.get(t),...e}):new Xo({texture:t,...e})}get uvRespectAnchor(){return ut(Ct,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture}set uvRespectAnchor(t){ut(Ct,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture=t}
384get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}set texture(t){t||(t=$.EMPTY);const 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.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){typeof t=="object"&&(e=t.height??t.width,t=t.width),this._width=t,this._height=e??t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}updateBounds(){const t=this._bounds,e=this._anchor,s=this._width,i=this._height;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}containsPoint(t){const e=this._width,s=this._height,i=-e*this._anchor._x;let r=0;return t.x>=i&&t.x<=i+e&&(r=-s*this._anchor._y,t.y>=r&&t.y<=r+s)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(s)}this._texture=null}};Lg.defaultOptions={texture:$.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let I1=Lg;class E1 extends er{constructor(t,e){const{text:s,resolution:i,style:r,anchor:o,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=s??"",this.style=r,this.resolution=i??null,this.allowChildren=!1,this._anchor=new Vt({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,s=this.bounds.height,i=-e*this.anchor.x;let r=0;return t.x>=i&&t.x<=i+e&&(r=-s*this.anchor.y,t.y>=r&&t.y<=r+s)}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 F1(n,t){let e=n[0]??{};return(typeof e=="string"||n[1])&&(ut(Ct,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:n[1]}),e}let Mi=null,Ws=null;function B1(n,t){Mi||(Mi=ft.get().createCanvas(256,128),Ws=Mi.getContext("2d",{willReadFrequently:!0}),Ws.globalCompositeOperation="copy",Ws.globalAlpha=1),(Mi.width<n||Mi.height<t)&&(Mi.width=Yn(n),Mi.height=Yn(t))}function Bd(n,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(n[i+3]!==0)return!1;return!0}function Rd(n,t,e,s,i){const r=4*t;
384for(let o=s,a=s*r+4*e;o<=i;++o,a+=r)if(n[a+3]!==0)return!1;return!0}function R1(...n){let t=n[0];t.canvas||(t={canvas:n[0],resolution:n[1]});const{canvas:e}=t,s=Math.min(t.resolution??1,1),i=t.width??e.width,r=t.height??e.height;let o=t.output;if(B1(i,r),!Ws)throw new TypeError("Failed to get canvas 2D context");Ws.drawImage(e,0,0,i,r,0,0,i*s,r*s);const h=Ws.getImageData(0,0,i,r).data;let l=0,c=0,u=i-1,d=r-1;for(;c<r&&Bd(h,i,c);)++c;if(c===r)return qt.EMPTY;for(;Bd(h,i,d);)--d;for(;Rd(h,i,l,c,d);)++l;for(;Rd(h,i,u,c,d);)--u;return++u,++d,Ws.globalCompositeOperation="source-over",Ws.strokeRect(l,c,u-l,d-c),Ws.globalCompositeOperation="copy",o??(o=new qt),o.set(l/s,c/s,(u-l)/s,(d-c)/s),o}class L1{constructor(t=0,e=0,s=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=s,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)){const 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()){const e=new Array(t.length);for(let s=0;s<t.length;s++){const i=t[s];e[s]=[i,this.get(i)]}return e}evict(t=!1){if(t||this.size>0){const 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){const 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(){const t=new Array(this.size);let e=this.first,s=0;for(;e!==null;)t[s++]=e.key,e=e.next;return t}setWithEvicted(t,e,s=this.resetTtl){let i=null;if(this.has(t))this.set(t,e,!0,s);else{this.max>0&&this.size===this.max&&(i={...this.first},this.evict(!0));let r=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=r:this.last.next=r,this.last=r}return i}set(t,e,s=!1,i=this.resetTtl){let r=this.items[t];return s||r!==void 0?(r.value=e,s===!1&&i&&(r.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(r)):(this.max>0&&this.size===this.max&&this.evict(!0),r=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=r:this.last.next=r,this.last=r),this}values(t=this.keys()){const e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=this.get(t[s]);return e}}function O1(n=1e3,t=0,e=!1){if(isNaN(n)||n<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 L1(n,t,e)}function Og(n){return!!n.tagStyles&&Object.keys(n.tagStyles).length>0}function Dg(n){return n.includes("<")}function D1(n,t){return n.clone().assign(t)}function N1(n,t){const e=[],s=t.tagStyles;if(!Og(t)||!Dg(n))return e.push({text:n,style:t}),e;const i=[t],r=[];let o="",a=0;for(;a<n.length;){const h=n[a];if(h==="<"){const l=n.indexOf(">",a);if(l===-1){o+=h,a++;continue}const c=n.indexOf("<",a+1);if(c!==-1&&c<l){o+=h,a++;continue}const u=n.slice(a+1,l);if(u.startsWith("/")){const d=u.slice(1).trim();if(r.length>0&&r[r.length-1]===d){o.length>0&&(e.push({text:o,style:i[i.length-1]}),o=""),i.pop(),r.pop(),a=l+1;continue}else{o+=n.slice(a,l+1),a=l+1;continue}}else{const d=u.trim();if(s[d]){o.length>0&&(e.push({text:o,style:i[i.length-1]}),o="");const f=i[i.length-1],g=D1(f,s[d]);i.push(g),r.push(d),a=l+1;continue}else{o+=n.slice(a,l+1),a=l+1;continue}}}else o+=h,a++}return o.length>0&&e.push({text:o,style:i[i.length-1]}),e}const W1=[10,13],z1=new Set(W1),Y1=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],V1=new Set(Y1),U1=[9,32],G1=new Set(U1),X1=[45,8208,8211,8212,173],$1=new Set(X1),H1=/(\r\n|\r|\n)/,j1=/(?:\r\n|\r|\n)/;
384function fa(n){return typeof n!="string"?!1:z1.has(n.charCodeAt(0))}function ts(n,t){return typeof n!="string"?!1:V1.has(n.charCodeAt(0))}function nk(n){return typeof n!="string"?!1:G1.has(n.charCodeAt(0))}function q1(n){return typeof n!="string"?!1:$1.has(n.charCodeAt(0))}function Ng(n){return n==="normal"||n==="pre-line"}function Wg(n){return n==="normal"}function Ls(n){if(typeof n!="string")return"";let t=n.length-1;for(;t>=0&&ts(n[t]);)t--;return t<n.length-1?n.slice(0,t+1):n}function zg(n){const t=[],e=[];if(typeof n!="string")return t;for(let s=0;s<n.length;s++){const i=n[s],r=n[s+1];if(ts(i)||fa(i)){e.length>0&&(t.push(e.join("")),e.length=0),i==="\r"&&r===`
385`?(t.push(`\r
386`),s++):t.push(i);continue}e.push(i),q1(i)&&r&&!ts(r)&&!fa(r)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function Yg(n,t,e,s){const i=e(n),r=[];for(let o=0;o<i.length;o++){let a=i[o],h=a,l=1;for(;i[o+l];){const c=i[o+l];if(!s(h,c,n,o,t))a+=c,h=c,l++;else break}o+=l-1,r.push(a)}return r}const K1=/\r\n|\r|\n/g;function Z1(n,t,e,s,i,r,o,a,h){const l=N1(n,t);if(Wg(t.whiteSpace))for(let k=0;k<l.length;k++){const E=l[k];l[k]={text:E.text.replace(K1," "),style:E.style}}const u=[];let d=[];for(const k of l){const E=k.text.split(H1);for(let F=0;F<E.length;F++){const B=E[F];B===`\r
387`||B==="\r"||B===`
388`?(u.push(d),d=[]):B.length>0&&d.push({text:B,style:k.style})}}(d.length>0||u.length===0)&&u.push(d);const f=e?Q1(u,t,s,r,a,h):u,g=[],p=[],m=[],y=[],x=[];let _=0;const b=t._fontString,w=o(b);w.fontSize===0&&(w.fontSize=t.fontSize,w.ascent=t.fontSize);let S="",v=!!t.dropShadow,T=t._stroke?.width||0;for(const k of f){let E=0,F=w.ascent,B=w.descent,N="";for(const R of k){const D=R.style._fontString,z=o(D);D!==S&&(s.font=D,S=D);const Y=i(R.text,R.style.letterSpacing,s);E+=Y,F=Math.max(F,z.ascent),B=Math.max(B,z.descent),N+=R.text;const W=R.style._stroke?.width||0;W>T&&(T=W),!v&&R.style.dropShadow&&(v=!0)}k.length===0&&(F=w.ascent,B=w.descent),g.push(E),p.push(F),m.push(B),x.push(N);const O=t.lineHeight||F+B;y.push(O+t.leading),_=Math.max(_,E)}const A=T,P=_+A+(t.dropShadow?t.dropShadow.distance:0);let M=0;for(let k=0;k<y.length;k++)M+=y[k];M=Math.max(M,y[0]+A);const I=M+(t.dropShadow?t.dropShadow.distance:0),C=t.lineHeight||w.fontSize;return{width:P,height:I,lines:x,lineWidths:g,lineHeight:C+t.leading,maxLineWidth:_,fontProperties:w,runsByLine:f,lineAscents:p,lineDescents:m,lineHeights:y,hasDropShadow:v}}function Q1(n,t,e,s,i,r){const{letterSpacing:o,whiteSpace:a,wordWrapWidth:h,breakWords:l}=t,c=Ng(a),u=h+o,d={};let f="";const g=(m,y)=>{const x=`${m}|${y.styleKey}`;let _=d[x];if(_===void 0){const b=y._fontString;b!==f&&(e.font=b,f=b),_=s(m,y.letterSpacing,e)+y.letterSpacing,d[x]=_}return _},p=[];for(const m of n){const y=J1(m),x=p.length,_=M=>{let I=0,C=M;do{const{token:k,style:E}=y[C];I+=g(k,E),C++}while(C<y.length&&y[C].continuesFromPrevious);return I},b=M=>{const I=[];let C=M;do I.push({token:y[C].token,style:y[C].style}),C++;while(C<y.length&&y[C].continuesFromPrevious);return I};let w=[],S=0,v=!c,T=null;const A=()=>{T&&T.text.length>0&&w.push(T),T=null},P=()=>{if(A(),w.length>0){const M=w[w.length-1];M.text=Ls(M.text),M.text.length===0&&w.pop()}p.push(w),w=[],S=0,v=!1};for(let M=0;M<y.length;M++){const{token:I,style:C,continuesFromPrevious:k}=y[M],E=g(I,C);if(c){const N=ts(I),O=T?.text[T.text.length-1]??w[w.length-1]?.text.slice(-1)??"",R=O?ts(O):!1;if(N&&R)continue}const F=!k,B=F?_(M):E;if(B>u&&F)if(S>0&&P(),l){const N=b(M);for(let O=0;O<N.length;O++){const R=N[O].token,D=N[O].style,z=Yg(R,l,r,i);for(const Y of z){const W=g(Y,D);W+S>u&&P(),!T||T.style!==D?(A(),T={text:Y,style:D}):T.text+=Y,S+=W}}M+=N.length-1}else{const N=b(M);A(),p.push(N.map(O=>({text:O.token,style:O.style}))),v=!1,M+=N.length-1}else if(B+S>u&&F){if(ts(I)){v=!1;continue}P(),T={text:I,style:C},S=E}else if(k&&!l)!T||T.style!==C?(A(),T={text:I,style:C}):T.text+=I,S+=E;else{const N=ts(I);if(S===0&&N&&!v)continue;!T||T.style!==C?(A(),T={text:I,style:C}):T.text+=I,S+=E}}if(A(),w.length>0){const M=w[w.length-1];M.text=Ls(M.text),M.text.length===0&&w.pop()}(w.length>0||p.length===x)&&p.push(w)}return p}function J1(n){const t=[];let e=!1;for(const s of n){const i=zg(s.text);let r=!0;for(const o of i){const a=ts(o)||fa(o),h=r&&e&&!a;t.push({token:o,style:s.style,continuesFromPrevious:h}),e=!a,r=!1}}return t}const tS={willReadFrequently:!0};function Ld(n,t,e,s,i){let r=e[n];return typeof r!="number"&&(r=i(n,t,s)+t,e[n]=r),r}function eS(n,t,e,s,i,r,o){const a=e.getContext("2d",tS);a.font=t._fontString;let h=0,l="";const c=[],u=Object.create(null),{letterSpacing:d,whiteSpace:f}=t,g=Ng(f),p=Wg(f);let m=!g;const y=t.wordWrapWidth+d,x=zg(n);for(let b=0;b<x.length;b++){let w=x[b];if(fa(w)){if(!p){c.push(Ls(l)),m=!g,l="",h=0;continue}w=" "}if(g){const v=ts(w),T=ts(l[l.length-1]);if(v&&T)continue}const S=Ld(w,d,u,a,s);if(S>y)if(l!==""&&(c.push(Ls(l)),l="",h=0),i(w,t.breakWords)){const v=Yg(w,t.breakWords,o,r);for(const T of v){const A=Ld(T,d,u,a,s);A+h>y&&(c.push(Ls(l)),m=!1,l="",h=0),l+=T,h+=A}}else l.length>0&&(c.push(Ls(l)),l="",h=0),c.push(Ls(w)),m=!1,l="",h=0;else S+h>y&&(m=!1,c.push(Ls(l)),l="",h=0),(l.length>0||!ts(w)||m)&&(l+=w,h+=S)}const _=Ls(l);return _.length>0&&c.push(_),c.join(`
389`)}const Od={willReadFrequently:!0},Zs=class st{static get experimentalLetterSpacingSupported(){let t=st._experimentalLetterSpacingSupported;if(t===void 0){const e=ft.get().getCanvasRenderingContext2D().prototype;t=st._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,r,o,a,h,l,c){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=r,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l,c&&(this.runsByLine
389=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,s=st._canvas,i=e.wordWrap){const r=`${t}-${e.styleKey}-wordWrap-${i}`;if(st._measurementCache.has(r))return st._measurementCache.get(r);if(Og(e)&&Dg(t)){const b=Z1(t,e,i,st._context,st._measureText,st._measureTextAdvance,st.measureFont,st.canBreakChars,st.wordWrapSplit),w=new st(t,e,b.width,b.height,b.lines,b.lineWidths,b.lineHeight,b.maxLineWidth,b.fontProperties,{runsByLine:b.runsByLine,lineAscents:b.lineAscents,lineDescents:b.lineDescents,lineHeights:b.lineHeights,hasDropShadow:b.hasDropShadow});return st._measurementCache.set(r,w),w}const a=e._fontString,h=st.measureFont(a);h.fontSize===0&&(h.fontSize=e.fontSize,h.ascent=e.fontSize,h.descent=0);const l=st._context;l.font=a;const u=(i?st._wordWrap(t,e,s):t).split(j1),d=new Array(u.length);let f=0;for(let b=0;b<u.length;b++){const w=st._measureText(u[b],e.letterSpacing,l);d[b]=w,f=Math.max(f,w)}const g=e._stroke?.width??0,p=e.lineHeight||h.fontSize,m=st._adjustWidthForStyle(f,e),y=Math.max(p,h.fontSize+g)+(u.length-1)*(
389p+e.leading),x=st._adjustHeightForStyle(y,e),_=new st(t,e,m,x,u,d,p+e.leading,f,h);return st._measurementCache.set(r,_),_}static _adjustWidthForStyle(t,e){const s=e._stroke?.width||0;let i=t+s;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _adjustHeightForStyle(t,e){let s=t;return e.dropShadow&&(s+=e.dropShadow.distance),s}static _measureText(t,e,s){const{metricWidth:i,metrics:r,letterSpacingVal:o}=st._measureTextCore(t,e,s),a=-(r.actualBoundingBoxLeft??0);let l=(r.actualBoundingBoxRight??0)-a;return r.width>0&&(l+=o),Math.max(i,l)}static _measureTextAdvance(t,e,s){return st._measureTextCore(t,e,s).metricWidth}static _measureTextCore(t,e,s){let i=!1;st.experimentalLetterSpacingSupported&&(st.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));const r=s.measureText(t);let o=r.width,a=0;return o>0&&(i?a=-e:a=(st.graphemeSegmenter(t).length-1)*e,o+=a),{metricWidth:o,metrics:r,letterSpacingVal:a}}static _wordWrap(t,e,s=st._canvas){return eS(t,e,s,st._measureTextAdvance,st.canBreakWords,st.canBreakChars,st.wordWrapSplit)}static isBreakingSpace(t,e){return ts(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,r){return!0}static wordWrapSplit(t){return st.graphemeSegmenter(t)}static measureFont(t){if(st._fonts[t])return st._fonts[t];const e=st._context;e.font=t;const s=e.measureText(st.METRICS_STRING+st.BASELINE_SYMBOL),i=s.actualBoundingBoxAscent??0,r=s.actualBoundingBoxDescent??0,o={ascent:i,descent:r,fontSize:i+r};return st._fonts[t]=o,o}static clearMetrics(t=""){t?delete st._fonts[t]:st._fonts={}}static get _canvas(){if(!st.__canvas){let t;try{const e=new OffscreenCanvas(0,0);if(e.getContext("2d",Od)?.measureText)return st.__canvas=e,e;t=ft.get().createCanvas()}catch{t=ft.get().createCanvas()}t.width=t.height=10,st.__canvas=t}return st.__canvas}static get _context(){return st.__context||(st.__context=st._canvas.getContext("2d",Od)),st.__context}};Zs.METRICS_STRING="|ÉqÅ";Zs.BASELINE_SYMBOL="M";Zs.BASELINE_MULTIPLIER=1.4;Zs.HEIGHT_MULTIPLIER=2;Zs.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){const n=new Intl.Segmenter;return t=>{const e=n.segment(t),s=[];let i=0;for(const r of e)s[i++]=r.segment;return s}}return n=>[...n]})();Zs.experimentalLetterSpacing=!1;Zs._fonts={};Zs._measurementCache=O1(1e3);let Js=Zs;const sS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Tl(n){const t=typeof n.fontSize=="number"?`${n.fontSize}px`:n.fontSize;let e=n.fontFamily;Array.isArray(n.fontFamily)||(e=n.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!sS.includes(i)&&(i=`"${i}"`),e[s]=i}return`${n.fontStyle} ${n.fontVariant} ${n.fontWeight} ${t} ${e.join(",")}`}const Dd=1e5;function Co(n,t,e,s=0,i=0,r=0){if(n.texture===$.WHITE&&!n.fill)return Nt.shared.setValue(n.color).setAlpha(n.alpha??1).toHexa();if(n.fill){if(n.fill instanceof Ha){const o=n.fill,a=t.createPattern(o.texture.source.resource,"repeat");return Tt.applyPatternTransform(a,o.transform,!1),a}else if(n.fill instanceof Hs){const o=n.fill,a=o.type==="linear",h=o.textureSpace==="local";let l=1,c=1;h&&e&&(l=e.width+s,c=e.height+s);let u,d=!1;if(a){const{start:f,end:g}=o;u=t.createLinearGradient(f.x*l+i,f.y*c+r,g.x*l+i,g.y*c+r),d=Math.abs(g.x-f.x)<Math.abs((g.y-f.y)*.1)}else{const{center:f,innerRadius:g,outerCenter:p,outerRadius:m}=o;u=t.createRadialGradient(f.x*l+i,f.y*c+r,g*l,p.x*l+i,p.y*c+r,m*l)}if(d&&h&&e){const f=e.lineHeight/c;for(let g=0;g<e.lines.length;g++){const p=(g*e.lineHeight+s/2)/c;o.colorStops.forEach(m=>{let y=p+m.offset*f;y=Math.max(0,Math.min(1,y)),u.addColorStop(Math.floor(y*Dd)/Dd,Nt.shared.setValue(m.color).toHex())})}}else o.colorStops.forEach(f=>{u.addColorStop(f.offset,Nt.shared.setValue(f.color).toHex())});return u}}else{const o=t.createPattern(n.texture.source.resource,"repeat"),a=n.matrix.copyTo(ot.shared);return a.scale(n.texture.source.pixelWidth,n.texture.source.pixelHeight),o.setTransform(a),o}return Dt("FillStyle not recognised",n),"red"}const Nd=new qt;function ln(n){let t=0;for(let e=0;e<n.length;e++)n.charCodeAt(e)===32&&t++;return t}class iS{getCanvasAndContext(t){const{text:e,style:s,resolution:i=1}=t,r=s._getFinalPadding(),o=Js.measureText(e||" ",s),a=Math.ceil(Math.ceil(Math.max(1,o.width)+r*2)*i),h=Math.ceil(Math.ceil(Math.max(1,o.height)+r*2)*i),l=Sl.getOptimalCanvasAndContext(a,h);this._renderTextToCanvas(s,r,i,l,o);const c=s.trim?R1({canvas:l.canvas,width:a,height:h,resolution:1,output:Nd}):Nd.set(0,0,a,h);return{canvasAndContext:l,frame:c}}returnCanvasAndContext(t){Sl.returnCanvasAndContext(t)}
389_renderTextToCanvas(t,e,s,i,r){if(r.runsByLine&&r.runsByLine.length>0){this._renderTaggedTextToCanvas(r,t,e,s,i);return}const{canvas:o,context:a}=i,h=Tl(t),l=r.lines,c=r.lineHeight,u=r.lineWidths,d=r.maxLineWidth,f=r.fontProperties,g=o.height;if(a.resetTransform(),a.scale(s,s),a.textBaseline=t.textBaseline,t._stroke?.width){const w=t._stroke;a.lineWidth=w.width,a.miterLimit=w.miterLimit,a.lineJoin=w.join,a.lineCap=w.cap}a.font=h;let p,m;const y=t.dropShadow?2:1,_=(t._stroke?.width??0)/2;let b=(c-f.fontSize)/2;c-f.fontSize<0&&(b=0);for(let w=0;w<y;++w){const S=t.dropShadow&&w===0,v=S?Math.ceil(Math.max(1,g)+e*2):0,T=v*s;if(S)this._setupDropShadow(a,t,s,T);else{const A=t._gradientBounds,P=t._gradientOffset;if(A){const M={width:A.width,height:A.height,lineHeight:A.height,lines:r.lines};this._setFillAndStrokeStyles(a,t,M,e,_,P?.x??0,P?.y??0)}else P?this._setFillAndStrokeStyles(a,t,r,e,_,P.x,P.y):this._setFillAndStrokeStyles(a,t,r,e,_);a.shadowColor="rgba(0,0,0,0)"}for(let A=0;A<l.length;A++){p=_,m=_+A*c+f.ascent+b,p+=this._getAlignmentOffset(u[A],d,t.align);let P=0;if(t.align==="justify"&&t.wordWrap&&A<l.length-1){const M=ln(l[A]);M>0&&(P=(d-u[A])/M)}t._stroke?.width&&this._drawLetterSpacing(l[A],t,i,p+e,m+e-v,!0,P),t._fill!==void 0&&this._drawLetterSpacing(l[A],t,i,p+e,m+e-v,!1,P)}}}_renderTaggedTextToCanvas(t,e,s,i,r){const{canvas:o,context:a}=r,{runsByLine:h,lineWidths:l,maxLineWidth:c,lineAscents:u,lineHeights:d,hasDropShadow:f}=t,g=o.height;a.resetTransform(),a.scale(i,i),a.textBaseline=e.textBaseline;const p=f?2:1;let m=e._stroke?.width??0;for(const _ of h)for(const b of _){const w=b.style._stroke?.width??0;w>m&&(m=w)}const y=m/2,x=[];for(let _=0;_<h.length;_++){const b=h[_],w=[];for(const S of b){const v=Tl(S.style);a.font=v,w.push({width:Js._measureText(S.text,S.style.letterSpacing,a),font:v})}x.push(w)}for(let _=0;_<p;++_){const b=f&&_===0,w=b?Math.ceil(Math.max(1,g)+s*2):0,S=w*i;b||(a.shadowColor="rgba(0,0,0,0)");let v=y;for(let T=0;T<h.length;T++){const A=h[T],P=l[T],M=u[T],I=d[T],C=x[T];let k=y;k+=this._getAlignmentOffset(P,c,e.align);let E=0;if(e.align==="justify"&&e.wordWrap&&T<h.length-1){let N=0;for(const O of A)N+=ln(O.text);N>0&&(E=(c-P)/N)}const F=v+M;let B=k+s;for(let N=0;N<A.length;N++){const O=A[N],{width:R,font:D}=C[N];if(a.font=D,a.textBaseline=O.style.textBaseline,O.style._stroke?.width){const Y=O.style._stroke;if(a.lineWidth=Y.width,a.miterLimit=Y.miterLimit,a.lineJoin=Y.join,a.lineCap=Y.cap,b)if(O.style.dropShadow)this._setupDropShadow(a,O.style,i,S);else{const W=ln(O.text);B+=R+W*E;continue}else{const W=Js.measureFont(D),V=O.style.lineHeight||W.fontSize,H={width:R,height:V,lineHeight:V,lines:[O.text]};a.strokeStyle=Co(Y,a,H,s*2,B-s,v)}this._drawLetterSpacing(O.text,O.style,r,B,F+s-w,!0,E)}const z=ln(O.text);B+=R+z*E}B=k+s;for(let N=0;N<A.length;N++){const O=A[N],{width:R,font:D}=C[N];if(a.font=D,a.textBaseline=O.style.textBaseline,O.style._fill!==void 0){if(b)if(O.style.dropShadow)this._setupDropShadow(a,O.style,i,S);else{const Y=ln(O.text);B+=R+Y*E;continue}else{const Y=Js.measureFont(D),W=O.style.lineHeight||Y.fontSize,V={width:R,height:W,lineHeight:W,lines:[O.text]};a.fillStyle=Co(O.style._fill,a,V,s*2,B-s,v)}this._drawLetterSpacing(O.text,O.style,r,B,F+s-w,!1,E)}const z=ln(O.text);B+=R+z*E}v+=I}}}_setFillAndStrokeStyles(t,e,s,i,r,o=0,a=0){if(t.fillStyle=e._fill?Co(e._fill,t,s,i*2,o,a):null,e._stroke?.width){const h=r+i*2;t.strokeStyle=Co(e._stroke,t,s,h,o,a)}}_setupDropShadow(t,e,s,i){t.fillStyle="black",t.strokeStyle="black";const r=e.dropShadow,o=r.color,a=r.alpha;t.shadowColor=Nt.shared.setValue(o).setAlpha(a).toRgbaString();const h=r.blur*s,l=r.distance*s;t.shadowBlur=h,t.shadowOffsetX=Math.cos(r.angle)*l,t.shadowOffsetY=Math.sin(r.angle)*l+i}_getAlignmentOffset(t,e,s){return s==="right"?e-t:s==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,s,i,r,o=!1,a=0){const{context:h}=s,l=e.letterSpacing;let c=!1;if(Js.experimentalLetterSpacingSupported&&(Js.experimentalLetterSpacing?(h.letterSpacing=`${l}px`,h.textLetterSpacing=`${l}px`,c=!0):(h.letterSpacing="0px",h.textLetterSpacing="0px")),(l===0||c)&&a===0){o?h.strokeText(t,i,r):h.fillText(t,i,r);return}if(a!==0&&(l===0||c)){const p=t.split(" ");let m=i;const y=h.measureText(" ").width;for(let x=0;x<p.length;
389x++)o?h.strokeText(p[x],m,r):h.fillText(p[x],m,r),m+=h.measureText(p[x]).width+y+a;return}let u=i;const d=Js.graphemeSegmenter(t);let f=h.measureText(t).width,g=0;for(let p=0;p<d.length;++p){const m=d[p];o?h.strokeText(m,u,r):h.fillText(m,u,r);let y="";for(let x=p+1;x<d.length;++x)y+=d[x];g=h.measureText(y).width,u+=f-g+l,m===" "&&(u+=a),f=g}}}const bn=new iS,Rc=class Ni extends re{constructor(t={}){super(),this.uid=Kt("textStyle"),this._tick=0,this._cachedFontString=null,nS(t),t instanceof Ni&&(t=t._toObject());const i={...Ni.defaultTextStyle,...t};for(const r in i){const o=r;this[o]=i[r]}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({...Ni.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Ni.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({...Ze.defaultFillStyle,...t},()=>{this._fill=Yi({...this._originalFill},Ze.defaultFillStyle)})),this._fill=Yi(t===0?"black":t,Ze.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ze.defaultStrokeStyle,...t},()=>{this._stroke=ua({...this._originalStroke},Ze.defaultStrokeStyle)})),this._stroke=ua(t,Ze.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(){const t=Ni.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const s=e;this[s]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=Tl(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 Ni(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){const s=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(s),this._originalFill?.texture&&this._originalFill.texture.destroy(s),this._stroke?.texture&&this._stroke.texture.destroy(s),this._originalStroke?.texture&&this._originalStroke.texture.destroy(s)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(s,i,r)=>(s[i]===r||(s[i]=r,e?.(i,r),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Nt.isColorLike(t)||t instanceof Hs||t instanceof Ha)}};Rc.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Rc.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};let wt=Rc;function nS(n){const t=n;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=wt.defaultDropShadow;n.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){ut(Ct,"strokeThickness is now a part of stroke");const e=t.stroke;let s={};if(Nt.isColorLike(e))s.color=e;else if(e instanceof Hs||e instanceof Ha)s.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))s=e;else throw new Error("Invalid stroke value.");n.stroke={...s,width:t.strokeThickness}}
389if(Array.isArray(t.fillGradientStops)){if(ut(Ct,"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&&Dt("The number of fill colors must match the number of fill gradient stops.");const e=new Hs({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),s=t.fillGradientStops.slice(),i=t.fill.map(r=>Nt.shared.setValue(r).toNumber());s.forEach((r,o)=>{e.addColorStop(r,i[o])}),n.fill={fill:e}}}function rS(n,t){const{texture:e,bounds:s}=n,i=t._style._getFinalPadding();dp(s,t._anchor,e);const r=t._anchor._x*i*2,o=t._anchor._y*i*2;s.minX-=i-r,s.minY-=i-o,s.maxX-=i-r,s.maxY-=i-o}class oS{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()}}class aS extends oS{}class Vg{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new en({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),s=t.styleKey;return e.currentKey!==s?!0:t._didTextUpdate}addRenderable(t,e){const s=this._getGpuText(t);if(t._didTextUpdate){const i=t._autoResolution?this._renderer.resolution:t.resolution;(s.currentKey!==t.styleKey||t._resolution!==i)&&this._updateGpuText(t),t._didTextUpdate=!1,rS(s,t)}this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const 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){const e=new aS;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){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:s}=this._renderer;s.getReferenceCount(e.currentKey)>0?s.decreaseReferenceCount(e.currentKey):e.texture&&s.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}Vg.extension={type:[X.WebGLPipes,X.WebGPUPipes,X.CanvasPipes],name:"text"};class Ug{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,s,i){typeof t=="string"&&(ut("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:s,resolution:e}),t.style instanceof wt||(t.style=new wt(t.style)),t.textureStyle instanceof Vn||(t.textureStyle=new Vn(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:r,style:o,textureStyle:a,autoGenerateMipmaps:h}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:u}=bn.getCanvasAndContext({text:r,style:o,resolution:l}),d=g1(u.canvas,c.width,c.height,l,h);if(a&&(d.source.style=a),o.trim&&(c.pad(o.padding),d.frame.copyFrom(c),d.frame.scale(1/l),d.updateUvs()),o.filters){const f=this._applyFilters(d,o.filters);return this.returnTexture(d),bn.returnCanvasAndContext(u),f}return this._renderer.texture.initSource(d._source),this._retainCanvasContext||bn.returnCanvasAndContext(u),d}returnTexture(t){const e=t.source,s=e.resource;if(this._retainCanvasContext&&s?.getContext){const i=s.getContext("2d");i&&bn.returnCanvasAndContext({canvas:s,context:i})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Va.returnTexture(t,!0)}renderTextToCanvas(){ut("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const s=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:s,usageCount:1},s}decreaseReferenceCount(t){const 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){const s=this._renderer.renderTarget.renderTarget,i=this._renderer.f
389ilter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(s,!1),i}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class Gg extends Ug{constructor(t){super(t,!0)}}Gg.extension={type:[X.CanvasSystem],name:"canvasText"};class Xg extends Ug{constructor(t){super(t,!1)}}Xg.extension={type:[X.WebGLSystem,X.WebGPUSystem],name:"canvasText"};yt.add(Gg);yt.add(Xg);yt.add(Vg);class ht extends E1{constructor(...t){const e=F1(t,"Text");super(e,wt),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Vn?e.textureStyle:new Vn(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??Pe.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let s=0,i=0;if(this._style.trim){const{frame:r,canvasAndContext:o}=bn.getCanvasAndContext({text:this.text,style:this._style,resolution:1});bn.returnCanvasAndContext(o),s=r.width,i=r.height}else{const r=Js.measureText(this._text,this._style);s=r.width,i=r.height}t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}}class Lc extends ${static create(t){const{dynamic:e,textureOptions:s,...i}=t;return new Lc({...s,source:new Pe(i),dynamic:e??!1})}resize(t,e,s){return this.source.resize(t,e,s),this}}const $g=class Hg extends Bc{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(ut(Ct,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...Hg.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;const e=this.verticesX*this.verticesY,s=[],i=[],r=[],o=this.verticesX-1,a=this.verticesY-1,h=this.width/o,l=this.height/a;for(let u=0;u<e;u++){const d=u%this.verticesX,f=u/this.verticesX|0;s.push(d*h,f*l),i.push(d/o,f/a)}const c=o*a;for(let u=0;u<c;u++){const d=u%o,f=u/o|0,g=f*this.verticesX+d,p=f*this.verticesX+d+1,m=(f+1)*this.verticesX+d,y=(f+1)*this.verticesX+d+1;r.push(g,p,m,p,y,m)}this.buffers[0].data=new Float32Array(s),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint32Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};$g.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let hS=$g;class jg{constructor(t){this._renderer=t}validateRenderable(t){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){const e=this._renderer,s=e.canvasContext,i=s.activeContext;i.save();const r=t.groupTransform,o=e._roundPixels|t._roundPixels;s.setContextTransform(r,o===1),s.setBlendMode(t.groupBlendMode);const a=e.globalUniforms.globalUniformData?.worldColor??4294967295,h=t.groupColorAlpha,l=(a>>>24&255)/255,c=(h>>>24&255)/255,u=e.filter?.alphaMultiplier??1,d=l*c*u;if(d<=0){i.restore();return}i.globalAlpha=d;const f=a&16777215,g=h&16777215,p=En(Ya(g,f)),m=t.texture,y=Tt.getCanvasSource(m);if(!y){i.restore();return}const x=s.smoothProperty,_=m.source.style.scaleMode!=="nearest";i[x]!==_&&(i[x]=_);const b=p!==16777215||m.rotate!==0,w=b?Tt.getTintedCanvas({texture:m},p):y,{leftWidth:S,topHeight:v,rightWidth:T,bottomHeight:A,width:P,height:M}=t,I=S+T,C=v+A,k=Math.min(I>P?P/I:1,C>M?M/C:1,1),E=S*k,F=T*k,B=v*k,N=A*k,O=Math.max(0,P-E-F),R=Math.max(0,M-B-N),D=t.anchor,z=m.source._resolution??m.source.resolution??1;let Y=m.frame.x*z,W=m.frame.y*z;const V=-D.x*P,H=-D.y*M,K=S*z,tt=v*z,xt=T*z,et=A*z;let St=m.frame.width*z,bt=m.frame.height*z;b&&(Y=0,W=0,St=w.width,bt=w.height),i.drawImage(w,Y,W,K,tt,V,H,E,B),i.drawImage(w,Y+K,W,St-K-xt,tt,V+E,H,O,B),i.drawImage(w,Y+St-xt,W,xt,tt,V+P-F,H,F,B),i.drawImage(w,Y,W+tt,K,bt-tt-et,V,H+B,E,R),i.drawImage(w,Y+K,W+tt,St-K-xt,bt-tt-et,V+E,H+B,O,R),i.drawImage(w,Y+St-xt,W+tt,xt,bt-tt-et,V+P-F,H+B,F,R),i.drawImage(w,Y,W+bt-et,K,et,V,H+M-N,E,N),i.drawImage(w,Y+K,W+bt-et,St-K-xt,et,V+E,H+M-N,O,N),i.drawImage(w,Y+St-xt,W+bt-et,xt,et,V+P-F,H+M-N,F,N),i.restore(
389)}destroy(){this._renderer=null}}jg.extension={type:[X.CanvasPipes],name:"nineSliceSprite"};const qg=class $o extends hS{constructor(t={}){t={...$o.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this._trimX=0,this._trimY=0,this._trimWidth=t.originalWidth??$o.defaultOptions.originalWidth,this._trimHeight=t.originalHeight??$o.defaultOptions.originalHeight,this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,t.trim!==void 0?(this._trimX=t.trim?.x??0,this._trimY=t.trim?.y??0,this._trimWidth=t.trim?.width??this._originalWidth,this._trimHeight=t.trim?.height??this._originalHeight):(this._trimWidth=this._originalWidth,this._trimHeight=this._originalHeight),this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,{width:e,height:s,_leftWidth:i,_rightWidth:r,_topHeight:o,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=i+r,u=e>c?1:e/c,d=o+a,f=s>d?1:s/d,g=Math.min(u,f),p=h*e,m=l*s;t[0]=t[8]=t[16]=t[24]=-p,t[2]=t[10]=t[18]=t[26]=i*g-p,t[4]=t[12]=t[20]=t[28]=e-r*g-p,t[6]=t[14]=t[22]=t[30]=e-p,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=o*g-m,t[17]=t[19]=t[21]=t[23]=s-a*g-m,t[25]=t[27]=t[29]=t[31]=s-m,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs,e=this._originalWidth,s=this._originalHeight,i=this._trimX/e,r=this._trimY/s,o=(this._trimX+this._trimWidth)/e,a=(this._trimY+this._trimHeight)/s;t[0]=t[8]=t[16]=t[24]=i,t[1]=t[3]=t[5]=t[7]=r,t[6]=t[14]=t[22]=t[30]=o,t[25]=t[27]=t[29]=t[31]=a;const h=1/e,l=1/s;t[2]=t[10]=t[18]=t[26]=i+h*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r+l*this._topHeight,t[4]=t[12]=t[20]=t[28]=o-h*this._rightWidth,t[17]=t[19]=t[21]=t[23]=a-l*this._bottomHeight,this.getBuffer("aUV").update()}};qg.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let Wi=qg;class lS extends Fg{constructor(){super(),this.geometry=new Wi}destroy(){this.geometry.destroy()}}class Kg{constructor(t){this._renderer=t,this._managedSprites=new en({renderer:t,type:"renderable",name:"nineSliceSprite"})}addRenderable(t,e){const s=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=t._gpuData[this._renderer.uid]=new lS,s=e;return s.renderable=t,s.transform=t.groupTransform,s.texture=t._texture,s.roundPixels=this._renderer._roundPixels|t._roundPixels,this._managedSprites.add(t),t.didViewUpdate||this._updateBatchableSprite(t,s),e}destroy(){this._managedSprites.destroy(),this._renderer=null}}Kg.extension={type:[X.WebGLPipes,X.WebGPUPipes],name:"nineSliceSprite"};yt.add(jg);yt.add(Kg);const Zg=class Qg extends er{constructor(t){t instanceof $&&(t={texture:t});const{width:e,height:s,anchor:i,leftWidth:r,rightWidth:o,topHeight:a,bottomHeight:h,texture:l,roundPixels:c,...u}=t;super({label:"NineSliceSprite",...u}),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=r??l?.defaultBorders?.left??Wi.defaultOptions.leftWidth,this._topHeight=a??l?.defaultBorders?.top??Wi.defaultOptions.topHeight,this._rightWidth=o??l?.defaultBorders?.right??Wi.defaultOptions.rightWidth,this._bottomHeight=h??l?.defaultBorders?.bottom??Wi.defaultOptions.bottomHeight,this._width=e??l.width??Wi.defaultOptions.width,this._height=s??l.height??Wi.defaultOptions.height,this.allowChildren=!1,this.texture=l??Qg.defaultOptions.texture,this.roundPixels=c??!1,this._anchor=new Vt({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}
389set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return this._width}set width(t){this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this._height=t,this.onViewUpdate()}setSize(t,e){typeof t=="object"&&(e=t.height??t.width,t=t.width),this._width=t,this._height=e??t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=$.EMPTY);const 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.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}get trim(){return this._texture.trim??null}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(s)}this._texture=null}updateBounds(){const t=this._bounds,e=this._anchor,s=this._width,i=this._height;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*i,t.maxY=t.minY+i}};Zg.defaultOptions={texture:$.EMPTY};let cS=Zg;yt.add(Wy,zy);class ui extends j{constructor(){super(),this.LayerGroup=Zi.getInstance(),ui.instance||(ui.instance=this),this.addToLayer()}addToLayer(){this.LayerGroup.addChild(this)}static getInstance(){return ui.instance}}if(typeof window<"u"&&window.PIXI){const n=window.require;window.require=t=>{if(n)return n(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}class rk{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class uS{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,i=t.length;s<i;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class Q{r;g;b;a;static WHITE=new Q(1,1,1,1);static RED=new Q(1,0,0,1);static GREEN=new Q(0,1,0,1);static BLUE=new Q(0,0,1,1);static MAGENTA=new Q(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){const t=e=>`0${(e*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,e=new Q){return e.setFromString(t)}}class U{static epsilon=1e-5;static epsilon2=U.epsilon*U.epsilon;static PI=3.1415927;static PI2=U.PI*2;static invPI2=1/U.PI2;static radiansToDegrees=180/U.PI;static radDeg=U.radiansToDegrees;static degreesToRadians=U.PI/180;static degRad=U.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*U.degRad)}static sinDeg(t){return Math.sin(t*U.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*U.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return U.randomTriangularWith(t,e,(t+e)*.5)}
389static randomTriangularWith(t,e,s){const i=Math.random(),r=e-t;return i<=(s-t)/r?t+Math.sqrt(i*r*(s-t)):e-Math.sqrt((1-i)*r*(e-s))}static isPowerOfTwo(t){return t&&(t&t-1)===0}}let Ho=class gn{static linear=new class extends gn{applyInternal(t){return t}};static smooth=new class extends gn{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends gn{applyInternal(t){return t*t}};static fastSlow=new class extends gn{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends gn{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,e,s){return e===void 0||s===void 0?this.applyInternal(t):t+(e-t)*this.applyInternal(s)}};class dS extends Ho{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}}class ok extends dS{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}}class G{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,e,s,i,r){for(let o=e,a=i;o<e+r;o++,a++)s[a]=t[o]}static arrayFill(t,e,s,i){for(let r=e;r<s;r++)t[r]=i}static setArraySize(t,e,s=0){const i=t.length;if(i===e)return t;if(t.length=e,i<e)for(let r=i;r<e;r++)t[r]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:G.setArraySize(t,e,s)}static newArray(t,e){const s=[];for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(G.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const e=[];for(let s=0;s<e.length;s++)e[s]=0;return e}}static newShortArray(t){if(G.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const e=[];for(let s=0;s<e.length;s++)e[s]=0;return e}}static toFloatArray(t){return G.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return G.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,e,s=!0){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class ak{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}}class Gr{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset?.(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class Al{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}}class hk{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class lk{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class Jg{_image;constructor(t){this._image=t}getImage(){return this._image}}var ce;(function(n){n[n.Nearest=9728]="Nearest",n[n.Linear=9729]="Linear",n[n.MipMap=9987]="MipMap",n[n.MipMapNearestNearest=9984]="MipMapNearestNearest",n[n.MipMapLinearNearest=9985]="MipMapLinearNearest",n[n.MipMapNearestLinear=9986]="MipMapNearestLinear",n[n.MipMapLinearLinear=9987]="MipMapLinearLinear"})(ce||(ce={}));var Gs;(function(n){n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat"})(Gs||(Gs={}));class fS{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class ck extends Jg{setFilters(t,e){}setWraps(t,e){}dispose(){}}class pS{pages=[];regions=[];constructor(t){const e=new gS(t),s=new Array(4),i={};i.size=c=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},i.format=()=>{},i.filter=c=>
vendor: 9,094 bytes, line 389
389{c.minFilter=G.enumValue(ce,s[1]),c.magFilter=G.enumValue(ce,s[2])},i.repeat=c=>{s[1].indexOf("x")!==-1&&(c.uWrap=Gs.Repeat),s[1].indexOf("y")!==-1&&(c.vWrap=Gs.Repeat)},i.pma=c=>{c.pma=s[1]==="true"};var r={};r.xy=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2])},r.size=c=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},r.bounds=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2]),c.width=parseInt(s[3]),c.height=parseInt(s[4])},r.offset=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2])},r.orig=c=>{c.originalWidth=parseInt(s[1]),c.originalHeight=parseInt(s[2])},r.offsets=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2]),c.originalWidth=parseInt(s[3]),c.originalHeight=parseInt(s[4])},r.rotate=c=>{const u=s[1];u==="true"?c.degrees=90:u!=="false"&&(c.degrees=parseInt(u))},r.index=c=>{c.index=parseInt(s[1])};let o=e.readLine();for(;o&&o.trim().length===0;)o=e.readLine();for(;!(!o||o.trim().length===0||e.readEntry(s,o)===0);)o=e.readLine();let a=null,h=null,l=null;for(;o!==null;)if(o.trim().length===0)a=null,o=e.readLine();else if(a){const c=new tm(a,o);for(;;){const u=e.readEntry(s,o=e.readLine());if(u===0)break;const d=r[s[0]];if(d)d(c);else{h||(h=[]),l||(l=[]),h.push(s[0]);const f=[];for(let g=0;g<u;g++)f.push(parseInt(s[g+1]));l.push(f)}}c.originalWidth===0&&c.originalHeight===0&&(c.originalWidth=c.width,c.originalHeight=c.height),h&&h.length>0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/a.width,c.v=c.y/a.height,c.degrees===90?(c.u2=(c.x+c.height)/a.width,c.v2=(c.y+c.width)/a.height):(c.u2=(c.x+c.width)/a.width,c.v2=(c.y+c.height)/a.height),this.regions.push(c)}else{for(a=new mS(o.trim());e.readEntry(s,o=e.readLine())!==0;){const c=i[s[0]];c&&c(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name===t)return this.regions[e];return null}setTextures(t,e=""){for(const s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class gS{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length===0))return 0;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){const o=e.indexOf(",",r);if(o===-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,o-r).trim(),r=o+1,i===4)return 4}}}class mS{name;minFilter=ce.Nearest;magFilter=ce.Nearest;uWrap=Gs.ClampToEdge;vWrap=Gs.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}}class tm extends fS{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class ja{static empty=[];name;timelineAttachment;timelineSlots=ja.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,e,s){let i=t[e];if(i.bone.isActive()){const r=(s?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,o=this.timelineSlots.length;r<o;r++){if(i=t[this.timelineSlots[r]],!i.bone.isActive())continue;const a=(s?i.getAppliedPose():i.getPose()).getAttachment();if(a!=null&&a.timelineAttachment===this)return!0}return!1}}class js extends ja{static nextID=0;id=js.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,e,s,i,r,o,a){i=o+(i>>1)*a;const h=e.appliedPose.deform;let l=this.vertices;const c=this.bones;if(!c){h.length>0&&(l=h);const g=e.bone.appliedPose,p=g.worldX,m=g.worldY,y=g.a,x=g.b,_=g.c,b=g.d;for(let w=s,S=o;S<i;w+=2,S+=a){const v=l[w],T=l[w+1];r[S]=v*y+T*x+p,r[S+1]=v*_+T*b+m}return}let u=0,d=0;for(let g=0;g<s;g+=2){const p=c[u];u+=p+1,d+=p}const f=t.bones;if(h.length===0)for(let g=o,p=d*3;g<i;g+=a){let m=0,y=0,x=c[u++];for(x+=u;u<x;u++,p+=3){const _=f[c[u]].appliedPose,b=l[p],w=l[p+1],S=l[p+2];m+=(b*_.a+w*_.b+_.worldX)*S,y+=(b*_.c+w*_.d+_.worldY)*S}r[g]=m,r[g+1]=y}else{const g=h;for(let p=o,m=d*3,y=d<<1;p<i;p+=a){let x=0,_=0,b=c[u++];for(b+=u;u<b;u++,m+=3,y+=2){const w=f[c[u]].appliedPose,S=l[m]+g[y],v=l[m+1]+g[y+1],T=l[m+2];x+=(S*w.a+v*w.b+w.worldX)*T,_+=(S*w.c+v*w.d+w.worldY)*T}r[p]=x,r[p+1]=_}}}copyTo(t){this.bones?(t.bones=[],G.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=G.newFloatArray(this.vertices.length),G.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}}class xe extends js{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new Q(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new Q(0,0,0,0);constructor(t,e){super(t),this.sequence=e}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new xe(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],G.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],G.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],G.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new xe(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,e,s){if(!t)throw new Error("Region not set.");const i=s.length;let r=t.u,o=t.v,a=0,h=0;if(t instanceof tm){const l=t.page,c=l.width,u=l.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/c,o-=(t.originalWidth-t.offsetX-t.width)/u,a=t.originalHeight/c,h=t.originalWidth/u;for(let d=0;d<i;d+=2)s[d]=r+e[d+1]*a,s[d+1]=o+(1-e[d])*h;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/c,o-=t.offsetY/u,a=t.originalWidth/c,h=t.originalHeight/u;for(let d=0;d<i;d+=2)s[d]=r+(1-e[d])*a,s[d+1]=o+(1-e[d+1])*h;return;case 270:r-=t.offsetY/c,o-=t.offsetX/u,a=t.originalHeight/c,h=t.originalWidth/u;for(let d=0;d<i;d+=2)s[d]=r+(1-e[d+1])*a,s[d+1]=o+e[d]*h;return;default:r-=t.offsetX/c,o-=(t.originalHeight-t.offsetY-t.height)/u,a=t.originalWidth/c,h=t.originalHeight/u}}else t?(a=t.u2-r,h=t.v2-o):(r=o=0,a=h=1);for(let l=0;l<i;l+=2)s[l]=r+e[l]*a,s[l+1]=o+e[l+1]*h}}class at extends ja{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new Q(1,1,1,1);tempColor=new Q(1,1,1,1);constructor(t,e){super(t),this.sequence=e}copy(){const t=new at(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,e,s,i,r){const o=t.bone.appliedPose,a=o.worldX,h=o.worldY,l=o.a,c=o.b,u=o.c,d=o.d;let f=e[0],g=e[1];s[i]=f*l+g*c+a,s[i+1]=f*u+g*d+h,i+=r,f=e[2],g=e[3],s[i]=f*l+g*c+a,s[i+1]=f*u+g*d+h,i+=r,f=e[4],g=e[5],s[i]=f*l+g*c+a,s[i+1]=f*u+g*d+h,i+=r,f=e[6],g=e[7],s[i]=f*l+g*c+a,s[i+1]=f*u+g*d+h}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,e,s,i,r,o,a,h,l,c){if(!t)throw new Error("Region not set.");const u=a/t.originalWidth*i,d=h/t.originalHeight*r,f=-a/2*i+t.offsetX*u,g=-h/2*r+t.offsetY*d,p=f+t.width*u,m=g+t.height*d,y=o*U.degRad,x=Math.cos(y),_=Math.sin(y),b=f*x+e,w=f*_,S=g*x+s,v=g*_,T=p*x+e,A=p*_,P=m*x+s,M=m*_;l[0]=b-v,l[1]=S+w,l[2]=b-M,l[3]=P+w,l[4]=T-M,l[5]=P+A,l[6]=T-v,l[7]=S+A,t==null?(c[0]=0,c[1]=0,c[2]=0,c[3]=1,c[4]=1,c[5]=1,c[6]=1,c[7]=0):(c[1]=t.v2,c[2]=t.u,c[5]=t.v,c[6]=t.u2,t.degrees===90?(c[0]=t.u2,c[3]=t.v2,c[4]=t.u,c[7]=t.v):(c[0]=t.u,c[3]=t.v,c[4]=t.u2,c[7]=t.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}let pa=class jo{static _nextID=0;id=jo.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,e){this.regions=new Array(t),this.pathSuffix=e}copy(){const t=this.regions.length,e=new jo(t,this.pathSuffix);
389if(G.arrayCopy(this.regions,0,e.regions,0,t),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,this.uvs!=null){const s=this.uvs[0].length;e.uvs=[];for(let i=0;i<t;i++)e.uvs[i]=G.newFloatArray(s),G.arrayCopy(this.uvs[i],0,e.uvs[i],0,s)}if(this.offsets!=null){e.offsets=[];for(let s=0;s<t;s++)e.offsets[s]=[],G.arrayCopy(this.offsets[s],0,e.offsets[s],0,8)}return e}update(t){const e=this.regions.length;if(t instanceof at){this.uvs=[],this.offsets=[];for(let s=0;s<e;s++)this.uvs[s]=G.newFloatArray(8),this.offsets[s]=[],at.computeUVs(this.regions[s],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[s],this.uvs[s])}else if(t instanceof xe){const s=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<e;i++)this.uvs[i]=G.newFloatArray(s.length),xe.computeUVs(this.regions[i],s,this.uvs[i])}}resolveIndex(t){let e=t.sequenceIndex;return e===-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1),e}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,e){if(!this.pathSuffix)return t;let s=t;const i=(this.start+e).toString();for(let r=this.digits-i.length;r>0;r--)s+="0";return s+=i,s}static nextID(){return jo._nextID++}};var pe;(function(n){n[n.hold=0]="hold",n[n.once=1]="once",n[n.loop=2]="loop",n[n.pingpong=3]="pingpong",n[n.onceReverse=4]="onceReverse",n[n.loopReverse=5]="loopReverse",n[n.pingpongReverse=6]="pingpongReverse"})(pe||(pe={}));const em=[pe.hold,pe.once,pe.loop,pe.pingpong,pe.onceReverse,pe.loopReverse,pe.pingpongReverse];let Oc=class{name;timelines=[];timelineIds;bones;color=new Q(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new uS,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,i=t;for(let r=0;r<e;r++){const o=i[r];this.timelineIds.addAll(o.propertyIds),xS(o)&&s.add(o.boneIndex)&&this.bones.push(o.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,o,a,h,l,c){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const u=this.timelines;for(let d=0,f=u.length;d<f;d++)u[d].apply(t,e,s,r,o,a,h,l,c)}};var q;(function(n){n[n.current=0]="current",n[n.setup=1]="setup",n[n.first=2]="first"})(q||(q={}));var nt;(function(n){n[n.rotate=0]="rotate",n[n.x=1]="x",n[n.y=2]="y",n[n.scaleX=3]="scaleX",n[n.scaleY=4]="scaleY",n[n.shearX=5]="shearX",n[n.shearY=6]="shearY",n[n.inherit=7]="inherit",n[n.rgb=8]="rgb",n[n.alpha=9]="alpha",n[n.rgb2=10]="rgb2",n[n.attachment=11]="attachment",n[n.deform=12]="deform",n[n.event=13]="event",n[n.drawOrder=14]="drawOrder",n[n.drawOrderFolder=15]="drawOrderFolder",n[n.ikConstraint=16]="ikConstraint",n[n.transformConstraint=17]="transformConstraint",n[n.pathConstraintPosition=18]="pathConstraintPosition",n[n.pathConstraintSpacing=19]="pathConstraintSpacing",n[n.pathConstraintMix=20]="pathConstraintMix",n[n.physicsConstraintInertia=21]="physicsConstraintInertia",n[n.physicsConstraintStrength=22]="physicsConstraintStrength",n[n.physicsConstraintDamping=23]="physicsConstraintDamping",n[n.physicsConstraintMass=24]="physicsConstraintMass",n[n.physicsConstraintWind=25]="physicsConstraintWind",n[n.physicsConstraintGravity=26]="physicsConstraintGravity",n[n.physicsConstraintMix=27]="physicsConstraintMix",n[n.physicsConstraintReset=28]="physicsConstraintReset",n[n.sequence=29]="sequence",n[n.sliderTime=30]="sliderTime",n[n.sliderMix=31]="sliderMix"})(nt||(nt={}));let Mt=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=G.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(t,e,s=1){const i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}};function yS(n){return typeof n=="object"&&n!==null&&typeof n.slotIndex=="number"}class sn extends Mt{curves;constructor(t,e,...s){super(t,...s),this.curves=G.newFloatArray(t
389+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=G.newFloatArray(e);G.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,o,a,h,l,c,u){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const g=(i-o*2+h)*.03,p=(r-a*2+l)*.03,m=((o-h)*3-i+c)*.006,y=((a-l)*3-r+u)*.006;let x=g*2+m,_=p*2+y,b=(o-i)*.3+g+m*.16666667,w=(a-r)*.3+p+y*.16666667,S=i+b,v=r+w;for(let T=f+18;f<T;f+=2)d[f]=S,d[f+1]=v,b+=x,w+=_,x+=m,_+=y,S+=b,v+=w}getBezierValue(t,e,s,i){const r=this.curves;if(r[i]>t){const l=this.frames[e],c=this.frames[e+s];return c+(t-l)/(r[i]-l)*(r[i+1]-c)}const o=i+18;for(i+=2;i<o;i+=2)if(r[i]>=t){const l=r[i-2],c=r[i-1];return c+(t-l)/(r[i]-l)*(r[i+1]-c)}e+=this.getFrameEntries();const a=r[o-2],h=r[o-1];return h+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-h)}}class Ys extends sn{constructor(t,e,s){super(t,e,s)}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}const i=this.curves[s>>1];switch(i){case 0:{const r=e[s],o=e[s+1];return o+(t-r)/(e[s+2]-r)*(e[s+2+1]-o)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r,o){if(t<this.frames[0])return Ys.beforeFirstKey(s,e,r,o);const a=this.getCurveValue(t);return s===q.setup?o+a*e:r+(i?a:a+o-r)*e}getAbsoluteValue(t,e,s,i,r,o,a){return a===void 0?this.getAbsoluteValue1(t,e,s,i,r,o):this.getAbsoluteValue2(t,e,s,i,r,o,a)}getAbsoluteValue1(t,e,s,i,r,o){if(t<this.frames[0])return Ys.beforeFirstKey(s,e,r,o);const a=this.getCurveValue(t);return s===q.setup?o+(i?a:a-o)*e:r+(i?a:a-r)*e}getAbsoluteValue2(t,e,s,i,r,o,a){return t<this.frames[0]?Ys.beforeFirstKey(s,e,r,o):s===q.setup?o+(i?a:a-o)*e:r+(i?a:a-r)*e}getScaleValue(t,e,s,i,r,o,a){if(t<this.frames[0])return Ys.beforeFirstKey(s,e,o,a);const h=this.getCurveValue(t)*a;if(e===1&&!i)return h;let l=s===q.setup?a:o;return i?l+(h-a)*e:r?l+(Math.abs(h)*Math.sign(l)-l)*e:(l=Math.abs(l)*Math.sign(h),l+(h-l)*e)}static beforeFirstKey(t,e,s,i){switch(t){case q.setup:return i;case q.first:return s+(i-s)*e;case q.current:return s}}}function xS(n){return typeof n=="object"&&n!==null&&typeof n.boneIndex=="number"}class nn extends Ys{boneIndex;constructor(t,e,s,i){super(t,e,`${i}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,i,r,o,a,h,l){const c=t.bones[this.boneIndex];c.active&&this.apply1(l?c.appliedPose:c.pose,c.data.setupPose,s,r,o,a,h)}}class Dc extends sn{boneIndex;constructor(t,e,s,i,r){super(t,e,`${i}|${s}`,`${r}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}apply(t,e,s,i,r,o,a,h,l){const c=t.bones[this.boneIndex];c.active&&this.apply1(l?c.appliedPose:c.pose,c.data.setupPose,s,r,o,a,h)}}class ga extends nn{constructor(t,e,s){super(t,e,s,nt.rotate)}apply1(t,e,s,i,r,o,a){t.rotation=this.getRelativeValue(s,i,r,o,t.rotation,e.rotation)}}class sm extends Dc{constructor(t,e,s){super(t,e,s,nt.x,nt.y)}apply1(t,e,s,i,r,o,a){const h=this.frames;if(s<h[0]){switch(r){case q.setup:t.x=e.x,t.y=e.y;break;case q.first:t.x+=(e.x-t.x)*i,t.y+=(e.y-t.y)*i;break}return}let l=0,c=0;const u=Mt.search(h,s,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];const g=(s-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*g,c+=(h[u+3+2]-c)*g;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}r===q.setup?(t.x=e.x+l*i,t.y=e.y+c*i):o?(t.x+=l*i,t.y+=c*i):(t.x+=(e.x+l-t.x)*i,t.y+=(e.y+c-t.y)*i)}}class im extends nn{constructor(t,e,s){super(t,e,s,nt.x)}apply1(t,e,s,i,r,o,a){t.x=this.getRelativeValue(s,i,r,o,t.x,e.x)}}class nm extends nn{constructor(t,e,s){super(t,e,s,nt.y)}apply1(t,e,s,i,r,o,a){t.y=this.getRelativeValue(s,i,r,o,t.y,e.y)}}class rm extends Dc{constructor(t,e,s){super(t,e,s,nt.scaleX,nt.scaleY)}apply1(t,e,s,i,r,o,a){const h=this.frames;if(s<h[0]){switch(r){case q.setup:t.scaleX=e.scaleX,t.scaleY=e.scaleY;break;case q.first:t.scaleX+=(e.scaleX-t.scaleX)*i,t.scaleY+=(e.scaleY-t.scaleY)*i;break}return}let l,c;const u=Mt.search(h,s,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];
389const g=(s-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*g,c+=(h[u+3+2]-c)*g;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}if(l*=e.scaleX,c*=e.scaleY,i===1&&!o)t.scaleX=l,t.scaleY=c;else{let f=0,g=0;r===q.setup?(f=e.scaleX,g=e.scaleY):(f=t.scaleX,g=t.scaleY),o?(t.scaleX=f+(l-e.scaleX)*i,t.scaleY=g+(c-e.scaleY)*i):a?(t.scaleX=f+(Math.abs(l)*Math.sign(f)-f)*i,t.scaleY=g+(Math.abs(c)*Math.sign(g)-g)*i):(f=Math.abs(f)*Math.sign(l),g=Math.abs(g)*Math.sign(c),t.scaleX=f+(l-f)*i,t.scaleY=g+(c-g)*i)}}}class om extends nn{constructor(t,e,s){super(t,e,s,nt.scaleX)}apply1(t,e,s,i,r,o,a){t.scaleX=this.getScaleValue(s,i,r,o,a,t.scaleX,e.scaleX)}}class am extends nn{constructor(t,e,s){super(t,e,s,nt.scaleY)}apply1(t,e,s,i,r,o,a){t.scaleY=this.getScaleValue(s,i,r,o,a,t.scaleY,e.scaleY)}}class hm extends Dc{constructor(t,e,s){super(t,e,s,nt.shearX,nt.shearY)}apply1(t,e,s,i,r,o,a){const h=this.frames;if(s<h[0]){switch(r){case q.setup:t.shearX=e.shearX,t.shearY=e.shearY;break;case q.first:t.shearX+=(e.shearX-t.shearX)*i,t.shearY+=(e.shearY-t.shearY)*i;break}return}let l=0,c=0;const u=Mt.search(h,s,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];const g=(s-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*g,c+=(h[u+3+2]-c)*g;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}r===q.setup?(t.shearX=e.shearX+l*i,t.shearY=e.shearY+c*i):o?(t.shearX+=l*i,t.shearY+=c*i):(t.shearX+=(e.shearX+l-t.shearX)*i,t.shearY+=(e.shearY+c-t.shearY)*i)}}class lm extends nn{constructor(t,e,s){super(t,e,s,nt.shearX)}apply1(t,e,s,i,r,o,a){t.shearX=this.getRelativeValue(s,i,r,o,t.shearX,e.shearX)}}class cm extends nn{constructor(t,e,s){super(t,e,s,nt.shearY)}
389apply1(t,e,s,i,r,o,a){t.shearY=this.getRelativeValue(s,i,r,o,t.shearY,e.shearY)}}class um extends Mt{boneIndex;constructor(t,e){super(t,`${nt.inherit}|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,o,a,h,l){const c=t.bones[this.boneIndex];if(!c.active)return;const u=l?c.appliedPose:c.pose;if(h)o!==q.current&&(u.inherit=c.data.setupPose.inherit);else{const d=this.frames;s<d[0]?o!==q.current&&(u.inherit=c.data.setupPose.inherit):u.inherit=this.frames[Mt.search(d,s,2)+1]}}}class qa extends sn{slotIndex;constructor(t,e,s,...i){super(t,e,...i),this.slotIndex=s}apply(t,e,s,i,r,o,a,h,l){const c=t.slots[this.slotIndex];c.bone.active&&this.apply1(c,l?c.appliedPose:c.pose,s,r,o,a)}}class dm extends qa{constructor(t,e,s){super(t,e,s,`${nt.rgb}|${s}`,`${nt.alpha}|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,i,r,o){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=o}apply1(t,e,s,i,r,o){const a=e.color,h=this.frames;if(s<h[0]){const p=t.data.setupPose.color;switch(r){case q.setup:a.setFromColor(p);break;case q.first:a.add((p.r-a.r)*i,(p.g-a.g)*i,(p.b-a.b)*i,(p.a-a.a)*i);break}return}let l=0,c=0,u=0,d=0;const f=Mt.search(h,s,5),g=this.curves[f/5];switch(g){case 0:{const p=h[f];l=h[f+1],c=h[f+2],u=h[f+3],d=h[f+4];const m=(s-p)/(h[f+5]-p);l+=(h[f+5+1]-l)*m,c+=(h[f+5+2]-c)*m,u+=(h[f+5+3]-u)*m,d+=(h[f+5+4]-d)*m;break}case 1:l=h[f+1],c=h[f+2],u=h[f+3],d=h[f+4];break;default:l=this.getBezierValue(s,f,1,g-2),c=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),d=this.getBezierValue(s,f,4,g+54-2)}if(i===1)a.set(l,c,u,d);else if(r===q.setup){const p=t.data.setupPose.color;a.set(p.r+(l-p.r)*i,p.g+(c-p.g)*i,p.b+(u-p.b)*i,p.a+(d-p.a)*i)}else a.add((l-a.r)*i,(c-a.g)*i,(u-a.b)*i,(d-a.a)*i)}}class fm extends qa{constructor(t,e,s){super(t,e,s,`${nt.rgb}|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply1(t,e,s,i,r,o){const a=e.color;let h=0,l=0,c=0;const u=this.frames;if(s<u[0]){const g=t.data.setupPose.color;switch(r){case q.setup:{a.r=g.r,a.g=g.g,a.b=g.b;break}case q.first:{a.r+=(g.r-a.r)*i,a.g+=(g.g-a.g)*i,a.b+=(g.b-a.b)*i;break}}return}
vendor: 6,894 bytes, line 389
389const d=Mt.search(u,s,4),f=this.curves[d>>2];switch(f){case 0:{const g=u[d];h=u[d+1],l=u[d+2],c=u[d+3];const p=(s-g)/(u[d+4]-g);h+=(u[d+4+1]-h)*p,l+=(u[d+4+2]-l)*p,c+=(u[d+4+3]-c)*p;break}case 1:h=u[d+1],l=u[d+2],c=u[d+3];break;default:h=this.getBezierValue(s,d,1,f-2),l=this.getBezierValue(s,d,2,f+18-2),c=this.getBezierValue(s,d,3,f+36-2)}if(i!==1)if(r===q.setup){const g=t.data.setupPose.color;h=g.r+(h-g.r)*i,l=g.g+(l-g.g)*i,c=g.b+(c-g.b)*i}else h=a.r+(h-a.r)*i,l=a.g+(l-a.g)*i,c=a.b+(c-a.b)*i;a.r=h<0?0:h>1?1:h,a.g=l<0?0:l>1?1:l,a.b=c<0?0:c>1?1:c}}class pm extends Ys{slotIndex=0;constructor(t,e,s){super(t,e,`${nt.alpha}|${s}`),this.slotIndex=s}apply(t,e,s,i,r,o,a,h,l){const c=t.slots[this.slotIndex];if(!c.bone.active)return;const u=(l?c.appliedPose:c.pose).color;let d=0;const f=this.frames;if(s<f[0]){const g=c.data.setupPose.color.a;switch(o){case q.setup:u.a=g;break;case q.first:u.a+=(g-u.a)*r;break}return}if(d=this.getCurveValue(s),r!==1)if(o===q.setup){const g=c.data.setupPose.color;d=g.a+(d-g.a)*r}else d=u.a+(d-u.a)*r;u.a=d<0?0:d>1?1:d}}class gm extends qa{constructor(t,e,s){super(t,e,s,`${nt.rgb}|${s}`,`${nt.alpha}|${s}`,`${nt.rgb2}|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,i,r,o,a,h,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=o,this.frames[t+5]=a,this.frames[t+6]=h,this.frames[t+7]=l}apply1(t,e,s,i,r,o){const a=e.color,h=e.darkColor;let l=0,c=0,u=0;const d=this.frames;if(s<d[0]){const _=t.data.setupPose,b=_.color,w=_.darkColor;switch(r){case q.setup:{a.setFromColor(b),h.r=w.r,h.g=w.g,h.b=w.b;break}case q.first:{a.add((b.r-a.r)*i,(b.g-a.g)*i,(b.b-a.b)*i,(b.a-a.a)*i),h.r+=(w.r-h.r)*i,h.g+=(w.g-h.g)*i,h.b+=(w.b-h.b)*i;break}}return}let f=0,g=0,p=0,m=0;const y=Mt.search(d,s,8),x=this.curves[y>>3];switch(x){case 0:{const _=d[y];f=d[y+1],g=d[y+2],p=d[y+3],m=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];const b=(s-_)/(d[y+8]-_);f+=(d[y+8+1]-f)*b,g+=(d[y+8+2]-g)*b,p+=(d[y+8+3]-p)*b,m+=(d[y+8+4]-m)*b,l+=(d[y+8+5]-l)*b,c+=(d[y+8+6]-c)*b,u+=(d[y+8+7]-u)*b;break}case 1:f=d[y+1],g=d[y+2],p=d[y+3],m=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];break;default:f=this.getBezierValue(s,y,1,x-2),g=this.getBezierValue(s,y,2,x+18-2),p=this.getBezierValue(s,y,3,x+36-2),m=this.getBezierValue(s,y,4,x+54-2),l=this.getBezierValue(s,y,5,x+72-2),c=this.getBezierValue(s,y,6,x+90-2),u=this.getBezierValue(s,y,7,x+108-2)}if(i===1)a.set(f,g,p,m);else if(r===q.setup){const _=t.data.setupPose;let b=_.color;a.set(b.r+(f-b.r)*i,b.g+(g-b.g)*i,b.b+(p-b.b)*i,b.a+(m-b.a)*i),b=_.darkColor,l=b.r+(l-b.r)*i,c=b.g+(c-b.g)*i,u=b.b+(u-b.b)*i}else a.add((f-a.r)*i,(g-a.g)*i,(p-a.b)*i,(m-a.a)*i),l=h.r+(l-h.r)*i,c=h.g+(c-h.g)*i,u=h.b+(u-h.b)*i;h.r=l<0?0:l>1?1:l,h.g=c<0?0:c>1?1:c,h.b=u<0?0:u>1?1:u}}class mm extends qa{constructor(t,e,s){super(t,e,s,`${nt.rgb}|${s}`,`${nt.rgb2}|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,i,r,o,a,h){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=o,this.frames[t+5]=a,this.frames[t+6]=h}apply1(t,e,s,i,r,o){const a=e.color,h=e.darkColor;let l=0,c=0,u=0,d=0,f=0,g=0;const p=this.frames;if(s<p[0]){const x=t.data.setupPose,_=x.color,b=x.darkColor;switch(r){case q.setup:a.r=_.r,a.g=_.g,a.b=_.b,h.r=b.r,h.g=b.g,h.b=b.b;break;case q.first:a.r+=(_.r-a.r)*i,a.g+=(_.g-a.g)*i,a.b+=(_.b-a.b)*i,h.r+=(b.r-h.r)*i,h.g+=(b.g-h.g)*i,h.b+=(b.b-h.b)*i;break}return}const m=Mt.search(p,s,7),y=this.curves[m/7];switch(y){case 0:{const x=p[m];l=p[m+1],c=p[m+2],u=p[m+3],d=p[m+4],f=p[m+5],g=p[m+6];const _=(s-x)/(p[m+7]-x);l+=(p[m+7+1]-l)*_,c+=(p[m+7+2]-c)*_,u+=(p[m+7+3]-u)*_,d+=(p[m+7+4]-d)*_,f+=(p[m+7+5]-f)*_,g+=(p[m+7+6]-g)*_;break}case 1:l=p[m+1],c=p[m+2],u=p[m+3],d=p[m+4],f=p[m+5],g=p[m+6];break;default:l=this.getBezierValue(s,m,1,y-2),c=this.getBezierValue(s,m,2,y+18-2),u=this.getBezierValue(s,m,3,y+36-2),d=this.getBezierValue(s,m,4,y+54-2),f=this.getBezierValue(s,m,5,y+72-2),g=this.getBezierValue(s,m,6,y+90-2)}if(i!==1)if(r===q.setup){const x=t.data.setupPose;let _=x.color;l=_.r+(l-_.r)*i,c=_.g+(c-_.g)*i,u=_.b+(u-_.b)*i,_=x.darkColor,d=_.r+(d-_.r)*i,f=_.g+(f-_.g)*i,g=_.b+(g-_.b)*i}else l=a.r+(l-a.r)*i,c=a.g+(c-a.g)*i,u=a.b+(u-a.b)*i,d=h.r+(d-h.r)*i,f=h.g+(f-h.g)*i,g=h.b+(g-h.b)*i;a.r=l<0?0:l>1?1:l,a.g=c<0?0:c>1?1:c,a.b=u<0?0:u>1?1:u,h.r=d<0?0:d>1?1:d,h.g=f<0?0:f>1?1:f,h.b=g<0?0:g>1?1:g}}class kr extends Mt{slotIndex=0;attachmentNames;constructor(t,e){super(t,`${nt.attachment}|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,o,a,h,l){const c=t.slots[this.slotIndex];if(!c.bone.active)return;const u=l?c.appliedPose:c.pose;h||s<this.frames[0]?o!==q.current&&this.setAttachment(t,u,c.data.attachmentName):this.setAttachment(t,u,this.attachmentNames[Mt.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class ym extends sn{slotIndex;attachment;vertices;constructor(t,e,s,i){super(t,e,`${nt.deform}|${s}|${i.id}`),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,o,a,h,l,c,u){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const g=(i-o*2+h)*.03,p=l*.03-a*.06,m=((o-h)*3-i+c)*.006,y=(a-l+.33333333)*.018;let x=g*2+m,_=p*2+y,b=(o-i)*.3+g+m*.16666667,w=a*.3+p+y*.16666667,S=i+b,v=w;for(let T=f+18;f<T;f+=2)d[f]=S,d[f+1]=v,b+=x,w+=_,x+=m,_+=y,S+=b,v+=w}getCurvePercent(t,e){const s=this.curves;let i=s[e];switch(i){case 0:{const h=this.frames[e];return(t-h)/(this.frames[e+this.getFrameEntries()]-h)}case 1:return 0}if(i-=2,s[i]>t){const h=this.frames[e];return s[i+1]*(t-h)/(s[i]-h)}const r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){const h=s[i-2],l=s[i-1];return l+(t-h)/(s[i]-h)*(s[i+1]-l)}const o=s[r-2],a=s[r-1];return a+(1-a)*(t-o)/(this.frames[e+this.getFrameEntries()]-o)}apply(t,e,s,i,r,o,a,h,l){const c=t.slots;if(!this.attachment.isTimelineActive(c,this.slotIndex,l))return;const u=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(c[this.slotIndex],l,r,o);for(const y of u)this.applyBeforeFirst(c[y],l,r,o);return}let f,g,p;if(s>=d[d.length-1])p=0,f=this.vertices[d.length-1],g=null;else{const y=Mt.search(d,s);p=this.getCurvePercent(s,y),f=this.vertices[y],g=this.vertices[y+1]}const m=this.vertices[0].length;this.applyToSlot(c[this.slotIndex],l,f,g,p,m,r,o,a);for(const y of u)this.applyToSlot(c[y],l,f,g,p,m,r,o,a)}applyBeforeFirst(t,e,s,i){if(!t.bone.active)return;const r=e?t.appliedPose:t.pose;if(r.attachment==null||r.attachment.timelineAttachment!==this.attachment)return;const o=r.deform;switch(o.length===0&&(i=q.setup),i){case q.setup:o.length=0;break;case q.first:{if(s===1){o.length=0;return}const a=this.vertices[0].length;o.length=a;const h=o,l=r.attachment;
389if(l.bones===null){const c=l.vertices;for(let u=0;u<a;u++)h[u]+=(c[u]-h[u])*s}else{s=1-s;for(let c=0;c<a;c++)h[c]*=s}}}}applyToSlot(t,e,s,i,r,o,a,h,l){if(!t.bone.active)return;const c=e?t.appliedPose:t.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;const u=c.attachment,d=c.deform;d.length===0&&(h=q.setup);const f=h===q.setup;if(d.length=o,i===null)if(a===1)if(l&&!f)if(u.bones)for(let g=0;g<o;g++)d[g]+=s[g];else{const g=u.vertices;for(let p=0;p<o;p++)d[p]+=s[p]-g[p]}else G.arrayCopy(s,0,d,0,o);else if(f)if(u.bones)for(let g=0;g<o;g++)d[g]=s[g]*a;else{const g=u.vertices;for(let p=0;p<o;p++){const m=g[p];d[p]=m+(s[p]-m)*a}}else if(l)if(u.bones)for(let g=0;g<o;g++)d[g]+=s[g]*a;else{const g=u.vertices;for(let p=0;p<o;p++)d[p]+=(s[p]-g[p])*a}else for(let g=0;g<o;g++)d[g]+=(s[g]-d[g])*a;else if(a===1)if(l&&!f)if(u.bones)for(let g=0;g<o;g++){const p=s[g];d[g]+=p+(i[g]-p)*r}else{const g=u.vertices;for(let p=0;p<o;p++){const m=s[p];d[p]+=m+(i[p]-m)*r-g[p]}}else if(r===0)G.arrayCopy(s,0,d,0,o);else for(let g=0;g<o;g++){const p=s[g];d[g]=p+(i[g]-p)*r}else if(f)if(u.bones)for(let g=0;g<o;g++){const p=s[g];d[g]=(p+(i[g]-p)*r)*a}else{const g=u.vertices;for(let p=0;p<o;p++){const m=s[p],y=g[p];d[p]=y+(m+(i[p]-m)*r-y)*a}}else if(l)if(u.bones)for(let g=0;g<o;g++){const p=s[g];d[g]+=(p+(i[g]-p)*r)*a}else{const g=u.vertices;for(let p=0;p<o;p++){const m=s[p];d[p]+=(m+(i[p]-m)*r-g[p])*a}}else for(let g=0;g<o;g++){const p=s[g];d[g]+=(p+(i[g]-p)*r-d[g])*a}}}class bs extends Mt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,`${nt.sequence}|${e}|${s.sequence.id}`),this.slotIndex=e,this.attachment=s,this.instant=!0}getFrameEntries(){return bs.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,r){const o=this.frames;t*=bs.ENTRIES,o[t]=e,o[t+bs.MODE]=s|i<<4,o[t+bs.DELAY]=r}apply(t,e,s,i,r,o,a,h,l){const c=t.slots;if(!this.attachment.isTimelineActive(c,this.slotIndex,l))return;const u=this.attachment.timelineSlots,d=this.frames;if(h||s<d[0]){if(o!==q.current){this.setupPose(c[this.slotIndex],l);for(const y of u)this.setupPose(c[y],l)}return}const f=Mt.search(d,s,bs.ENTRIES),g=d[f],p=d[f+bs.MODE],m=d[f+bs.DELAY];this.applyToSlot(c[this.slotIndex],l,s,g,p,m);for(const y of u)this.applyToSlot(c[y],l,s,g,p,m)}setupPose(t,e){if(!t.bone.active)return;const s=e?t.appliedPose:t.pose;s.attachment===null||s.attachment.timelineAttachment!==this.attachment||(s.sequenceIndex=-1)}applyToSlot(t,e,s,i,r,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;let h=r>>4,l=a.attachment.sequence.regions.length;const c=em[r&15];if(c!==pe.hold)switch(h+=(s-i)/o+1e-5|0,c){case pe.once:h=Math.min(l-1,h);break;case pe.loop:h%=l;break;case pe.pingpong:{const u=(l<<1)-2;h=u===0?0:h%u,h>=l&&(h=u-h);break}case pe.onceReverse:h=Math.max(l-1-h,0);break;case pe.loopReverse:h=l-1-h%l;break;case pe.pingpongReverse:{const u=(l<<1)-2;h=u===0?0:(h+l-1)%u,h>=l&&(h=u-h)}}a.sequenceIndex=h}}class ro extends Mt{static propertyIds=[`${nt.event}`];events;constructor(t){super(t,...ro.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,r,o,a,h,l){if(!i)return;const c=this.frames,u=this.frames.length;if(e>s)this.apply(null,e,Number.MAX_VALUE,i,0,o,!1,!1,!1),e=-1;else if(e>=c[u-1])return;if(s<c[0])return;let d=0;if(e<c[0])d=0;else{d=Mt.search(c,e)+1;const f=c[d];for(;d>0&&c[d-1]===f;)d--}for(;d<u&&s>=c[d];d++)i.push(this.events[d])}}class Xs extends Mt{static propertyID=`${nt.drawOrder}`;static propertyIds=[Xs.propertyID];drawOrders;constructor(t){super(t,...Xs.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,r,o,a,h,l){const c=l?t.drawOrder.appliedPose:t.drawOrder.pose,u=t.slots;if(h||s<this.frames[0]){o!==q.current&&G.arrayCopy(u,0,c,0,t.slots.length);return}const d=this.drawOrders[Mt.search(this.frames,s)];if(!d)G.arrayCopy(u,0,c,0,t.slots.length);else for(let f=0,g=d.length;f<g;f++)c[f]=u[d[f]]}}class Ji extends Mt{static propertyID=`${nt.drawOrderFolder}`;slots;inFolder;drawOrders;constructor(t,e,s){super(t,...Ji.propertyIds(e)),this.slots=e,this.drawOrders=new Array(t),this.inFolder=new Array(s);for(const i of e)this.inFolder[i]=!0;this.instant=!0}static propertyIds(t){const e=t.length,s=new Array(e);for(let i=0;i<e;i++)s[i]=`${Ji.propertyID}|${t[i]}`;return s}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,r,o,a,h,l){const c=l?t.drawOrder.appliedPose:t.drawOrder.pose,u=t.slots;if(h||s<this.frames[0])o!==q.current&&this.setup(c,u);else{const d=this.drawOrders[Mt.search(this.frames,s)];if(!d)this.setup(c,u);else{const f=this.inFolder,g=this.slots;for(let p=0,m=0,y=g.length;
389!(f[c[p].data.index]&&(c[p]=u[g[d[m]]],++m===y));p++);}}}setup(t,e){const{inFolder:s,slots:i}=this;for(let r=0,o=0,a=i.length;!(s[t[r].data.index]&&(t[r]=e[i[o]],++o===a));r++);}}function _S(n){return typeof n=="object"&&n!==null&&typeof n.constraintIndex=="number"}class xm extends sn{constraintIndex=0;constructor(t,e,s){super(t,e,`${nt.ikConstraint}|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,o,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=o?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(!c.active)return;const u=l?c.appliedPose:c.pose,d=this.frames;if(s<d[0]){const x=c.data.setupPose;switch(o){case q.setup:{u.mix=x.mix,u.softness=x.softness,u.bendDirection=x.bendDirection,u.compress=x.compress,u.stretch=x.stretch;break}case q.first:{u.mix+=(x.mix-u.mix)*r,u.softness+=(x.softness-u.softness)*r,u.bendDirection=x.bendDirection,u.compress=x.compress,u.stretch=x.stretch;break}}return}let f=0,g=0;const p=Mt.search(d,s,6),m=this.curves[p/6];switch(m){case 0:{const x=d[p];f=d[p+1],g=d[p+2];const _=(s-x)/(d[p+6]-x);f+=(d[p+6+1]-f)*_,g+=(d[p+6+2]-g)*_;break}case 1:f=d[p+1],g=d[p+2];break;default:f=this.getBezierValue(s,p,1,m-2),g=this.getBezierValue(s,p,2,m+18-2)}const y=o===q.setup?c.data.setupPose:u;u.mix=y.mix+(f-y.mix)*r,u.softness=y.softness+(g-y.softness)*r,h?o===q.setup&&(u.bendDirection=y.bendDirection,u.compress=y.compress,u.stretch=y.stretch):(u.bendDirection=d[p+3],u.compress=d[p+4]!==0,u.stretch=d[p+5]!==0)}}class _m extends sn{constraintIndex=0;constructor(t,e,s){super(t,e,`${nt.transformConstraint}|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,i,r,o,a,h){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=r,l[t+4]=o,l[t+5]=a,l[t+6]=h}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(!c.active)return;const u=l?c.appliedPose:c.pose,d=this.frames;if(s<d[0]){const S=c.data.setupPose;switch(o){case q.setup:{u.mixRotate=S.mixRotate,u.mixX=S.mixX,u.mixY=S.mixY,u.mixScaleX=S.mixScaleX,u.mixScaleY=S.mixScaleY,u.mixShearY=S.mixShearY;break}case q.first:{u.mixRotate+=(S.mixRotate-u.mixRotate)*r,u.mixX+=(S.mixX-u.mixX)*r,u.mixY+=(S.mixY-u.mixY)*r,u.mixScaleX+=(S.mixScaleX-u.mixScaleX)*r,u.mixScaleY+=(S.mixScaleY-u.mixScaleY)*r,u.mixShearY+=(S.mixShearY-u.mixShearY)*r;break}}return}let f,g,p,m,y,x;const _=Mt.search(d,s,7),b=this.curves[_/7];switch(b){case 0:{const S=d[_];f=d[_+1],g=d[_+2],p=d[_+3],m=d[_+4],y=d[_+5],x=d[_+6];const v=(s-S)/(d[_+7]-S);f+=(d[_+7+1]-f)*v,g+=(d[_+7+2]-g)*v,p+=(d[_+7+3]-p)*v,m+=(d[_+7+4]-m)*v,y+=(d[_+7+5]-y)*v,x+=(d[_+7+6]-x)*v;break}case 1:f=d[_+1],g=d[_+2],p=d[_+3],m=d[_+4],y=d[_+5],x=d[_+6];break;default:f=this.getBezierValue(s,_,1,b-2),g=this.getBezierValue(s,_,2,b+18-2),p=this.getBezierValue(s,_,3,b+36-2),m=this.getBezierValue(s,_,4,b+54-2),y=this.getBezierValue(s,_,5,b+72-2),x=this.getBezierValue(s,_,6,b+90-2)}const w=o===q.setup?c.data.setupPose:u;a?(u.mixRotate=w.mixRotate+f*r,u.mixX=w.mixX+g*r,u.mixY=w.mixY+p*r,u.mixScaleX=w.mixScaleX+m*r,u.mixScaleY=w.mixScaleY+y*r,u.mixShearY=w.mixShearY+x*r):(u.mixRotate=w.mixRotate+(f-w.mixRotate)*r,u.mixX=w.mixX+(g-w.mixX)*r,u.mixY=w.mixY+(p-w.mixY)*r,u.mixScaleX=w.mixScaleX+(m-w.mixScaleX)*r,u.mixScaleY=w.mixScaleY+(y-w.mixScaleY)*r,u.mixShearY=w.mixShearY+(x-w.mixShearY)*r)}}class oo extends Ys{constraintIndex;constructor(t,e,s,i){super(t,e,`${i}|${s}`),this.constraintIndex=s}}class bm extends oo{constructor(t,e,s){super(t,e,s,nt.pathConstraintPosition),this.additive=!0}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.position=this.getAbsoluteValue(s,r,o,a,u.position,c.data.setupPose.position)}}}class wm extends oo{constructor(t,e,s){super(t,e,s,nt.pathConstraintSpacing)}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.spacing=this.getAbsoluteValue(s,r,o,!1,u.spacing,c.data.setupPose.spacing)}}}class Sm extends sn{constraintIndex;constructor(t,e,s){super(t,e,`${nt.pathConstraintMix}|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){const o=this.frames;t<<=2,o[t]=e,o[t+1]=s,o[t+2]=i,o[t+3]=r}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(!c.active)return;const u=l?c.appliedPose:c.pose,d=this.frames;if(s<d[0]){const _=c.data.setupPose;switch(o){case q.setup:{u.mixRotate=_.mixRotate,u.mixX=_.mixX,u.mixY=_.mixY;break}
389case q.first:{u.mixRotate+=(_.mixRotate-u.mixRotate)*r,u.mixX+=(_.mixX-u.mixX)*r,u.mixY+=(_.mixY-u.mixY)*r;break}}return}let f,g,p;const m=Mt.search(d,s,4),y=this.curves[m>>2];switch(y){case 0:{const _=d[m];f=d[m+1],g=d[m+2],p=d[m+3];const b=(s-_)/(d[m+4]-_);f+=(d[m+4+1]-f)*b,g+=(d[m+4+2]-g)*b,p+=(d[m+4+3]-p)*b;break}case 1:f=d[m+1],g=d[m+2],p=d[m+3];break;default:f=this.getBezierValue(s,m,1,y-2),g=this.getBezierValue(s,m,2,y+18-2),p=this.getBezierValue(s,m,3,y+36-2)}const x=o===q.setup?c.data.setupPose:u;a?(u.mixRotate=x.mixRotate+f*r,u.mixX=x.mixX+g*r,u.mixY=x.mixY+p*r):(u.mixRotate=x.mixRotate+(f-x.mixRotate)*r,u.mixX=x.mixX+(g-x.mixX)*r,u.mixY=x.mixY+(p-x.mixY)*r)}}class Si extends oo{constructor(t,e,s,i){super(t,e,s,i)}apply(t,e,s,i,r,o,a,h,l){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const c=s>=this.frames[0]?this.getCurveValue(s):0,u=t.physics;for(const d of u)if(d.active&&this.global(d.data)){const f=l?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,r,o,a,this.get(f),this.get(d.data.setupPose),c))}}else{const c=t.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;this.set(u,this.getAbsoluteValue(s,r,o,a,this.get(u),this.get(c.data.setupPose)))}}}}class vm extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintInertia)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class Tm extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintStrength)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Am extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintDamping)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Cm extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintMass)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class Pm extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintWind),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Mm extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintGravity),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class km extends Si{constructor(t,e,s){super(t,e,s,nt.physicsConstraintMix)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Ka extends Mt{static propertyIds=[nt.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,...Ka.propertyIds),this.constraintIndex=e,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,r,o,a,h,l){let c;if(this.constraintIndex!==-1&&(c=t.constraints[this.constraintIndex],!c.active))return;const u=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],r,o,!1,!1,!1),e=-1;else if(e>=u[u.length-1])return;if(!(s<u[0])&&(e<u[0]||s>=u[Mt.search(u,e)+1]))if(c!=null)c.reset(t);else for(const d of t.physics)d.active&&d.reset(t)}}class Im extends oo{constructor(t,e,s){super(t,e,s,nt.sliderTime)}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.time=this.getAbsoluteValue(s,r,o,a,u.time,c.data.setupPose.time)}}}class Em extends oo{constructor(t,e,s){super(t,e,s,nt.sliderMix),this.additive=!0}apply(t,e,s,i,r,o,a,h,l){const c=t.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.mix=this.getAbsoluteValue(s,r,o,a,u.mix,c.data.setupPose.mix)}}}class Xr{static emptyAnimation=new Oc("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new wS(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new Gr(()=>new bS);constructor(t){this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=t*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale===0?0:(h/r.timeScale+t)*a.timeScale,r.trackTime+=o,this.setTrack(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let h=r.mixingFrom;for(r.mixingFrom=null,h&&(h.mixingTo=null);h;
vendor: 13,592 bytes, line 389
389)this.queue.end(h),h=h.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(!s)return!0;const i=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(s.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=t),s.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(s)}return i}return s.trackTime+=e*s.timeScale,t.mixTime+=e,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let i=!1;for(let a=0,h=s.length;a<h;a++){const l=s[a];if(!l||l.delay>0)continue;i=!0;let c=l.alpha;l.mixingFrom?c*=this.applyMixingFrom(l,t):l.trackTime>=l.trackEnd&&!l.next&&(c=0);let u=l.animationLast,d=l.getAnimationTime(),f=d,g=e;l.reverse&&(f=l.animation.duration-f,g=null);const p=l.animation.timelines,m=p.length;if(a===0&&c===1)for(let y=0;y<m;y++){G.webkit602BugfixHelper(c);const x=p[y];x instanceof kr?this.applyAttachmentTimeline(x,t,f,q.setup,!0):x.apply(t,u,f,g,c,q.setup,!1,!1,!1)}else{const y=l.timelineMode,x=c>=l.alphaAttachmentThreshold,_=l.additive,b=_||l.shortestRotation,w=!b&&l.timelinesRotation.length!==m<<1;w&&(l.timelinesRotation.length=m<<1);for(let S=0;S<m;S++){const v=p[S],T=y[S]&Yd;!b&&v instanceof ga?this.applyRotateTimeline(v,t,f,c,T,l.timelinesRotation,S<<1,w):v instanceof kr?this.applyAttachmentTimeline(v,t,f,T,x):(G.webkit602BugfixHelper(c),v.apply(t,u,f,g,c,T,_,!1,!1))}}l.reverse&&this.eventsReverse(l,u,d),this.queueEvents(l,d),e.length=0,l.nextAnimationLast=d,l.nextTrackLast=l.trackTime}const r=this.unkeyedState+Vd,o=t.slots;for(let a=0,h=t.slots.length;a<h;a++){const l=o[a];if(l.attachmentState===r){const c=l.data.attachmentName;l.pose.setAttachment(c?t.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e){const s=t.mixingFrom,i=s.mixingFrom!==null?this.applyMixingFrom(s,e):1,r=t.mix(),o=s.alpha*i,a=1-r*t.alpha,h=o*(1-r),l=a>0?h/a:o,c=s.animation.timelines,u=c.length,d=s.timelineMode,f=s.timelineHoldMix,g=r<s.mixAttachmentThreshold,p=r<s.mixDrawOrderThreshold,m=s.additive,y=m||s.shortestRotation,x=!y&&s.timelinesRotation.length!==u<<1;x&&(s.timelinesRotation.length=u<<1);const _=s.timelinesRotation;let b=s.animationLast,w=s.getAnimationTime(),S=w,v=null;s.reverse?S=s.animation.duration-S:r<s.eventThreshold&&(v=this.events),s.totalAlpha=0;for(let T=0;T<u;T++){const A=c[T],P=d[T],M=P&Yd;let I=0;if((P&Po)!==0){const C=f[T];I=C==null?l:l*(1-C.mix())}else{if(!p&&A instanceof Xs&&M===q.current)continue;I=h}if(s.totalAlpha+=I,!y&&A instanceof ga)this.applyRotateTimeline(A,e,S,I,M,_,T<<1,x);else if(A instanceof kr)this.applyAttachmentTimeline(A,e,S,M,g&&I>=s.alphaAttachmentThreshold);else{const C=!p||!(A instanceof Xs)||M===q.current;A.apply(e,b,S,v,I,M,m,C,!1)}}return s.reverse&&r<s.eventThreshold&&this.eventsReverse(s,b,w),t.mixDuration>0&&this.queueEvents(s,w),this.events.length=0,s.nextAnimationLast=w,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(t,e,s,i,r){const o=e.slots[t.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+Ud)return;let a=s<t.frames[0],h=null;if(a||(h=t.attachmentNames[Mt.search(t.frames,s)],a=!r&&h==null),a){if(i===q.current)return;h=o.data.attachmentName}o.pose.setAttachment(h==null?null:e.getAttachment(o.data.index,h)),r?o.attachmentState=this.unkeyedState+Ud:a||(o.attachmentState=this.unkeyedState+Vd)}applyRotateTimeline(t,e,s,i,r,o,a,h){if(h&&(o[a]=0),i===1){t.apply(e,0,s,null,1,r,!1,!1,!1);return}const l=e.bones[t.boneIndex];if(!l.active)return;const c=l.pose,u=l.data.setupPose,d=t.frames;let f,g;if(s<d[0]){switch(r){case q.setup:{c.rotation=u.rotation;return}case q.current:return}f=c.rotation,g=u.rotation}else f=r===q.setup?u.rotation:c.rotation,g=u.rotation+t.getCurveValue(s);let p=0,m=g-f;if(m-=Math.ceil(m/360-.5)*360,m===0)p=o[a];else{let y=0,x=0;h?(y=0,x=m):(y=o[a],x=o[a+1]);const _=y-y%360;p=m+_;let b=m>=0,w=y>=0;Math.abs(x)<=90&&U.signum(x)!==U.signum(m)&&(Math.abs(y-_)>180?(p+=360*U.signum(y),w=b):_!==0?p-=360*U.signum(y):w=b),w!==b&&(p+=360*U.signum(y)),o[a]=p}o[a+1]=m,c.rotation=f+p*i}queueEvents(t,e){const s=t.animationStart,i=t.animationEnd,r=i-s,o=t.reverse;let a=t.trackLast%r;o&&(a=r-a);const h=this.events;let l=0,c=h.length;for(;l<c;l++){const d=h[l];if(d.time<a!==o)break;d.time>=s&&d.time<=i&&this.queue.event(t,d)}let u=!1;if(t.loop)if(r===0)u=!0;else{const d=Math.floor(t.trackTime/r);u=d>0&&d>Math.floor(t.trackLast/r)}else u=e>=i&&t.animationLast<i;for(u&&this.queue.complete(t);l<c;l++){const d=h[l];d.time>=s&&d.time<=i&&this.queue.event(t,d)}}eventsReverse(t,e,s){const i=t.animation.duration,r=i-e,o=i-s,a=t.animation.timelines;for(let h=0,l=t.animation.timelines.length;h<l;h++){const c=a[h];if(!(c instanceof ro))continue;const u=c.events,d=c.frames,f=d.length;if(r>=o){for(let g=0;g<f;g++)if(!(d[g]<o)){if(d[g]>=r)break;this.events.push(u[g])}}else{for(let p=0;p<f&&!(d[p]>=r);p++)this.events.push(u[p]);let g=0;for(;g<f&&!(d[g]>=o);g++);for(;g<f;g++)this.events.push(u[g])}}}clearTracks(){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){const i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[e.trackIndex]=null,this.queue.drain()}setTrack(t,e,s){const i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(i.next=null,s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){return typeof e=="string"?this.setAnimation1(t,e,s):this.setAnimation2(t,e,s)}setAnimation1(t,e,s=!1){const i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);return this.setAnimation2(t,i,s)}setAnimation2(t,e,s=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!e)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===e?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const o=this.trackEntry(t,e,s,r);return this.setTrack(t,o,i),this.queue.drain(),o}addAnimation(t,e,s=!1,i=0){return typeof e=="string"?this.addAnimation1(t,e,s,i):this.addAnimation2(t,e,s,i)}addAnimation1(t,e,s=!1,i=0){const r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);return this.addAnimation2(t,r,s,i)}addAnimation2(t,e,s=!1,i=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!e)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(t,e,s,r);return r?(r.next=o,o.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,e=0){const s=this.setAnimation(t,Xr.emptyAnimation,!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){const i=this.addAnimation(t,Xr.emptyAnimation,!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-e,0)),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){const r=this.tracks[s];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(G.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=e,r.loop=s,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=e.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,e):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(!i)continue;let r=i;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,i),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(t,e){const s=t.animation.timelines,i=t.animation.timelines.length,r=t.timelineMode;r.length=i;const o=t.timelineHoldMix;o.length=0;const a=t.additive,h=t.keepHold,l=t.mixingTo;for(let c=0;c<i;c++){const u=s[c],d=u.propertyIds,f=this.from(e,u,d);if(a&&u.additive){r[c]=f;continue}let g;if(l===null||u.instant||l.additive&&u.additive||!l.animation?.hasTimeline(d))g=f;else{g=f|Po;for(let p=l.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&u.additive||!p.animation?.hasTimeline(d)){p.mixDuration>0&&(o[c]=p);break}}h&&(g=g&~Po|r[c]&Po),r[c]=g}}from(t,e,s){const i=this.propertyIds;let r=SS;for(let o=0,a=s.length;o<a;o++){const h=i.get(s[o]);if(h===void 0)i.set(s[o],t);else{if(h!==t){for(;++o<a;)i.has(s[o])||i.set(s[o],t);return Wd}r=zd}}if(e instanceof Ji){const o=i.get(Xs.propertyID);if(o!=null)return o!==t?Wd:zd}return r}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class bS{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Ho.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Ho.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Ho.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class wS{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(Me.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Me.interrupt),this.objects.push(t)}end(t){this.objects.push(Me.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Me.dispose),this.objects.push(t)}complete(t){this.objects.push(Me.complete),this.objects.push(t)}event(t,e){this.objects.push(Me.event),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],i=e[t+1],r=this.animState.listeners.slice();switch(s){case Me.start:i.listener?.start&&i.listener.start(i);for(let o=0;o<r.length;o++){const a=r[o];a.start&&a.start(i)}break;case Me.interrupt:i.listener?.interrupt&&i.listener.interrupt(i);for(let o=0;o<r.length;o++){const a=r[o];a.interrupt&&a.interrupt(i)}break;case Me.end:i.listener?.end&&i.listener.end(i);for(let o=0;o<r.length;o++){const a=r[o];a.end&&a.end(i)}case Me.dispose:i.listener?.dispose&&i.listener.dispose(i);for(let o=0;o<r.length;o++){const a=r[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case Me.complete:i.listener?.complete&&i.listener.complete(i);for(let o=0;o<r.length;o++){const a=r[o];a.complete&&a.complete(i)}break;case Me.event:{const o=e[t+++2];i.listener?.event&&i.listener.event(i,o);for(let a=0;a<r.length;a++){const h=r[a];h.event&&h.event(i,o)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}}var Me;(function(n){n[n.start=0]="start",n[n.interrupt=1]="interrupt",n[n.end=2]="end",n[n.dispose=3]="dispose",n[n.c
389omplete=4]="complete",n[n.event=5]="event"})(Me||(Me={}));class fk{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Wd=0,SS=1,zd=2,Yd=3,Po=4,Vd=1,Ud=2;class vS{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);const r=this.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);this.setMix2(i,r,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const i=`${t.name}.${e.name}`;this.animationToMixTime[i]=s}getMix(t,e){const s=`${t.name}.${e.name}`,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}}class Za extends js{color=new Q(1,1,1,1);constructor(t){super(t)}copy(){const t=new Za(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class vs extends js{endSlot=null;convex=!1;inverse=!1;color=new Q(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new vs(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}}class $r extends js{lengths=[];closed=!1;constantSpeed=!1;color=new Q(1,1,1,1);constructor(t){super(t)}copy(){const t=new $r(this.name);return this.copyTo(t),t.lengths=[],G.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Nc extends js{x=0;y=0;rotation=0;color=new Q(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*U.degRad,s=Math.cos(e),i=Math.sin(e),r=s*t.a+i*t.b,o=s*t.c+i*t.d;return U.atan2Deg(o,r)}copy(){const t=new Nc(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class TS{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const i=s.regions;for(let r=0,o=i.length;r<o;r++)i[r]=this.findRegion(t,s.getPath(e,r))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,i,r){return this.findRegions(s,i,r),new at(s,r)}newMeshAttachment(t,e,s,i,r){return this.findRegions(s,i,r),new xe(s,r)}newBoundingBoxAttachment(t,e,s){return new Za(s)}newPathAttachment(t,e,s){return new $r(s)}newPointAttachment(t,e,s){return new Nc(s)}newClippingAttachment(t,e,s){return new vs(s)}}class Wc{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}}class Qa extends Wc{index=0;parent=null;length=0;color=new Q;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,e,s){if(super(e,new Cl),t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.parent=s}copy(t){const e=new Qa(this.index,this.name,t);return e.length=this.length,e.setupPose.set(this.setupPose),e}}var Yt;(function(n){n[n.Normal=0]="Normal",n[n.OnlyTranslation=1]="OnlyTranslation",n[n.NoRotationOrReflection=2]="NoRotationOrReflection",n[n.NoScale=3]="NoScale",n[n.NoScaleOrReflection=4]="NoScaleOrReflection"})(Yt||(Yt={}));class Cl{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=Yt.Normal;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,i=this.scaleY,r=this.shearX,o=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,g=(e+r)*U.degRad,p=(e+90+o)*U.degRad;this.a=Math.cos(g)*s*d,this.b=Math.cos(p)*i*d,this.c=Math.sin(g)*s*f,this.d=Math.sin(p)*i*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const a=this.bone.parent.appliedPose;let h=a.a,l=a.b,c=a.c,u=a.d;switch(this.worldX=h*this.x+l*this.y+a.worldX,this.worldY=c*this.x+u*this.y+a.worldY,this.inherit){case Yt.Normal:{const d=(e+r)*U.degRad,f=(e+90+o)*U.degRad,g=Math.cos(d)*s,p=Math.cos(f)*i,m=Math.sin(d)*s,y=Math.sin(f)*i;this.a=h*g+l*m,this.b=h*p+l*y,this.c=c*g+u*m,this.d=c*p+u*y;return}case Yt.OnlyTranslation:{const d=t.scaleX,f=t.scaleY,g=(e+r)*U.degRad,p=(e+90+o)*U.degRad;this.a=Math.cos(g)*s*d,this.b=Math.cos(p)*i*d,this.c=Math.sin(g)*s*f,this.d=Math.sin(p)*i*f;break}
vendor: 12,182 bytes, line 389
389case Yt.NoRotationOrReflection:{const d=t.scaleX,f=t.scaleY,g=1/d,p=1/f;h*=g,c*=p;let m=h*h+c*c,y=0;m>U.epsilon2?(m=Math.abs(h*u*p-l*g*c)/m,l=c*m,u=h*m,y=e-U.atan2Deg(c,h)):(h=0,c=0,y=e-90+U.atan2Deg(u,l));const x=(y+r)*U.degRad,_=(y+o+90)*U.degRad,b=Math.cos(x)*s,w=Math.cos(_)*i,S=Math.sin(x)*s,v=Math.sin(_)*i;this.a=(h*b-l*S)*d,this.b=(h*w-l*v)*d,this.c=(c*b+u*S)*f,this.d=(c*w+u*v)*f;break}case Yt.NoScale:case Yt.NoScaleOrReflection:{const d=t.scaleX,f=t.scaleY,g=1/d,p=1/f,m=e*U.degRad,y=Math.cos(m),x=Math.sin(m);let _=(h*y+l*x)*g,b=(c*y+u*x)*p;const w=1/Math.sqrt(_*_+b*b);_*=w,b*=w;let S=-b,v=_;this.inherit===Yt.NoScale&&h*u-l*c<0!=(d<0!=f<0)&&(S=-S,v=-v);const T=r*U.degRad,A=(90+o)*U.degRad,P=Math.cos(T)*s,M=Math.cos(A)*i,I=Math.sin(T)*s,C=Math.sin(A)*i;this.a=(_*P+S*I)*d,this.b=(_*M+S*C)*d,this.c=(b*P+v*I)*f,this.d=(b*M+v*C)*f;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const y=1/e,x=1/s;this.x=(this.worldX-t.x)*y,this.y=(this.worldY-t.y)*x,this.set5(this.a*y,this.b*y,this.c*x,this.d*x,0);return}const i=this.bone.parent.appliedPose;let r=i.a,o=i.b,a=i.c,h=i.d;const l=r*h-o*a,c=1/(r*h-o*a),u=h*c,d=o*c,f=a*c,g=r*c,p=this.worldX-i.worldX,m=this.worldY-i.worldY;switch(this.x=p*u-m*d,this.y=m*g-p*f,this.inherit){case Yt.Normal:this.set5(u*this.a-d*this.c,u*this.b-d*this.d,g*this.c-f*this.a,g*this.d-f*this.b,0);break;case Yt.OnlyTranslation:{const y=1/e,x=1/s;this.set5(this.a*y,this.b*y,this.c*x,this.d*x,0);break}case Yt.NoRotationOrReflection:{const y=1/e,x=1/s;r*=y,a*=x;const _=this.a*y,b=this.b*y,w=this.c*x,S=this.d*x,v=1/(r*r+a*a),T=1/Math.abs(l*y*x);this.set5((r*_+a*w)*v,(r*b+a*S)*v,(r*w-a*_)*T,(r*S-a*b)*T,U.atan2Deg(a,r));break}case Yt.NoScale:case Yt.NoScaleOrReflection:{const y=1/e,x=1/s,_=this.a*y,b=this.b*y,w=this.c*x,S=this.d*x;let v=h*this.a-o*this.c,T=r*this.c-a*this.a;l<0&&(v=-v,T=-T);let A=U.atan2Deg(T,v);this.rotation=A,A*=U.degRad;const P=Math.cos(A),M=Math.sin(A);let I=(r*P+o*M)*y,C=(a*P+h*M)*x;const k=1/Math.sqrt(I*I+C*C);I*=k,C*=k;const E=this.inherit===Yt.NoScale&&l<0!=(e<0!=s<0)?-1:1;this.set4(I*_+C*w,I*b+C*S,(I*w-C*_)*E,(I*S-C*b)*E)}}}set4(t,e,s,i){const r=t*t+s*s,o=e*e+i*i;r>U.epsilon2?(this.shearX=U.atan2Deg(s,t),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(o),o>U.epsilon2?(this.shearY=U.atan2Deg(i,e),t*i-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,i,r){this.shearX=0;const o=t*t+s*s,a=e*e+i*i;if(o>U.epsilon2){const h=U.atan2Deg(s,t);this.rotation=h+r,this.scaleX=Math.sqrt(o),this.scaleY=Math.sqrt(a),a>U.epsilon2?(this.shearY=U.atan2Deg(i,e),t*i-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-h):this.shearY-=90+h,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>U.epsilon2?U.atan2Deg(i,e)-90+r:r}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t,t._update)}modifyWorld(t){const e=t._update;this.local=e,this.world=e,this.resetWorld(t,e)}resetWorld(t,e){const s=this.bone.children;for(let i=0,r=s.length;i<r;i++){const o=s[i].appliedPose;o.world===e&&(o.local===e&&o.updateLocalTransform(t),o.world=0,o.resetWorld(t,e))}}getWorldRotationX(){return U.atan2Deg(this.c,this.a)}getWorldRotationY(){return U.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,i=t.y-this.worldY;return t.x=(s*this.d-i*this.b)/e,t.y=(i*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=U.degRad;const e=Math.sin(t),s=Math.cos(t);return U.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*U.degRad;const e=Math.sin(t),s=Math.cos(t);return U.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=U.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}}class Fm{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}}class Bm extends Fm{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}}class Ir extends Bm{parent=null;children=[];sorted=!1;constructor(t,e){super(t,new Cl,new Cl),this.parent=e,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const e=new Ir(this.data,t);return e.pose.set(this.pose),e}}class ao extends Bm{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}}class AS{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,G.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,G.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}}class ho extends Wc{constructor(t,e){super(t,e)}}var Te;(function(n){n[n.None=0]="None",n[n.Uniform=1]="Uniform",n[n.Volume=2]="Volume"})(Te||(Te={}));let zc=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class Rm{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new zc(-1,this);constructor(t){this.name=t}}class Pl{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}}class ei extends ao{bones;target;constructor(t,e){if(super(t,new Pl,new Pl),!e)throw new Error("skeleton cannot be null.");this.bones=[];for(const s of t.bones)this.bones.push(e.bones[s.index].constrainedPose);this.target=e.bones[t.target.index]}copy(t){var e=new ei(this.data,t);return e.pose.set(this.pose),e}update(t,e){const s=this.appliedPose;if(s.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:ei.apply(t,r[0],i.worldX,i.worldY,s.compress,s.stretch,this.data.scaleYMode,s.mix);break;case 2:ei.apply(t,r[0],r[1],i.worldX,i.worldY,s.bendDirection,s.stretch,this.data.scaleYMode,s.softness,s.mix);break}}sort(t){t.sortBone(this.target);const e=this.bones[0].bone;t.sortBone(e),t._updateCache.push(this),e.sorted=!1,t.sortReset(e.children),t.constrained(e),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,e,s,i,r,o,a,h,l,c){typeof s=="number"?ei.apply1(t,e,s,i,r,o,a,h):ei.apply2(t,e,s,i,r,o,a,h,l,c)}static apply1(t,e,s,i,r,o,a,h){e.modifyLocal(t);const l=e.bone.parent.appliedPose;let c=l.a,u=l.b,d=l.c,f=l.d,g=-e.shearX-e.rotation,p=0,m=0;switch(e.inherit){case Yt.OnlyTranslation:p=(s-e.worldX)*U.signum(t.scaleX),m=(i-e.worldY)*U.signum(t.scaleY);break;case Yt.NoRotationOrReflection:{const y=Math.abs(c*f-u*d)/Math.max(U.epsilon,c*c+d*d),x=c/t.scaleX,_=d/t.scaleY;u=-_*y*t.scaleX,f=x*y*t.scaleY,g+=U.atan2Deg(_,x)}default:{const y=s-l.worldX,x=i-l.worldY,_=c*f-u*d;Math.abs(_)<=U.epsilon?(p=0,m=0):(p=(y*f-x*u)/_-e.x,m=(x*c-y*d)/_-e.y)}}if(g+=U.atan2Deg(m,p),e.scaleX<0&&(g+=180),g>180?g-=360:g<=-180&&(g+=360),e.rotation+=g*h,r||o){switch(e.inherit){case Yt.NoScale:case Yt.NoScaleOrReflection:p=s-e.worldX,m=i-e.worldY}const y=e.bone.data.length*e.scaleX;if(y>U.epsilon){const x=p*p+m*m;if(r&&x<y*y||o&&x>y*y){const _=(Math.sqrt(x)/y-1)*h+1;switch(e.scaleX*=_,a){case Te.Uniform:e.scaleY*=_;break;case Te.Volume:e.scaleY/=_<.7?.25+.642857*_:_}}}}}static apply2(t,e,s,i,r,o,a,h,l,c){if(e.inherit!==Yt.Normal||s.inherit!==Yt.Normal)return;e.modifyLocal(t),s.modifyLocal(t);let u=e.x,d=e.y,f=e.scaleX,g=e.scaleY,p=s.scaleX,m=0,y=0,x=0;f<0?(f=-f,m=180,x=-1):(m=0,x=1),g<0&&(g=-g,x=-x),p<0?(p=-p,y=180):y=0;let _=0,b=0,w=e.a,S=e.b,v=e.c,T=e.d;const A=Math.abs(f-g)<=U.epsilon;!A||a?(s.y=0,_=w*s.x+e.worldX,b=v*s.x+e.worldY):(_=w*s.x+S*s.y+e.worldX,b=v*s.x+T*s.y+e.worldY);const P=e.bone.parent.appliedPose;w=P.a,S=P.b,v=P.c,T=P.d;let M=w*T-S*v,I=_-P.worldX,C=b-P.worldY;M=Math.abs(M)<=U.epsilon?0:1/M;const k=(I*T-C*S)*M-u,E=(C*w-I*v)*M-d;let F=Math.sqrt(k*k+E*E),B=s.bone.data.length*p,N,O;if(F<U.epsilon){ei.apply(t,e,i,r,!1,a,Te.None,c),s.rotation=0;return}I=i-P.worldX,C=r-P.worldY;let R=(I*T-C*S)*M-u,D=(C*w-I*v)*M-d,z=R*R+D*D;if(l!==0){l*=f*(p+1)*.5;const W=Math.sqrt(z),V=W-F-B*f+l;if(V>0){let H=Math.min(1,V/(l*2))-1;H=(V-l*(1-H*H))/W,R-=H*R,D-=H*D,z=R*R+D*D}}t:if(A){B*=f;let W=(z-F*F-B*B)/(2*F*B);if(W<-1)W=-1,O=Math.PI*o;else if(W>1){if(W=1,O=0,a)switch(w=(Math.sqrt(z)/(F+B)-1)*c+1,e.scaleX*=w,h){case Te.Uniform:e.scaleY*=w;break;case Te.Volume:e.scaleY/=w<.7?.25+.642857*w:w}}else O=Math.acos(W)*o;w=F+B*W,S=B*Math.sin(O),N=Math.atan2(D*w-R*S,R*w+D*S)}else{w=f*B,S=g*B;const W=w*w,V=S*S,H=Math.atan2(D,R);v=V*F*F+W*z-W*V;const K=-2*V*F,tt=V-W;if(T=K*K-4*tt*v,T>=0){let he=Math.sqrt(T);K<0&&(he=-he),he=-(K+he)*.5;let rs=he/tt,Ai=v/he;const Ci=Math.abs(rs)<Math.abs(Ai)?rs:Ai;if(rs=z-Ci*Ci,rs>=0){C=Math.sqrt(rs)*o,N=H-Math.atan2(C,Ci),O=Math.atan2(C/g,(Ci-F)/f);break t}}let xt=U.PI,et=F-w,St=et*et,bt=0,kt=0,Jt=F+w,Ht=Jt*Jt,be=0;v=-w*F/(W-V),v>=-1&&v<=1&&(v=Math.acos(v),I=w*Math.cos(v)+F,C=S*Math.sin(v),T=I*I+C*C,T<St&&(xt=v,St=T,et=I,bt=C),T>Ht&&(kt=v,Ht=T,Jt=I,be=C)),z<=(St+Ht)*.5?(N=H-Math.atan2(bt*o,et),O=xt*o):(N=H-Math.atan2(be*o,Jt),O=kt*o)}const Y=Math.atan2(s.y,s.x)*x;N=(N-Y)*U.radDeg+m-e.rotation,N>180?N-=360:N<=-180&&(N+=360),e.rotation+=N*c,O=((O+Y)*U.radDeg-s.shearX)*x+y-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*c}}class qo extends ho{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=Te.None;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new Pl)}create(t){return new ei(this,t)}}class Ml{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}}class Ko extends ho{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=Ms.Fixed;spacingMode=oe.Fixed;rotateMode=Xi.Chain;offsetRotation=0;constructor(t){super(t,new Ml)}create(t){return new si(this,t)}}var Ms;(function(n){n[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent"})(Ms||(Ms={}));var oe;(function(n){n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n[n.Proportional=3]="Proportional"})(oe||(oe={}));var Xi;(function(n){n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale"})(Xi||(Xi={}));class si extends ao{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;
389spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,e){if(super(t,new Ml,new Ml),!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const s of this.data.bones)this.bones.push(e.bones[s.index].constrainedPose);this.slot=e.slots[t.slot.index]}copy(t){var e=new si(this.data,t);return e.pose.set(this.pose),e}update(t,e){const s=this.slot.appliedPose.attachment;if(!(s instanceof $r))return;const i=this.appliedPose,r=i.mixRotate,o=i.mixX,a=i.mixY;if(r===0&&o===0&&a===0)return;const h=this.data,l=h.rotateMode===Xi.Tangent,c=h.rotateMode===Xi.ChainScale,u=this.bones,d=u.length,f=l?d:d+1,g=G.setArraySize(this.spaces,f),p=c?this.lengths=G.setArraySize(this.lengths,d):[],m=i.spacing;switch(h.spacingMode){case oe.Percent:if(c)for(let S=0,v=f-1;S<v;S++){const T=u[S],A=T.bone.data.length,P=A*T.a,M=A*T.c;p[S]=Math.sqrt(P*P+M*M)}G.arrayFill(g,1,f,m);break;case oe.Proportional:{let S=0;for(let v=0,T=f-1;v<T;){const A=u[v],P=A.bone.data.length;if(P<U.epsilon)c&&(p[v]=0),g[++v]=m;else{const M=P*A.a,I=P*A.c,C=Math.sqrt(M*M+I*I);c&&(p[v]=C),g[++v]=C,S+=C}}if(S>0){S=f/S*m;for(let v=1;v<f;v++)g[v]*=S}break}default:{const S=h.spacingMode===oe.Length;for(let v=0,T=f-1;v<T;){const A=u[v],P=A.bone.data.length;if(P<U.epsilon)c&&(p[v]=0),g[++v]=m;else{const M=P*A.a,I=P*A.c,C=Math.sqrt(M*M+I*I);c&&(p[v]=C),g[++v]=(S?Math.max(0,P+m):m)*C/P}}}}const y=this.computeWorldPositions(t,s,f,l);let x=y[0],_=y[1],b=h.offsetRotation,w=!1;if(b===0)w=h.rotateMode===Xi.Chain;else{w=!1;const S=this.slot.bone.appliedPose;b*=S.a*S.d-S.b*S.c>0?U.degRad:-U.degRad}for(let S=0,v=3;S<d;S++,v+=3){const T=u[S];
vendor: 17,459 bytes, line 389
389T.modifyWorld(t),T.worldX+=(x-T.worldX)*o,T.worldY+=(_-T.worldY)*a;const A=y[v],P=y[v+1],M=A-x,I=P-_;if(c){const C=p[S];if(C!==0){const k=(Math.sqrt(M*M+I*I)/C-1)*r+1;T.a*=k,T.c*=k}}if(x=A,_=P,r>0){let C=T.a,k=T.b,E=T.c,F=T.d,B=0,N=0,O=0;if(l?B=y[v-1]:g[S+1]===0?B=y[v+2]:B=Math.atan2(I,M),B-=Math.atan2(E,C),w){N=Math.cos(B),O=Math.sin(B);const R=T.bone.data.length;x+=(R*(N*C-O*E)-M)*r,_+=(R*(O*C+N*E)-I)*r}else B+=b;B>U.PI?B-=U.PI2:B<-U.PI&&(B+=U.PI2),B*=r,N=Math.cos(B),O=Math.sin(B),T.a=N*C-O*E,T.b=N*k-O*F,T.c=O*C+N*E,T.d=O*k+N*F}}}computeWorldPositions(t,e,s,i){const r=this.slot;let o=this.appliedPose.position,a=this.spaces,h=G.setArraySize(this.positions,s*3+2),l=this.world;const c=e.closed;let u=e.worldVerticesLength,d=u/6,f=si.NONE;if(!e.constantSpeed){const O=e.lengths;d-=c?1:2;const R=O[d];this.data.positionMode===Ms.Percent&&(o*=R);let D;switch(this.data.spacingMode){case oe.Percent:D=R;break;case oe.Proportional:D=R/s;break;default:D=1}l=G.setArraySize(this.world,8);for(let z=0,Y=0,W=0;z<s;z++,Y+=3){const V=a[z]*D;o+=V;let H=o;if(c)H%=R,H<0&&(H+=R),W=0;else if(H<0){f!==si.BEFORE&&(f=si.BEFORE,e.computeWorldVertices(t,r,2,4,l,0,2)),this.addBeforePosition(H,l,0,h,Y);continue}else if(H>R){f!==si.AFTER&&(f=si.AFTER,e.computeWorldVertices(t,r,u-6,4,l,0,2)),this.addAfterPosition(H-R,l,0,h,Y);continue}for(;;W++){const K=O[W];if(!(H>K)){if(W===0)H/=K;else{const tt=O[W-1];H=(H-tt)/(K-tt)}break}}W!==f&&(f=W,c&&W===d?(e.computeWorldVertices(t,r,u-4,4,l,0,2),e.computeWorldVertices(t,r,0,4,l,4,2)):e.computeWorldVertices(t,r,W*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],h,Y,i||z>0&&V===0)}return h}c?(u+=2,l=G.setArraySize(this.world,u),e.computeWorldVertices(t,r,2,u-4,l,0,2),e.computeWorldVertices(t,r,0,2,l,u-4,2),l[u-2]=l[0],l[u-1]=l[1]):(d--,u-=4,l=G.setArraySize(this.world,u),e.computeWorldVertices(t,r,2,u,l,0,2));const g=G.setArraySize(this.curves,d);let p=0,m=l[0],y=l[1],x=0,_=0,b=0,w=0,S=0,v=0,T=0,A=0,P=0,M=0,I=0,C=0,k=0,E=0;for(let O=0,R=2;O<d;O++,R+=6)x=l[R],_=l[R+1],b=l[R+2],w=l[R+3],S=l[R+4],v=l[R+5],T=(m-x*2+b)*.1875,A=(y-_*2+w)*.1875,P=((x-b)*3-m+S)*.09375,M=((_-w)*3-y+v)*.09375,I=T*2+P,C=A*2+M,k=(x-m)*.75+T+P*.16666667,E=(_-y)*.75+A+M*.16666667,p+=Math.sqrt(k*k+E*E),k+=I,E+=C,I+=P,C+=M,p+=Math.sqrt(k*k+E*E),k+=I,E+=C,p+=Math.sqrt(k*k+E*E),k+=I+P,E+=C+M,p+=Math.sqrt(k*k+E*E),g[O]=p,m=S,y=v;this.data.positionMode===Ms.Percent&&(o*=p);let F;switch(this.data.spacingMode){case oe.Percent:F=p;break;case oe.Proportional:F=p/s;break;default:F=1}const B=this.segments;let N=0;for(let O=0,R=0,D=0,z=0;O<s;O++,R+=3){const Y=a[O]*F;o+=Y;let W=o;if(c)W%=p,W<0&&(W+=p),D=0,z=0;else if(W<0){this.addBeforePosition(W,l,0,h,R);continue}else if(W>p){this.addAfterPosition(W-p,l,u-4,h,R);continue}for(;;D++){const V=g[D];if(!(W>V)){if(D===0)W/=V;else{const H=g[D-1];W=(W-H)/(V-H)}break}}if(D!==f){f=D;let V=D*6;for(m=l[V],y=l[V+1],x=l[V+2],_=l[V+3],b=l[V+4],w=l[V+5],S=l[V+6],v=l[V+7],T=(m-x*2+b)*.03,A=(y-_*2+w)*.03,P=((x-b)*3-m+S)*.006,M=((_-w)*3-y+v)*.006,I=T*2+P,C=A*2+M,k=(x-m)*.3+T+P*.16666667,E=(_-y)*.3+A+M*.16666667,N=Math.sqrt(k*k+E*E),B[0]=N,V=1;V<8;V++)k+=I,E+=C,I+=P,C+=M,N+=Math.sqrt(k*k+E*E),B[V]=N;k+=I,E+=C,N+=Math.sqrt(k*k+E*E),B[8]=N,k+=I+P,E+=C+M,N+=Math.sqrt(k*k+E*E),B[9]=N,z=0}for(W*=N;;z++){const V=B[z];if(!(W>V)){if(z===0)W/=V;else{const H=B[z-1];W=z+(W-H)/(V-H)}break}}this.addCurvePosition(W*.1,m,y,x,_,b,w,S,v,h,R,i||O>0&&Y===0)}return h}addBeforePosition(t,e,s,i,r){const o=e[s],a=e[s+1],h=e[s+2]-o,l=e[s+3]-a,c=Math.atan2(l,h);i[r]=o+t*Math.cos(c),i[r+1]=a+t*Math.sin(c),i[r+2]=c}addAfterPosition(t,e,s,i,r){const o=e[s+2],a=e[s+3],h=o-e[s],l=a-e[s+1],c=Math.atan2(l,h);i[r]=o+t*Math.cos(c),i[r+1]=a+t*Math.sin(c),i[r+2]=c}addCurvePosition(t,e,s,i,r,o,a,h,l,c,u,d){if(t===0||Number.isNaN(t)){c[u]=e,c[u+1]=s,c[u+2]=Math.atan2(r-s,i-e);return}const f=t*t,g=f*t,p=1-t,m=p*p,y=m*p,x=p*t,_=x*3,b=p*_,w=_*t,S=e*y+i*b+o*w+h*g,v=s*y+r*b+a*w+l*g;c[u]=S,c[u+1]=v,d&&(t<.001?c[u+2]=Math.atan2(r-s,i-e):c[u+2]=Math.atan2(v-(s*m+r*x*2+a*f),S-(e*m+i*x*2+o*f)))}sort(t){const e=this.slot.data.index,s=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,e,s),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,e,s),this.sortPath(t,this.slot.pose.attachment,s);const i=this.bones,r=this.bones.length;for(let o=0;o<r;o++){const a=i[o].bone;t.sortBone(a),t.constrained(a)}t._updateCache.push(this);for(let o=0;o<r;o++)t.sortReset(i[o].bone.children);for(let o=0;o<r;o++)i[o].bone.sorted=!0}sortPathSlot(t,e,s,i){const r=e.getAttachments();for(let o=0,a=r.length;o<a;o++){const h=r[o];h.slotIndex===s&&this.sortPath(t,h.attachment,i)}}sortPath(t,e,s){if(!(e instanceof $r))return;const i=e.bones;if(i==null)t.sortBone(s);else{const r=t.bones;for(let o=0,a=i.length;o<a;){let h=i[o++];for(h+=o;o<h;)t.sortBone(r[i[o++]])}}}isSourceActive(){return this.slot.bone.active}}var cs;(function(n){n[n.none=0]="none",n[n.reset=1]="reset",n[n.update=2]="update",n[n.pose=3]="pose"})(cs||(cs={}));class kl{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}}class Il{color=new Q(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof js)||!(this.attachment instanceof js)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}}class Yc extends Fm{skeleton;bone;attachmentState=0;constructor(t,e){if(super(t,new Il,new Il),!e)throw new Error("skeleton cannot be null.");this.skeleton=e,this.bone=e.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new Q,this.constrainedPose.darkColor=new Q),this.setupPose()}copy(t,e,s){const i=new Yc(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new Q,i.constrainedPose.darkColor=new Q),i.pose.set(t.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}}class $s{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return $s.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*$s.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let e=0;e<t.bones.length;e++){const s=t.bones[e];let i;if(!s.parent)i=new Ir(s,null);else{const r=this.bones[s.parent.index];i=new Ir(s,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const e of this.data.slots)this.slots.push(new Yc(e,this));this.drawOrder=new AS(this.slots),this.physics=[],this.constraints=[];for(const e of this.data.constraints){const s=e.create(this);s instanceof Ja&&this.physics.push(s),this.constraints.push(s)}this.color=new Q(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let o=0,a=t.length;o<a;o++)t[o].unconstrained();const e=this.bones,s=e.length;for(let o=0,a=s;o<a;o++){const h=e[o];h.sorted=h.data.skinRequired,h.active=!h.sorted,h.unconstrained()}if(this.skin){const o=this.skin.bones;for(let a=0,h=this.skin.bones.length;a<h;a++){let l=this.bones[o[a].index];do l.sorted=!1,l.active=!0,l=l.parent;while(l)}}const i=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)i[o].unconstrained();for(let o=0;o<r;o++){const a=i[o];a.active=a.isSourceActive()&&(!a.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(a.data)),a.active&&a.sort(this)}for(let o=0;o<s;o++)this.sortBone(e[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const a=this._updateCache[o];a instanceof Ir&&(this._updateCache[o]=a.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){const i=t[e];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const e=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)e[i].resetConstrained();const s=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)s[i].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let s=0,i=t.length;s<i;s++)t[s].setupPose();const e=this.constraints;for(let s=0,i=e.length;s<i;s++)e[s].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let e=0,s=t.length;e<s;e++)t[e].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].data.name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].data.name===t)return e[s];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const e=this.data.findSkin(t);if(!e)throw new Error(`Skin not found: ${t}`);this.setSkin(e)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const e=this.slots;for(let s=0,i=e.length;s<i;s++){const r=e[s],o=r.data.attachmentName;if(o){const a=t.getAttachment(s,o);a&&r.pose.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachment(t,e){return typeof t=="string"?this.getAttachmentByName(t,e):this.getAttachmentByIndex(t,e)}getAttachmentByName(t,e){const s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachmentByIndex(t,e){if(!e)throw new Error("placeholder cannot be null.");if(this.skin){const s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");const s=this.findSlot(t);if(!s)throw new Error(`Slot not found: ${t}`);let i=null;if(e&&(i=this.getAttachment(s.data.index,e),!i))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);s.pose.setAttachment(i)}findConstraint(t,e){if(t==null)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let i=0,r=s.length;i<r;i++){const o=s[i];if(o instanceof e&&o.data.name===t)return o}return null}getBoundsRect(t){const e=new Al,s=new Al;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,o=r;let a=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let u=0,d=r.length;u<d;u++){const f=o[u];if(!f.bone.active)continue;let g=0,p=null,m=null;const y=f.appliedPose.attachment;if(y){if(y instanceof at)g=8,p=G.setArraySize(s,g,0),y.computeWorldVertices(f,y.getOffsets(f.appliedPose),p,0,2),m=$s.quadTriangles;else if(y instanceof xe)g=y.worldVerticesLength,p=G.setArraySize(s,g,0),y.computeWorldVertices(this,f,0,g,p,0,2),m=y.triangles;else if(y instanceof vs&&i){i.clipEnd(f),i.clipStart(this,f,y);continue}if(p&&m){i?.isClipping()&&i.clipTriangles(p,m,m.length)&&(p=i.clippedVertices,g=i.clippedVertices.length);for(let x=0,_=p.length;x<_;x+=2){const b=p[x],w=p[x+1];a=Math.min(a,b),h=Math.min(h,w),l=Math.max(l,b),c=Math.max(c,w)}}}i&&i.clipEnd(f)}i&&i.clipEnd(),t.set(a,h),e.set(l-a,c-h)}setScale(t,e){this.scaleX=t,this.scaleY=e}setPosition(t,e){this.x=t,this.y=e}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physics;for(let i=0,r=s.length;i<r;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physics;for(let r=0,o=i.length;r<o;r++)i[r].rotate(t,e,s)}}class Ja extends ao{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,e){if(super(t,new kl,new kl),e==null)throw new Error("skeleton cannot be null.");this.bone=e.bones[t.bone.index].constrainedPose}copy(t){var e=new Ja(this.data,t);return e.pose.set(this.pose),e}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*U.degRad,r=Math.cos(i),o=Math.sin(i),a=this.cx-t,h=this.cy-e;this.translate(a*r-h*o-a,a*o+h*r-h)}update(t,e){const s=this.appliedPose,i=s.mix;if(i===0)return;const r=this.data.x>0,o=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone;let c=l.bone.data.length,u=this.data.step,d=0;if(e!==cs.none){switch(l.modifyWorld(t),e){case cs.reset:this.reset(t);case cs.update:{const f=Math.max(t.time-this.lastTime,0),g=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=l.worldX,m=l.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=m;else{let y=this.remaining,x=s.inertia,_=t.data.referenceScale,b=-1,w=0,S=0,v=this.data.limit*f,T=v*Math.abs(t.scaleY);if(v*=Math.abs(t.scaleX),r||o){if(r){const A=(this.ux-p)*x;this.xOffset+=A>v?v:A<-v?-v:A,this.ux=p}if(o){const A=(this.uy-m)*x;this.yOffset+=A>T?T:A<-T?-T:A,this.uy=m}if(y>=u){const A=this.xOffset,P=this.yOffset;b=s.damping**(60*u),w=u*s.massInverse,S=s.strength;const M=_*s.wind,I=_*s.gravity,C=(M*t.windX+I*t.gravityX)*t.scaleX,k=(M*t.windY+I*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(C-this.xOffset*S)*w,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),o&&(this.yVelocity-=(k+this.yOffset*S)*w,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),y-=u;while(y>=u);this.xLag=this.xOffset-A,this.yLag=this.yOffset-P}d=Math.max(0,1-y/u),r&&(l.worldX+=(this.xOffset-this.xLag*d)*i*this.data.x),o&&(l.worldY+=(this.yOffset-this.yLag*d)*i*this.data.y)}if(a||h){let A=Math.atan2(l.c,l.a),P=0,M=0,I=0,C=this.cx-l.worldX,k=this.cy-l.worldY;if(C>v?C=v:C<-v&&(C=-v),k>T?k=T:k<-T&&(k=-T),y=this.remaining,a){I=(this.data.rotate+this.data.shearX)*i,d=this.rotateLag*Math.max(0,1-g/u);let E=Math.atan2(k+this.ty,C+this.tx)-A-(this.rotateOffset-d)*I;this.rotateOffset+=(E-Math.ceil(E*U.invPI2-.5)*U.PI2)*x,E=(this.rotateOffset-d)*I+A,P=Math.cos(E),M=Math.sin(E),h&&(E=c*l.getWorldScaleX(),E>0&&(this.scaleOffset+=(C*P+k*M)*x/E))}else{P=Math.cos(A),M=Math.sin(A);const E=c*l.getWorldScaleX()-this.scaleLag*Math.max(0,1-g/u);E>0&&(this.scaleOffset+=(C*P+k*M)*x/E)}if(y>=u){b===-1&&(b=s.damping**(60*u),w=u*s.massInverse,S=s.strength);const E=s.wind*t.windX+s.gravity*t.gravityX,F=(s.wind*t.windY+s.gravity*t.gravityY)*$s.yDir,B=this.rotateOffset,N=this.scaleOffset,O=c/_;for(;;)if(y-=u,h&&(this.scaleVelocity+=(E*P-F*M-this.scaleOffset*S)*w,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),a){if(this.rotateVelocity-=((E*M+F*P)*O+this.rotateOffset*S)*w,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,y<u)break;const R=this.rotateOffset*I+A;P=Math.cos(R),M=Math.sin(R)}else if(y<u)break;this.rotateLag=this.rotateOffset-B,this.scaleLag=this.scaleOffset-N}d=Math.max(0,1-y/u)}this.remaining=y}this.cx=l.worldX,this.cy=l.worldY;break}case cs.pose:d=Math.max(0,1-this.remaining/u),r&&(l.worldX+=(this.xOffset-this.xLag*d)*i*this.data.x),o&&(l.worldY+=(this.yOffset-this.yLag*d)*i*this.data.y)}if(a){let f=(this.rotateOffset-this.rotateLag*d)*i,g=0,p=0,m=0;if(this.data.shearX>0){let y=0;this.data.rotate>0&&(y=f*this.data.rotate,g=Math.sin(y),p=Math.cos(y),m=l.b,l.b=p*m-g*l.d,l.d=g*m+p*l.d),y+=f*this.data.shearX,g=Math.sin(y),p=Math.cos(y),m=l.a,l.a=p*m-g*l.c,l.c=g*m+p*l.c}else f*=this.data.rotate,g=Math.sin(f),p=Math.cos(f),m=l.a,l.a=p*m-g*l.c,l.c=g*m+p*l.c,m=l.b,l.b=p*m-g*l.d,l.d=g*m+p*l.d}if(h){let f=1+(this.scaleOffset-this.scaleLag*d)*i*this.data.scaleX;switch(l.a*=f,l.c*=f,this.data.scaleYMode){case Te.Uniform:l.b*=f,l.d*=f;break;case Te.Volume:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,l.b*=f,l.d*=f}}e!==cs.pose&&(this.tx=c*l.a,this.ty=c*l.c)}}sort(t){const e=this.bone.bone;t.sortBone(e),t._updateCache.push(this),t.sortReset(e.children),t.constrained(e)}isSourceActive(){return this.bone.bone.active}}class Zo extends ho{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}
389_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=Te.None;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new kl)}create(t){return new Ja(this,t)}}typeof Math.fround>"u"&&(Math.fround=(n=>t=>(n[0]=t,n[0]))(new Float32Array(1)));class El{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}}class ma extends ao{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,e){if(super(t,new El,new El),!e)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=e.bones[t.bone.index])}copy(t){var e=new ma(this.data,t);return e.pose.set(this.pose),e}update(t,e){const s=this.appliedPose;if(s.mix===0)return;const i=this.data,r=i.animation,o=this.bone;if(o!==null){if(!o.active)return;i.local&&o.appliedPose.validateLocalTransform(t),s.time=i.offset+(i.property.value(t,o.appliedPose,i.local,ma.offsets)-i.property.offset)*i.scale,i.loop?s.time=r.duration+s.time%r.duration:s.time=Math.max(0,s.time)}const a=t.bones,h=r.bones;for(let l=0,c=r.bones.length;l<c;l++)a[h[l]].appliedPose.modifyLocal(t);r.apply(t,s.time,s.time,i.loop,null,s.mix,q.current,i.additive,!1,!0)}sort(t){const e=this.bone,s=this.data;e&&!s.local&&t.sortBone(e),t._updateCache.push(this);const i=t.bones,r=s.animation.bones;for(let u=0,d=s.animation.bones.length;u<d;u++){const f=i[r[u]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const o=s.animation.timelines,a=t.slots,h=t.constraints,l=t.physics,c=t.physics.length;for(let u=0,d=s.animation.timelines.length;u<d;u++){const f=o[u];if(yS(f))t.constrained(a[f.slotIndex]);else if(f instanceof Xs||f instanceof Ji)t.drawOrder.constrained();else if(f instanceof Si)if(f.constraintIndex===-1)for(let g=0;g<c;g++)t.constrained(l[g]);else t.constrained(h[f.constraintIndex]);else if(_S(f)){const g=f.constraintIndex;g!==-1&&t.constrained(h[g])}}}}class Vi extends ho{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(t){super(t,new El)}create(t){return new ma(this,t)}}class Vc{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,i=this.constraints.length;s<i;s++){const r=e[s];r instanceof Vi&&r.animation!=null&&t.push(r.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let i=0,r=this.constraints.length;i<r;i++){const o=s[i];if(o instanceof e&&o.name===t)return o}return null}}class Gd{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}}class ya{name;attachments=[];bones=[];constraints=[];color=new Q(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let r=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===i){r=!0;break}r||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let r=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===i){r=!0;break}r||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.placeholder,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let r=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===i){r=!0;break}r||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let r=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===i){r=!0;break}r||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment&&(i.attachment instanceof xe?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const i in s){const r=s[i];r&&t.push(new Gd(e,i,r))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const r=s[i];r&&e.push(new Gd(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const r=t.slots[i],o=r.pose.getAttachment();if(o&&s<e.attachments.length){const a=e.attachments[s];for(const h in a){const l=a[h];if(o===l){const c=this.getAttachment(s,h);c&&r.pose.setAttachment(c);break}}}s++}}}class Lm extends Wc{index=0;boneData;attachmentName=null;blendMode=ri.Normal;visible=!0;constructor(t,e,s){if(super(e,new Il),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}}var ri;(function(n){n[n.Normal=0]="Normal",n[n.Additive=1]="Additive",n[n.Multiply=2]="Multiply",n[n.Screen=3]="Screen"})(ri||(ri={}));class Fl{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}}class Uc extends ao{bones;source;constructor(t,e){if(super(t,new Fl,new Fl),!e)throw new Error("skeleton cannot be null.");this.bones=[];
vendor: 71,604 bytes, line 389
389for(const i of t.bones)this.bones.push(e.bones[i.index].constrainedPose);const s=e.bones[t.source.index];if(s==null)throw new Error("source cannot be null.");this.source=s}copy(t){var e=new Uc(this.data,t);return e.pose.set(this.pose),e}update(t,e){const s=this.appliedPose;if(s.mixRotate===0&&s.mixX===0&&s.mixY===0&&s.mixScaleX===0&&s.mixScaleY===0&&s.mixShearY===0)return;const i=this.data,r=i.localSource,o=i.localTarget,a=i.additive,h=i.clamp,l=i.offsets,c=this.source.appliedPose;r&&c.validateLocalTransform(t);const u=i.properties,d=i.properties.length,f=this.bones;for(let g=0,p=this.bones.length;g<p;g++){const m=f[g];o?m.modifyLocal(t):m.modifyWorld(t);for(let y=0;y<d;y++){const x=u[y],_=x.value(t,c,r,l)-x.offset,b=x.to;for(let w=0,S=x.to.length;w<S;w++){const v=b[w];if(v.mix(s)!==0){let T=v.offset+_*v.scale;h&&(v.offset<v.max?T=U.clamp(T,v.offset,v.max):T=U.clamp(T,v.max,v.offset)),v.apply(t,s,m,T,o,a)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const e=this.bones,s=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<s;r++)t.sortBone(e[r].bone);t._updateCache.push(this);for(let r=0;r<s;r++){const o=e[r].bone;t.sortReset(o.children),t.constrained(o)}for(let r=0;r<s;r++)e[r].bone.sorted=i}isSourceActive(){return this.source.active}}class rt extends ho{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new Fl)}create(t){return new Uc(this,t)}getOffsetRotation(){return this.offsets[rt.ROTATION]}setOffsetRotation(t){this.offsets[rt.ROTATION]=t}getOffsetX(){return this.offsets[rt.X]}setOffsetX(t){this.offsets[rt.X]=t}getOffsetY(){return this.offsets[rt.Y]}setOffsetY(t){this.offsets[rt.Y]=t}getOffsetScaleX(){return this.offsets[rt.SCALEX]}setOffsetScaleX(t){this.offsets[rt.SCALEX]=t}getOffsetScaleY(){return this.offsets[rt.SCALEY]}setOffsetScaleY(t){this.offsets[rt.SCALEY]=t}getOffsetShearY(){return this.offsets[rt.SHEARY]}setOffsetShearY(t){this.offsets[rt.SHEARY]=t}}class ir{offset=0;to=[]}class nr{offset=0;max=0;scale=0}class Bl extends ir{value(t,e,s,i){if(s)return e.rotation+i[rt.ROTATION];const r=t.scaleX,o=t.scaleY;let a=Math.atan2(e.c/o,e.a/r)*U.radDeg+((e.a*e.d-e.b*e.c)*r*o>0?i[rt.ROTATION]:-i[rt.ROTATION]);return a<0&&(a+=360),a}}class Om extends nr{mix(t){return t.mixRotate}apply(t,e,s,i,r,o){if(r)s.rotation+=(o?i:i-s.rotation)*e.mixRotate;else{const a=t.scaleX,h=t.scaleY,l=1/a,c=1/h,u=s.a*l,d=s.b*l,f=s.c*c,g=s.d*c;i*=U.degRad,o||(i-=Math.atan2(f,u)),i>U.PI?i-=U.PI2:i<-U.PI&&(i+=U.PI2),i*=e.mixRotate;const p=Math.cos(i),m=Math.sin(i);s.a=(p*u-m*f)*a,s.b=(p*d-m*g)*a,s.c=(m*u+p*f)*h,s.d=(m*d+p*g)*h}}}class Rl extends ir{value(t,e,s,i){return s?e.x+i[rt.X]:(i[rt.X]*e.a+i[rt.Y]*e.b+e.worldX)/t.scaleX}}class Dm extends nr{mix(t){return t.mixX}apply(t,e,s,i,r,o){r?s.x+=(o?i:i-s.x)*e.mixX:(o||(i-=s.worldX/t.scaleX),s.worldX+=i*e.mixX*t.scaleX)}}class Ll extends ir{value(t,e,s,i){return s?e.y+i[rt.Y]:(i[rt.X]*e.c+i[rt.Y]*e.d+e.worldY)/t.scaleY}}class Nm extends nr{mix(t){return t.mixY}apply(t,e,s,i,r,o){r?s.y+=(o?i:i-s.y)*e.mixY:(o||(i-=s.worldY/t.scaleY),s.worldY+=i*e.mixY*t.scaleY)}}class Ol extends ir{value(t,e,s,i){if(s)return e.scaleX+i[rt.SCALEX];const r=e.a/t.scaleX,o=e.c/t.scaleY;return Math.sqrt(r*r+o*o)+i[rt.SCALEX]}}class Wm extends nr{mix(t){return t.mixScaleX}apply(t,e,s,i,r,o){if(r)o?s.scaleX*=1+(i-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(i-s.scaleX)*e.mixScaleX);else if(o){const a=1+(i-1)*e.mixScaleX;s.a*=a,s.c*=a}else{let a=s.a/t.scaleX,h=s.c/t.scaleY,l=Math.sqrt(a*a+h*h);l!==0&&(l=1+(i-l)*e.mixScaleX/l,s.a*=l,s.c*=l)}}}class Dl extends ir{value(t,e,s,i){if(s)return e.scaleY+i[rt.SCALEY];const r=e.b/t.scaleX,o=e.d/t.scaleY;return Math.sqrt(r*r+o*o)+i[rt.SCALEY]}}class zm extends nr{mix(t){return t.mixScaleY}apply(t,e,s,i,r,o){if(r)o?s.scaleY*=1+(i-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(i-s.scaleY)*e.mixScaleY);else if(o){const a=1+(i-1)*e.mixScaleY;s.b*=a,s.d*=a}else{let a=s.b/t.scaleX,h=s.d/t.scaleY,l=Math.sqrt(a*a+h*h);l!==0&&(l=1+(i-l)*e.mixScaleY/l,s.b*=l,s.d*=l)}}}class Nl extends ir{value(t,e,s,i){if(s)return e.shearY+i[rt.SHEARY];const r=1/t.scaleX,o=1/t.scaleY;return(Math.atan2(e.d*o,e.b*r)-Math.atan2(e.c*o,e.a*r))*U.radDeg-90+i[rt.SHEARY]}}class Ym extends nr{mix(t){return t.mixShearY}apply(t,e,s,i,r,o){if(r)o||(i-=s.shearY),s.shearY+=i*e.mixShearY;else{const a=t.scaleX,h=t.scaleY,l=s.b/a,c=s.d/h,u=Math.atan2(c,l);i=(i+90)*U.degRad,o?i-=U.PI/2:(i-=u-Math.atan2(s.c/h,s.a/a),i>U.PI?i-=U.PI2:i<-U.PI&&(i+=U.PI2)),i=u+i*e.mixShearY;const d=Math.sqrt(l*l+c*c);s.b=Math.cos(i)*d*a,s.d=Math.sin(i)*d*h}}}class CS{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Vc;s.name="";const i=new PS(t),r=i.readInt32(),o=i.readInt32();s.hash=o===0&&r===0?null:o.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;const a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let h=0;h=i.readInt(!0);for(let g=0;g<h;g++){const p=i.readString();if(!p)throw new Error("String in string table must not be null.");i.strings.push(p)}const l=s.bones;h=i.readInt(!0);for(let g=0;g<h;g++){const p=i.readString();if(!p)throw new Error("Bone name must not be null.");const m=g===0?null:l[i.readInt(!0)],y=new Qa(g,p,m),x=y.setupPose;x.rotation=i.readFloat(),x.x=i.readFloat()*e,x.y=i.readFloat()*e,x.scaleX=i.readFloat(),x.scaleY=i.readFloat(),x.shearX=i.readFloat(),x.shearY=i.readFloat(),x.inherit=i.readByte(),y.length=i.readFloat()*e,y.skinRequired=i.readBoolean(),a&&(Q.rgba8888ToColor(y.color,i.readInt32()),y.icon=i.readString()??void 0,y.iconSize=i.readFloat(),y.iconRotation=i.readFloat(),y.visible=i.readBoolean()),l.push(y)}h=i.readInt(!0);for(let g=0;g<h;g++){const p=i.readString();if(!p)throw new Error("Slot name must not be null.");const m=l[i.readInt(!0)],y=new Lm(g,p,m);Q.rgba8888ToColor(y.setupPose.color,i.readInt32());const x=i.readInt32();x!==-1&&Q.rgb888ToColor(y.setupPose.darkColor=new Q,x),y.attachmentName=i.readStringRef(),y.blendMode=i.readInt(!0),a&&(y.visible=i.readBoolean()),s.slots.push(y)}const c=s.constraints,u=i.readInt(!0);for(let g=0;g<u;g++){const p=i.readString();if(!p)throw new Error("Constraint data name must not be null.");let m;switch(i.readByte()){case jS:{const y=new qo(p);m=i.readInt(!0);for(let b=0;b<m;b++)y.bones.push(l[i.readInt(!0)]);y.target=l[i.readInt(!0)];const x=i.readByte();y.skinRequired=(x&1)!==0,(x&2)!==0&&(y.scaleYMode=i.readUnsignedByte());const _=y.setupPose;_.bendDirection=(x&4)!==0?-1:1,_.compress=(x&8)!==0,_.stretch=(x&16)!==0,(x&32)!==0&&(_.mix=(x&64)!==0?i.readFloat():1),(x&128)!==0&&(_.softness=i.readFloat()*e),c.push(y);break}case KS:{const y=new rt(p);m=i.readInt(!0);for(let b=0;b<m;b++)y.bones.push(l[i.readInt(!0)]);y.source=l[i.readInt(!0)];let x=i.readUnsignedByte();y.skinRequired=(x&1)!==0,y.localSource=(x&2)!==0,y.localTarget=(x&4)!==0,y.additive=(x&8)!==0,y.clamp=(x&16)!==0,m=x>>5;for(let b=0,w;b<m;b++){let S=1,v;switch(i.readByte()){case 0:v=new Bl;break;case 1:{S=e,v=new Rl;break}case 2:{S=e,v=new Ll;break}case 3:v=new Ol;break;case 4:v=new Dl;break;case 5:v=new Nl;break;default:v=null}if(v){v.offset=i.readFloat()*S,w=i.readByte();for(let T=0;T<w;T++){let A=1,P;switch(i.readByte()){case 0:P=new Om;break;case 1:{A=e,P=new Dm;break}case 2:{A=e,P=new Nm;break}case 3:P=new Wm;break;case 4:P=new zm;break;case 5:P=new Ym;break;default:P=null}P&&(P.offset=i.readFloat()*A,P.max=i.readFloat()*A,P.scale=i.readFloat()*A/S,v.to[T]=P)}y.properties[b]=v}}x=i.readByte(),(x&1)!==0&&(y.offsets[rt.ROTATION]=i.readFloat()),(x&2)!==0&&(y.offsets[rt.X]=i.readFloat()*e),(x&4)!==0&&(y.offsets[rt.Y]=i.readFloat()*e),(x&8)!==0&&(y.offsets[rt.SCALEX]=i.readFloat()),(x&16)!==0&&(y.offsets[rt.SCALEY]=i.readFloat()),(x&32)!==0&&(y.offsets[rt.SHEARY]=i.readFloat()),x=i.readByte();const _=y.setupPose;(x&1)!==0&&(_.mixRotate=i.readFloat()),(x&2)!==0&&(_.mixX=i.readFloat()),(x&4)!==0&&(_.mixY=i.readFloat()),(x&8)!==0&&(_.mixScaleX=i.readFloat()),(x&16)!==0&&(_.mixScaleY=i.readFloat()),(x&32)!==0&&(_.mixShearY=i.readFloat()),c.push(y);break}case qS:{const y=new Ko(p);m=i.readInt(!0);for(let b=0;b<m;b++)y.bones.push(l[i.readInt(!0)]);y.slot=s.slots[i.readInt(!0)];const x=i.readByte();y.skinRequired=(x&1)!==0,y.positionMode=x>>1&1,y.spacingMode=x>>2&3,y.rotateMode=x>>4&3,(x&128)!==0&&(y.offsetRotation=i.readFloat());const _=y.setupPose;_.position=i.readFloat(),y.positionMode===Ms.Fixed&&(_.position*=e),_.spacing=i.readFloat(),(y.spacingMode===oe.Length||y.spacingMode===oe.Fixed)&&(_.spacing*=e),_.mixRotate=i.readFloat(),_.mixX=i.readFloat(),_.mixY=i.readFloat(),c.push(y);break}case ZS:{const y=new Zo(p);y.bone=l[i.readInt(!0)];let x=i.readByte();if(y.skinRequired=(x&1)!==0,(x&2)!==0&&(y.x=i.readFloat()),(x&4)!==0&&(y.y=i.readFloat()),(x&8)!==0&&(y.rotate=i.readFloat()),(x&16)!==0){let b=i.readFloat();b<-2?(y.scaleYMode=Te.Volume,b=-2-b):b<0&&(y.scaleYMode=Te.Uniform,b=-1-b),y.scaleX=b}(x&32)!==0&&(y.shearX=i.readFloat()),y.limit=((x&64)!==0?i.readFloat():5e3)*e,y.step=1/i.readUnsignedByte();const _=y.setupPose;_.inertia=i.readFloat(),_.strength=i.readFloat(),_.damping=i.readFloat(),_.massInverse=(x&128)!==0?i.readFloat():1,_.wind=i.readFloat(),_.gravity=i.readFloat(),x=i.readByte(),(x&1)!==0&&(y.inertiaGlobal=!0),(x&2)!==0&&(y.strengthGlobal=!0),(x&4)!==0&&(y.dampingGlobal=!0),(x&8)!==0&&(y.massGlobal=!0),(x&16)!==0&&(y.windGlobal=!0),(x&32)!==0&&(y.gravityGlobal=!0),(x&64)!==0&&(y.mixGlobal=!0),_.mix=(x&128)!==0?i.readFloat():1,c.push(y);break}case QS:{const y=new Vi(p),x=i.readByte();if(y.skinRequired=(x&1)!==0,y.loop=(x&2)!==0,y.additive=(x&4)!==0,(x&8)!==0){const _=i.readFloat();a&&(x&64)!==0?y.max=_:y.setupPose.time=_}if((x&16)!==0&&(y.setupPose.mix=(x&32)!==0?i.readFloat():1),(x&64)!==0){y.local=(x&128)!==0,y.bone=l[i.readInt(!0)];const _=i.readFloat();let b=1;switch(i.readByte()){case 0:y.property=new Bl;break;case 1:{b=e,y.property=new Rl;break}case 2:{b=e,y.property=new Ll;break}case 3:y.property=new Ol;break;case 4:y.property=new Dl;break;case 5:y.property=new Nl;break;default:continue}y.property.offset=_*b,y.offset=i.readFloat(),y.scale=i.readFloat()/b}c.push(y);break}}}const d=this.readSkin(i,s,!0,a);d&&(s.defaultSkin=d,s.skins.push(d));{let g=s.skins.length;for(G.setArraySize(s.skins,h=g+i.readInt(!0));g<h;g++){const p=this.readSkin(i,s,!1,a);if(!p)throw new Error("readSkin() should not have returned null.");s.skins[g]=p}}h=this.linkedMeshes.length;for(let g=0;g<h;g++){const p=this.linkedMeshes[g],m=s.skins[p.skinIndex];if(!p.source)throw new Error("Linked mesh parent must not be null");const y=m.getAttachment(p.sourceIndex,p.source);if(!y)throw new Error(`Source mesh not found: ${p.source}`);p.mesh.timelineAttachment=p.inheritTimelines?y:p.mesh,p.mesh.setSourceMesh(y),p.mesh.updateSequence()}this.linkedMeshes.length=0,h=i.readInt(!0);for(let g=0;g<h;g++){const p=i.readString();if(!p)throw new Error("Event data name must not be null");const m=new Rm(p),y=m.setupPose;y.intValue=i.readInt(!1),y.floatValue=i.readFloat(),y.stringValue=i.readString(),m._audioPath=i.readString(),m.audioPath&&(y.volume=i.readFloat(),y.balance=i.readFloat()),s.events.push(m)}const f=s.animations;h=i.readInt(!0);for(let g=0;g<h;g++){const p=i.readString();if(!p)throw new Error("Animation name must not be null.");f.push(this.readAnimation(i,p,s,a))}for(let g=0;g<u;g++){const p=c[g];p instanceof Vi&&(p.animation=f[i.readInt(!0)])}return s}readSkin(t,e,s,i){let r=null,o=0;if(s){if(o=t.readInt(!0),o===0)return null;r=new ya("default")}else{const a=t.readString();if(!a)throw new Error("Skin name must not be null.");r=new ya(a),i&&Q.rgba8888ToColor(r.color,t.readInt32());let h=t.readInt(!0),l=e.bones,c=r.bones;for(let u=0;u<h;u++)c[u]=l[t.readInt(!0)];h=t.readInt(!0),l=e.constraints,c=r.constraints;for(let u=0;u<h;u++)c[u]=l[t.readInt(!0)];o=t.readInt(!0)}for(let a=0;a<o;a++){const h=t.readInt(!0);for(let l=0,c=t.readInt(!0);l<c;l++){const u=t.readStringRef();if(!u)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,r,h,u,i);d&&r.setAttachment(h,u,d)}}return r}readAttachment(t,e,s,i,r,o){const a=this.scale,h=t.readByte(),l=(h&8)!==0?t.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case Os.Region:{let c=(h&16)!==0?t.readStringRef():null;const u=(h&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(h&64)!==0),f=(h&128)!==0?t.readFloat():0,g=t.readFloat(),p=t.readFloat(),m=t.readFloat(),y=t.readFloat(),x=t.readFloat(),_=t.readFloat();c||(c=l);const b=this.attachmentLoader.newRegionAttachment(s,r,l,c,d);return b?(b.path=c,b.x=g*a,b.y=p*a,b.scaleX=m,b.scaleY=y,b.rotation=f,b.width=x*a,b.height=_*a,Q.rgba8888ToColor(b.color,u),b.updateSequence(),b):null}case Os.BoundingBox:{const c=this.readVertices(t,(h&16)!==0),u=o?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,r,l);return d?(d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,o&&Q.rgba8888ToColor(d.color,u),d):null}case Os.Mesh:{let c=(h&16)!==0?t.readStringRef():l;const u=(h&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(h&64)!==0),f=t.readInt(!0),g=this.readVertices(t,(h&128)!==0),p=this.readFloatArray(t,g.length,1),m=this.readShortArray(t,(g.length-f-2)*3),y=t.readInt(!0);let x=null;if(y>0){x=[];for(let v=0;v<y;v++)x[v]=t.readInt(!0)}let _=[],b=0,w=0;o&&(_=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),w=t.readFloat()),c||(c=l);const S=this.attachmentLoader.newMeshAttachment(s,r,l,c,d);return S?(S.path=c,Q.rgba8888ToColor(S.color,u),S.hullLength=f<<1,S.bones=g.bones,S.vertices=g.vertices,S.worldVerticesLength=g.length,S.regionUVs=p,S.triangles=m,x&&(S.timelineSlots=x),o&&(S.edges=_,S.width=b*a,S.height=w*a),S.updateSequence(),S):null}case Os.LinkedMesh:{const c=(h&16)!==0?t.readStringRef():l;if(c==null)throw new Error("Path of linked mesh must not be null");const u=(h&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(h&64)!==0),f=(h&128)!==0,g=t.readInt(!0),p=t.readInt(!0),m=t.readStringRef();let y=0,x=0;o&&(y=t.readFloat(),x=t.readFloat());const _=this.attachmentLoader.newMeshAttachment(s,r,l,c,d);return _?(_.path=c,Q.rgba8888ToColor(_.color,u),o&&(_.width=y*a,_.height=x*a),this.linkedMeshes.push(new MS(_,p,i,g,m,f)),_):null}case Os.Path:{const c=(h&16)!==0,u=(h&32)!==0,d=this.readVertices(t,(h&64)!==0),f=this.readFloatArray(t,d.length/6,a),g=o?t.readInt32():0,p=this.attachmentLoader.newPathAttachment(s,r,l);return p?(p.closed=c,p.constantSpeed=u,p.worldVerticesLength=d.length,p.vertices=d.vertices,p.bones=d.bones,p.lengths=f,o&&Q.rgba8888ToColor(p.color,g),p):null}case Os.Point:{const c=t.readFloat(),u=t.readFloat(),d=t.readFloat(),f=o?t.readInt32():0,g=this.attachmentLoader.newPointAttachment(s,r,l);return g?(g.x=u*a,g.y=d*a,g.rotation=c,o&&Q.rgba8888ToColor(g.color,f),g):null}case Os.Clipping:{const c=t.readInt(!0),u=this.readVertices(t,(h&16)!==0),d=o?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,r,l);return f?(f.endSlot=e.slots[c],f.convex=(h&32)!==0,f.inverse=(h&64)!==0,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,o&&Q.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new pa(1,!1);const s=new pa(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,r=t.readInt(!0)<<1;if(!e)return new Xd(null,this.readFloatArray(t,r,s),r);const o=t.readInt(!0),a=[],h=[];for(let l=0,c=0;l<o;){const u=t.readInt(!0);a[l++]=u;for(let d=0;d<u;d++,c+=3)a[l++]=t.readInt(!0),h[c]=t.readFloat()*s,h[c+1]=t.readFloat()*s,h[c+2]=t.readFloat()}return new Xd(a,G.toFloatArray(h),r)}readFloatArray(t,e,s){const i=[];if(s===1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){const s=[];for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s,i){t.readInt(!0);const r=[],o=this.scale;for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0);for(let m=0,y=t.readInt(!0);m<y;m++){const x=t.readByte(),_=t.readInt(!0),b=_-1;switch(x){case VS:{const w=new kr(_,p);for(let S=0;S<_;S++)w.setFrame(S,t.readFloat(),t.readStringRef());r.push(w);break}case US:{const w=t.readInt(!0),S=new dm(_,w,p);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let I=0,C=0;S.setFrame(I,v,T,A,P,M),I!==b;I++){const k=t.readFloat(),E=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case xs:S.setStepped(I);break;case _s:dt(t,S,C++,I,0,v,k,T,E,1),dt(t,S,C++,I,1,v,k,A,F,1),dt(t,S,C++,I,2,v,k,P,B,1),dt(t,S,C++,I,3,v,k,M,N,1)}v=k,T=E,A=F,P=B,M=N}r.push(S);break}case GS:{const w=t.readInt(!0),S=new fm(_,w,p);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;for(let M=0,I=0;S.setFrame(M,v,T,A,P),M!==b;M++){const C=t.readFloat(),k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;switch(t.readByte()){case xs:S.setStepped(M);break;case _s:dt(t,S,I++,M,0,v,C,T,k,1),dt(t,S,I++,M,1,v,C,A,E,1),dt(t,S,I++,M,2,v,C,P,F,1)}v=C,T=k,A=E,P=F}r.push(S);break}case XS:{const w=t.readInt(!0),S=new gm(_,w,p);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,F=0;S.setFrame(E,v,T,A,P,M,I,C,k),E!==b;E++){const B=t.readFloat(),N=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,z=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case xs:S.setStepped(E);break;case _s:dt(t,S,F++,E,0,v,B,T,N,1),dt(t,S,F++,E,1,v,B,A,O,1),dt(t,S,F++,E,2,v,B,P,R,1),dt(t,S,F++,E,3,v,B,M,D,1),dt(t,S,F++,E,4,v,B,I,z,1),dt(t,S,F++,E,5,v,B,C,Y,1),dt(t,S,F++,E,6,v,B,k,W,1)}v=B,T=N,A=O,P=R,M=D,I=z,C=Y,k=W}r.push(S);break}case $S:{const w=t.readInt(!0),S=new mm(_,w,p);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let k=0,E=0;S.setFrame(k,v,T,A,P,M,I,C),k!==b;k++){const F=t.readFloat(),B=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,z=t.readUnsignedByte()/255;switch(t.readByte()){case xs:S.setStepped(k);break;case _s:dt(t,S,E++,k,0,v,F,T,B,1),dt(t,S,E++,k,1,v,F,A,N,1),dt(t,S,E++,k,2,v,F,P,O,1),dt(t,S,E++,k,3,v,F,M,R,1),dt(t,S,E++,k,4,v,F,I,D,1),dt(t,S,E++,k,5,v,F,C,z,1)}v=F,T=B,A=N,P=O,M=R,I=D,C=z}r.push(S);break}case HS:{const w=new pm(_,t.readInt(!0),p);let S=t.readFloat(),v=t.readUnsignedByte()/255;for(let T=0,A=0;w.setFrame(T,S,v),T!==b;T++){const P=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case xs:w.setStepped(T);break;case _s:dt(t,w,A++,T,0,S,P,v,M,1)}S=P,v=M}r.push(w)}}}}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0);for(let m=0,y=t.readInt(!0);m<y;m++){const x=t.readByte(),_=t.readInt(!0);if(x===YS){const w=new um(_,p);for(let S=0;S<_;S++)w.setFrame(S,t.readFloat(),t.readByte());r.push(w);continue}const b=t.readInt(!0);switch(x){case ES:te(t,r,new ga(_,b,p),1);break;case FS:te(t,r,new sm(_,b,p),o);break;case BS:te(t,r,new im(_,b,p),o);break;case RS:te(t,r,new nm(_,b,p),o);break;case LS:te(t,r,new rm(_,b,p),1);break;case OS:te(t,r,new om(_,b,p),1);break;case DS:te(t,r,new am(_,b,p),1);break;case NS:te(t,r,new hm(_,b,p),1);break;case WS:te(t,r,new lm(_,b,p),1);break;case zS:te(t,r,new cm(_,b,p),1);break}}}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0),m=t.readInt(!0),y=m-1,x=new xm(m,t.readInt(!0),p);let _=t.readByte(),b=t.readFloat(),w=(_&1)!==0?(_&2)!==0?t.readFloat():1:0,S=(_&4)!==0?t.readFloat()*o:0;for(let v=0,T=0;x.setFrame(v,b,w,S,(_&8)!==0?1:-1,(_&16)!==0,(_&32)!==0),v!==y;v++){_=t.readByte();const A=t.readFloat(),P=(_&1)!==0?(_&2)!==0?t.readFloat():1:0,M=(_&4)!==0?t.readFloat()*o:0;(_&64)!==0?x.setStepped(v):(_&128)!==0&&(dt(t,x,T++,v,0,b,A,w,P,1),dt(t,x,T++,v,1,b,A,S,M,o)),b=A,w=P,S=M}r.push(x)}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0),m=t.readInt(!0),y=m-1,x=new _m(m,t.readInt(!0),p);let _=t.readFloat(),b=t.readFloat(),w=t.readFloat(),S=t.readFloat(),v=t.readFloat(),T=t.readFloat(),A=t.readFloat();for(let P=0,M=0;x.setFrame(P,_,b,w,S,v,T,A),P!==y;P++){const I=t.readFloat(),C=t.readFloat(),k=t.readFloat(),E=t.readFloat(),F=t.readFloat(),B=t.readFloat(),N=t.readFloat();switch(t.readByte()){case xs:x.setStepped(P);break;case _s:dt(t,x,M++,P,0,_,I,b,C,1),dt(t,x,M++,P,1,_,I,w,k,1),dt(t,x,M++,P,2,_,I,S,E,1),dt(t,x,M++,P,3,_,I,v,F,1),dt(t,x,M++,P,4,_,I,T,B,1),dt(t,x,M++,P,5,_,I,A,N,1)}_=I,b=C,w=k,S=E,v=F,T=B,A=N}r.push(x)}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0),m=s.constraints[p];for(let y=0,x=t.readInt(!0);y<x;y++){const _=t.readByte(),b=t.readInt(!0),w=t.readInt(!0);switch(_){case ev:te(t,r,new bm(b,w,p),m.positionMode===Ms.Fixed?o:1);break;case sv:te(t,r,new wm(b,w,p),m.spacingMode===oe.Length||m.spacingMode===oe.Fixed?o:1);break;case iv:{const S=new Sm(b,w,p);let v=t.readFloat(),T=t.readFloat(),A=t.readFloat(),P=t.readFloat();for(let M=0,I=0,C=S.getFrameCount()-1;S.setFrame(M,v,T,A,P),M!==C;M++){const k=t.readFloat(),E=t.readFloat(),F=t.readFloat(),B=t.readFloat();switch(t.readByte()){case xs:S.setStepped(M);break;case _s:dt(t,S,I++,M,0,v,k,T,E,1),dt(t,S,I++,M,1,v,k,A,F,1),dt(t,S,I++,M,2,v,k,P,B,1)}v=k,T=E,A=F,P=B}r.push(S)}}}}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0)-1;for(let m=0,y=t.readInt(!0);m<y;m++){const x=t.readByte(),_=t.readInt(!0);if(x===uv){const w=new Ka(_,p);for(let S=0;S<_;S++)w.setFrame(S,t.readFloat());r.push(w);continue}const b=t.readInt(!0);switch(x){case nv:te(t,r,new vm(_,b,p),1);break;case rv:te(t,r,new Tm(_,b,p),1);break;case ov:te(t,r,new Am(_,b,p),1);break;case av:te(t,r,new Cm(_,b,p),1);break;case hv:te(t,r,new Pm(_,b,p),1);break;case lv:te(t,r,new Mm(_,b,p),1);break;case cv:te(t,r,new km(_,b,p),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,g=t.readInt(!0);f<g;f++){const p=t.readInt(!0);for(let m=0,y=t.readInt(!0);m<y;m++){const x=t.readByte(),_=t.readInt(!0),b=t.readInt(!0);switch(x){case dv:te(t,r,new Im(_,b,p),1);break;case fv:te(t,r,new Em(_,b,p),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let f=0,g=t.readInt(!0);f<g;f++){const p=s.skins[t.readInt(!0)];for(let m=0,y=t.readInt(!0);m<y;m++){const x=t.readInt(!0);for(let _=0,b=t.readInt(!0);_<b;_++){const w=t.readStringRef();if(!w)throw new Error("attachmentName must not be null.");const S=p.getAttachment(x,w),v=t.readByte(),T=t.readInt(!0),A=T-1;switch(v){case JS:{const P=S,M=P.bones,I=P.vertices,C=M?I.length/3*2:I.length,k=t.readInt(!0),E=new ym(T,k,x,P);let F=t.readFloat();for(let B=0,N=0;;B++){let O,R=t.readInt(!0);if(R===0)O=M?G.newFloatArray(C):I;else{O=G.newFloatArray(C);const z=t.readInt(!0);if(R+=z,o===1)for(let Y=z;Y<R;Y++)O[Y]=t.readFloat();else for(let Y=z;Y<R;Y++)O[Y]=t.readFloat()*o;if(!M)for(let Y=0,W=O.length;Y<W;Y++)O[Y]+=I[Y]}if(E.setFrame(B,F,O),B===A)break;const D=t.readFloat();switch(t.readByte()){case xs:E.setStepped(B);break;case _s:dt(t,E,N++,B,0,F,D,0,1,1)}F=D}r.push(E);break}case tv:{const P=new bs(T,x,S);for(let M=0;M<T;M++){const I=t.readFloat(),C=t.readInt32();P.setFrame(M,I,em[C&15],C>>4,t.readFloat())}r.push(P);break}}}}}const a=s.slots.length,h=t.readInt(!0);if(h>0){const f=new Xs(h);for(let g=0;g<h;g++)f.setFrame(g,t.readFloat(),$d(t,a));r.push(f)}const l=t.readInt(!0);for(let f=0;f<l;f++){const g=t.readInt(!0),p=new Array(g);for(let x=0;x<g;x++)p[x]=t.readInt(!0);const m=t.readInt(!0),y=new Ji(m,p,a);for(let x=0;x<m;x++)y.setFrame(x,t.readFloat(),$d(t,g));r.push(y)}const c=t.readInt(!0);if(c>0){const f=new ro(c);for(let g=0;g<c;g++){const p=t.readFloat(),m=s.events[t.readInt(!0)],y=new zc(p,m);y.intValue=t.readInt(!1),y.floatValue=t.readFloat(),y.stringValue=t.readString(),y.stringValue==null&&(y.stringValue=m.setupPose.stringValue),y.data.audioPath&&(y.volume=t.readFloat(),y.balance=t.readFloat()),f.setFrame(g,y)}r.push(f)}let u=0;for(let f=0,g=r.length;f<g;f++)u=Math.max(u,r[f].getDuration());const d=new Oc(e,r,u);return i&&Q.rgba8888ToColor(d.color,t.readInt32()),d}}class PS{strings;index;buffer;constructor(t,e=[],s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}}let MS=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,i,r,o){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=i,this.source=r,this.inheritTimelines=o}};class Xd{bones;vertices;length;constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}}var Os;(function(n){n[n.Region=0]="Region",n[n.BoundingBox=1]="BoundingBox",n[n.Mesh=2]="Mesh",n[n.LinkedMesh=3]="LinkedMesh",n[n.Path=4]="Path",n[n.Point=5]="Point",n[n.Clipping=6]="Clipping"})(Os||(Os={}));function te(n,t,e,s){e instanceof Ys?kS(n,t,e,s):IS(n,t,e,s)}function kS(n,t,e,s){let i=n.readFloat(),r=n.readFloat()*s;for(let o=0,a=0,h=e.getFrameCount()-1;e.setFrame(o,i,r),o!==h;o++){const l=n.readFloat(),c=n.readFloat()*s;switch(n.readByte()){case xs:e.setStepped(o);break;case _s:dt(n,e,a++,o,0,i,l,r,c,s)}i=l,r=c}t.push(e)}function IS(n,t,e,s){let i=n.readFloat(),r=n.readFloat()*s,o=n.readFloat()*s;for(let a=0,h=0,l=e.getFrameCount()-1;e.setFrame(a,i,r,o),a!==l;a++){const c=n.readFloat(),u=n.readFloat()*s,d=n.readFloat()*s;switch(n.readByte()){case xs:e.setStepped(a);break;case _s:dt(n,e,h++,a,0,i,c,r,u,s),dt(n,e,h++,a,1,i,c,o,d,s)}i=c,r=u,o=d}t.push(e)}function $d(n,t){const e=n.readInt(!0);if(e===0)return null;const s=new Array(t).fill(-1),i=new Array(t-e);let r=0,o=0;for(let a=0;a<e;a++){const h=n.readInt(!0);for(;r!==h;)i[o++]=r++;s[r+n.readInt(!0)]=r++}for(;r<t;)i[o++]=r++;for(let a=t-1;a>=0;a--)s[a]===-1&&(s[a]=i[--o]);return s}function dt(n,t,e,s,i,r,o,a,h,l){t.setBezier(e,s,i,r,a,n.readFloat(),n.readFloat()*l,n.readFloat(),n.readFloat()*l,o,h)}const ES=0,FS=1,BS=2,RS=3,LS=4,OS=5,DS=6,NS=7,WS=8,zS=9,YS=10,VS=0,US=1,GS=2,XS=3,$S=4,HS=5,jS=0,qS=1,KS=2,ZS=3,QS=4,JS=0,tv=1,ev=0,sv=1,iv=2,nv=0,rv=1,ov=2,av=4,hv=5,lv=6,cv=7,uv=8,dv=0,fv=1,xs=1,_s=2;class pv{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Gr(()=>G.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,o=t.slots,a=o.length;s.length=0,r.freeAll(i),i.length=0;for(let h=0;h<a;h++){const l=o[h];if(!l.bone.active)continue;const c=l.appliedPose.attachment;if(c instanceof Za){s.push(c);let u=r.obtain();u.length!==c.worldVerticesLength&&(u=G.newFloatArray(c.worldVerticesLength)),i.push(u),c.computeWorldVertices(t,l,0,c.worldVerticesLength,u,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r=this.polygons;for(let o=0,a=r.length;o<a;o++){const h=r[o],l=h;for(let c=0,u=h.length;c<u;c+=2){const d=l[c],f=l[c+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){const r=this.minX,o=this.minY,a=this.maxX,h=this.maxY;if(t<=r&&s<=r||e<=o&&i<=o||t>=a&&s>=a||e>=h&&i>=h)return!1;const l=(i-e)/(s-t);let c=l*(r-t)+e;if(c>o&&c<h||(c=l*(a-t)+e,c>o&&c<h))return!0;let u=(o-e)/l+t;return u>r&&u<a||(u=(h-e)/l+t,u>r&&u<a)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){const i=t,r=t.length;let o=r-2,a=!1;for(let h=0;h<r;h+=2){const l=i[h+1],c=i[o+1];if(l<s&&c>=s||c<s&&l>=s){const u=i[h];u+(s-l)/(c-l)*(i[o]-u)<e&&(a=!a)}o=h}return a}intersectsSegment(t,e,s,i){const r=this.polygons;for(let o=0,a=r.length;o<a;o++)if(this.intersectsSegmentPolygon(r[o],t,e,s,i))return this.boundingBoxes[o];return null}intersectsSegmentPolygon(t,e,s,i,r){const o=t,a=t.length,h=e-i,l=s-r,c=e*r-s*i;let u=o[a-2],d=o[a-1];for(let f=0;f<a;f+=2){const g=o[f],p=o[f+1],m=u*p-d*g,y=u-g,x=d-p,_=h*x-l*y,b=(c*y-h*m)/_;if((b>=u&&b<=g||b>=g&&b<=u)&&(b>=e&&b<=i||b>=i&&b<=e)){const w=(c*x-l*m)/_;if((w>=d&&w<=p||w>=p&&w<=d)&&(w>=s&&w<=r||w>=r&&w<=s))return!0}u=g,d=p}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class Se{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Gr(()=>[]);polygonIndicesPool=new Gr(()=>[]);triangulate(t){const e=t;let s=t.length>>1;const i=this.indicesArray;i.length=0;for(let a=0;a<s;a++)i[a]=a;const r=this.isConcaveArray;r.length=0;for(let a=0;a<s;a++)r[a]=Se.isConcave(a,s,e,i);const o=this.triangles;for(o.length=0;s>3;){let a=s-1,h=0,l=1;for(;;){t:if(!r[h]){const d=i[a]<<1,f=i[h]<<1,g=i[l]<<1,p=e[d],m=e[d+1],y=e[f],x=e[f+1],_=e[g],b=e[g+1];for(let w=l+1<s?l+1:0;w!==a;){if(r[w]){const S=i[w]<<1,v=e[S],T=e[S+1];if(Se.positiveArea(_,b,p,m,v,T)&&Se.positiveArea(p,m,y,x,v,T)&&Se.positiveArea(y,x,_,b,v,T))break t}++w===s&&(w=0)}break}if(l===0){do{if(!r[h])break;h--}while(h>0);a=h>0?h-1:s-1,l=h+1<s?h+1:0;break}a=h,h=l,++l===s&&(l=0)}o.push(i[a],i[h],i[l]),i.splice(h,1),r.splice(h,1),s--;const c=h>0?h-1:s-1,u=h<s?h:0;r[c]=Se.isConcave(c,s,e,i),r[u]=Se.isConcave(u,s,e,i)}return s===3&&o.push(i[2],i[0],i[1]),o}decompose(t,e){const s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let h=-1,l=0;for(let c=0,u=e.length;c<u;c+=3){const d=e[c]<<1,f=e[c+1]<<1,g=e[c+2]<<1,p=s[d],m=s[d+1],y=s[f],x=s[f+1],_=s[g],b=s[g+1];if(h===d){const w=a.length-4;if(Se.winding(a[w],a[w+1],a[w+2],a[w+3],_,b)===l&&Se.winding(_,b,a[0],a[1],a[2],a[3])===l){a.push(_,b),o.push(g);continue}}a.length>0&&(i.push(a),r.push(o),a=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),a.length=0,a.push(p,m,y,x),a.push(_,b),o.length=0,o.push(d,f,g),l=Se.winding(p,m,y,x,_,b),h=d}a.length>0&&(i.push(a),r.push(o));for(let c=0,u=i.length;c<u;c++){if(o=r[c],o.length===0)continue;const d=o[0];let f=o[o.length-1];a=i[c];const g=a.length-4;let p=a[g],m=a[g+1],y=a[g+2],x=a[g+3];const _=a[0],b=a[1],w=a[2],S=a[3],v=Se.winding(p,m,y,x,_,b);for(let T=0;T<u;T++){if(T===c)continue;const A=r[T];if(A.length!==3)continue;const P=A[0],M=A[1],I=A[2],C=i[T],k=C[C.length-2],E=C[C.length-1];P!==d||M!==f||Se.winding(p,m,y,x,k,E)===v&&Se.winding(k,E,_,b,w,S)===v&&(C.length=0,A.length=0,a.push(k,E),o.push(I),f=I,p=y,m=x,y=k,x=E,T=-1)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length===0?(i.splice(c,1),this.polygonPool.free(a),o=r[c],r.splice(c,1),this.polygonIndicesPool.free(o)):a.push(a[0],a[1]);return i}static isConcave(t,e,s,i){const r=i[t>0?t-1:e-1]<<1,o=i[t]<<1,a=i[t+1<e?t+1:0]<<1;return!Se.positiveArea(s[r],s[r+1],s[o],s[o+1],s[a],s[a+1])}static positiveArea(t,e,s,i,r,o){return t*(o-i)+s*(e-o)+r*(i-e)>=0}static winding(t,e,s,i,r,o){return t*(o-i)+s*(e-o)+r*(i-e)>=0?1:-1}}class Gc{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const i=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const r=G.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,e,0,i,r,0,2);const o=this.clippingPolygon,a=this.makeClockwise(o);a||this.inverse||s.convex?(a||this.makeConvex(o),this.clippingPolygon.push(o[0],o[1]),this.clippingPolygons.push(o)):(this.triangulator===null&&(this.triangulator=new Se),this.clippingPolygons.push(...this.triangulator.decompose(o,this.triangulator.triangulate(o))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,i,r,o,a,h){return i&&r&&o&&typeof a=="boolean"&&typeof h=="number"?this.clipTrianglesRender(t,e,s,i,r,o,a,h):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const i=this.clippedVertices;i.length=0;const r=this.clippedTriangles;r.length=0;let o=0;if(this.inverse){const u=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const g=t[f],p=t[f+1];f=e[d+1]<<1;const m=t[f],y=t[f+1];f=e[d+2]<<1;const x=t[f],_=t[f+1];this.clipInverse(g,p,m,y,x,_,u);const b=this.inverseVertices;for(let w=0,S=this.inverseVertices.length;w<S;){const v=b[w++];let T=v>>1,A=i.length;const P=G.setArraySize(i,A+v);G.arrayCopy(b,w,P,A,v),A=r.length;const M=G.setArraySize(r,A+3*(T-2));for(let I=1;I<T-1;I++,A+=3)M[A]=o,M[A+1]=o+I,M[A+2]=o+I+1;o+=T,w+=v}}return!0}const a=this.clipOutput,h=this.clippingPolygons,l=h.length;let c=null;for(let u=0;u<s;u+=3){let d=e[u]<<1;const f=t[d],g=t[d+1];d=e[u+1]<<1;const p=t[d],m=t[d+1];d=e[u+2]<<1;const y=t[d],x=t[d+1];for(let _=0;_<l;_++){let b=i.length;if(this.clip(f,g,p,m,y,x,h[_])){c=this.clipOutput;const w=a.length;if(w===0)continue;let S=w>>1;const v=G.setArraySize(i,b+w);G.arrayCopy(c,0,v,b,w),b=r.length;const T=G.setArraySize(r,b+3*(S-2));S--;for(let A=1;A<S;A++,b+=3)T[b]=o,T[b+1]=o+A,T[b+2]=o+A+1;o+=S}else{const w=G.setArraySize(i,b+6);w[b]=f,w[b+1]=g,w[b+2]=p,w[b+3]=m,w[b+4]=y,w[b+5]=x,b=r.length;const S=G.setArraySize(r,b+3);S[b]=o,S[b+1]=o+1,S[b+2]=o+2,o+=3;break}}}return c!=null}clipTrianglesRender(t,e,s,i,r,o,a,h){const l=this.clippedVertices;l.length=0;const c=this.clippedTriangles;c.length=0;let u=0;if(this.inverse){const m=this.clippingPolygons[0];for(let y=0;y<s;y+=3){let x=e[y],_=e[y+1],b=e[y+2];const w=t[x*h],S=t[x*h+1],v=t[_*h],T=t[_*h+1],A=t[b*h],P=t[b*h+1];this.clipInverse(w,S,v,T,A,P,m);const M=this.inverseVertices.length;if(M===0)continue;const I=i[x<<=1],C=i[x+1],k=i[_<<=1],E=i[_+1],F=i[b<<=1],B=i[b+1],N=T-P,O=A-v,R=w-A,D=P-S,z=1/(N*R+O*(S-P)),Y=this.inverseVertices;for(let W=0;W<M;){const V=Y[W++],H=V>>1;let K=l.length;const tt=G.setArraySize(l,K+H*h);for(let et=0;et<V;et+=2,K+=h){const St=Y[W+et],bt=Y[W+et+1];tt[K]=St,tt[K+1]=bt,tt[K+2]=r.r,tt[K+3]=r.g,tt[K+4]=r.b,tt[K+5]=r.a;const kt=St-A,Jt=bt-P,Ht=(N*kt+O*Jt)*z,be=(D*kt+R*Jt)*z,he=1-Ht-be;tt[K+6]=I*Ht+k*be+F*he,tt[K+7]=C*Ht+E*be+B*he,a&&(tt[K+8]=o.r,tt[K+9]=o.g,tt[K+10]=o.b,tt[K+11]=o.a)}K=c.length;const xt=G.setArraySize(c,K+3*(H-2));for(let et=1;et<H-1;et++,K+=3)xt[K]=u,xt[K+1]=u+et,xt[K+2]=u+et+1;u+=H,W+=V}}return!0}const d=this.clipOutput,f=this.clippingPolygons,g=this.clippingPolygons.length;let p=null;for(let m=0;m<s;m+=3){let y=e[m];const x=t[y*h],_=t[y*h+1],b=i[y<<1],w=i[(y<<1)+1];y=e[m+1];const S=t[y*h],v=t[y*h+1],T=i[y<<1],A=i[(y<<1)+1];y=e[m+2];const P=t[y*h],M=t[y*h+1],I=i[y<<1],C=i[(y<<1)+1];let k=0,E=0,F=0,B=0,N=0;for(let O=0;O<g;O++){let R=l.length;if(this.clip(x,_,S,v,P,M,f[O])){p=this.clipOutput;const D=d.length;if(D===0)continue;let z=D>>1;N===0&&(k=v-M,E=P-S,F=x-P,B=M-_,N=1/(k*F-E*B));const Y=G.setArraySize(l,R+z*h);for(let V=0;V<D;V+=2,R+=h){const H=p[V],K=p[V+1];Y[R]=H,Y[R+1]=K,Y[R+2]=r.r,Y[R+3]=r.g,Y[R+4]=r.b,Y[R+5]=r.a;const tt=H-P,xt=K-M,et=(k*tt+E*xt)*N,St=(B*tt+F*xt)*N,bt=1-et-St;Y[R+6]=b*et+T*St+I*bt,Y[R+7]=w*et+A*St+C*bt,a&&(Y[R+8]=o.r,Y[R+9]=o.g,Y[R+10]=o.b,Y[R+11]=o.a)}R=c.length;const W=G.setArraySize(c,R+3*(z-2));z--;for(let V=1;V<z;V++,R+=3)W[R]=u,W[R+1]=u+V,W[R+2]=u+V+1;u+=z+1}else{const D=G.setArraySize(l,R+3*h);D[R]=x,D[R+1]=_,D[R+2]=r.r,D[R+3]=r.g,D[R+4]=r.b,D[R+5]=r.a,a?(D[R+6]=b,D[R+7]=w,D[R+8]=o.r,D[R+9]=o.g,D[R+10]=o.b,D[R+11]=o.a,D[R+12]=S,D[R+13]=v,D[R+14]=r.r,D[R+15]=r.g,D[R+16]=r.b,D[R+17]=r.a,D[R+18]=T,D[R+19]=A,D[R+20]=o.r,D[R+21]=o.g,D[R+22]=o.b,D[R+23]=o.a,D[R+24]=P,D[R+25]=M,D[R+26]=r.r,D[R+27]=r.g,D[R+28]=r.b,D[R+29]=r.a,D[R+30]=I,D[R+31]=C,D[R+32]=o.r,D[R+33]=o.g,D[R+34]=o.b,D[R+35]=o.a):(D[R+6]=b,D[R+7]=w,D[R+8]=S,D[R+9]=v,D[R+10]=r.r,D[R+11]=r.g,D[R+12]=r.b,D[R+13]=r.a,D[R+14]=T,D[R+15]=A,D[R+16]=P,D[R+17]=M,D[R+18]=r.r,D[R+19]=r.g,D[R+20]=r.b,D[R+21]=r.a,D[R+22]=I,D[R+23]=C),R=c.length;const z=G.setArraySize(c,R+3);z[R]=u,z[R+1]=u+1,z[R+2]=u+2,u+=3;break}}}return p!=null}clipTrianglesUnpacked(t,e,s,i,r,o=2){let a=this._clippedVerticesTyped,h=this._clippedUVsTyped,l=this._clippedTrianglesTyped,c=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const p=this.clippingPolygons[0];for(let m=0;m<i;m+=3){let y=s[m]*o;const x=t[e+y],_=t[e+y+1];let b=s[m]<<1;const w=r[b],S=r[b+1];y=s[m+1]*o;const v=t[e+y],T=t[e+y+1];b=s[m+1]<<1;const A=r[b],P=r[b+1];y=s[m+2]*o;const M=t[e+y],I=t[e+y+1];b=s[m+2]<<1;const C=r[b],k=r[b+1];this.clipInverse(x,_,v,T,M,I,p);const E=this.inverseVertices.length;if(E===0)continue;const F=T-I,B=M-v,N=x-M,O=I-_,R=1/(F*N+B*(_-I)),D=this.inverseVertices;for(let z=0;z<E;){const Y=D[z++],W=Y>>1;let V=this.clippedVerticesLength;const H=V+W*o,K=this.clippedUVsLength+W*2;a.length<H&&(this._clippedVerticesTyped=new Float32Array(H*2),this._clippedVerticesTyped.set(a.subarray(0,V)),a=this._clippedVerticesTyped),h.length<K&&(this._clippedUVsTyped=new Float32Array(K*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped),this.clippedVerticesLength=H,this.clippedUVsLength=K;const tt=this._clippedVerticesTyped,xt=this._clippedUVsTyped;let et=K-W*2;for(let kt=0;kt<Y;kt+=2,V+=o,et+=2){const Jt=D[z+kt],Ht=D[z+kt+1];tt[V]=Jt,tt[V+1]=Ht;const be=Jt-M,he=Ht-I,rs=(F*be+B*he)*R,Ai=(O*be+N*he)*R,Ci=1-rs-Ai;xt[et]=w*rs+A*Ai+C*Ci,xt[et+1]=S*rs+P*Ai+k*Ci}V=this.clippedTrianglesLength;const St=V+3*(W-2);l.length<St&&(this._clippedTrianglesTyped=new Uint16Array(St*2),this._clippedTrianglesTyped.set(l.subarray(0,V)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=St;const bt=l;for(let kt=1;kt<W-1;kt++,V+=3)bt[V]=c,bt[V+1]=c+kt,bt[V+2]=c+kt+1;c+=W,z+=Y}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const u=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let g=null;for(let p=0;p<i;p+=3){let m=s[p],y=m*o;const x=t[e+y],_=t[e+y+1];let b=m<<1;const w=r[b],S=r[b+1];m=s[p+1],y=m*o;const v=t[e+y],T=t[e+y+1];b=m<<1;const A=r[b],P=r[b+1];m=s[p+2],y=m*o;const M=t[e+y],I=t[e+y+1];b=m<<1;const C=r[b],k=r[b+1];let E=0,F=0,B=0,N=0,O=0;for(let R=0;R<f;R++){let D=this.clippedVerticesLength;if(this.clip(x,_,v,T,M,I,d[R])){g=u;const z=u.length;if(z===0)continue;let Y=z>>1;O===0&&(E=T-I,F=M-v,B=x-M,N=I-_,O=1/(E*B-F*N));const W=D+Y*o;a.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(a.subarray(0,D)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+Y*2)*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),a=this._clippedVerticesTyped,h=this._clippedUVsTyped);const V=a,H=h;this.clippedVerticesLength=W;let K=this.clippedUVsLength;this.clippedUVsLength=K+Y*2;for(let et=0;et<z;et+=2,D+=o,K+=2){const St=g[et],bt=g[et+1];V[D]=St,V[D+1]=bt;const kt=St-M,Jt=bt-I,Ht=(E*kt+F*Jt)*O,be=(N*kt+B*Jt)*O,he=1-Ht-be;H[K]=w*Ht+A*be+C*he,H[K+1]=S*Ht+P*be+k*he}D=this.clippedTrianglesLength;const tt=D+3*(Y-2);l.length<tt&&(this._clippedTrianglesTyped=new Uint16Array(tt*2),this._clippedTrianglesTyped.set(l.subarray(0,D)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=tt;const xt=l;Y--;for(let et=1;et<Y;et++,D+=3)xt[D]=c,xt[D+1]=c+et,xt[D+2]=c+et+1;c+=Y+1}else{let z=D+3*o;a.length<z&&(this._clippedVerticesTyped=new Float32Array(z*2),this._clippedVerticesTyped.set(a.subarray(0,D)),a=this._clippedVerticesTyped),a[D]=x,a[D+1]=_,a[D+o]=v,a[D+o+1]=T,a[D+o*2]=M,a[D+o*2+1]=I;const Y=this.clippedUVsLength+6;h.length<Y&&(this._clippedUVsTyped=new Float32Array(Y*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped);const W=this.clippedUVsLength;h[W]=w,h[W+1]=S,h[W+2]=A,h[W+3]=P,h[W+4]=C,h[W+5]=k,this.clippedVerticesLength=z,this.clippedUVsLength=Y,D=this.clippedTrianglesLength,z=D+3,l.length<z&&(this._clippedTrianglesTyped=new Uint16Array(z*2),this._clippedTrianglesTyped.set(l.subarray(0,D)),l=this._clippedTrianglesTyped);const V=l;V[D]=c,V[D+1]=c+1,V[D+2]=c+2,c+=3,this.clippedTrianglesLength=z;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),g!==null}clip(t,e,s,i,r,o,a){const h=this.clipOutput;let l=!1,c,u;a.length%4>=2?(c=this.clipOutput,u=this.scratch):(c=this.scratch,u=this.clipOutput);const d=a;c.length=8;const f=c;f[0]=t,f[1]=e,f[2]=s,f[3]=i,f[4]=r,f[5]=o,f[6]=t,f[7]=e,u.length=0;const g=a.length-4;for(let p=0;;p+=2){const m=d[p],y=d[p+1],x=m-d[p+2],_=y-d[p+3],b=u.length,w=c;t=w[0],e=w[1];let S=_*(m-t)-x*(y-e);for(let T=2,A=c.length-2;T<=A;T+=2){s=w[T],i=w[T+1];const P=_*(m-s)-x*(y-i);if(S>0)if(P>0)u.push(s,i);else{const M=s-t,I=i-e,C=S/(M*_-I*x);C>=0&&C<=1?(u.push(t+M*C,e+I*C),l=!0):u.push(s,i)}else if(P>0){const M=s-t,I=i-e,C=S/(M*_-I*x);C>=0&&C<=1?(u.push(t+M*C,e+I*C,s,i),l=!0):u.push(s,i)}else l=!0;t=s,e=i,S=P}if(b===u.length)return h.length=0,!0;if(u.push(u[0],u[1]),p===g)break;const v=u;u=c,u.length=0,c=v}if(h!==u){h.length=0;for(let p=0,m=u.length-2;p<m;p++)h[p]=u[p]}else h.length=h.length-2;return l}clipInverse(t,e,s,i,r,o,a){this.inverseVertices.length=0;const h=a.length-4;let l,c;a.length%4>=2?(l=this.clipOutput,c=this.scratch):(l=this.scratch,c=this.clipOutput),l.length=8;let u=a,d=l;d[0]=t,d[1]=e,d[2]=s,d[3]=i,d[4]=r,d[5]=o,d[6]=t,d[7]=e,c.length=0;for(let f=0;;f+=2){const g=u[f],p=u[f+1],m=g-u[f+2],y=p-u[f+3],x=c.length,_=this.inverseVertices.length;this.inverseVertices.push(0),d=l,t=d[0],e=d[1];let b=y*(g-t)-m*(p-e);for(let v=2,T=l.length-2;v<=T;v+=2){s=d[v],i=d[v+1];const A=y*(g-s)-m*(p-i);if(b>0)if(A>0)c.push(s,i);else{const P=s-t,M=i-e,I=b/(P*y-M*m);if(I>=0&&I<=1){const C=t+P*I,k=e+M*I;c.push(C,k),this.inverseVertices.push(C,k,s,i)}else c.push(s,i)}else if(A>0){const P=s-t,M=i-e,I=b/(P*y-M*m);if(I>=0&&I<=1){const C=t+P*I,k=e+M*I;this.inverseVertices.push(C,k),c.push(C,k,s,i)}else c.push(s,i)}else this.inverseVertices.push(s,i);t=s,e=i,b=A}const w=this.inverseVertices.length-_-1;if(w>=6?this.inverseVertices[_]=w:this.inverseVertices.length=_,x===c.length||(c.push(c[0],c[1]),f===h))break;const S=c;c=l,c.length=0,l=S}}makeClockwise(t){const e=t,s=t.length;let i=!0,r=!0,o=0,a=e[s-2],h=e[s-1],l=e[0],c=e[1];for(let d=2;d<s;d+=2){const f=e[d],g=e[d+1];o+=l*g-f*c;const p=(l-a)*(g-c)-(c-h)*(f-l);r=r&&p<=0,i=i&&p>=0,a=l,h=c,l=f,c=g}o+=l*e[1]-e[0]*c;const u=(l-a)*(e[1]-c)-(c-h)*(e[0]-l);if(r=r&&u<=0,i=i&&u>=0,o>=0){for(let d=0,f=s-2,g=s>>1;d<g;d+=2){const p=e[d],m=e[d+1],y=f-d;e[d]=e[y],e[d+1]=e[y+1],e[y]=p,e[y+1]=m}return i}return r}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const i=this.clipOutput;i[0]=s[0],i[1]=s[1];for(let a=2;a<e;a+=2){const h=s[a],l=s[a+1];let c=a-2;for(;c>=0&&(i[c]>h||i[c]===h&&i[c+1]>l);c-=2)i[c+2]=i[c],i[c+3]=i[c+1];i[c+2]=h,i[c+3]=l}s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3];let r=4;for(let a=4;a<e;a+=2,r+=2){const h=i[a],l=i[a+1];for(;(s[r-2]-s[r-4])*(l-s[r-3])-(s[r-1]-s[r-3])*(h-s[r-4])>=0&&(r-=2,r!==2););s[r]=h,s[r+1]=l}s[r]=i[e-4],s[r+1]=i[e-3];const o=r;r+=2;for(let a=e-6;a>=0;a-=2,r+=2){const h=i[a],l=i[a+1];for(;(s[r-2]-s[r-4])*(l-s[r-3])-(s[r-1]-s[r-3])*(h-s[r-4])>=0&&(r-=2,r!==o););s[r]=h,s[r+1]=l}t.length=r-2}}class gv{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Vc,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=L(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let o=0;o<i.bones.length;o++){const a=i.bones[o];let h=null;const l=L(a,"parent",null);l&&(h=s.findBone(l));const c=new Qa(s.bones.length,a.name,h);c.length=L(a,"length",0)*e;const u=c.setupPose;u.x=L(a,"x",0)*e,u.y=L(a,"y",0)*e,u.rotation=L(a,"rotation",0),u.scaleX=L(a,"scaleX",1),u.scaleY=L(a,"scaleY",1),u.shearX=L(a,"shearX",0),u.shearY=L(a,"shearY",0),u.inherit=G.enumValue(Yt,L(a,"inherit","Normal")),c.skinRequired=L(a,"skin",!1);const d=L(a,"color",null);d&&c.color.setFromString(d),c.icon=L(a,"icon",void 0),c.iconSize=L(a,"iconSize",1),c.iconRotation=L(a,"iconRotation",0),s.bones.push(c)}if(i.slots)for(let o=0;o<i.slots.length;o++){const a=i.slots[o],h=a.name,l=s.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${h}`);const c=new Lm(s.slots.length,h,l),u=L(a,"color",null);u&&c.setupPose.color.setFromString(u);const d=L(a,"dark",null);d&&(c.setupPose.darkColor=Q.fromString(d)),c.attachmentName=L(a,"attachment",null),c.blendMode=G.enumValue(ri,L(a,"blend","normal")),c.visible=L(a,"visible",!0),s.slots.push(c)}if(i.constraints)for(const o of i.constraints){const a=o.name,h=L(o,"skin",!1);switch(L(o,"type",!1)){case"ik":{const l=new qo(a);l.skinRequired=h;for(let g=0;g<o.bones.length;g++){const p=s.findBone(o.bones[g]);if(!p)throw new Error(`Couldn't find bone ${o.bones[g]} for IK constraint ${a}.`);l.bones.push(p)}const c=o.target,u=s.findBone(c);if(!u)throw new Error(`Couldn't find target bone ${c} for IK constraint ${a}.`);l.target=u;const d=L(o,"scaleY",null);d!=null&&(l.scaleYMode=G.enumValue(Te,d));const f=l.setupPose;f.mix=L(o,"mix",1),f.softness=L(o,"softness",0)*e,f.bendDirection=L(o,"bendPositive",!0)?1:-1,f.compress=L(o,"compress",!1),f.stretch=L(o,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new rt(a);l.skinRequired=h;for(let b=0;b<o.bones.length;b++){const w=o.bones[b],S=s.findBone(w);if(!S)throw new Error(`Couldn't find bone ${w} for transform constraint ${o.name}.`);l.bones.push(S)}const c=o.source,u=s.findBone(c);if(!u)throw new Error(`Couldn't find source bone ${c} for transform constraint ${o.name}.`);l.source=u,l.localSource=L(o,"localSource",!1),l.localTarget=L(o,"localTarget",!1),l.additive=L(o,"additive",!1),l.clamp=L(o,"clamp",!1);let d=!1,f=!1,g=!1,p=!1,m=!1,y=!1;const x=Object.entries(L(o,"properties",{}));for(const[b,w]of x){const S=this.fromProperty(b),v=this.propertyScale(b,e);S.offset=L(w,"offset",0)*v;const T=Object.entries(L(w,"to",{}));for(const[A,P]of T){let M=1,I;switch(A){case"rotate":{d=!0,I=new Om;break}case"x":{f=!0,I=new Dm,M=e;break}case"y":{g=!0,I=new Nm,M=e;break}case"scaleX":{p=!0,I=new Wm;break}case"scaleY":{m=!0,I=new zm;break}case"shearY":{y=!0,I=new Ym;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}I.offset=L(P,"offset",0)*M,I.max=L(P,"max",1)*M,I.scale=L(P,"scale",1)*M/v,S.to.push(I)}S.to.length>0&&l.properties.push(S)}l.offsets[rt.ROTATION]=L(o,"rotation",0),l.offsets[rt.X]=L(o,"x",0)*e,l.offsets[rt.Y]=L(o,"y",0)*e,l.offsets[rt.SCALEX]=L(o,"scaleX",0),l.offsets[rt.SCALEY]=L(o,"scaleY",0),l.offsets[rt.SHEARY]=L(o,"shearY",0);const _=l.setupPose;d&&(_.mixRotate=L(o,"mixRotate",1)),f&&(_.mixX=L(o,"mixX",1)),g&&(_.mixY=L(o,"mixY",_.mixX)),p&&(_.mixScaleX=L(o,"mixScaleX",1)),m&&(_.mixScaleY=L(o,"mixScaleY",_.mixScaleX)),y&&(_.mixShearY=L(o,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new Ko(a);l.skinRequired=h;for(let f=0;f<o.bones.length;f++){const g=o.bones[f],p=s.findBone(g);if(!p)throw new Error(`Couldn't find bone ${g} for path constraint ${o.name}.`);l.bones.push(p)}const c=o.slot,u=s.findSlot(c);if(!u)throw new Error(`Couldn't find slot ${c} for path constraint ${o.name}.`);l.slot=u,l.positionMode=G.enumValue(Ms,L(o,"positionMode","Percent")),l.spacingMode=G.enumValue(oe,L(o,"spacingMode","Length")),l.rotateMode=G.enumValue(Xi,L(o,"rotateMode","Tangent")),l.offsetRotation=L(o,"rotation",0);const d=l.setupPose;d.position=L(o,"position",0),l.positionMode===Ms.Fixed&&(d.position*=e),d.spacing=L(o,"spacing",0),(l.spacingMode===oe.Length||l.spacingMode===oe.Fixed)&&(d.spacing*=e),d.mixRotate=L(o,"mixRotate",1),d.mixX=L(o,"mixX",1),d.mixY=L(o,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new Zo(a);l.skinRequired=h;const c=o.bone,u=s.findBone(c);if(u==null)throw new Error(`Physics bone not found: ${c}`);l.bone=u,l.x=L(o,"x",0),l.y=L(o,"y",0),l.rotate=L(o,"rotate",0),l.scaleX=L(o,"scaleX",0);const d=L(o,"scaleY",null);d!=null&&(l.scaleYMode=G.enumValue(Te,d)),l.shearX=L(o,"shearX",0),l.limit=L(o,"limit",5e3)*e,l.step=1/L(o,"fps",60);const f=l.setupPose;f.inertia=L(o,"inertia",.5),f.strength=L(o,"strength",100),f.damping=L(o,"damping",.85),f.massInverse=1/L(o,"mass",1),f.wind=L(o,"wind",0),f.gravity=L(o,"gravity",0),f.mix=L(o,"mix",1),l.inertiaGlobal=L(o,"inertiaGlobal",!1),l.strengthGlobal=L(o,"strengthGlobal",!1),l.dampingGlobal=L(o,"dampingGlobal",!1),l.massGlobal=L(o,"massGlobal",!1),l.windGlobal=L(o,"windGlobal",!1),l.gravityGlobal=L(o,"gravityGlobal",!1),l.mixGlobal=L(o,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new Vi(a);l.skinRequired=h,l.additive=L(o,"additive",!1),l.loop=L(o,"loop",!1),l.setupPose.mix=L(o,"mix",1);const c=o.bone;if(c){if(l.bone=s.findBone(c),!l.bone)throw new Error(`Slider bone not found: ${c}`);const u=o.property;l.property=this.fromProperty(u);const d=this.propertyScale(u,e);l.property.offset=L(o,"from",0)*d,l.offset=L(o,"to",0),l.scale=L(o,"scale",1)/d,l.max=L(o,"max",0),l.local=L(o,"local",!1)}else l.setupPose.time=L(o,"time",0);s.constraints.push(l);break}}}if(i.skins)for(let o=0;o<i.skins.length;o++){const a=i.skins[o],h=new ya(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){const c=a.bones[l],u=s.findBone(c);if(!u)throw new Error(`Couldn't find bone ${c} for skin ${a.name}.`);h.bones.push(u)}if(a.ik)for(let l=0;l<a.ik.length;l++){const c=a.ik[l],u=s.findConstraint(c,qo);if(!u)throw new Error(`Couldn't find IK constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.transform)for(let l=0;l<a.transform.length;l++){const c=a.transform[l],u=s.findConstraint(c,rt);if(!u)throw new Error(`Couldn't find transform constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.path)for(let l=0;l<a.path.length;l++){const c=a.path[l],u=s.findConstraint(c,Ko);if(!u)throw new Error(`Couldn't find path constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.physics)for(let l=0;l<a.physics.length;l++){const c=a.physics[l],u=s.findConstraint(c,Zo);if(!u)throw new Error(`Couldn't find physics constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.slider)for(let l=0;l<a.slider.length;l++){const c=a.slider[l],u=s.findConstraint(c,Vi);if(!u)throw new Error(`Couldn't find slider constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}for(const l in a.attachments){const c=s.findSlot(l);if(!c)throw new Error(`Couldn't find skin slot ${l} for skin ${a.name}.`);const u=a.attachments[l];for(const d in u){const f=this.readAttachment(u[d],h,c.index,d,s);f&&h.setAttachment(c.index,d,f)}}s.skins.push(h),h.name==="default"&&(s.defaultSkin=h)}for(let o=0,a=this.linkedMeshes.length;o<a;o++){const h=this.linkedMeshes[o],l=h.skin?s.findSkin(h.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);const c=l.getAttachment(h.sourceIndex,h.source);if(!c)throw new Error(`Source mesh not found: ${h.source}`);h.mesh.timelineAttachment=h.inheritTimelines?c:h.mesh,h.mesh.setSourceMesh(c),h.mesh.updateSequence();t:if(h.inheritTimelines&&h.slotIndex!==h.sourceIndex){const u=c.timelineSlots;for(const f of u)if(f===h.slotIndex)break t;const d=[...u];d[u.length]=h.slotIndex,c.timelineSlots=d}}if(this.linkedMeshes.length=0,i.events)for(const o in i.events){const a=i.events[o],h=new Rm(o),l=h.setupPose;l.intValue=L(a,"int",0),l.floatValue=L(a,"float",0),l.stringValue=L(a,"string",""),h._audioPath=L(a,"audio",null),h.audioPath&&(l.volume=L(a,"volume",l.volume),l.balance=L(a,"balance",l.balance)),s.events.push(h)}if(i.animations)for(const o in i.animations){const a=i.animations[o];this.readAnimation(a,o,s)}if(i.constraints)for(const o in i.constraints){const a=i.constraints[o];if(a.type==="slider"){const h=s.findConstraint(a.name,Vi),l=a.animation,c=s.findAnimation(l);if(!c)throw new Error(`Slider animation not found: ${l}`);h.animation=c}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new Bl;break;case"x":e=new Rl;break;case"y":e=new Ll;break;case"scaleX":e=new Ol;break;case"scaleY":e=new Dl;break;case"shearY":e=new Nl;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,i,r){const o=this.scale,a=L(t,"name",i);switch(L(t,"type","region")){case"region":{const h=L(t,"path",a),l=this.readSequence(L(t,"sequence",null)),c=this.attachmentLoader.newRegionAttachment(e,i,a,h,l);if(!c)return null;c.path=h,c.x=L(t,"x",0)*o,c.y=L(t,"y",0)*o,c.scaleX=L(t,"scaleX",1),c.scaleY=L(t,"scaleY",1),c.rotation=L(t,"rotation",0),c.width=t.width*o,c.height=t.height*o;const u=L(t,"color",null);return u&&c.color.setFromString(u),c.updateSequence(),c}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,i,a);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const l=L(t,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=L(t,"path",a),l=this.readSequence(L(t,"sequence",null)),c=this.attachmentLoader.newMeshAttachment(e,i,a,h,l);if(!c)return null;c.path=h;const u=L(t,"color",null);u&&c.color.setFromString(u),c.width=L(t,"width",0)*o,c.height=L(t,"height",0)*o;const d=L(t,"source",null);if(d){let g=s;const p=L(t,"slot",null);if(p){const m=r.findSlot(p);if(!m)throw new Error(`Source mesh slot not found: ${p}`);g=m.index}return this.linkedMeshes.push(new mv(c,L(t,"skin",null),s,g,d,L(t,"timelines",!0))),c}const f=t.uvs;return this.readVertices(t,c,f.length),c.triangles=t.triangles,c.regionUVs=f,c.edges=L(t,"edges",null),c.hullLength=L(t,"hull",0)*2,c.updateSequence(),c}case"path":{const h=this.attachmentLoader.newPathAttachment(e,i,a);if(!h)return null;h.closed=L(t,"closed",!1),h.constantSpeed=L(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,h,l<<1);const c=G.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)c[d]=t.lengths[d]*o;h.lengths=c;const u=L(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,i,a);if(!h)return null;h.x=L(t,"x",0)*o,h.y=L(t,"y",0)*o,h.rotation=L(t,"rotation",0);const l=L(t,"color",null);return l&&h.color.setFromString(l),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,i,a);if(!h)return null;const l=L(t,"end",null);l&&(h.endSlot=r.findSlot(l)),h.convex=L(t,"convex",!1),h.inverse=L(t,"inverse",!1);const c=t.vertexCount;this.readVertices(t,h,c<<1);const u=L(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return new pa(1,!1);const e=new pa(L(t,"count",0),!0);return e.start=L(t,"start",1),e.digits=L(t,"digits",0),e.setupIndex=L(t,"setup",0),e}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const r=t.vertices;if(s===r.length){const h=G.toFloatArray(r);if(i!==1)for(let l=0,c=r.length;l<c;l++)h[l]*=i;e.vertices=h;return}const o=[],a=[];for(let h=0,l=r.length;h<l;){const c=r[h++];a.push(c);for(let u=h+c*4;h<u;h+=4)a.push(r[h]),o.push(r[h+1]*i),o.push(r[h+2]*i),o.push(r[h+3])}e.bones=a,e.vertices=G.toFloatArray(o)}readAnimation(t,e,s){const i=this.scale,r=[];if(t.slots)for(const l in t.slots){const c=t.slots[l],u=s.findSlot(l);if(!u)throw new Error(`Slot not found: ${l}`);const d=u.index;for(const f in c){const g=c[f];if(!g)continue;const p=g.length;switch(f){case"attachment":{const m=new kr(p,d);for(let y=0;y<p;y++){const x=g[y];m.setFrame(y,L(x,"time",0),L(x,"name",null))}r.push(m);break}case"rgba":{const m=new dm(p,p<<2,d);let y=g[0],x=L(y,"time",0),_=Q.fromString(y.color);for(let b=0,w=0;;b++){m.setFrame(b,x,_.r,_.g,_.b,_.a);const S=g[b+1];if(!S){m.shrink(w);break}const v=L(S,"time",0),T=Q.fromString(S.color),A=y.curve;A&&(w=pt(A,m,w,b,0,x,v,_.r,T.r,1),w=pt(A,m,w,b,1,x,v,_.g,T.g,1),w=pt(A,m,w,b,2,x,v,_.b,T.b,1),w=pt(A,m,w,b,3,x,v,_.a,T.a,1)),x=v,_=T,y=S}r.push(m);break}case"rgb":{const m=new fm(p,p*3,d);let y=g[0],x=L(y,"time",0),_=Q.fromString(y.color);for(let b=0,w=0;;b++){m.setFrame(b,x,_.r,_.g,_.b);const S=g[b+1];if(!S){m.shrink(w);break}const v=L(S,"time",0),T=Q.fromString(S.color),A=y.curve;A&&(w=pt(A,m,w,b,0,x,v,_.r,T.r,1),w=pt(A,m,w,b,1,x,v,_.g,T.g,1),w=pt(A,m,w,b,2,x,v,_.b,T.b,1)),x=v,_=T,y=S}r.push(m);break}case"alpha":{Oe(r,g,new pm(p,p,d),0,1);break}case"rgba2":{const m=new gm(p,p*7,d);let y=g[0],x=L(y,"time",0),_=Q.fromString(y.light),b=Q.fromString(y.dark);for(let w=0,S=0;;w++){m.setFrame(w,x,_.r,_.g,_.b,_.a,b.r,b.g,b.b);const v=g[w+1];if(!v){m.shrink(S);break}const T=L(v,"time",0),A=Q.fromString(v.light),P=Q.fromString(v.dark),M=y.curve;M&&(S=pt(M,m,S,w,0,x,T,_.r,A.r,1),S=pt(M,m,S,w,1,x,T,_.g,A.g,1),S=pt(M,m,S,w,2,x,T,_.b,A.b,1),S=pt(M,m,S,w,3,x,T,_.a,A.a,1),S=pt(M,m,S,w,4,x,T,b.r,P.r,1),S=pt(M,m,S,w,5,x,T,b.g,P.g,1),S=pt(M,m,S,w,6,x,T,b.b,P.b,1)),x=T,_=A,b=P,y=v}r.push(m);break}case"rgb2":{const m=new mm(p,p*6,d);let y=g[0],x=L(y,"time",0),_=Q.fromString(y.light),b=Q.fromString(y.dark);for(let w=0,S=0;;w++){m.setFrame(w,x,_.r,_.g,_.b,b.r,b.g,b.b);const v=g[w+1];if(!v){m.shrink(S);break}const T=L(v,"time",0),A=Q.fromString(v.light),P=Q.fromString(v.dark),M=y.curve;M&&(S=pt(M,m,S,w,0,x,T,_.r,A.r,1),S=pt(M,m,S,w,1,x,T,_.g,A.g,1),S=pt(M,m,S,w,2,x,T,_.b,A.b,1),S=pt(M,m,S,w,3,x,T,b.r,P.r,1),S=pt(M,m,S,w,4,x,T,b.g,P.g,1),S=pt(M,m,S,w,5,x,T,b.b,P.b,1)),x=T,_=A,b=P,y=v}r.push(m);break}default:throw new Error(`Invalid timeline type for a slot: ${g.name} (${c.name})`)}}}if(t.bones)for(const l in t.bones){const c=t.bones[l],u=s.findBone(l);if(!u)throw new Error(`Bone not found: ${l}`);const d=u.index;for(const f in c){const g=c[f],p=g.length;if(p!==0)switch(f){case"rotate":Oe(r,g,new ga(p,p,d),0,1);break;case"translate":Dh(r,g,new sm(p,p<<1,d),"x","y",0,i);break;case"translatex":Oe(r,g,new im(p,p,d),0,i);break;case"translatey":Oe(r,g,new nm(p,p,d),0,i);break;case"scale":Dh(r,g,new rm(p,p<<1,d),"x","y",1,1);break;case"scalex":Oe(r,g,new om(p,p,d),1,1);break;case"scaley":Oe(r,g,new am(p,p,d),1,1);break;case"shear":Dh(r,g,new hm(p,p<<1,d),"x","y",0,1);break;case"shearx":Oe(r,g,new lm(p,p,d),0,1);break;case"sheary":Oe(r,g,new cm(p,p,d),0,1);break;case"inherit":{const m=new um(p,u.index);for(let y=0;y<g.length;y++){const x=g[y];m.setFrame(y,L(x,"time",0),G.enumValue(Yt,L(x,"inherit","Normal")))}r.push(m);break}default:throw new Error(`Invalid timeline type for a bone: ${g.name} (${c.name})`)}}}if(t.ik)for(const l in t.ik){const c=t.ik[l];let u=c[0];if(!u)continue;const d=s.findConstraint(l,qo);if(!d)throw new Error(`IK Constraint not found: ${l}`);const f=new xm(c.length,c.length<<1,s.constraints.indexOf(d));let g=L(u,"time",0),p=L(u,"mix",1),m=L(u,"softness",0)*i;for(let y=0,x=0;;y++){f.setFrame(y,g,p,m,L(u,"bendPositive",!0)?1:-1,L(u,"compress",!1),L(u,"stretch",!1));const _=c[y+1];if(!_){f.shrink(x);break}const b=L(_,"time",0),w=L(_,"mix",1),S=L(_,"softness",0)*i,v=u.curve;v&&(x=pt(v,f,x,y,0,g,b,p,w,1),x=pt(v,f,x,y,1,g,b,m,S,i)),g=b,p=w,m=S,u=_}r.push(f)}if(t.transform)for(const l in t.transform){const c=t.transform[l];let u=c[0];if(!u)continue;const d=s.findConstraint(l,rt);if(!d)throw new Error(`Transform constraint not found: ${l}`);const f=new _m(c.length,c.length*6,s.constraints.indexOf(d));let g=L(u,"time",0),p=L(u,"mixRotate",1),m=L(u,"mixX",1),y=L(u,"mixY",m),x=L(u,"mixScaleX",1),_=L(u,"mixScaleY",1),b=L(u,"mixShearY",1);for(let w=0,S=0;;w++){f.setFrame(w,g,p,m,y,x,_,b);const v=c[w+1];if(!v){f.shrink(S);break}const T=L(v,"time",0),A=L(v,"mixRotate",1),P=L(v,"mixX",1),M=L(v,"mixY",P),I=L(v,"mixScaleX",1),C=L(v,"mixScaleY",1),k=L(v,"mixShearY",1),E=u.curve;E&&(S=pt(E,f,S,w,0,g,T,p,A,1),S=pt(E,f,S,w,1,g,T,m,P,1),S=pt(E,f,S,w,2,g,T,y,M,1),S=pt(E,f,S,w,3,g,T,x,I,1),S=pt(E,f,S,w,4,g,T,_,C,1),S=pt(E,f,S,w,5,g,T,b,k,1)),g=T,p=A,m=P,y=M,x=I,_=C,b=k,u=v}r.push(f)}if(t.path)for(const l in t.path){const c=t.path[l],u=s.findConstraint(l,Ko);if(!u)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(u);for(const f in c){const g=c[f];let p=g[0];if(!p)continue;const m=g.length;switch(f){case"position":{const y=new bm(m,m,d);Oe(r,g,y,0,u.positionMode===Ms.Fixed?i:1);break}case"spacing":{const y=new wm(m,m,d);Oe(r,g,y,0,u.spacingMode===oe.Length||u.spacingMode===oe.Fixed?i:1);break}case"mix":{const y=new Sm(m,m*3,d);let x=L(p,"time",0),_=L(p,"mixRotate",1),b=L(p,"mixX",1),w=L(p,"mixY",b);for(let S=0,v=0;;S++){y.setFrame(S,x,_,b,w);const T=g[S+1];if(!T){y.shrink(v);break}const A=L(T,"time",0),P=L(T,"mixRotate",1),M=L(T,"mixX",1),I=L(T,"mixY",M),C=p.curve;C&&(v=pt(C,y,v,S,0,x,A,_,P,1),v=pt(C,y,v,S,1,x,A,b,M,1),v=pt(C,y,v,S,2,x,A,w,I,1)),x=A,_=P,b=M,w=I,p=T}r.push(y);break}}}}if(t.physics)for(const l in t.physics){const c=t.physics[l];let u=-1;if(l.length>0){const d=s.findConstraint(l,Zo);if(!d)throw new Error(`Physics constraint not found: ${l}`);u=s.constraints.indexOf(d)}for(const d in c){const f=c[d];let g=f[0];if(!g)continue;const p=f.length;let m,y=0;if(d==="reset"){const x=new Ka(p,u);for(let _=0;g!=null;g=f[_+1],_++)x.setFrame(_,L(g,"time",0));r.push(x);continue}switch(d){case"inertia":m=new vm(p,p,u);break;case"strength":m=new Tm(p,p,u);break;case"damping":m=new Am(p,p,u);break;case"mass":m=new Cm(p,p,u);break;case"wind":m=new Pm(p,p,u);break;case"gravity":m=new Mm(p,p,u);break;case"mix":{y=1,m=new km(p,p,u);break}default:continue}Oe(r,f,m,y,1)}}if(t.slider)for(const l in t.slider){const c=t.slider[l],u=s.findConstraint(l,Vi);if(!u)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(u);for(const f in c){const g=c[f];if(!g[0])continue;const m=g.length;switch(f){case"time":Oe(r,g,new Im(m,m,d),1,1);break;case"mix":Oe(r,g,new Em(m,m,d),1,1);break}}}if(t.attachments)for(const l in t.attachments){const c=t.attachments[l],u=s.findSkin(l);if(!u)throw new Error(`Skin not found: ${l}`);for(const d in c){const f=c[d],g=s.findSlot(d);if(!g)throw new Error(`Attachment slot not found: ${d}`);const p=g.index;for(const m in f){const y=f[m],x=u.getAttachment(p,m);if(!x)throw new Error(`Timeline attachment not found: ${m}`);for(const _ in y){const b=y[_];let w=b[0];if(w){if(_==="deform"){const S=x.bones,v=x.vertices,T=S?v.length/3*2:v.length,A=new ym(b.length,b.length,p,x);let P=L(w,"time",0);for(let M=0,I=0;;M++){let C;const k=L(w,"vertices",null);if(!k)C=S?G.newFloatArray(T):v;else{C=G.newFloatArray(T);const N=L(w,"offset",0);if(G.arrayCopy(k,0,C,N,k.length),i!==1)for(let O=N,R=O+k.length;O<R;O++)C[O]*=i;if(!S)for(let O=0;O<T;O++)C[O]+=v[O]}A.setFrame(M,P,C);const E=b[M+1];if(!E){A.shrink(I);break}const F=L(E,"time",0),B=w.curve;B&&(I=pt(B,A,I,M,0,P,F,0,1,1)),P=F,w=E}r.push(A)}else if(_==="sequence"){const S=new bs(b.length,p,x);let v=0;for(let T=0;T<b.length;T++){const A=L(w,"delay",v),P=L(w,"time",0),M=pe[L(w,"mode","hold")],I=L(w,"index",0);S.setFrame(T,P,M,I,A),v=A,w=b[T+1]}r.push(S)}}}}}}if(t.drawOrder){const l=new Xs(t.drawOrder.length),c=s.slots.length;let u=0;for(const d of t.drawOrder)l.setFrame(u++,L(d,"time",0),Hd(s,d,c,null));r.push(l)}if(t.drawOrderFolder)for(const l of t.drawOrderFolder){const c=L(l,"slots",[]),u=new Array(c.length);let d=0;for(const m of c){const y=s.findSlot(m);if(!y)throw new Error(`Draw order folder slot not found: ${m}`);u[d++]=y.index}const f=L(l,"keys",[]),g=new Ji(f.length,u,s.slots.length);let p=0;for(const m of f)g.setFrame(p++,L(m,"time",0),Hd(s,m,u.length,u));r.push(g)}if(t.events){const l=new ro(t.events.length);let c=0;for(let u=0;u<t.events.length;u++,c++){const d=t.events[u],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const g=f.setupPose,p=new zc(G.toSinglePrecision(L(d,"time",0)),f);p.intValue=L(d,"int",g.intValue),p.floatValue=L(d,"float",g.floatValue),p.stringValue=L(d,"string",g.stringValue),p.data.audioPath&&(p.volume=L(d,"volume",g.volume),p.balance=L(d,"balance",g.volume)),l.setFrame(c,p)}r.push(l)}let o=0;for(let l=0,c=r.length;l<c;l++)o=Math.max(o,r[l].getDuration());const a=new Oc(e,r,o),h=L(t,"color",null);h!==null&&a.color.setFromString(h),s.animations.push(a)}}class mv{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,i,r,o){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=i,this.source=r,this.inheritTimelines=o}}function Oe(n,t,e,s,i){let r=t[0],o=r.time??0,a=(r.value??s)*i,h=0;for(let l=0;;l++){e.setFrame(l,o,a);const c=t[l+1];if(!c){e.shrink(h),n.push(e);return}const u=c.time??0,d=(c.value??s)*i;r.curve&&(h=pt(r.curve,e,h,l,0,o,u,a,d,i)),o=u,a=d,r=c}}function Dh(n,t,e,s,i,r,o){let a=t[0],h=a.time??0,l=(a[s]??r)*o,c=(a[i]??r)*o,u=0;for(let d=0;;d++){e.setFrame(d,h,l,c);const f=t[d+1];if(!f){e.shrink(u),n.push(e);return}const g=f.time??0,p=(f[s]??r)*o,m=(f[i]??r)*o,y=a.curve;y&&(u=pt(y,e,u,d,0,h,g,l,p,o),u=pt(y,e,u,d,1,h,g,c,m,o)),h=g,l=p,c=m,a=f}}function Hd(n,t,e,s){const i=t.offsets;if(!i)return null;const r=new Array(e).fill(-1),o=new Array(e-i.length);let a=0,h=0;for(const l of i){const c=n.findSlot(l.slot);if(c==null)throw new Error(`Draw order slot not found: ${l.slot}`);let u=0;if(!s)u=c.index;else{u=-1;for(let d=0;d<e;d++)if(s[d]===c.index){u=d;break}if(u===-1)throw new Error(`Slot not in folder: ${l.slot}`)}for(;a!==u;)o[h++]=a++;r[a+l.offset]=a++}for(;a<e;)o[h++]=a++;for(let l=e-1;l>=0;l--)r[l]===-1&&(r[l]=o[--h]);return r}function pt(n,t,e,s,i,r,o,a,h,l){if(n==="stepped")return t.setStepped(s),e;const c=i<<2,u=n[c],d=n[c+1]*l,f=n[c+2],g=n[c+3]*l;return t.setBezier(e,s,i,r,a,u,d,f,g,o,h),e+1}function L(n,t,e){return n[t]!==void 0?n[t]:e}class yv{skeleton;adapter;positionInheritanceFactorX=0;positionInheritanceFactorY=0;rotationInheritanceFactor=0;hasLastTransform=!1;lastX=0;lastY=0;lastZ=0;lastRotation=0;currentTransform={x:0,y:0,z:0,rotation:0};currentPosition={x:0,y:0,z:0};lastPosition={x:0,y:0,z:0};constructor(t,e,s={}){this.skeleton=t,this.adapter=e,this.positionInheritanceFactorX=s.positionInheritanceX??0,this.positionInheritanceFactorY=s.positionInheritanceY??0,this.rotationInheritanceFactor=s.rotationInheritance??0}get positionInheritanceX(){return this.positionInheritanceFactorX}get positionInheritanceY(){return this.positionInheritanceFactorY}setPositionInheritance(t,e){const s=this.positionInheritanceFactorX===0&&this.positionInheritanceFactorY===0,i=t!==0||e!==0;this.positionInheritanceFactorX=t,this.positionInheritanceFactorY=e,s&&i&&this.resetPosition()}get rotationInheritance(){return this.rotationInheritanceFactor}set rotationInheritance(t){const e=this.rotationInheritanceFactor===0;this.rotationInheritanceFactor=t,e&&t!==0&&this.resetRotation()}resetPosition(){const t=this.currentTransform,e=!this.hasLastTransform&&this.rotationInheritanceFactor!==0;this.adapter.readTransform(t,e),this.lastX=t.x,this.lastY=t.y,this.lastZ=t.z,e&&(this.lastRotation=t.rotation),this.hasLastTransform=!0}resetRotation(){const t=this.currentTransform;this.adapter.readTransform(t,!0),this.lastRotation=t.rotation,this.hasLastTransform||(this.lastX=t.x,this.lastY=t.y,this.lastZ=t.z),this.hasLastTransform=!0}resetTransform(){const t=this.currentTransform;this.adapter.readTransform(t,!0),this.setLastTransform(t.x,t.y,t.z,t.rotation)}applyTransformMovement(){const t=this.positionInheritanceFactorX!==0||this.positionInheritanceFactorY!==0,e=this.rotationInheritanceFactor!==0;if(!t&&!e)return;const s=this.currentTransform;this.adapter.readTransform(s,e);const{x:i,y:r,z:o}=s,a=e?s.rotation:this.lastRotation,h=i!==this.lastX||r!==this.lastY||o!==this.lastZ;if(this.hasLastTransform){if(!h&&a===this.lastRotation)return;t&&h&&this.applyPositionMovement(i,r,o),e&&a!==this.lastRotation&&this.applyRotationMovement(a)}this.setLastTransform(i,r,o,a)}applyPositionMovement(t,e,s){const i=this.currentPosition;i.x=t,i.y=e,i.z=s,this.adapter.worldToSkeleton(i);const r=this.lastPosition;r.x=this.lastX,r.y=this.lastY,r.z=this.lastZ,this.adapter.worldToSkeleton(r),this.skeleton.physicsTranslate((i.x-r.x)*this.positionInheritanceFactorX,(i.y-r.y)*this.positionInheritanceFactorY)}applyRotationMovement(t){const e=this.rotationInheritanceFactor;e!==0&&this.skeleton.physicsRotate(0,0,this.getRotationDelta(t,this.lastRotation)*e)}setLastTransform(t,e,s,i){this.lastX=t,this.lastY=e,this.lastZ=s,this.lastRotation=i,this.hasLastTransform=!0}getRotationDelta(t,e){let s=t-e;return s=(s+180)%360-180,s<-180?s+360:s}}class hs extends Jg{static textureMap=new Map;static from(t){return hs.textureMap.has(t)?hs.textureMap.get(t):new hs(t)}texture;constructor(t){super(t.resource),this.texture=$.from(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=hs.toPixiTextureFilter(t),s.magFilter=hs.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=hs.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=hs.toPixiTextureWrap(t),s.addressModeV=hs.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case ce.Nearest:case ce.Linear:return!1;
389case ce.MipMapNearestLinear:case ce.MipMapNearestNearest:case ce.MipMapLinearLinear:case ce.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case ce.Nearest:case ce.MipMapNearestLinear:case ce.MipMapNearestNearest:return"nearest";case ce.Linear:case ce.MipMapLinearLinear:case ce.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case Gs.ClampToEdge:return"clamp-to-edge";case Gs.MirroredRepeat:return"mirror-repeat";case Gs.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case ri.Normal:return"normal";case ri.Additive:return"add";case ri.Multiply:return"multiply";case ri.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}}const cn="spineTextureAtlasLoader",xv={extension:X.Asset,resolver:{test:n=>is(n,".atlas"),parse:n=>{const t=n.split(".");return{resolution:parseFloat(tn.RETINA_PREFIX?.exec(n)?.[1]??"1"),format:t[t.length-2],src:n}}},loader:{id:cn,name:cn,extension:{type:X.LoadParser,priority:ds.Normal,name:cn},test(n){return is(n,".atlas")},async load(n){const t=await ft.get().fetch(n);if(!t.ok)throw new Error(`[${cn}] Failed to fetch ${n}: ${t.status} ${t.statusText}`);return await t.text()},testParse(n,t){const e=is(t.src,".atlas"),s=typeof n=="string",i=t.parser===cn||t.loadParser===cn;return Promise.resolve((e||i)&&s)},unload(n){n.dispose()},async parse(n,t,e){const s=t.data||{};let i=ie.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const r=new pS(n);if(s.images instanceof Pe||typeof s.images=="string"){const a=s.images;s.images={},s.images[r.pages[0].name]=a}const o=[];for(const a of r.pages){const h=a.name,l=s?.images?s.images[h]:void 0;if(l instanceof Pe)a.setTexture(hs.from(l));else{const c=l??ie.normalize([...i.split(ie.sep),h].join(ie.sep)),u={src:ha(c,t.src),data:{...s.imageMetadata,alphaMode:a.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=e.load(u).then(f=>{a.setTexture(hs.from(f.source))});o.push(d)}}return await Promise.all(o),r}}};yt.add(xv);const un="spineSkeletonLoader";function _v(n){return Object.prototype.hasOwnProperty.call(n,"bones")}function bv(n){return n instanceof Uint8Array}const wv={extension:X.Asset,loader:{id:un,name:un,extension:{type:X.LoadParser,priority:ds.Normal,name:un},test(n){return is(n,".skel")},async load(n){const t=await ft.get().fetch(n);if(!t.ok)throw new Error(`[${un}] Failed to fetch ${n}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(n,t){const e=is(t.src,".json")&&_v(n),s=is(t.src,".skel")&&bv(n),i=t.parser===un||t.loadParser===un;return Promise.resolve(e||s||i)}}};yt.add(wv);const Sv=new Float32Array(1),vv=new Uint32Array(1);class Tv extends bc{constructor(){const e=new Ps({data:Sv,label:"attribute-batch-buffer",usage:Lt.VERTEX|Lt.COPY_DST,shrinkToFit:!1}),s=new Ps({data:vv,label:"index-batch-buffer",usage:Lt.INDEX|Lt.COPY_DST,shrinkToFit:!1}),i=28;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:24}},indexBuffer:s})}}const Av={name:"color-bit",vertex:{header:`
390            @in aDarkColor: vec4<f32>;
391            @out vDarkColor: vec4<f32>;
392        `,main:`
393        vDarkColor = aDarkColor;
394        `},fragment:{header:`
395            @in vDarkColor: vec4<f32>;
396        `,end:`
397
398        let alpha = outColor.a * vColor.a;
399        let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
400
401        finalColor = vec4<f32>(rgb, alpha);
402
403        `}},Cv={name:"color-bit",vertex:{header:`
404            in vec4 aDarkColor;
405            out vec4 vDarkColor;
406        `,main:`
407            vDarkColor = aDarkColor;
408        `},fragment:{header:`
409            in vec4 vDarkColor;
410        `,end:`
411
412        finalColor.a = outColor.a * vColor.a;
413        finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
414        `}};class Pv extends io{constructor(t){const e=Sc({name:"dark-tint-batch",bits:[ug,Cv,fg(t),Tc]}),s=wc({name:"dark-tint-batch",bits:[cg,Av,dg(t),vc]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:pg(t)}})}}let jd=null;class Xc extends og{static extension={type:[X.Batcher],name:"darkTint"};geometry=new Tv;shader=jd||(jd=new Pv(this.maxTextures));name=Xc.extension.name;vertexSize=7;packAttributes(t,e,s,i,r){const o=r<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:g,uvs:p}=t,m=t.color,y=(m>>24&255)/255,x=Nt.shared.setValue(t.darkColor).premultiply(y,!0).toPremultiplied(1,!1),_=t.attributeOffset,b=_+t.attributeSize;
414for(let w=_;w<b;w++){const S=w*2,v=g[S],T=g[S+1];e[i++]=h*v+c*T+d,e[i++]=u*T+l*v+f,e[i++]=p[S],e[i++]=p[S+1],s[i++]=m,s[i++]=x,s[i++]=o}}packQuadAttributes(t,e,s,i,r){const o=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,g=t.bounds,p=g.maxX,m=g.minX,y=g.maxY,x=g.minY,_=o.uvs,b=t.color,w=t.darkColor,S=r<<16|t.roundPixels&65535;e[i+0]=h*m+c*x+d,e[i+1]=u*x+l*m+f,e[i+2]=_.x0,e[i+3]=_.y0,s[i+4]=b,s[i+5]=w,s[i+6]=S,e[i+7]=h*p+c*x+d,e[i+8]=u*x+l*p+f,e[i+9]=_.x1,e[i+10]=_.y1,s[i+11]=b,s[i+12]=w,s[i+13]=S,e[i+14]=h*p+c*y+d,e[i+15]=u*y+l*p+f,e[i+16]=_.x2,e[i+17]=_.y2,s[i+18]=b,s[i+19]=w,s[i+20]=S,e[i+21]=h*m+c*y+d,e[i+22]=u*y+l*m+f,e[i+23]=_.x3,e[i+24]=_.y3,s[i+25]=b,s[i+26]=w,s[i+27]=S}}yt.add(Xc);const Mv=G.newFloatArray(8);class Er{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=G.newFloatArray(8*1024);tempColor=new Q;constructor(t){this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){const e=this.ctx,s=this.tempColor,i=t.color,r=t.drawOrder.appliedPose;this.debugRendering&&(e.strokeStyle="green");for(let o=0,a=r.length;o<a;o++){const h=r[o],l=h.bone;if(!l.active)continue;const c=h.appliedPose,u=c.attachment;if(!(u instanceof at))continue;const d=u.sequence,f=d.resolveIndex(c);u.computeWorldVertices(h,u.getOffsets(c),Mv,0,2);const g=d.regions[f],p=g.texture.getImage(),m=c.color,y=u.color;s.set(i.r*m.r*y.r,i.g*m.g*y.g,i.b*m.b*y.b,i.a*m.a*y.a),e.save();const x=l.appliedPose;e.transform(x.a,x.c,x.b,x.d,x.worldX,x.worldY);const _=u.getOffsets(c);e.translate(_[0],_[1]),e.rotate(u.rotation*Math.PI/180);const b=u.width/g.originalWidth;e.scale(b*u.scaleX,b*u.scaleY);let w=g.width,S=g.height;if(e.translate(w/2,S/2),g.degrees===90){const v=w;w=S,S=v,e.rotate(-Math.PI/2)}e.scale(1,-1),e.translate(-w/2,-S/2),e.globalAlpha=s.a,e.drawImage(p,p.width*g.u,p.height*g.v,w,S,0,0,w,S),this.debugRendering&&e.strokeRect(0,0,w,S),e.restore()}}drawTriangles(t){const e=this.ctx,s=this.tempColor,i=t.color,r=t.drawOrder.appliedPose;let o=null,a=this.vertices,h=null;for(let l=0,c=r.length;l<c;l++){const u=r[l],d=u.appliedPose,f=d.attachment;let g;if(f instanceof at){const p=f.sequence,m=p.resolveIndex(d),y=p.getUVs(m),x=f.getOffsets(d);a=this.computeRegionVertices(u,f,x,y,!1),h=Er.QUAD_TRIANGLES,g=(p.regions[m]?.texture).getImage()}else if(f instanceof xe){const p=f.sequence,m=p.resolveIndex(d),y=p.getUVs(m);a=this.computeMeshVertices(u,f,y,!1),h=f.triangles,g=(p.regions[m]?.texture).getImage()}else continue;if(g){u.data.blendMode!==o&&(o=u.data.blendMode);const p=d.color,m=f.color;s.set(i.r*p.r*m.r,i.g*p.g*m.g,i.b*p.b*m.b,i.a*p.a*m.a),e.globalAlpha=s.a;for(let y=0;y<h.length;y+=3){const x=h[y]*8,_=h[y+1]*8,b=h[y+2]*8,w=a[x],S=a[x+1],v=a[x+6],T=a[x+7],A=a[_],P=a[_+1],M=a[_+6],I=a[_+7],C=a[b],k=a[b+1],E=a[b+6],F=a[b+7];this.drawTriangle(g,w,S,v,T,A,P,M,I,C,k,E,F),this.debugRendering&&(e.strokeStyle="green",e.beginPath(),e.moveTo(w,S),e.lineTo(A,P),e.lineTo(C,k),e.lineTo(w,S),e.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,e,s,i,r,o,a,h,l,c,u,d,f){const g=this.ctx,p=t.width-1,m=t.height-1;i*=p,r*=m,h*=p,l*=m,d*=p,f*=m,g.beginPath(),g.moveTo(e,s),g.lineTo(o,a),g.lineTo(c,u),g.closePath(),o-=e,a-=s,c-=e,u-=s,h-=i,l-=r,d-=i,f-=r;let y=h*f-d*l;if(y===0)return;y=1/y;const x=(f*o-l*c)*y,_=(f*a-l*u)*y,b=(h*c-d*o)*y,w=(h*u-d*a)*y,S=e-x*i-b*r,v=s-_*i-w*r;g.save(),g.transform(x,_,b,w,S,v),g.clip(),g.drawImage(t,0,0),g.restore()}computeRegionVertices(t,e,s,i,r){const o=t.skeleton.color,a=t.appliedPose.color,h=e.color,l=o.a*a.a*h.a,c=r?l:1,u=this.tempColor;u.set(o.r*a.r*h.r*c,o.g*a.g*h.g*c,o.b*a.b*h.b*c,l),e.computeWorldVertices(t,s,this.vertices,0,Er.VERTEX_SIZE);const d=this.vertices;return d[at.C1R]=u.r,d[at.C1G]=u.g,d[at.C1B]=u.b,d[at.C1A]=u.a,d[at.U1]=i[0],d[at.V1]=i[1],d[at.C2R]=u.r,d[at.C2G]=u.g,d[at.C2B]=u.b,d[at.C2A]=u.a,d[at.U2]=i[2],d[at.V2]=i[3],d[at.C3R]=u.r,d[at.C3G]=u.g,d[at.C3B]=u.b,d[at.C3A]=u.a,d[at.U3]=i[4],d[at.V3]=i[5],d[at.C4R]=u.r,d[at.C4G]=u.g,d[at.C4B]=u.b,d[at.C4A]=u.a,d[at.U4]=i[6],d[at.V4]=i[7],d}computeMeshVertices(t,e,s,i){const r=t.skeleton,o=r.color,a=t.appliedPose.color,h=e.color,l=o.a*a.a*h.a,c=i?l:1,u=this.tempColor;u.set(o.r*a.r*h.r*c,o.g*a.g*h.g*c,o.b*a.b*h.b*c,l);const d=e.worldVerticesLength/2;let f=this.vertices;
414f.length<e.worldVerticesLength&&(this.vertices=f=G.newFloatArray(e.worldVerticesLength)),e.computeWorldVertices(r,t,0,e.worldVerticesLength,f,0,Er.VERTEX_SIZE);for(let g=0,p=0,m=2;g<d;g++)f[m++]=u.r,f[m++]=u.g,f[m++]=u.b,f[m++]=u.a,f[m++]=s[p++],f[m++]=s[p++],m+=2;return f}}class kv{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const r=t.a*s*255;if(e!==16777215){const o=e>>16&255,a=e>>8&255,h=e&255,l=t.r*h,c=t.g*a,u=t.b*o;i=r<<24|u<<16|c<<8|l}else i=r<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const r=e.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}}const Iv={0:"normal",1:"add",2:"multiply",3:"screen"};class Ev{static extension={type:[X.WebGLPipes,X.WebGPUPipes,X.CanvasPipes],name:"spine"};renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}
414validateRenderable(t){if(this.renderer.type===Gi.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder.appliedPose,s=this.gpuSpineData[t.uid];if(!s)return!1;for(let i=0,r=e.length;i<r;i++){const o=e[i];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof at||a instanceof xe){const h=t._getCachedData(o,a),l=s.slotBatches[h.id],c=h.texture;if(c!==l?.texture&&!l?._batcher.checkAndUpdateTexture(l,c))return!0}}}return!1}execute(t){if(this.renderer.type===Gi.CANVAS){const e=this.renderer,s=(t.groupColorAlpha>>>24&255)/255,i=e.canvasContext,r=i.activeContext;r.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new Er(r),this.canvasSkeletonRenderer.triangleRendering=!0),i.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);const o=t.skeleton.color.a;t.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=o,r.restore()}}addRenderable(t,e){if(this.renderer.type===Gi.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder.appliedPose,o=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let a=0,h=r.length;a<h;a++){const l=r[a];if(!l.bone.active)continue;const c=l.appliedPose.attachment,u=Iv[l.data.blendMode];let d=!1;if(c instanceof at||c instanceof xe){const g=t._getCachedData(l,c),p=s.slotBatches[g.id]||=new kv;p.setData(t,g,u,o),d=g.skipRender,d||i.addToBatch(p,e)}const f=t._slotsObject[l.data.name];if(f?.wasRenderable){const g=f.container;g.includeInBuild=!0,g.collectRenderables(e,this.renderer,null),g.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];if(!e)return;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder.appliedPose;for(let i=0,r=s.length;i<r;i++){const o=s[i];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof at||a instanceof xe){const h=t._getCachedData(o,a);if(!h.skipRender){const l=e.slotBatches[h.id];l&&(l.uvs=h.clipped?h.clippedData.uvs:h.uvs,l._batcher?.updateElement(l))}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}}yt.add(Ev);const Mo=new Al;$s.yDown=!0;const gs=new Gc;class mk{x;y;width;height;constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}class yk{clipping;constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new $s(t.skeleton.data);e.setupPose(),e.updateWorldTransform(cs.update);const s=e.getBoundsRect(this.clipping?new Gc:void 0);return s.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}}class xk{animation;skins;timeStep;clipping;constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Xr(t.state.data),s=new $s(t.skeleton.data),i=this.clipping?new Gc:void 0,r=s.data;if(this.skins.length>0){const a=new ya("custom-skin");for(const h of this.skins){const l=r.findSkin(h);l!=null&&a.addSkin(l)}s.setSkin(a)}s.setupPose();const o=this.animation!=null?r.findAnimation(this.animation):null;if(o==null){s.updateWorldTransform(cs.update);const a=s.getBoundsRect(i);return a.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:a}else{let a=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimation(0,o,!1);const u=Math.max(o.duration/this.timeStep,1);for(let f=0;f<u;f++){const g=f>0?this.timeStep:0;e.update(g),e.apply(s),s.update(g),s.updateWorldTransform(cs.update);const p=s.getBoundsRect(i);a=Math.min(a,p.x),h=Math.min(h,p.y),l=Math.max(l,p.x+p.width),c=Math.max(c,p.y+p.height)}const d={x:a,y:h,width:l-a,height:c-h};return d.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}}const qd=new Gr(()=>new Wt);class ws extends er{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonPhysics;skeletonBounds;
414darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let e;if(typeof t=="number"?e=this.skeleton.slots[t]:typeof t=="string"?e=this.skeleton.findSlot(t):e=t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_lastRenderableCacheIds=[];_lastClippingAttachmentIds=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;_ticker=Zt.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??Zt.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){super({}),t instanceof Vc?t={skeletonData:t}:"skeleton"in t&&(t=new.target.createOptions(t)),this.allowChildren=!0;const{autoUpdate:e,boundsProvider:s,darkTint:i,skeletonData:r,ticker:o}=t;this.skeleton=new $s(r),this.skeletonPhysics=new yv(this.skeleton,{readTransform:(h,l)=>this.readPhysicsTransform(h,l),worldToSkeleton:h=>this.pixiWorldCoordinatesToSkeleton(h)}),this.state=new Xr(new vS(r)),o&&(this._ticker=o),this.autoUpdate=e??!0,this._boundsProvider=s,this.darkTint=i===void 0?this.skeleton.slots.some(h=>!!h.data.setupPose.darkColor):i;const a=this.skeleton.slots;for(let h=0;h<a.length;h++)this.attachmentCacheData[h]=Object.create(null)}update(t){this.internalUpdate(void 0,t)}internalUpdate(t,e){this._updateAndApplyState(e??this._ticker.deltaMS/1e3)}readPhysicsTransform(t,e){const s=this.worldTransform;if(t.x=s.tx,t.y=s.ty,t.z=0,!e)return;let i=0;for(let r=this;r;r=r.parent)i+=r.rotation+(r.skew.y-r.skew.x)/2;t.rotation=i*180/Math.PI}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);Mo.set(e.x,e.y);const i=t.appliedPose;if(t.parent){const r=t.parent.appliedPose.worldToLocal(Mo);i.x=r.x,i.y=-r.y}else i.x=Mo.x,i.y=Mo.y}getBonePosition(t,e){const s=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.appliedPose.worldX,e.y=t.appliedPose.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.skeletonPhysics.applyTransformMovement(),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(cs.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder.appliedPose,e=this._lastAttachments,s=this._lastRenderableCacheIds,i=this._lastClippingAttachmentIds;let r=0,o=0,a=0,h=!1;for(let l=0;l<t.length;l++){const c=t[l];if(!c.bone.active)continue;const u=c.appliedPose.attachment;if(u&&(u!==e[r]&&(h=!0,e[r]=u),r++),u instanceof at||u instanceof xe){const d=this.getRenderableCacheId(c,u);d!==s[o]&&(h=!0,s[o]=d),o++}else if(u instanceof vs){const d=`${c.data.index}-${u.name}-${u.endSlot?.index??-1}`;d!==i[a]&&(h=!0,i[a]=d),a++}}r!==e.length&&(h=!0,e.length=r),o!==s.length&&(h=!0,s.length=o),a!==i.length&&(h=!0,i.length=a),this.spineAttachmentsDirty||=h}currentClippingSlot;updateAndSetPixiMask(t){const s=t.appliedPose.attachment,i=this._slotsObject[t.data.name],r=this.currentClippingSlot;if(r&&t.bone.active&&i?.wasRenderable){const o=r.slot,a=o.appliedPose.attachment;if(o.bone.active&&a instanceof vs){let h=r.mask;if(h||(h=qd.obtain(),r.mask=h,this.addChild(h)),!r.maskComputed){r.maskComputed=!0;const l=a.worldVerticesLength,c=r.vertices;
414a.computeWorldVertices(this.skeleton,o,0,l,c,0,2),h.clear().poly(c).stroke({width:0}).fill({alpha:.25})}i.container.mask=h}}else i?.container.mask&&(i.container.mask=null);if(this.closeCurrentPixiMaskIfEndingAt(t),!!t.bone.active&&s instanceof vs){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:[]};o.slot=t,o.maskComputed=!1,this.currentClippingSlot=o}}closeCurrentPixiMaskIfEndingAt(t){const e=this.currentClippingSlot,s=e?.slot.appliedPose.attachment;e&&s instanceof vs&&s.endSlot===t.data&&(this.currentClippingSlot=void 0)}cleanupPixiMasks(){for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];(!e.slot.bone.active||!(e.slot.appliedPose.attachment instanceof vs)||!e.maskComputed)&&e.mask&&(this.removeChild(e.mask),qd.free(e.mask),e.mask=void 0)}this.currentClippingSlot=void 0}transformAttachments(){const t=this.skeleton.drawOrder.appliedPose,e=this.skeleton;for(let s=0;s<t.length;s++){const i=t[s],r=i.appliedPose,o=r.attachment;if(this.updateAndSetPixiMask(i),!i.bone.active){this.markSlotAttachmentSkipped(i,o),gs.clipEnd(i);continue}if(o){if(o instanceof xe||o instanceof at){const a=this._getCachedData(i,o),h=o.sequence,l=h.resolveIndex(r);o instanceof at?o.computeWorldVertices(i,o.getOffsets(r),a.vertices,0,2):o.computeWorldVertices(e,i,0,o.worldVerticesLength,a.vertices,0,2),a.uvs=h.getUVs(l);const c=e.color,u=r.color,d=o.color,f=c.a*u.a*d.a;if(this.alpha===0||f===0)a.skipRender||(this.spineAttachmentsDirty=!0),a.skipRender=!0,a.clipped=!1;else{a.skipRender&&(this.spineAttachmentsDirty=!0),a.skipRender=a.clipped=!1,a.color.set(c.r*u.r*d.r,c.g*u.g*d.g,c.b*u.b*d.b,f),r.darkColor&&a.darkColor.setFromColor(r.darkColor);const g=h.regions[l]?.texture?.texture||$.EMPTY;a.texture!==g&&(a.texture=g,this.spineTexturesDirty=!0),gs.isClipping()&&this.updateClippingData(a)}}else if(o instanceof vs){gs.clipEnd(i),gs.clipStart(e,i,o);continue}}gs.clipEnd(i)}gs.clipEnd(),this.cleanupPixiMasks()}updateClippingData(t){t.clipped=!0,gs.clipTrianglesUnpacked(t.vertices,0,t.indices,t.indices.length,t.uvs);const{clippedVerticesTyped:e,clippedUVsTyped:s,clippedTrianglesTyped:i}=gs,r=gs.clippedVerticesLength/2,o=gs.clippedTrianglesLength;t.clippedData||(t.clippedData={vertices:new Float32Array(r*2),uvs:new Float32Array(r*2),vertexCount:r,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const a=t.clippedData,h=a.vertexCount!==r||o!==a.indicesCount;t.skipRender=r===0,h&&(this.spineAttachmentsDirty=!0,a.vertexCount<r&&(a.vertices=new Float32Array(r*2),a.uvs=new Float32Array(r*2)),a.indices.length<o&&(a.indices=new Uint16Array(o)));const{vertices:l,uvs:c,indices:u}=a;l.set(e),c.set(s);for(let d=0;d<o;d++){const f=i[d];u[d]!==f&&(this.spineAttachmentsDirty=!0),u[d]=f}a.vertexCount=r,a.indicesCount=o}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:e,container:s}=t,i=e.appliedPose,r=this.skeleton.color.a*i.color.a,o=this.isSlotObjectRenderable(t,r);if(t.wasRenderable!==o&&(this.spineAttachmentsDirty=!0,t.wasRenderable=o),s.visible=o,o){const a=e.bone.appliedPose,h=s.localTransform;h.a=a.a,h.b=a.c,h.c=-a.b,h.d=-a.d,h.tx=a.worldX,h.ty=a.worldY,s.setFromMatrix(h),s.alpha=r,t.followSlotColor&&(s.tint=255*this.skeleton.color.r*i.color.r<<16|255*this.skeleton.color.g*i.color.g<<8|255*this.skeleton.color.b*i.color.b)}else s.mask&&(s.mask=null)}isSlotObjectRenderable(t,e=this.skeleton.color.a*t.slot.appliedPose.color.a){const{slot:s}=t,i=t.followAttachmentTimeline?!!s.appliedPose.attachment:!0;return this.skeleton.drawOrder.appliedPose.includes(s)&&s.bone.active&&i&&this.alpha>0&&e>0}getRenderableCacheId(t,e){return`${t.data.index}-${e.name}`}getExistingCachedData(t,e){return this.attachmentCacheData[t.data.index]?.[e.name]}markSlotAttachmentSkipped(t,e){if(!(e instanceof at||e instanceof xe))return;const s=this.getExistingCachedData(t,e);s&&(s.skipRender||(this.spineAttachmentsDirty=!0),s.skipRender=!0,s.clipped=!1)}_getCachedData(t,e){return this.getExistingCachedData(t,e)||this.initCachedData(t,e)}initCachedData(t,e){let s;if(this.spineAttachmentsDirty=!0,e instanceof at){s=new Float32Array(8);const i=e.sequence;this.attachmentCacheData[t.data.index][e.name]={id:this.getRenderableCacheId(t,e),vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(i.getUVs(0).length),color:new Q(1,1,1,1),darkColor:new Q(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:i.regions[0]?.texture?.texture}}else{s=new Float32Array(e.worldVerticesLength);const i=e.sequence;this.attachmentCacheData[t.data.index][e.name]={id:this.getRenderableCacheId(t,e),vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(i.getUVs(0).length),color:new Q(1,1,1,1),darkColor:new Q(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:i.regions[0]?.texture?.texture}}return this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,e,s){t=this.getSlotFromRef(t);for(const r in this._slotsObject)this._slotsObject[r]?.container===e&&this.removeSlotObject(this._slotsObject[r].slot);this.removeSlotObject(t),e.mask=null,e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t,followAttachmentTimeline:s?.followAttachmentTimeline||!1,followSlotColor:s?.followSlotColor||!1,wasRenderable:!1};this._slotsObject[t.data.name]=i,this.spineAttachmentsDirty=!0,this.updateSlotObject(i)}removeSlotObject(t){let e;if(t instanceof j){for(const s in this._slotsObject)if(this._slotsObject[s]?.container===t){this._slotsObject[s]=null,e=t;break}}else{const s=this.getSlotFromRef(t);e=this._slotsObject[s.data.name]?.container,this._slotsObject[s.data.name]=null}e&&(this.removeChild(e),e.mask=null,e.includeInBuild=!0,this.spineAttachmentsDirty=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,e])=>{e&&(e.container.removeFromParent(),e.container.mask=null,e.container.includeInBuild=!0),delete this._slotsObject[t]}),this.spineAttachmentsDirty=!0}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new pv;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const e=this._boundsProvider.calculateBounds(this),s=this._bounds;s.clear(),s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._val
414idateAndTransformAttachments();const e=this.skeleton.drawOrder.appliedPose,s=this._bounds;s.clear();for(let i=0;i<e.length;i++){const r=e[i];if(!r.bone.active)continue;const o=r.appliedPose.attachment;if(o&&(o instanceof at||o instanceof xe)){const a=this._getCachedData(r,o);s.addVertexData(a.vertices,0,a.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this.attachmentCacheData=null,this._lastAttachments.length=0,this._lastRenderableCacheIds.length=0,this._lastClippingAttachmentIds.length=0}unloadFromCache(){const t=this.skeleton?.data;if(!t)return!1;const e=ws.skeletonDataCacheKeys.get(t);return!e||!Bt.has(e)||Bt.get(e)!==t?!1:(Bt.remove(e),ws.skeletonDataCacheKeys.delete(t),!0)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.appliedPose.worldToLocal(t):e.appliedPose.worldToLocal(t)}static createOptions({skeleton:t,atlas:e,scale:s=1,darkTint:i,autoUpdate:r=!0,boundsProvider:o,allowMissingRegions:a=!1,ticker:h}){const l=ws.getSkeletonCacheKey({skeleton:t,atlas:e,scale:s});if(Bt.has(l)){const p=Bt.get(l);return ws.skeletonDataCacheKeys.set(p,l),{skeletonData:p,darkTint:i,autoUpdate:r,boundsProvider:o,ticker:h}}const c=ae.get(e),u=new TS(c,a),d=ae.get(t),f=d instanceof Uint8Array?new CS(u):new gv(u);f.scale=s;const g=f.readSkeletonData(d);return Bt.set(l,g),ws.skeletonDataCacheKeys.set(g,l),{skeletonData:g,darkTint:i,autoUpdate:r,boundsProvider:o,ticker:h}}static skeletonDataCacheKeys=new WeakMap;static getSkeletonCacheKey({skeleton:t,atlas:e,scale:s=1}){return`${t}-${e}-${s}`}static from(t){return new ws(ws.createOptions(t))}}function Fv(n){return{href:n.href,protocol:n.protocol,username:n.username,password:n.password,host:n.host,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,searchParams:[...n.searchParams].map(([t,e])=>({key:t,value:e})),hash:n.hash,origin:n.origin}}const Wl={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function zl(n,t,e,s=!1){const i=String(t),r=(h,l)=>`\x1B[${l[0]}m${h}\x1B[${l[1]}m`,o=(h,l)=>l!=null&&typeof l=="string"?r(h,Wl[l]):l!=null&&Array.isArray(l)?l.reduce((c,u)=>o(c,u),h):l!=null&&l[h.trim()]!=null?o(h,l[h.trim()]):l!=null&&l["*"]!=null?o(h,l["*"]):h,a=null;return i.replace(/{{(.+?)}}/g,(h,l)=>{const c=e[l]!=null?String(e[l]):s?"":h;return n.stylePrettyLogs?o(c,n?.prettyLogStyles?.[l]??a)+r("",Wl.reset):c})}function qe(n,t=2,e=0){return n!=null&&isNaN(n)?"":(n=n!=null?n+e:n,t===2?n==null?"--":n<10?"0"+n:n.toString():n==null?"---":n<10?"00"+n:n<100?"0"+n:n.toString())}function Vm(n,t){if(t==null)return{text:"",template:n.prettyLogTemplate,placeholders:{}};let e=n.prettyLogTemplate;const s={};e.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?e=e.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):n.prettyLogTimeZone==="UTC"?(s.yyyy=t.date?.getUTCFullYear()??"----",s.mm=qe(t.date?.getUTCMonth(),2,1),s.dd=qe(t.date?.getUTCDate(),2),s.hh=qe(t.date?.getUTCHours(),2),s.MM=qe(t.date?.getUTCMinutes(),2),s.ss=qe(t.date?.getUTCSeconds(),2),s.ms=qe(t.date?.getUTCMilliseconds(),3)):(s.yyyy=t.date?.getFullYear()??"
414----",s.mm=qe(t.date?.getMonth(),2,1),s.dd=qe(t.date?.getDate(),2),s.hh=qe(t.date?.getHours(),2),s.MM=qe(t.date?.getMinutes(),2),s.ss=qe(t.date?.getSeconds(),2),s.ms=qe(t.date?.getMilliseconds(),3));const i=n.prettyLogTimeZone==="UTC"?t.date:t.date!=null?new Date(t.date.getTime()-t.date.getTimezoneOffset()*6e4):void 0;s.rawIsoStr=i?.toISOString()??"",s.dateIsoStr=i?.toISOString().replace("T"," ").replace("Z","")??"",s.logLevelName=t.logLevelName,s.fileNameWithLine=t.path?.fileNameWithLine??"",s.filePathWithLine=t.path?.filePathWithLine??"",s.fullFilePath=t.path?.fullFilePath??"";let r=n.parentNames?.join(n.prettyErrorParentNamesSeparator);r=r!=null&&t.name!=null?r+n.prettyErrorParentNamesSeparator:void 0;const o=t.name!=null||r!=null?`${r??""}${t.name??""}`:"";return s.name=o,s.nameWithDelimiterPrefix=o.length>0?n.prettyErrorLoggerNameDelimiter+o:"",s.nameWithDelimiterSuffix=o.length>0?o+n.prettyErrorLoggerNameDelimiter:"",n.overwrite?.addPlaceholders!=null&&n.overwrite.addPlaceholders(t,s),{text:zl(n,e,s),template:e,placeholders:s}}const Um=[/(?:^|[\\/])node_modules[\\/].*tslog/i,/(?:^|[\\/])deps[\\/].*tslog/i,/tslog[\\/]+src[\\/]+internal[\\/]/i,/tslog[\\/]+src[\\/]BaseLogger/i,/tslog[\\/]+src[\\/]index/i];function Bv(n){const t=typeof n?.stack=="string"?n.stack:void 0;return t==null||t.length===0?[]:t.split(`
415`).map(e=>e.trimEnd())}function Rv(n){return n.filter(t=>t.length>0&&!/^\s*Error\b/.test(t))}function Lv(n,t){const e=[];for(const s of n){const i=t(s);i!=null&&e.push(i)}return e}function Ov(n,t=Um){for(let e=0;e<n.length;e+=1){const s=n[e],i=s.filePath??"",r=s.fullFilePath??"";if(!t.some(o=>o.test(i)||o.test(r)))return e}return 0}function Dv(n){return Rv(Bv(n))}function Nh(n,t){return Lv(Dv(n),t)}function Kd(n,t){return n<0?0:n>=t?Math.max(0,t-1):n}function Zd(){return[...Um]}const Nv=5;function Wv(n,t={}){const e=t.maxDepth??Nv,s=[],i=new Set;let r=n,o=0;for(;r!=null&&o<e;){const a=r?.cause;if(a==null||i.has(a))break;i.add(a),s.push(Gm(a)),r=a,o+=1}return s}function Gm(n){if(n instanceof Error)return n;const t=new Error(typeof n=="string"?n:JSON.stringify(n));return typeof n=="object"&&n!=null&&Object.assign(t,n),t}function Xm(n){const t=new Set;return JSON.stringify(n,(e,s)=>{if(typeof s=="object"&&s!==null){if(t.has(s))return"[Circular]";t.add(s)}return typeof s=="bigint"?`${s}`:typeof s>"u"?"[undefined]":s})}function Qe(n,t){const e={seen:[],stylize:$m};return t!=null&&Km(e,t),wn(e.showHidden)&&(e.showHidden=!1),wn(e.depth)&&(e.depth=2),wn(e.colors)&&(e.colors=!0),wn(e.customInspect)&&(e.customInspect=!0),e.colors&&(e.stylize=Yv),xa(e,n,e.depth)}Qe.colors=Wl;Qe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function zv(n){return typeof n=="boolean"}function wn(n){return n===void 0}function $m(n){return n}function Yv(n,t){const e=Qe.styles[t];return e!=null&&Qe?.colors?.[e]?.[0]!=null&&Qe?.colors?.[e]?.[1]!=null?"\x1B["+Qe.colors[e][0]+"m"+n+"\x1B["+Qe.colors[e][1]+"m":n}function ko(n){return typeof n=="function"}function Hm(n){return typeof n=="string"}function Vv(n){return typeof n=="number"}function jm(n){return n===null}function qm(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function Wh(n){return th(n)&&$c(n)==="[object RegExp]"}function th(n){return typeof n=="object"&&n!==null}function zh(n){return th(n)&&($c(n)==="[object Error]"||n instanceof Error)}function Qd(n){return th(n)&&$c(n)==="[object Date]"}function $c(n){return Object.prototype.toString.call(n)}function Uv(n){const t={};return n.forEach(e=>{t[e]=!0}),t}function Gv(n,t,e,s,i){const r=[];for(let o=0,a=t.length;o<a;++o)qm(t,String(o))?r.push(Yl(n,t,e,s,String(o),!0)):r.push("");return i.forEach(o=>{o.match(/^\d+$/)||r.push(Yl(n,t,e,s,o,!0))}),r}function Yh(n){return"["+Error.prototype.toString.call(n)+"]"}function xa(n,t,e=0){if(n.customInspect&&t!=null&&ko(t)&&t?.inspect!==Qe&&!(t?.constructor&&t?.constructor.prototype===t)){if(typeof t.inspect!="function"&&t.toString!=null)return t.toString();let c=t?.inspect(e,n);return Hm(c)||(c=xa(n,c,e)),c}const s=ti(n,t);if(s)return s;let i=Object.keys(t);const r=Uv(i);try{n.showHidden&&Object.getOwnPropertyNames&&(i=Object.getOwnPropertyNames(t))}catch{}if(zh(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return Yh(t);if(i.length===0)if(ko(n.stylize)){if(ko(t)){const c=t.name?": "+t.name:"";return n.stylize("[Function"+c+"]","special")}if(Wh(t))return n.stylize(RegExp.prototype.toString.call(t),"regexp");if(Qd(t))return n.stylize(Date.prototype.toISOString.call(t),"date");if(zh(t))return Yh(t)}else return t;let o="",a=!1,h=[`{
416`,`
417}`];if(Array.isArray(t)&&(a=!0,h=[`[
418`,`
419]`]),ko(t)&&(o=" [Function"+(t.name?": "+t.name:"")+"]"),Wh(t)&&(o=" "+RegExp.prototype.toString.call(t)),Qd(t)&&(o=" "+Date.prototype.toUTCString.call(t)),zh(t)&&(o=" "+Yh(t)),i.length===0&&(!a||t.length==0))return h[0]+o+h[1];if(e<0)return Wh(t)?n.stylize(RegExp.prototype.toString.call(t),"regexp"):n.stylize("[Object]","special");n.seen.push(t);let l;return a?l=Gv(n,t,e,r,i):l=i.map(c=>Yl(n,t,e,r,c,a)),n.seen.pop(),Xv(l,o,h)}function Yl(n,t,e,s,i,r){let o,a,h={value:void 0};try{h.value=t[i]}catch{}try{Object.getOwnPropertyDescriptor&&(h=Object.getOwnPropertyDescriptor(t,i)||h)}catch{}if(h.get?h.set?a=n.stylize("[Getter/Setter]","special"):a=n.stylize("[Getter]","special"):h.set&&(a=n.stylize("[
419Setter]","special")),qm(s,i)||(o="["+i+"]"),a||(n.seen.indexOf(h.value)<0?(jm(e)?a=xa(n,h.value,void 0):a=xa(n,h.value,e-1),a.indexOf(`
420`)>-1&&(r?a=a.split(`
421`).map(l=>"  "+l).join(`
422`).substr(2):a=`
423`+a.split(`
424`).map(l=>"   "+l).join(`
425`))):a=n.stylize("[Circular]","special")),wn(o)){if(r&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=n.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),o=n.stylize(o,"string"))}return o+": "+a}function ti(n,t){if(wn(t))return n.stylize("undefined","undefined");if(Hm(t)){const e="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return n.stylize(e,"string")}if(Vv(t))return n.stylize(""+t,"number");if(zv(t))return n.stylize(""+t,"boolean");if(jm(t))return n.stylize("null","null")}function Xv(n,t,e){return e[0]+(t===""?"":t+`
426`)+"  "+n.join(`,
427  `)+" "+e[1]}function Km(n,t){const e={...n};if(!t||!th(t))return n;const s={...t},i=Object.keys(t);let r=i.length;for(;r--;)e[i[r]]=s[i[r]];return e}function $v(n,...t){const e={seen:[],stylize:$m};n!=null&&Km(e,n);const s=t[0];let i=0,r="",o="";if(typeof s=="string"){if(t.length===1)return s;let a,h=0;for(let l=0;l<s.length-1;l++)if(s.charCodeAt(l)===37){const c=s.charCodeAt(++l);if(i+1!==t.length){switch(c){case 115:{const u=t[++i];typeof u=="number"||typeof u=="bigint"?a=ti(e,u):typeof u!="object"||u===null?a=String(u):a=Qe(u,{...n,compact:3,colors:!1,depth:0});break}case 106:a=Xm(t[++i]);break;case 100:{const u=t[++i];typeof u=="bigint"?a=ti(e,u):typeof u=="symbol"?a="NaN":a=ti(e,u);break}case 79:a=Qe(t[++i],n);break;case 111:a=Qe(t[++i],{...n,showHidden:!0,showProxy:!0,depth:4});break;case 105:{const u=t[++i];typeof u=="bigint"?a=ti(e,u):typeof u=="symbol"?a="NaN":a=ti(e,parseInt(a));break}case 102:{const u=t[++i];typeof u=="symbol"?a="NaN":a=ti(e,parseInt(u));break}case 99:i+=1,a="";break;case 37:r+=s.slice(h,l),h=l+1;continue;default:continue}h!==l-1&&(r+=s.slice(h,l-1)),r+=a,h=l+1}else c===37&&(r+=s.slice(h,l),h=l+1)}h!==0&&(i++,o=" ",h<s.length&&(r+=s.slice(h)))}for(;i<t.length;){const a=t[i];r+=o,r+=typeof a!="string"?Qe(a,n):a,o=" ",i++}return r}function Hv(){try{const n=globalThis?.process;if(typeof n?.cwd=="function")return n.cwd()}catch{}try{const n=globalThis?.Deno;if(typeof n?.cwd=="function")return n.cwd()}catch{}}function Zm(){return typeof window<"u"&&typeof document<"u"}function jv(){if(!Zm())return!1;const t=globalThis?.navigator?.userAgent??"";return/firefox/i.test(t)||globalThis?.CSS?.supports?.("color","#000")?!0:/safari/i.test(t)&&!/chrome/i.test(t)}function qv(){const n=T(),t=b(n),e=n.name==="browser"||n.name==="worker",s=e?[...Zd(),/node_modules[\\/].*tslog/i]:[...Zd(),/node:(?:internal|vm)/i,/\binternal[\\/]/i];let i;const r={getMeta(C,k,E,F,B,N){return Object.assign({},t,{name:B,parentNames:N,date:new Date,logLevelId:C,logLevelName:k,path:F?void 0:r.getCallerStackFrame(E)})},getCallerStackFrame(C,k=new Error){const E=Nh(k,O=>o(O));if(E.length===0)return{};const F=Ov(E,s),B=Number.isFinite(C)&&C>=0,N=Kd(B?C:F,E.length);return E[N]??{}},getErrorTrace(C){return Nh(C,k=>o(k))},isError(C){return I(C)},isBuffer(C){return typeof Buffer<"u"&&typeof Buffer.isBuffer=="function"?Buffer.isBuffer(C):!1},prettyFormatLogObj(C,k){return C.reduce((E,F)=>(r.isError(F)?E.errors.push(r.prettyFormatErrorObj(F,k)):E.args.push(F),E),{args:[],errors:[]})},prettyFormatErrorObj(C,k){const E=l(r.getErrorTrace(C),k),F=Wv(C).map((N,O)=>{const R=`Caused by (${O+1}): ${N.name??"Error"}${N.message?`: ${N.message}`:""}`,D=l(Nh(N,z=>o(z)),k);return[R,...D].join(`
428`)}),B={errorName:` ${C.name} `,errorMessage:c(C),errorStack:[...E,...F].join(`
429`)};return zl(k,k.prettyErrorTemplate,B)},transportFormatted(C,k,E,F,B){const N=B.stylePrettyLogs!==!1,O=(E.length>0&&k.length>0?`
430`:"")+E.join(`
431`),R=d(C),D=N?C:R;if(u(N)){B.prettyInspectOptions.colors=!1;const Y=w(B.prettyInspectOptions,k),W=F!=null?f(B,F):{text:R,styles:[]},V=W.text.length>0&&W.styles.length>0,K=(V?W.text:R)+Y+O;V?console.log(K,...W.styles):console.log(K);return}B.prettyInspectOptions.colors=N;
431const z=w(B.prettyInspectOptions,k);console.log(D+z+O)},transportJSON(C){console.log(Xm(C))}};return M()==="test"&&(r.__resetWorkingDirectoryCacheForTests=()=>{i=void 0}),r;function o(C){return e?h(C):a(C)}function a(C){if(typeof C!="string"||C.length===0)return;const k=C.trim();if(!k.includes(" at ")&&!k.startsWith("at "))return;const E=k.replace(/^at\s+/,"");let F,B=E;const N=E.match(/^(.*?)\s+\((.*)\)$/);N&&(F=N[1],B=N[2]);const O=B.replace(/^\(/,"").replace(/\)$/,""),R=O.replace(/\?.*$/,"");let D,z,Y=R;const W=R.split(":");W.length>=3&&/^\d+$/.test(W[W.length-1]??"")?(z=W.pop(),D=W.pop(),Y=W.join(":")):W.length>=2&&/^\d+$/.test(W[W.length-1]??"")&&(D=W.pop(),Y=W.join(":"));let V=Y.replace(/^file:\/\//,"");const H=y();H!=null&&V.startsWith(H)&&(V=V.slice(H.length),V=V.replace(/^[\\/]/,"")),V.length===0&&(V=Y);const K=v(V),tt=K.length>0?K:V,xt=tt.split(/\\|\//),et=xt[xt.length-1],St=et&&D?`${et}:${D}`:void 0,bt=tt&&D?`${tt}:${D}`:void 0;return{fullFilePath:O,fileName:et,fileNameWithLine:St,fileColumn:z,fileLine:D,filePath:tt,filePathWithLine:bt,method:F}}function h(C){const k=globalThis.location?.origin;if(C==null)return;const E=C.match(Jv);if(!E)return;const F=E[1]?.replace(/\?.*$/,"");if(F==null)return;const B=F.split("/"),N=E[2],O=E[3],R=B[B.length-1];return{fullFilePath:k?`${k}${F}`:F,fileName:R,fileNameWithLine:R&&N?`${R}:${N}`:void 0,fileColumn:O,fileLine:N,filePath:F,filePathWithLine:N?`${F}:${N}`:void 0,method:void 0}}function l(C,k){return C.map(E=>zl(k,k.prettyErrorStackTemplate,{...E},!0))}function c(C){return Object.getOwnPropertyNames(C).filter(k=>k!=="stack"&&k!=="cause").reduce((k,E)=>{const F=C[E];return typeof F=="function"||k.push(String(F)),k},[]).join(", ")}function u(C){return C&&(n.name==="browser"||n.name==="worker")&&jv()}function d(C){return C.replace(Kv,"")}function f(C,k){if(k==null)return{text:"",styles:[]};const{template:E,placeholders:F}=Vm(C,k),B=[],N=[];let O=0;const R=/{{(.+?)}}/g;let D;for(;(D=R.exec(E))!=null;){D.index>O&&B.push(E.slice(O,D.index));const z=D[1],Y=F[z]!=null?String(F[z]):"",W=g(C.prettyLogStyles?.[z],Y),V=p(W);V.length>0?(B.push(`%c${Y}%c`),N.push(V,"")):B.push(Y),O=R.lastIndex}return O<E.length&&B.push(E.slice(O)),{text:B.join(""),styles:N}}function g(C,k){if(C==null)return[];if(typeof C=="string")return[C];if(Array.isArray(C))return C.flatMap(E=>g(E,k));if(typeof C=="object"){const E=k.trim(),F=C[E]??C["*"];return F==null?[]:g(F,k)}return[]}function p(C){const k=new Set,E=[];for(const F of C){const B=m(F);B!=null&&B.length>0&&!k.has(B)&&(k.add(B),E.push(B))}return E.join("; ")}function m(C){const k=Zv[C];if(k!=null)return`color: ${k}`;const E=Qv[C];if(E!=null)return`background-color: ${E}`;switch(C){case"bold":return"font-weight: bold";case"dim":return"opacity: 0.75";case"italic":return"font-style: italic";case"underline":return"text-decoration: underline";case"overline":return"text-decoration: overline";case"inverse":return"filter: invert(1)";case"hidden":return"visibility: hidden";case"strikethrough":return"text-decoration: line-through";default:return}}function y(){return i===void 0&&(i=Hv()??null),i??void 0}function x(){return n.name==="node"||n.name==="deno"||n.name==="bun"}function _(){return n.name==="node"||n.name==="deno"||n.name==="bun"}function b(C){if(C.name==="browser"||C.name==="worker")return{runtime:C.name,browser:C.userAgent};const k={runtime:C.name};return _()&&(k.runtimeVersion=C.version??"unknown"),x()&&(k.hostname=C.hostname??"unknown"),k}function w(C,k){try{return $v(C,...k)}catch{return k.map(S).join(" ")}}function S(C){if(typeof C=="string")return C;try{return JSON.stringify(C)}catch{return String(C)}}function v(C){if(typeof C!="string"||C.length===0)return C;const k=C.replace(/\\+/g,"\\").replace(/\\/g,"/"),E=k.startsWith("//"),F=k.startsWith("/")&&!E,B=k.match(/^[A-Za-z]:/),N=B?B[0]:"",R=(N?k.slice(N.length):k).split("/"),D=[];for(const Y of R)if(!(Y===""||Y===".")){if(Y===".."){D.length>0&&D.pop();continue}D.push(Y)}let z=D.join("/");return E?z=`//${z}`:F?z=`/${z}`:N!==""&&(z=`${N}${z.length>0?`/${z}`:""}`),z.length===0?C:z}function T(){if(Zm())return{name:"browser",userAgent:globalThis.navigator?.userAgent};const C=globalThis;if(typeof C.importScripts=="function")return{name:"worker",userAgent:C.navigator?.userAgent};const k=globalThis;if(k.Bun!=null){const E=k.Bun.version;return{name:"bun",version:E!=null?`bun/${E}`:void 0,hostname:A(k.process,k.Deno,k.Bun,k.location)}}if(k.Deno!=null){const E=P(k.Deno),F=k.Deno?.version?.deno;return{name:"deno",version:F!=null?`deno/${F}`:void 0,hostname:E??A(k.process,k.Deno,k.Bun,k.location)}}
431return k.process?.versions?.node!=null||k.process?.version!=null?{name:"node",version:k.process?.versions?.node??k.process?.version,hostname:A(k.process,k.Deno,k.Bun,k.location)}:k.process!=null?{name:"node",version:"unknown",hostname:A(k.process,k.Deno,k.Bun,k.location)}:{name:"unknown"}}function A(C,k,E,F){const B=C?.env?.HOSTNAME??C?.env?.HOST??C?.env?.COMPUTERNAME;if(B!=null&&B.length>0)return B;const N=E?.env?.HOSTNAME??E?.env?.HOST??E?.env?.COMPUTERNAME;if(N!=null&&N.length>0)return N;try{const O=k?.env?.get;if(typeof O=="function"){const R=O("HOSTNAME");if(R!=null&&R.length>0)return R}}catch{}if(F?.hostname!=null&&F.hostname.length>0)return F.hostname}function P(C){try{if(typeof C?.hostname=="function"){const E=C.hostname();if(E!=null&&E.length>0)return E}}catch{}const k=globalThis.location?.hostname;if(k!=null&&k.length>0)return k}function M(){return globalThis?.process?.env?.NODE_ENV}function I(C){if(C instanceof Error)return!0;if(C!=null&&typeof C=="object"){const k=Object.prototype.toString.call(C);if(/\[object .*Error\]/.test(k))return!0;const E=C.name;if(typeof E=="string"&&E.endsWith("Error"))return!0}return!1}}const Kv=/\u001b\[[0-9;]*m/g,Zv={black:"#000000",red:"#ef5350",green:"#66bb6a",yellow:"#fdd835",blue:"#42a5f5",magenta:"#ab47bc",cyan:"#26c6da",white:"#fafafa",blackBright:"#424242",redBright:"#ff7043",greenBright:"#81c784",yellowBright:"#ffe082",blueBright:"#64b5f6",magentaBright:"#ce93d8",cyanBright:"#4dd0e1",whiteBright:"#ffffff"},Qv={bgBlack:"#000000",bgRed:"#ef5350",bgGreen:"#66bb6a",bgYellow:"#fdd835",bgBlue:"#42a5f5",bgMagenta:"#ab47bc",bgCyan:"#26c6da",bgWhite:"#fafafa",bgBlackBright:"#424242",bgRedBright:"#ff7043",bgGreenBright:"#81c784",bgYellowBright:"#ffe082",bgBlueBright:"#64b5f6",bgMagentaBright:"#ce93d8",bgCyanBright:"#4dd0e1",bgWhiteBright:"#ffffff"},Jv=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/,as=qv();class tT{constructor(t,e,s=Number.NaN){this.logObj=e,this.stackDepthLevel=s,this.runtime=as,this.maxErrorCauseDepth=5,this.settings={type:t?.type??"pretty",name:t?.name,parentNames:t?.parentNames,minLevel:t?.minLevel??0,argumentsArrayName:t?.argumentsArrayName,hideLogPositionForProduction:t?.hideLogPositionForProduction??!1,prettyLogTemplate:t?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}	{{logLevelName}}	{{filePathWithLine}}{{nameWithDelimiterPrefix}}	",prettyErrorTemplate:t?.prettyErrorTemplate??`
432{{errorName}} {{errorMessage}}
433error stack:
434{{errorStack}}`,prettyErrorStackTemplate:t?.prettyErrorStackTemplate??`  • {{fileName}}	{{method}}
435	{{filePathWithLine}}`,prettyErrorParentNamesSeparator:t?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:t?.prettyErrorLoggerNameDelimiter??"	",stylePrettyLogs:t?.stylePrettyLogs??!0,prettyLogTimeZone:t?.prettyLogTimeZone??"UTC",prettyLogStyles:t?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:t?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:t?.metaProperty??"_meta",maskPlaceholder:t?.maskPlaceholder??"[***]",maskValuesOfKeys:t?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:t?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:t?.maskValuesRegEx,prefix:[...t?.prefix??[]],attachedTransports:[...t?.attachedTransports??[]],over
435write:{mask:t?.overwrite?.mask,toLogObj:t?.overwrite?.toLogObj,addMeta:t?.overwrite?.addMeta,addPlaceholders:t?.overwrite?.addPlaceholders,formatMeta:t?.overwrite?.formatMeta,formatLogObj:t?.overwrite?.formatLogObj,transportFormatted:t?.overwrite?.transportFormatted,transportJSON:t?.overwrite?.transportJSON}},this.captureStackForMeta=this._shouldCaptureStack()}log(t,e,...s){if(t<this.settings.minLevel)return;const i=this._resolveLogArguments(s),r=[...this.settings.prefix,...i],o=this.settings.overwrite?.mask!=null?this.settings.overwrite?.mask(r):this.settings.maskValuesOfKeys!=null&&this.settings.maskValuesOfKeys.length>0?this._mask(r):r,a=this.logObj!=null?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,h=this.settings.overwrite?.toLogObj!=null?this.settings.overwrite?.toLogObj(o,a):this._toLogObj(o,a),l=this.settings.overwrite?.addMeta!=null?this.settings.overwrite?.addMeta(h,t,e):this._addMetaToLogObj(h,t,e),c=l?.[this.settings.metaProperty];let u,d;if(this.settings.overwrite?.formatMeta!=null&&(u=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),this.settings.overwrite?.formatLogObj!=null&&(d=this.settings.overwrite?.formatLogObj(o,this.settings)),this.settings.type==="pretty"&&(u=u??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),d=d??as.prettyFormatLogObj(o,this.settings)),u!=null&&d!=null)if(this.settings.overwrite?.transportFormatted!=null){const f=this.settings.overwrite.transportFormatted,g=f.length;g<4?f(u,d.args,d.errors):g===4?f(u,d.args,d.errors,c):f(u,d.args,d.errors,c,this.settings)}else as.transportFormatted(u,d.args,d.errors,c,this.settings);else this.settings.overwrite?.transportJSON!=null?this.settings.overwrite.transportJSON(l):this.settings.type!=="hidden"&&as.transportJSON(l);return this.settings.attachedTransports!=null&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(f=>{f(l)}),l}attachTransport(t){this.settings.attachedTransports.push(t)}getSubLogger(t,e){const s={...this.settings,...t,parentNames:this.settings?.parentNames!=null&&this.settings?.name!=null?[...this.settings.parentNames,this.settings.name]:this.settings?.name!=null?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...t?.prefix??[]]};return new this.constructor(s,e??this.logObj,this.stackDepthLevel)}_mask(t){const e=this._getMaskKeys();return t?.map(s=>this._recursiveCloneAndMaskValuesOfKeys(s,e))}_getMaskKeys(){const t=this.settings.maskValuesOfKeys??[],e=t.map(String).join("|");if(this.settings.maskValuesOfKeysCaseInsensitive===!0){if(this.maskKeysCache?.source===t&&this.maskKeysCache.caseInsensitive===!0&&this.maskKeysCache.signature===e)return this.maskKeysCache.normalized;const s=t.map(i=>typeof i=="string"?i.toLowerCase():String(i).toLowerCase());return this.maskKeysCache={source:t,caseInsensitive:!0,normalized:s,signature:e},s}return this.maskKeysCache={source:t,caseInsensitive:!1,normalized:t,signature:e},t}_resolveLogArguments(t){if(t.length===1&&typeof t[0]=="function"){const e=t[0];if(e.length===0){const s=e();return Array.isArray(s)?s:[s]}}return t}_recursiveCloneAndMaskValuesOfKeys(t,e,s=[]){if(s.includes(t))return{...t};if(typeof t=="object"&&t!==null&&s.push(t),as.isError(t)||as.isBuffer(t))return t;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(Array.isArray(t))return t.map(i=>this._recursiveCloneAndMaskValuesOfKeys(i,e,s));if(t instanceof Date)return new Date(t.getTime());if(t instanceof URL)return Fv(t);if(t!==null&&typeof t=="object"){const i=as.isError(t)?this._cloneError(t):Object.create(Object.getPrototypeOf(t));return Object.getOwnPropertyNames(t).reduce((r,o)=>{const a=this.settings?.maskValuesOfKeysCaseInsensitive!==!0?o:typeof o=="string"?o.toLowerCase():String(o).toLowerCase();return r[o]=e.includes(a)?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(t[o],e,s)}catch{return null}})(),r},i)}else{if(typeof t=="string"){let i=t;for(const r of this.settings?.maskValuesRegEx||[])i=i.replace(r,this.settings?.maskPlaceholder||"");return i}return t}}_recursiveCloneAndExecuteFunctions(t,e=[]){return this.isObjectOrArray(t)&&e.includes(t)?this.shallowCopy(t):(this.isObjectOrArray(t)&&e.push(t),Array.isArray(t)?t.map(s=>this._recursiveCloneAndExecuteFunctions(s,e)):t instanceof Date?new Date(t.getTime()):this.isObject(t)?Object.getOwnPropertyNames(t).reduce((s,i)=>{const r=Object.getOwnPropertyDescriptor(t,i);if(r){Object.defineProperty(s,i,r);const o=t[i];s[i]=typeof o=="function"?o():this._recursiveCloneAndExecuteFunctions(o,e)}return s},Object.create(Object.getPrototypeOf(t))):t)}isObjectOrArray(t){return typeof t=="object"&&t!==null}isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}shallowCopy(t){return Array.isArray(t)?[...t]:{...t}}_toLogObj(t,e={}){return t=t?.map(s=>as.isError(s)?this._toErrorObject(s):s),this.settings.argumentsArrayName==null?t.length===1&&!Array.isArray(t[0])&&as.isBuffer(t[0])!==!0&&!(t[0]instanceof Date)?e=typeof t[0]=="object"&&t[0]!=null?{...t[0],...e}:{0:t[0],...e}:e={...e,...t}:e={...e,[this.settings.argumentsArrayName]:t},e}_cloneError(t){const e=new t.constructor;return Object.getOwnPropertyNames(t).forEach(s=>{e[s]=t[s]}),e}_toErrorObject(t,e=0,s=new Set){s.has(t)||s.add(t);const i={nativeError:t,name:t.name??"Error",message:t.message,stack:as.getErrorTrace(t)};if(e>=this.maxErrorCauseDepth)return i;const r=t.cause;if(r!=null){const o=Gm(r);
435s.has(o)||(i.cause=this._toErrorObject(o,e+1,s))}return i}_addMetaToLogObj(t,e,s){return{...t,[this.settings.metaProperty]:as.getMeta(e,s,this.stackDepthLevel,!this.captureStackForMeta,this.settings.name,this.settings.parentNames)}}_shouldCaptureStack(){if(this.settings.hideLogPositionForProduction)return!1;if(this.settings.type==="json")return!0;const t=this.settings.prettyLogTemplate??"";return!!/{{\s*(file(Name|Path|Line|PathWithLine|NameWithLine)|fullFilePath)\s*}}/.test(t)}_prettyFormatLogObjMeta(t){return Vm(this.settings,t).text}}class eT extends tT{constructor(t,e){const s=typeof window<"u"&&typeof document<"u",i={...t??{}};s&&(i.stylePrettyLogs=t?.stylePrettyLogs??!0),super(i,e,Number.NaN)}log(t,e,...s){return super.log(t,e,...s)}silly(...t){return super.log(0,"SILLY",...t)}trace(...t){return super.log(1,"TRACE",...t)}debug(...t){return super.log(2,"DEBUG",...t)}info(...t){return super.log(3,"INFO",...t)}warn(...t){return super.log(4,"WARN",...t)}error(...t){return super.log(5,"ERROR",...t)}fatal(...t){return super.log(6,"FATAL",...t)}getSubLogger(t,e){return super.getSubLogger(t,e)}}const Z=new eT({name:"game",type:"pretty",minLevel:3,prettyLogStyles:{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]}}});function sT(n){Z.settings.name=n}const Qm="7.5.0";function Jm(n){return n.gitDescribe&&n.gitDescribe!=="unknown"?n.gitDescribe:n.gameVersion}function iT(n){const t=Jm(n),e=Z.settings.minLevel;Z.settings.minLevel=Math.min(e,3),Z.info(`Startup: ${n.gameName}@${t} sha=${n.gitSha} built=${n.buildTime} sdk=${Qm}`),Z.settings.minLevel=e}const za=class za{static createSpineAnimation(t){const e=this.spineAliases[t];if(!e)return Z.error(`[SpineManager] Spine asset references not found for: ${t}`),null;try{const s=ws.from({skeleton:e.skeleton,atlas:e.atlas});return this.spineAnimations[t]=s,s}catch(s){return Z.error(`[SpineManager] Failed to create spine animation ${t}:`,s),null}}static getSpineAnimation(t){return this.spineAnimations[t]||null}static playAnimation(t,e,s=!0,i=0){if(!t||!t.state){Z.error("Invalid spine object or state");return}try{t.state.setAnimation(i,e,s)}catch(r){Z.error(`Failed to play animation ${e}:`,r)}}static stopAnimation(t,e=0){if(!t||!t.state){Z.error("Invalid spine object or state");return}t.state.clearTrack(e)}static getAvailableAnimations(t){return!t||!t.skeleton||!t.skeleton.data?(Z.error("[SpineManager] Invalid spine object for getting animations"),[]):t.skeleton.data.animations.map(s=>s.name)}};za.spineAliases={background:{skeleton:"anim_background.json",atlas:"anim_background.atlas"}},za.spineAnimations={};let ii=za;const kn=class kn extends j{constructor(){super(),this.Main=Rt.getInstance(),this.spineAnimation=null,this.BottomLayer=Wn.getInstance(),this.dim=this.Main.getDim(),this.setupBackgroundWithRetry()}async setupBackgroundWithRetry(t=10,e=500){for(let s=1;s<=t;s++){if(await this.setupBackground())return;s<t?await new Promise(r=>setTimeout(r,e)):Z.error("[SpineBackground] Failed to setup background after all retries")}}async setupBackground(){try{return this.spineAnimation=ii.createSpineAnimation(kn.SPINE_NAME),this.spineAnimation?(this.setupSpinePosition(),ii.getAvailableAnimations(this.spineAnimation).length>0?ii.playAnimation(this.spineAnimation,"animation",!0):Z.warn("[SpineBackground] No animations found in spine data"),this.addChild(this.spineAnimation),this.addToContainer(),!0):(Z.error("[SpineBackground] Failed to create spine background animation - data not ready yet"),!1)}catch(t){return Z.error("[SpineBackground] Error setting up spine background:",t),!1}}setupSpinePosition(){if(!this.spineAnimation)return;const t=this.Main.layout.getSolution(),e=t.scale||1,s=this.Main.screen,i=-t.offset.x/e,r=-t.offset.y/e,o=s.width/e,a=s.height/e,h=kn.ART,l=Math.max(o/h.w,a/h.h);this.spineAnimation.scale.set(l,l),this.spineAnimation.x=i+o/2-h.cx*l,this.spineAnimation.y=r+a-h.bottom*l}resize(){this.dim=this.Main.getDim(),this.setupSpinePosition()}playAnimation(t,e=!0){this.spineAnimation&&ii.playAnimation(this.spineAnimation,t,e)}stopAnimation(){this.spineAnimation&&ii.stopAnimation(this.spineAnimation)}getAvailableAnimations(){return this.spineAnimation?ii.getAvailableAnimations(this.spineAnimation):[]}addToContainer(){this.BottomLayer&&this.BottomLayer.addChild(this)}destroy(){this.spineAnimation&&(this.spineAnimation.destroy(),this.spineAnimation=null),super.destroy()}};kn.SPINE_NAME="background",kn.ART={cx:-8,bottom:0,w:1282,h:1280};let Vl=kn;class _t{static getLogo(){try{return new $(ae.get("logo_game"))}catch{return Z.warn("Logo texture not found"),new $($.EMPTY)}}static resolveAlias(t){return t.startsWith("./")?`firework-frenzy/main/${t.slice(2)}`:t}static getTexture(t){try{const e=ae.get(_t.resolveAlias(t));return e?new $(e):(Z.info("texture is not found",t),new $($.EMPTY))}catch{return Z.info("texture is not found",t),new $($.EMPTY)}}}const t0={width:1e3,height:590},e0={width:630,height:1162},_a={x:135,y:128},Rn={frame:{width:605,height:570},inside:{width:561,height:510}};function Ln(n,t,e){return{x:n,y:t,width:e.width,height:e.height}}function nT(){const{width:n,height:t}=t0,e=n/2,s=t/2;return{box:{frame:Ln(e,s,Rn.frame),inside:Ln(e,s,Rn.inside),mask:Ln(e,s,Rn.inside)},grid:{originX:e-200,originY:s-190,stepX:_a.x,stepY:_a.y},playButton:{x:e+400,y:s+145,width:120,height:120},autoPlayButton:{x:e+400,y:s+250,width:112,height:31},payAmount:{x:e+400,y:s+20,width:180,height:95,fontSize:18},totalWon:{x:e-400,y:s+20,width:180,height:95,fontSize:18},winningElement:{x:e-400,y:s-180,width:160,height:160},logo:{x:e+400,y:165,width:512*.35,height:292*.35},optionsButton:{x:e+466,y:s-285+136*.35/2,width:134*.35,height:136*.35},prizeChartButton:{x:e-400,y:s+250,width:112,height:31},soundButton:{x:n-40,y:40,width:50,height:50}}}function rT(){const{width:n}=e0,t=n/2,e=567;return{box:{frame:Ln(t,e,Rn.frame),inside:Ln(t,e,Rn.inside),mask:Ln(t,e,Rn.inside)},grid:{originX:t-200,originY:e-190,stepX:_a.x,stepY:_a.y},playButton:{x:t+170,y:e+490,width:180,height:180},autoPlayButton:{x:t+170,y:e+345,width:224*.7,height:63*.7},payAmount:{x:t-170,y:e+500,width:180,height:95,fontSize:22},totalWon:{x:t-170,y:e+365,width:180,height:95,fontSize:22},winningElement:{x:t,y:e-422,width:210,height:210},logo:{x:t-220,y:e-422,width:512*.3,height:292*.3},optionsButton:{x:n-40,y:e-422-210/2+136*.4/2,width:134*.4,height:136*.4},prizeChartButton:{x:t+230,y:e-422,width:224*.7,height:63*.7},soundButton:{x:n-40,y:40,width:50,height:50}}}const Jd={landscape:nT(),portrait:rT()};function di(n,t){return n>t?Jd.landscape:Jd.portrait}
435const oT="./images/scene/ui_box_inside_mask.png";class aT extends it{constructor(){super(),this.Main=Rt.getInstance(),this.BoxLayer=gi.getInstance(),this.addBounds(),this.addTexture(),this.addToLayer()}addBounds(){const t=this.Main.getDim(),{mask:e}=di(t.width,t.height).box;this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.anchor.set(.5)}resize(){this.addBounds()}addTexture(){const t=_t.getTexture(oT);this.texture=t}addToLayer(){this.BoxLayer.addChild(this),this.BoxLayer.mask=this}}const hT={left:0,top:0,right:0,bottom:0};function lT(n){const{padding:t=hT,...e}=n,s=new cS(e),{leftWidth:i=0,topHeight:r=0,rightWidth:o=0,bottomHeight:a=0}=e;if(s.width<i+o||s.height<r+a)throw new Error(`Nine-slice frame ${s.width}x${s.height} is smaller than its borders (${i}+${o} x ${r}+${a}); the corners would overlap`);return{view:s,content:{x:s.x+t.left,y:s.y+t.top,width:s.width-t.left-t.right,height:s.height-t.top-t.bottom}}}const Io=16;function ba(n){return n.padding??{left:n.leftWidth+Io,top:n.topHeight+Io,right:n.rightWidth+Io,bottom:n.bottomHeight+Io}}function s0(n){const t=ba(n);return{left:Math.max(n.leftWidth,t.left),top:Math.max(n.topHeight,t.top),right:Math.max(n.rightWidth,t.right),bottom:Math.max(n.bottomHeight,t.bottom)}}function i0(n,t){const e=s0(n);return{width:t.width+e.left+e.right,height:t.height+e.top+e.bottom}}function cT(n,t,e){return lT({texture:n,leftWidth:t.leftWidth,topHeight:t.topHeight,rightWidth:t.rightWidth,bottomHeight:t.bottomHeight,padding:ba(t),...e})}function n0(n){return{x:-n.width/2,y:-n.height/2,width:n.width,height:n.height}}function Hc(n,t){const e=n0(n);return{x:e.x+t.left,y:e.y+t.top,width:n.width-t.left-t.right,height:n.height-t.top-t.bottom}}function uT(n,t,e,s={x:0,y:0}){const i=Hc(n,t);return{x:i.x+i.width-e.width/2+s.x,y:i.y+e.height/2+s.y}}function dT(n,t,e=.94,s=1){return Math.min(s,n.width*e/t.width,n.height*e/t.height)}function tf(n,t,e,s){return n.y-t*e-s}function fT(n,t,{backdrop:e,maxScale:s}={}){const i={x:n.x??0,y:n.y??0,width:n.width,height:n.height};return{backdrop:e??i,center:{x:i.x+i.width/2,y:i.y+i.height/2},scale:dT(i,t,void 0,s)}}function Ds(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function r0(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.__proto__=t}var Xe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},$n={duration:.5,overwrite:!1,delay:0},jc,ge,Ot,es=1e8,Pt=1/es,Ul=Math.PI*2,pT=Ul/4,gT=0,o0=Math.sqrt,mT=Math.cos,yT=Math.sin,de=function(t){return typeof t=="string"},Qt=function(t){return typeof t=="function"},qs=function(t){return typeof t=="number"},qc=function(t){return typeof t>"u"},Is=function(t){return typeof t=="object"},Ie=function(t){return t!==!1},Kc=function(){return typeof window<"u"},Eo=function(t){return Qt(t)||de(t)},a0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},_e=Array.isArray,xT=/random\([^)]+\)/g,_T=/,\s*/g,ef=/(?:-?\.?\d|\.)+/gi,h0=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Sn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Vh=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,l0=/[+-]=-?[.\d]+/,bT=/[^,'"\[\]\s]+/gi,wT=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Gt,Ss,Gl,Zc,$e={},wa={},c0,u0=function(t){return(wa=Hn(t,$e))&&Le},Qc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},Hr=function(t,e){return!e&&console.warn(t)},d0=function(t,e){return t&&($e[t]=e)&&wa&&(wa[t]=e)||$e},jr=function(){return 0},ST={suppressEvents:!0,isStart:!0,kill:!1},Qo={suppressEvents:!0,kill:!1},vT={suppressEvents:!0},Jc={},fi=[],Xl={},f0,Ye={},Uh={},sf=30,Jo=[],tu="",eu=function(t){var e=t[0],s,i;if(Is(e)||Qt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(i=Jo.length;i--&&!Jo[i].targetTest(e););s=Jo[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new D0(t[i],s)))||t.splice(i,1);return t},$i=function(t){return t._gsap||eu(ss(t))[0]._gsap},p0=function(t,e,s){return(s=t[e])&&Qt(s)?t[e]():qc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ee=function(t,e){return(t=t.split(",")).forEach(e)||t},ee=function(t){return Math.round(t*1e5)/1e5||0},Ut=function(t){return Math.round(t*1e7)/1e7||0},On=function(t,e){var s=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+i:s==="-"?t-i:s==="*"?t*i:t/i},TT=function(t,e){for(var s=e.length,i=0;t.indexOf(e[i])<0&&++i<s;);return i<s},Sa=function(){var t=fi.length,e=fi.slice(0),s,i;for(Xl={},fi.length=0,s=0;s<t;s++)i=e[s],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},su=function(t){return!!(t._initted||t._startAt||t.add)},g0=function(t,e,s,i){fi.length&&!ge&&Sa(),t.render(e,s,!!(ge&&e<0&&su(t))),fi.length&&!ge&&Sa()},m0=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(bT).length<2?e:de(t)?t.trim():t},y0=function(t){return t},He=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},AT=function(t){return function(e,s){for(var i in s)i in e||i==="duration"&&t||i==="ease"||(e[i]=s[i])}},Hn=function(t,e){for(var s in e)t[s]=e[s];return t},nf=function n(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Is(e[s])?n(t[s]||(t[s]={}),e[s]):e[s]);return t},va=function(t,e){var s={},i;for(i in t)i in e||(s[i]=t[i]);return s},Fr=function(t){var e=t.parent||Gt,s=t.keyframes?AT(_e(t.keyframes)):He;if(Ie(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},CT=function(t,e){for(var s=t.length,i=s===e.length;i&&s--&&t[s]===e[s];);return s<0},x0=function(t,e,s,i,r){var o=t[i],a;if(r)for(a=e[r];o&&o[r]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[i]=e,e._prev=o,e.parent=e._dp=t,e},eh=function(t,e,s,i){s===void 0&&(s="_first"),i===void 0&&(i="_last");var r=e._prev,o=e._next;r?r._next=o:t[s]===e&&(t[s]=o),o?o._prev=r:t[i]===e&&(t[i]=r),e._next=e._prev=e.parent=null},_i=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Hi=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var s=t;s;)s._dirty=1,s=s.parent;return t},PT=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},$l=function(t,e,s,i){return t._startAt&&(ge?t._startAt.revert(Qo):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},MT=function n(t){return!t||t._ts&&n(t.parent)},rf=function(t){return t._repeat?jn(t._tTime,t=t.duration()+t._rDelay)*t:0},jn=function(t,e){var s=Math.floor(t=Ut(t/e));return t&&s===t?s-1:s},Ta=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},sh=function(t){return t._end=Ut(t._start+(t._tDur/Math.abs(t._ts||t._rts||Pt)||0))},ih=function(t,e){var s=t._dp;return s&&s.smoothChildTiming&&t._ts&&(t._start=Ut(s._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),sh(t),s._dirty||Hi(s,t)),t},_0=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=Ta(t.rawTime(),e),(!e._dur||lo(0,e.totalDuration(),s)-e._tTime>Pt)&&e.render(s,!0)),Hi(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(s=t;s._dp;)s.rawTime()>=0&&s.totalTime(s._tTime),s=s._dp;t._zTime=-Pt}},Ts=function(t,e,s,i){return e.parent&&_i(e),e._start=Ut((qs(s)?s:s||t!==Gt?Ke(t,s,e):t._time)+e._delay),e._end=Ut(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),x0(t,e,"_first","_last",t._sort?"_start":0),Hl(e)||(t._recent=e),i||_0(t,e),t._ts<0&&ih(t,t._tTime),t},b0=function(t,e){return($e.ScrollTrigger||Qc("scrollTrigger",e))&&$e.ScrollTrigger.create(e,t)},w0=function(t,e,s,i,r){if(nu(t,e,r),!t._initted)return 1;if(!s&&t._pt&&!ge&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&f0!==Ve.frame)return fi.push(t),t._lazy=[r,i],1},kT=function n(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||n(e))}
vendor: 4,722 bytes, line 435
435,Hl=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},IT=function(t,e,s,i){var r=t.ratio,o=e<0||!e&&(!t._start&&kT(t)&&!(!t._initted&&Hl(t))||(t._ts<0||t._dp._ts<0)&&!Hl(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=lo(0,t._tDur,e),c=jn(h,a),t._yoyo&&c&1&&(o=1-o),c!==jn(t._tTime,a)&&(r=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==r||ge||i||t._zTime===Pt||!e&&t._zTime){if(!t._initted&&w0(t,e,i,s,h))return;for(u=t._zTime,t._zTime=e||(s?Pt:0),s||(s=e&&!u),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&$l(t,e,s,!0),t._onUpdate&&!s&&Ue(t,"onUpdate"),h&&t._repeat&&!s&&t.parent&&Ue(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&_i(t,1),!s&&!ge&&(Ue(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},ET=function(t,e,s){var i;if(s>e)for(i=t._first;i&&i._start<=s;){if(i.data==="isPause"&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=s;){if(i.data==="isPause"&&i._start<e)return i;i=i._prev}},qn=function(t,e,s,i){var r=t._repeat,o=Ut(e)||0,a=t._tTime/t._tDur;return a&&!i&&(t._time*=o/t._dur),t._dur=o,t._tDur=r?r<0?1e10:Ut(o*(r+1)+t._rDelay*r):o,a>0&&!i&&ih(t,t._tTime=t._tDur*a),t.parent&&sh(t),s||Hi(t.parent,t),t},of=function(t){return t instanceof Ae?Hi(t):qn(t,t._dur)},FT={_start:0,endTime:jr,totalDuration:jr},Ke=function n(t,e,s){var i=t.labels,r=t._recent||FT,o=t.duration()>=es?r.endTime(!1):t._dur,a,h,l;return de(e)&&(isNaN(e)||e in i)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?r._start:r.endTime(r._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?r:s).totalDuration()/100:1)):a<0?(e in i||(i[e]=o),i[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&s&&(h=h/100*(_e(s)?s[0]:s).totalDuration()),a>1?n(t,e.substr(0,a-1),s)+h:o+h)):e==null?o:+e},Br=function(t,e,s){var i=qs(e[1]),r=(i?2:1)+(t<2?0:1),o=e[r],a,h;if(i&&(o.duration=e[1]),o.parent=s,t){for(a=o,h=s;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=Ie(h.vars.inherit)&&h.parent;o.immediateRender=Ie(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[r-1]}return new ne(e[0],o,e[r+1])},vi=function(t,e){return t||t===0?e(t):e},lo=function(t,e,s){return s<t?t:s>e?e:s},ye=function(t,e){return!de(t)||!(e=wT.exec(t))?"":e[1]},BT=function(t,e,s){return vi(s,function(i){return lo(t,e,i)})},jl=[].slice,S0=function(t,e){return t&&Is(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Is(t[0]))&&!t.nodeType&&t!==Ss},RT=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(i){var r;return de(i)&&!e||S0(i,1)?(r=s).push.apply(r,ss(i)):s.push(i)})||s},ss=function(t,e,s){return Ot&&!e&&Ot.selector?Ot.selector(t):de(t)&&!s&&(Gl||!Kn())?jl.call((e||Zc).querySelectorAll(t),0):_e(t)?RT(t,s):S0(t)?jl.call(t,0):t?[t]:[]},ql=function(t){return t=ss(t)[0]||Hr("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return ss(e,s.querySelectorAll?s:s===t?Hr("Invalid scope")||Zc.createElement("div"):t)}},v0=function(t){return t.sort(function(){return .5-Math.random()})},T0=function(t){if(Qt(t))return t;var e=Is(t)?t:{each:t},s=ji(e.ease),i=e.from||0,r=parseFloat(e.base)||0,o={},a=i>0&&i<1,h=isNaN(i)||a,l=e.axis,c=i,u=i;return de(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&h&&(c=i[0],u=i[1]),function(d,f,g){var p=(g||e).length,m=o[p],y,x,_,b,w,S,v,T,A;if(!m){if(A=e.grid==="auto"?0:(e.grid||[1,es])[1],!A){for(v=-es;v<(v=g[A++].getBoundingClientRect().left)&&A<p;);A<p&&A--}for(m=o[p]=[],y=h?Math.min(A,p)*c-.5:i%A,x=A===es?0:h?p*u/A-.5:i/A|0,v=0,T=es,S=0;S<p;S++)_=S%A-y,b=x-(S/A|0),m[S]=w=l?Math.abs(l==="y"?b:_):o0(_*_+b*b),w>v&&(v=w),w<T&&(T=w);i==="random"&&v0(m),m.max=v-T,m.min=T,m.v=p=(parseFloat(e.amount)||parseFloat(e.each)*(A>p?p-1:l?l==="y"?p/A:A:Math.max(A,p/A))||0)*(i==="edges"?-1:1),m.b=p<0?r-p:r,m.u=ye(e.amount||e.each)||0,s=s&&p<0?R0(s):s}return p=(m[d]-m.min)/m.max||0,Ut(m.b+(s?s(p):p)*m.v)+m.u}},Kl=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var i=Ut(Math.round(parseFloat(s)/t)*t*e);return(i-i%1)/e+(qs(s)?0:ye(s))}},A0=function(t,e){var s=_e(t),i,r;return!s&&Is(t)&&(i=s=t.radius||es,t.values?(t=ss(t.values),(r=!qs(t[0]))&&(i*=i)):t=Kl(t.increment)),vi(e,s?Qt(t)?function(o){return r=t(o),Math.abs(r-o)<=i?r:o}:function(o){for(var a=parseFloat(r?o.x:o),h=parseFloat(r?o.y:0),l=es,c=0,u=t.length,d,f;u--;)r?(d=t[u].x-a,f=t[u].y-h,d=d*d+f*f):d=Math.abs(t[u]-a),d<l&&(l=d,c=u);return c=!i||l<=i?t[c]:o,r||c===o||qs(o)?c:c+ye(o)}:Kl(t))},C0=function(t,e,s,i){return vi(_e(t)?!e:s===!0?!!(s=0):!i,function(){return _e(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(i=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*i)/i}
vendor: 1,450 bytes, line 435
435)},LT=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(i){return e.reduce(function(r,o){return o(r)},i)}},OT=function(t,e){return function(s){return t(parseFloat(s))+(e||ye(s))}},DT=function(t,e,s){return M0(t,e,0,1,s)},P0=function(t,e,s){return vi(s,function(i){return t[~~e(i)]})},NT=function n(t,e,s){var i=e-t;return _e(t)?P0(t,n(0,t.length),e):vi(s,function(r){return(i+(r-t)%i)%i+t})},WT=function n(t,e,s){var i=e-t,r=i*2;return _e(t)?P0(t,n(0,t.length-1),e):vi(s,function(o){return o=(r+(o-t)%r)%r||0,t+(o>i?r-o:o)})},qr=function(t){return t.replace(xT,function(e){var s=e.indexOf("[")+1,i=e.substring(s||7,s?e.indexOf("]"):e.length-1).split(_T);return C0(s?i:+i[0],s?0:+i[1],+i[2]||1e-5)})},M0=function(t,e,s,i,r){var o=e-t,a=i-s;return vi(r,function(h){return s+((h-t)/o*a||0)})},zT=function n(t,e,s,i){var r=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!r){var o=de(t),a={},h,l,c,u,d;if(s===!0&&(i=1)&&(s=null),o)t={p:t},e={p:e};else if(_e(t)&&!_e(e)){for(c=[],u=t.length,d=u-2,l=1;l<u;l++)c.push(n(t[l-1],t[l]));u--,r=function(g){g*=u;var p=Math.min(d,~~g);return c[p](g-p)},s=e}else i||(t=Hn(_e(t)?[]:{},t));if(!c){for(h in e)iu.call(a,t,h,"get",e[h]);r=function(g){return au(g,a)||(o?t.p:t)}}}return vi(s,r)},af=function(t,e,s){var i=t.labels,r=es,o,a,h;for(o in i)a=i[o]-e,a<0==!!s&&a&&r>(a=Math.abs(a))&&(h=o,r=a);return h},Ue=function(t,e,s){var i=t.vars,r=i[e],o=Ot,a=t._ctx,h,l,c;
vendor: 7,111 bytes, line 435
435if(r)return h=i[e+"Params"],l=i.callbackScope||t,s&&fi.length&&Sa(),a&&(Ot=a),c=h?r.apply(l,h):r.call(l),Ot=o,c},yr=function(t){return _i(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ge),t.progress()<1&&Ue(t,"onInterrupt"),t},vn,k0=[],I0=function(t){if(t)if(t=!t.name&&t.default||t,Kc()||t.headless){var e=t.name,s=Qt(t),i=e&&!s&&t.init?function(){this._props=[]}:t,r={init:jr,render:au,add:iu,kill:sA,modifier:eA,rawVars:0},o={targetTest:0,get:0,getSetter:ou,aliases:{},register:0};if(Kn(),t!==i){if(Ye[e])return;He(i,He(va(t,r),o)),Hn(i.prototype,Hn(r,va(t,o))),Ye[i.prop=e]=i,t.targetTest&&(Jo.push(i),Jc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}d0(e,i),t.register&&t.register(Le,i,Fe)}else k0.push(t)},At=255,xr={aqua:[0,At,At],lime:[0,At,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,At],navy:[0,0,128],white:[At,At,At],olive:[128,128,0],yellow:[At,At,0],orange:[At,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[At,0,0],pink:[At,192,203],cyan:[0,At,At],transparent:[At,At,At,0]},Gh=function(t,e,s){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(s-e)*t*6:t<.5?s:t*3<2?e+(s-e)*(2/3-t)*6:e)*At+.5|0},E0=function(t,e,s){var i=t?qs(t)?[t>>16,t>>8&At,t&At]:0:xr.black,r,o,a,h,l,c,u,d,f,g;if(!i){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),xr[t])i=xr[t];else if(t.charAt(0)==="#"){if(t.length<6&&(r=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+r+r+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return i=parseInt(t.substr(1,6),16),[i>>16,i>>8&At,i&At,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),i=[t>>16,t>>8&At,t&At]}else if(t.substr(0,3)==="hsl"){if(i=g=t.match(ef),!e)h=+i[0]%360/360,l=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(l+1):c+l-c*l,r=c*2-o,i.length>3&&(i[3]*=1),i[0]=Gh(h+1/3,r,o),i[1]=Gh(h,r,o),i[2]=Gh(h-1/3,r,o);else if(~t.indexOf("="))return i=t.match(h0),s&&i.length<4&&(i[3]=1),i}else i=t.match(ef)||xr.transparent;i=i.map(Number)}return e&&!g&&(r=i[0]/At,o=i[1]/At,a=i[2]/At,u=Math.max(r,o,a),d=Math.min(r,o,a),c=(u+d)/2,u===d?h=l=0:(f=u-d,l=c>.5?f/(2-u-d):f/(u+d),h=u===r?(o-a)/f+(o<a?6:0):u===o?(a-r)/f+2:(r-o)/f+4,h*=60),i[0]=~~(h+.5),i[1]=~~(l*100+.5),i[2]=~~(c*100+.5)),s&&i.length<4&&(i[3]=1),i},F0=function(t){var e=[],s=[],i=-1;return t.split(pi).forEach(function(r){var o=r.match(Sn)||[];e.push.apply(e,o),s.push(i+=o.length+1)}),e.c=s,e},hf=function(t,e,s){var i="",r=(t+i).match(pi),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!r)return t;if(r=r.map(function(d){return(d=E0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(c=F0(t),h=s.c,h.join(i)!==c.c.join(i)))for(l=t.replace(pi,"1").split(Sn),u=l.length-1;a<u;a++)i+=l[a]+(~h.indexOf(a)?r.shift()||o+"0,0,0,0)":(c.length?c:r.length?r:s).shift());if(!l)for(l=t.split(pi),u=l.length-1;a<u;a++)i+=l[a]+r[a];return i+l[u]},pi=(function(){var n="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in xr)n+="|"+t+"\\b";return new RegExp(n+")","gi")})(),YT=/hsl[a]?\(/,B0=function(t){var e=t.join(" "),s;if(pi.lastIndex=0,pi.test(e))return s=YT.test(e),t[1]=hf(t[1],s),t[0]=hf(t[0],s,F0(t[1])),!0},Kr,Ve=(function(){var n=Date.now,t=500,e=33,s=n(),i=s,r=1e3/240,o=r,a=[],h,l,c,u,d,f,g=function p(m){var y=n()-i,x=m===!0,_,b,w,S;if((y>t||y<0)&&(s+=y-e),i+=y,w=i-s,_=w-o,(_>0||x)&&(S=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=_+(_>=r?4:r-_),b=1),x||(h=l(p)),b)for(f=0;f<a.length;f++)a[f](w,d,S,m)};return u={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(m){return d/(1e3/(m||60))},wake:function(){c0&&(!Gl&&Kc()&&(Ss=Gl=window,Zc=Ss.document||{},$e.gsap=Le,(Ss.gsapVersions||(Ss.gsapVersions=[])).push(Le.version),u0(wa||Ss.GreenSockGlobals||!Ss.gsap&&Ss||{}),k0.forEach(I0)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(m){return setTimeout(m,o-u.time*1e3+1|0)},Kr=1,g(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),Kr=0,l=jr},lagSmoothing:function(m,y){t=m||1/0,e=Math.min(y||33,t)},fps:function(m){r=1e3/(m||240),o=u.time*1e3+r},add:function(m,y,x){var _=y?function(b,w,S,v){m(b,w,S,v),u.remove(_)}:m;return u.remove(m),a[x?"unshift":"push"](_),Kn(),_},remove:function(m,y){~(y=a.indexOf(m))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u})(),Kn=function(){return!Kr&&Ve.wake()},mt={},VT=/^[\d.\-M][\d.\-,\s]/,UT=/["']/g,GT=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),i=s[0],r=1,o=s.length,a,h,l;r<o;r++)h=s[r],a=r!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[i]=isNaN(l)?l.replace(UT,"").trim():+l,i=h.substr(a+1).trim();return e},XT=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),i=t.indexOf("(",e);return t.substring(e,~i&&i<s?t.indexOf(")",s+1):s)},$T=function(t){var e=(t+"").split("("),s=mt[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[GT(e[1])]:XT(t).split(",").map(m0)):mt._CE&&VT.test(t)?mt._CE("",t):s},R0=function(t){return function(e){return 1-t(1-e)}},L0=function n(t,e){for(var s=t._first,i;s;)s instanceof Ae?n(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?n(s.timeline,e):(i=s._ease,s._ease=s._yEase,s._yEase=i,s._yoyo=e)),s=s._next},ji=function(t,e){return t&&(Qt(t)?t:mt[t]||$T(t))||e},rn=function(t,e,s,i){s===void 0&&(s=function(h){return 1-e(1-h)}),i===void 0&&(i=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var r={easeIn:e,easeOut:s,easeInOut:i},o;return Ee(t,function(a){mt[a]=$e[a]=r,mt[o=a.toLowerCase()]=s;for(var h in r)mt[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=mt[a+"."+h]=r[h]}),r},O0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Xh=function n(t,e,s){var i=e>=1?e:1,r=(s||(t?.3:.45))/(e<1?e:1),o=r/Ul*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*yT((c-o)*r)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:O0(a);return r=Ul/r,h.config=function(l,c){return n(t,l,c)},h},$h=function n(t,e){e===void 0&&(e=1.70158);var s=function(o){return o?--o*o*((e+1)*o+e)+1:0},i=t==="out"?s:t==="in"?function(r){return 1-s(1-r)}:O0(s);return i.config=function(r){return n(t,r)},i};Ee("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,t){var e=t<5?t+1:t;rn(n+",Power"+(e-1),t?function(s){return Math.pow(s,e)}:function(s){return s},function(s){return 1-Math.pow(1-s,e)},function(s){return s<.5?Math.pow(s*2,e)/2:1-Math.pow((1-s)*2,e)/2})});mt.Linear.easeNone=mt.none=mt.Linear.easeIn;rn("Elastic",Xh("in"),Xh("out"),Xh());(function(n,t){var e=1/t,s=2*e,i=2.5*e,r=function(a){return a<e?n*a*a:a<s?n*Math.pow(a-1.5/t,2)+.75:a<i?n*(a-=2.25/t)*a+.9375:n*Math.pow(a-2.625/t,2)+.984375};rn("Bounce",function(o){return 1-r(1-o)},r)})(7.5625,2.75);rn("Expo",function(n){return Math.pow(2,10*(n-1))*n+n*n*n*n*n*n*(1-n)});rn("Circ",function(n){return-(o0(1-n*n)-1)});rn("Sine",function(n){return n===1?1:-mT(n*pT)+1});rn("Back",$h("in"),$h("out"),$h());mt.SteppedEase=mt.steps=$e.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,i=t+(e?0:1),r=e?1:0,o=1-Pt;return function(a){return((i*lo(0,o,a)|0)+r)*s}}};$n.ease=mt["quad.out"];Ee("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(n){return tu+=n+","+n+"Params,"});
vendor: 5,314 bytes, line 435
435var D0=function(t,e){this.id=gT++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:p0,this.set=e?e.getSetter:ou},Zr=(function(){function n(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,qn(this,+e.duration,1,1),this.data=e.data,Ot&&(this._ctx=Ot,Ot.data.push(this)),Kr||Ve.wake()}var t=n.prototype;return t.delay=function(s){return s||s===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+s-this._delay),this._delay=s,this):this._delay},t.duration=function(s){return arguments.length?this.totalDuration(this._repeat>0?s+(s+this._rDelay)*this._repeat:s):this.totalDuration()&&this._dur},t.totalDuration=function(s){return arguments.length?(this._dirty=0,qn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,i){if(Kn(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(ih(this,s),!r._dp||r.parent||_0(r,this);r&&r.parent;)r.parent._time!==r._start+(r._ts>=0?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&s<this._tDur||this._ts<0&&s>0||!this._tDur&&!s)&&Ts(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===Pt||!this._initted&&this._dur&&s||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),g0(this,s,i)),this},t.time=function(s,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+rf(this))%(this._dur+this._rDelay)||(s?this._dur:0),i):this._time},t.totalProgress=function(s,i){return arguments.length?this.totalTime(this.totalDuration()*s,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(s,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+rf(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,i){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*r,i):this._repeat?jn(this._tTime,r)+1:1},t.timeScale=function(s,i){if(!arguments.length)return this._rts===-Pt?0:this._rts;if(this._rts===s)return this;var r=this.parent&&this._ts?Ta(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Pt?0:this._rts,this.totalTime(lo(-Math.abs(this._delay),this.totalDuration(),r),i!==!1),sh(this),PT(this)},t.paused=function(s){return arguments.length?(this._ps!==s&&(this._ps=s,s?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Kn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Pt&&(this._tTime-=Pt)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=Ut(s);var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Ts(i,this,this._start-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ie(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var i=this.parent||this._dp;return i?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Ta(i.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=vT);var i=ge;return ge=s,su(this)&&(this.timeline&&this.timeline.revert(s),this.totalTime(-.01,s.suppressEvents)),this.data!=="nested"&&s.kill!==!1&&this.kill(),ge=i,this},t.globalTime=function(s){for(var i=this,r=arguments.length?s:i.rawTime();i;)r=i._start+r/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(s):r},t.repeat=function(s){return arguments.length?(this._repeat=s===1/0?-2:s,of(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var i=this._time;return this._rDelay=s,of(this),i?this.time(i):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,i){return this.totalTime(Ke(this,s),Ie(i))},t.restart=function(s,i){return this.play().totalTime(s?-this._delay:0,Ie(i)),this._dur||(this._zTime=-Pt),this},t.play=function(s,i){return s!=null&&this.seek(s,i),this.reversed(!1).paused(!1)},t.reverse=function(s,i){return s!=null&&this.seek(s||this.totalDuration(),i),this.reversed(!0).paused(!1)},t.pause=function(s,i){return s!=null&&this.seek(s,i),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(s){return arguments.length?(!!s!==this.reversed()&&this.timeScale(-this._rts||(s?-Pt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Pt,this},t.isActive=function(){var s=this.parent||this._dp,i=this._start,r;return!!(!s||this._ts&&this._initted&&s.isActive()&&(r=s.rawTime(!0))>=i&&r<this.endTime(!0)-Pt)},t.eventCallback=function(s,i,r){var o=this.vars;return arguments.length>1?(i?(o[s]=i,r&&(o[s+"Params"]=r),s==="onUpdate"&&(this._onUpdate=i)):delete o[s],this):o[s]},t.then=function(s){var i=this,r=i._prom;return new Promise(function(o){var a=Qt(s)?s:y0,h=function(){var c=i.then;
vendor: 2,278 bytes, line 435
435i.then=null,r&&r(),Qt(a)&&(a=a(i))&&(a.then||a===i)&&(i.then=c),o(a),i.then=c};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?h():i._prom=h})},t.kill=function(){yr(this)},n})();He(Zr.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Pt,_prom:0,_ps:!1,_rts:1});var Ae=(function(n){r0(t,n);function t(s,i){var r;return s===void 0&&(s={}),r=n.call(this,s)||this,r.labels={},r.smoothChildTiming=!!s.smoothChildTiming,r.autoRemoveChildren=!!s.autoRemoveChildren,r._sort=Ie(s.sortChildren),Gt&&Ts(s.parent||Gt,Ds(r),i),s.reversed&&r.reverse(),s.paused&&r.paused(!0),s.scrollTrigger&&b0(Ds(r),s.scrollTrigger),r}var e=t.prototype;return e.to=function(i,r,o){return Br(0,arguments,this),this},e.from=function(i,r,o){return Br(1,arguments,this),this},e.fromTo=function(i,r,o,a){return Br(2,arguments,this),this},e.set=function(i,r,o){return r.duration=0,r.parent=this,Fr(r).repeatDelay||(r.repeat=0),r.immediateRender=!!r.immediateRender,new ne(i,r,Ke(this,o),1),this},e.call=function(i,r,o){return Ts(this,ne.delayedCall(0,i,r),o)},e.staggerTo=function(i,r,o,a,h,l,c){return o.duration=r,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new ne(i,o,Ke(this,h)),this},e.staggerFrom=function(i,r,o,a,h,l,c){return o.runBackwards=1,Fr(o).immediateRender=Ie(o.immediateRender),this.staggerTo(i,r,o,a,h,l,c)},e.staggerFromTo=function(i,r,o,a,h,l,c,u){return a.startAt=o,Fr(a).immediateRender=Ie(a.immediateRender),this.staggerTo(i,r,a,h,l,c,u)},e.render=function(i,r,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=i<=0?0:Ut(i),u=this._zTime<0!=i<0&&(this._initted||!l),d,f,g,p,m,y,x,_,b,w,S,v;if(this!==Gt&&c>h&&i>=0&&(c=h),c!==this._tTime||o||u){if(a!==this._time&&l&&(c+=this._time-a,i+=this._time-a),d=c,b=this._start,_=this._ts,y=!_,u&&(l||(a=this._zTime),(i||!r)&&(this._zTime=i)),this._repeat){if(S=this._yoyo,m=l+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(m*100+i,r,o);if(d=Ut(c%m),c===h?(p=this._repeat,d=l):(w=Ut(c/m),p=~~w,p&&p===w&&(d=l,p--),d>l&&(d=l)),w=jn(this._tTime,m),!a&&this._tTime&&w!==p&&this._tTime-w*m-this._dur<=0&&(w=p),S&&p&1&&(d=l-d,v=1),p!==w&&!this._lock){var T=S&&w&1,A=T===(S&&p&1);
vendor: 4,736 bytes, line 435
435if(p<w&&(T=!T),a=T?0:c%l?l:c,this._lock=1,this.render(a||(v?0:Ut(p*m)),r,!l)._lock=0,this._tTime=c,!r&&this.parent&&Ue(this,"onRepeat"),this.vars.repeatRefresh&&!v&&(this.invalidate()._lock=1,w=p),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,A&&(this._lock=2,a=T?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!v&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;L0(this,v)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=ET(this,Ut(a),Ut(d)),x&&(c-=d-(d=x._start))),this._tTime=c,this._time=d,this._act=!_,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,a=0),!a&&c&&l&&!r&&!w&&(Ue(this,"onStart"),this._tTime!==c))return this;if(d>=a&&i>=0)for(f=this._first;f;){if(g=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,r,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,r,o),d!==this._time||!this._ts&&!y){x=0,g&&(c+=this._zTime=-Pt);break}}f=g}else{f=this._last;for(var P=i<0?i:d;f;){if(g=f._prev,(f._act||P<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,r,o);if(f.render(f._ts>0?(P-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(P-f._start)*f._ts,r,o||ge&&su(f)),d!==this._time||!this._ts&&!y){x=0,g&&(c+=this._zTime=P?-Pt:Pt);break}}f=g}}if(x&&!r&&(this.pause(),x.render(d>=a?0:-Pt)._zTime=d>=a?1:-1,this._ts))return this._start=b,sh(this),this.render(i,r,o);this._onUpdate&&!r&&Ue(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(b===this._start||Math.abs(_)!==Math.abs(this._ts))&&(this._lock||((i||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&_i(this,1),!r&&!(i<0&&!a)&&(c||a||!h)&&(Ue(this,c===h&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(i,r){var o=this;if(qs(r)||(r=Ke(this,r,i)),!(i instanceof Zr)){if(_e(i))return i.forEach(function(a){return o.add(a,r)}),this;if(de(i))return this.addLabel(i,r);if(Qt(i))i=ne.delayedCall(0,i);else return this}return this!==i?Ts(this,i,r):this},e.getChildren=function(i,r,o,a){i===void 0&&(i=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),a===void 0&&(a=-es);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof ne?r&&h.push(l):(o&&h.push(l),i&&h.push.apply(h,l.getChildren(!0,r,o)))),l=l._next;return h},e.getById=function(i){for(var r=this.getChildren(1,1,1),o=r.length;o--;)if(r[o].vars.id===i)return r[o]},e.remove=function(i){return de(i)?this.removeLabel(i):Qt(i)?this.killTweensOf(i):(i.parent===this&&eh(this,i),i===this._recent&&(this._recent=this._last),Hi(this))},e.totalTime=function(i,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Ut(Ve.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,r),this._forcing=0,this):this._tTime},e.addLabel=function(i,r){return this.labels[i]=Ke(this,r),this},e.removeLabel=function(i){return delete this.labels[i],this},e.addPause=function(i,r,o){var a=ne.delayedCall(0,r||jr,o);return a.data="isPause",this._hasPause=1,Ts(this,a,Ke(this,i))},e.removePause=function(i){var r=this._first;for(i=Ke(this,i);r;)r._start===i&&r.data==="isPause"&&_i(r),r=r._next},e.killTweensOf=function(i,r,o){for(var a=this.getTweensOf(i,o),h=a.length;h--;)oi!==a[h]&&a[h].kill(i,r);return this},e.getTweensOf=function(i,r){for(var o=[],a=ss(i),h=this._first,l=qs(r),c;h;)h instanceof ne?TT(h._targets,a)&&(l?(!oi||h._initted&&h._ts)&&h.globalTime(0)<=r&&h.globalTime(h.totalDuration())>r:!r||h.isActive())&&o.push(h):(c=h.getTweensOf(a,r)).length&&o.push.apply(o,c),h=h._next;return o},e.tweenTo=function(i,r){r=r||{};var o=this,a=Ke(o,i),h=r,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,g=ne.to(o,He({ease:r.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:r.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Pt,onStart:function(){if(o.pause(),!f){var m=r.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());g._dur!==m&&qn(g,m,0,1).render(g._time,!0,!0),f=1}c&&c.apply(g,u||[])}},r));return d?g.render(0):g},e.tweenFromTo=function(i,r,o){return this.tweenTo(r,He({startAt:{time:Ke(this,i)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(i){return i===void 0&&(i=this._time),af(this,Ke(this,i))},e.previousLabel=function(i){return i===void 0&&(i=this._time),af(this,Ke(this,i),1)},e.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+Pt)},e.shiftChildren=function(i,r,o){o===void 0&&(o=0);var a=this._first,h=this.labels,l;for(i=Ut(i);a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(r)for(l in h)h[l]>
vendor: 28,271 bytes, line 435
435=o&&(h[l]+=i);return Hi(this)},e.invalidate=function(i){var r=this._first;for(this._lock=0;r;)r.invalidate(i),r=r._next;return n.prototype.invalidate.call(this,i)},e.clear=function(i){i===void 0&&(i=!0);for(var r=this._first,o;r;)o=r._next,this.remove(r),r=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Hi(this)},e.totalDuration=function(i){var r=0,o=this,a=o._last,h=es,l,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ts(o,a,c-a._delay,1)._lock=0):h=c,c<0&&a._ts&&(r-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=Ut(c/o._ts),o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),h=0),a._end>r&&a._ts&&(r=a._end),a=l;qn(o,o===Gt&&o._time>r?o._time:r,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(i){if(Gt._ts&&(g0(Gt,Ta(i,Gt)),f0=Ve.frame),Ve.frame>=sf){sf+=Xe.autoSleep||120;var r=Gt._first;if((!r||!r._ts)&&Xe.autoSleep&&Ve._listeners.length<2){for(;r&&!r._ts;)r=r._next;r||Ve.sleep()}}},t})(Zr);He(Ae.prototype,{_lock:0,_hasPause:0,_forcing:0});var HT=function(t,e,s,i,r,o,a){var h=new Fe(this._pt,t,e,0,1,U0,null,r),l=0,c=0,u,d,f,g,p,m,y,x;for(h.b=s,h.e=i,s+="",i+="",(y=~i.indexOf("random("))&&(i=qr(i)),o&&(x=[s,i],o(x,t,e),s=x[0],i=x[1]),d=s.match(Vh)||[];u=Vh.exec(i);)g=u[0],p=i.substring(l,u.index),f?f=(f+1)%5:p.substr(-5)==="rgba("&&(f=1),g!==d[c++]&&(m=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:p||c===1?p:",",s:m,c:g.charAt(1)==="="?On(m,g)-m:parseFloat(g)-m,m:f&&f<4?Math.round:0},l=Vh.lastIndex);return h.c=l<i.length?i.substring(l,i.length):"",h.fp=a,(l0.test(i)||y)&&(h.e=0),this._pt=h,h},iu=function(t,e,s,i,r,o,a,h,l,c){Qt(i)&&(i=i(r||0,t,o));var u=t[e],d=s!=="get"?s:Qt(u)?l?t[e.indexOf("set")||!Qt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Qt(u)?l?QT:Y0:ru,g;if(de(i)&&(~i.indexOf("random(")&&(i=qr(i)),i.charAt(1)==="="&&(g=On(d,i)+(ye(d)||0),(g||g===0)&&(i=g))),!c||d!==i||Zl)return!isNaN(d*i)&&i!==""?(g=new Fe(this._pt,t,e,+d||0,i-(d||0),typeof u=="boolean"?tA:V0,0,f),l&&(g.fp=l),a&&g.modifier(a,this,t),this._pt=g):(!u&&!(e in t)&&Qc(e,i),HT.call(this,t,e,d,i,f,h||Xe.stringFilter,l))},jT=function(t,e,s,i,r){if(Qt(t)&&(t=Rr(t,r,e,s,i)),!Is(t)||t.style&&t.nodeType||_e(t)||a0(t))return de(t)?Rr(t,r,e,s,i):t;var o={},a;for(a in t)o[a]=Rr(t[a],r,e,s,i);return o},N0=function(t,e,s,i,r,o){var a,h,l,c;if(Ye[t]&&(a=new Ye[t]).init(r,a.rawVars?e[t]:jT(e[t],i,r,o,s),s,i,o)!==!1&&(s._pt=h=new Fe(s._pt,r,t,0,1,a.render,a,0,a.priority),s!==vn))for(l=s._ptLookup[s._targets.indexOf(r)],c=a._props.length;c--;)l[a._props[c]]=h;return a},oi,Zl,nu=function n(t,e,s){var i=t.vars,r=i.ease,o=i.startAt,a=i.immediateRender,h=i.lazy,l=i.onUpdate,c=i.runBackwards,u=i.yoyoEase,d=i.keyframes,f=i.autoRevert,g=t._dur,p=t._startAt,m=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:m,_=t._overwrite==="auto"&&!jc,b=t.timeline,w,S,v,T,A,P,M,I,C,k,E,F,B;if(b&&(!d||!r)&&(r="none"),t._ease=ji(r,$n.ease),t._yEase=u?R0(ji(u===!0?r:u,$n.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!b&&!!i.runBackwards,!b||d&&!i.stagger){if(I=m[0]?$i(m[0]).harness:0,F=I&&i[I.prop],w=va(i,Jc),p&&(p._zTime<0&&p.progress(1),e<0&&c&&a&&!f?p.render(-1,!0):p.revert(c&&g?Qo:ST),p._lazy=0),o){if(_i(t._startAt=ne.set(m,He({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!p&&Ie(h),startAt:null,delay:0,onUpdate:l&&function(){return Ue(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge||!a&&!f)&&t._startAt.revert(Qo),a&&g&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(c&&g&&!p){if(e&&(a=!1),v=He({overwrite:!1,data:"isFromStart",lazy:a&&!p&&Ie(h),immediateRender:a,stagger:0,parent:y},w),F&&(v[I.prop]=F),_i(t._startAt=ne.set(m,v)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge?t._startAt.revert(Qo):t._startAt.render(-1,!0)),t._zTime=e,!a)n(t._startAt,Pt,Pt);else if(!e)return}for(t._pt=t._ptCache=0,h=g&&Ie(h)||h&&!g,S=0;S<m.length;S++){if(A=m[S],M=A._gsap||eu(m)[S]._gsap,t._ptLookup[S]=k={},Xl[M.id]&&fi.length&&Sa(),E=x===m?S:x.indexOf(A),I&&(C=new I).init(A,F||w,t,E,x)!==!1&&(t._pt=T=new Fe(t._pt,A,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(N){k[N]=T}),C.priority&&(P=1)),!I||F)for(v in w)Ye[v]&&(C=N0(v,w,t,E,A,x))?C.priority&&(P=1):k[v]=T=iu.call(t,A,v,"get",w[v],E,x,0,i.stringFilter);t._op&&t._op[S]&&t.kill(A,t._op[S]),_&&t._pt&&(oi=t,Gt.killTweensOf(A,k,t.globalTime(e)),B=!t.parent,oi=0),t._pt&&h&&(Xl[M.id]=1)}P&&G0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!B,d&&e<=0&&b.render(es,!0,!0)},qT=function(t,e,s,i,r,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(c=d[f][e],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return Zl=1,t.vars[e]="+=0",nu(t,a),Zl=0,h?Hr(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)u=l[f],c=u._pt||u,c.s=(i||i===0)&&!r?i:c.s+(i||0)+o*c.c,c.c=s-c.s,u.e&&(u.e=ee(s)+ye(u.e)),u.b&&(u.b=c.s+ye(u.b))},KT=function(t,e){var s=t[0]?$i(t[0]).harness:0,i=s&&s.aliases,r,o,a,h;if(!i)return e;r=Hn({},e);for(o in i)if(o in r)for(h=i[o].split(","),a=h.length;a--;)r[h[a]]=r[o];return r},ZT=function(t,e,s,i){var r=e.ease||i||"power1.inOut",o,a;if(_e(e))a=s[t]||(s[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:r})});else for(o in e)a=s[o]||(s[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:r})},Rr=function(t,e,s,i,r){return Qt(t)?t.call(e,s,i,r):de(t)&&~t.indexOf("random(")?qr(t):t},W0=tu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",z0={};Ee(W0+",id,stagger,delay,duration,paused,scrollTrigger",function(n){return z0[n]=1});var ne=(function(n){r0(t,n);function t(s,i,r,o){var a;typeof i=="number"&&(r.duration=i,i=r,r=null),a=n.call(this,o?i:Fr(i))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,g=h.keyframes,p=h.defaults,m=h.scrollTrigger,y=h.yoyoEase,x=i.parent||Gt,_=(_e(s)||a0(s)?qs(s[0]):"length"in i)?[s]:ss(s),b,w,S,v,T,A,P,M;if(a._targets=_.length?eu(_):Hr("GSAP target "+s+" not found. https://gsap.com",!Xe.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,g||d||Eo(l)||Eo(c)){if(i=a.vars,b=a.timeline=new Ae({data:"nested",defaults:p||{},targets:x&&x.data==="nested"?x.vars.targets:_}),b.kill(),b.parent=b._dp=Ds(a),b._start=0,d||Eo(l)||Eo(c)){if(v=_.length,P=d&&T0(d),Is(d))for(T in d)~W0.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(w=0;w<v;w++)S=va(i,z0),S.stagger=0,y&&(S.yoyoEase=y),M&&Hn(S,M),A=_[w],S.duration=+Rr(l,Ds(a),w,A,_),S.delay=(+Rr(c,Ds(a),w,A,_)||0)-a._delay,!d&&v===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),b.to(A,S,P?P(w,A,_):0),b._ease=mt.none;b.duration()?l=c=0:a.timeline=0}else if(g){Fr(He(b.vars.defaults,{ease:"none"})),b._ease=ji(g.ease||i.ease||"none");var I=0,C,k,E;if(_e(g))g.forEach(function(F){return b.to(_,F,">")}),b.duration();else{S={};for(T in g)T==="ease"||T==="easeEach"||ZT(T,g[T],S,g.easeEach);for(T in S)for(C=S[T].sort(function(F,B){return F.t-B.t}),I=0,w=0;w<C.length;w++)k=C[w],E={ease:k.e,duration:(k.t-(w?C[w-1].t:0))/100*l},E[T]=k.v,b.to(_,E,I),I+=E.duration;b.duration()<l&&b.to({},{duration:l-b.duration()})}}l||a.duration(l=b.duration())}else a.timeline=0;return f===!0&&!jc&&(oi=Ds(a),Gt.killTweensOf(_),oi=0),Ts(x,Ds(a),r),i.reversed&&a.reverse(),i.paused&&a.paused(!0),(u||!l&&!g&&a._start===Ut(x._time)&&Ie(u)&&MT(Ds(a))&&x.data!=="nested")&&(a._tTime=-Pt,a.render(Math.max(0,-c)||0)),m&&b0(Ds(a),m),a}var e=t.prototype;return e.render=function(i,r,o){var a=this._time,h=this._tDur,l=this._dur,c=i<0,u=i>h-Pt&&!c?h:i<Pt?0:i,d,f,g,p,m,y,x,_,b;if(!l)IT(this,i,r,o);else if(u!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c||this._lazy){if(d=u,_=this.timeline,this._repeat){if(p=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(p*100+i,r,o);if(d=Ut(u%p),u===h?(g=this._repeat,d=l):(m=Ut(u/p),g=~~m,g&&g===m?(d=l,g--):d>l&&(d=l)),y=this._yoyo&&g&1,y&&(b=this._yEase,d=l-d),m=jn(this._tTime,p),d===a&&!o&&this._initted&&g===m)return this._tTime=u,this;g!==m&&(_&&this._yEase&&L0(_,y),this.vars.repeatRefresh&&!y&&!this._lock&&d!==p&&this._initted&&(this._lock=o=1,this.render(Ut(p*g),!0).invalidate()._lock=0))}if(!this._initted){if(w0(this,c?i:d,o,r,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&g!==m))return this;if(l!==this._dur)return this.render(i,r,o)}if(this._tTime=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(b||this._ease)(d/l),this._from&&(this.ratio=x=1-x),!a&&u&&!r&&!m&&(Ue(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;_&&_.render(i<0?i:_._dur*_._ease(d/this._dur),r,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!r&&(c&&$l(this,i,r,o),Ue(this,"onUpdate")),this._repeat&&g!==m&&this.vars.onRepeat&&!r&&this.parent&&Ue(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&$l(this,i,!0,!0),(i||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&_i(this,1),!r&&!(c&&!a)&&(u||a||y)&&(Ue(this,u===h?"onComplete":"onReverseComplete",!0),this._prom&&!(u<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},e.resetTo=function(i,r,o,a,h){Kr||Ve.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||nu(this,l),c=this._ease(l/this._dur),qT(this,i,r,o,a,c,l,h)?this.resetTo(i,r,o,a,1):(ih(this,0),this.parent||x0(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(i,r){if(r===void 0&&(r="all"),!i&&(!r||r==="all"))return this._lazy=this._pt=0,this.parent?yr(this):this.scrollTrigger&&this.scrollTrigger.kill(!!ge),this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,r,oi&&oi.vars.overwrite!==!0)._first||yr(this),this.parent&&o!==this.timeline.totalDuration()&&qn(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=i?ss(i):a,l=this._ptLookup,c=this._pt,u,d,f,g,p,m,y;if((!r||r==="all")&&CT(a,h))return r==="all"&&(this._pt=0),yr(this);for(u=this._op=this._op||[],r!=="all"&&(de(r)&&(p={},Ee(r,function(x){return p[x]=1}),r=p),r=KT(a,r)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],r==="all"?(u[y]=r,g=d,f={}):(f=u[y]=u[y]||{},g=r);for(p in g)m=d&&d[p],m&&((!("kill"in m.d)||m.d.kill(p)===!0)&&eh(this,m,"_pt"),delete d[p]),f!=="all"&&(f[p]=1)}return this._initted&&!this._pt&&c&&yr(this),this},t.to=function(i,r){return new t(i,r,arguments[2])},t.from=function(i,r){return Br(1,arguments)},t.delayedCall=function(i,r,o,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:r,onReverseComplete:r,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(i,r,o){return Br(2,arguments)},t.set=function(i,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(i,r)},t.killTweensOf=function(i,r,o){return Gt.killTweensOf(i,r,o)},t})(Zr);He(ne.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Ee("staggerTo,staggerFrom,staggerFromTo",function(n){ne[n]=function(){var t=new Ae,e=jl.call(arguments,0);return e.splice(n==="staggerFromTo"?5:4,0,0),t[n].apply(t,e)}});var ru=function(t,e,s){return t[e]=s},Y0=function(t,e,s){return t[e](s)},QT=function(t,e,s,i){return t[e](i.fp,s)},JT=function(t,e,s){return t.setAttribute(e,s)},ou=function(t,e){return Qt(t[e])?Y0:qc(t[e])&&t.setAttribute?JT:ru},V0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},tA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},U0=function(t,e){var s=e._pt,i="";if(!t&&e.b)i=e.b;else if(t===1&&e.e)i=e.e;else{for(;s;)i=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+i,s=s._next;i+=e.c}e.set(e.t,e.p,i,e)},au=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},eA=function(t,e,s,i){for(var r=this._pt,o;r;)o=r._next,r.p===i&&r.modifier(t,e,s),r=o},sA=function(t){for(var e=this._pt,s,i;e;)i=e._next,e.p===t&&!e.op||e.op===t?eh(this,e,"_pt"):e.dep||(s=1),e=i;return!s},iA=function(t,e,s,i){i.mSet(t,e,i.m.call(i.tween,s,i.mt),i)},G0=function(t){for(var e=t._pt,s,i,r,o;e;){for(s=e._next,i=r;i&&i.pr>e.pr;)i=i._next;(e._prev=i?i._prev:o)?e._prev._next=e:r=e,(e._next=i)?i._prev=e:o=e,e=s}t._pt=r},Fe=(function(){function n(e,s,i,r,o,a,h,l,c){this.t=s,this.s=r,this.c=o,this.p=i,this.r=a||V0,this.d=h||this,this.set=l||ru,this.pr=c||0,this._next=e,e&&(e._prev=this)}var t=n.prototype;return t.modifier=function(s,i,r){this.mSet=this.mSet||this.set,this.set=iA,this.m=s,this.mt=r,this.tween=i},n})();Ee(tu+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return Jc[n]=1});$e.TweenMax=$e.TweenLite=ne;$e.TimelineLite=$e.TimelineMax=Ae;Gt=new Ae({sortChildren:!1,defaults:$n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Xe.stringFilter=B0;var qi=[],ta={},nA=[],lf=0,rA=0,Hh=function(t){return(ta[t]||nA).map(function(e){return e()})},Ql=function(){var t=Date.now(),e=[];t-lf>2&&(Hh("matchMediaInit"),qi.forEach(function(s){var i=s.queries,r=s.conditions,o,a,h,l;for(a in i)o=Ss.matchMedia(i[a]).matches,o&&(h=1),o!==r[a]&&(r[a]=o,l=1);l&&(s.revert(),h&&e.push(s))}),Hh("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(i){return s.add(null,i)})}),lf=t,Hh("matchMedia"))},X0=(function(){function n(e,s){this.selector=s&&ql(s),this.data=[],this._r=[],this.isReverted=!1,this.id=rA++,e&&this.add(e)}var t=n.prototype;return t.add=function(s,i,r){Qt(s)&&(r=i,i=s,s=Qt);var o=this,a=function(){var l=Ot,c=o.selector,u;return l&&l!==o&&l.data.push(o),r&&(o.selector=ql(r)),Ot=o,u=i.apply(o,arguments),Qt(u)&&o._r.push(u),Ot=l,o.selector=c,o.isReverted=!1,u};return o.last=a,s===Qt?a(o,function(h){return o.add(null,h)}):s?o[s]=a:a},t.ignore=function(s){var i=Ot;Ot=null,s(this),Ot=i},t.getTweens=function(){var s=[];return this.data.forEach(function(i){return i instanceof n?s.push.apply(s,i.getTweens()):i instanceof ne&&!(i.parent&&i.parent.data==="nested")&&s.push(i)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,i){var r=this;if(s?(function(){for(var a=r.getTweens(),h=r.data.length,l;h--;)l=r.data[h],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(c){return a.splice(a.indexOf(c),1)}));for(a.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,u){return u.g-c.g||-1/0}).forEach(function(c){return c.t.revert(s)}),h=r.data.length;h--;)l=r.data[h],l instanceof Ae?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof ne)&&l.revert&&l.revert(s);r._r.forEach(function(c){return c(s,r)}),r.isReverted=!0})():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),i)for(var o=qi.length;o--;)qi[o].id===this.id&&qi.splice(o,1)},t.revert=function(s){this.kill(s||{})},n})(),oA=(function(){function n(e){this.contexts=[],this.scope=e,Ot&&Ot.data.push(this)}var t=n.prototype;return t.add=function(s,i,r){Is(s)||(s={matches:s});var o=new X0(0,r||this.scope),a=o.conditions={},h,l,c;Ot&&!o.selector&&(o.selector=Ot.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=s;for(l in s)l==="all"?c=1:(h=Ss.matchMedia(s[l]),h&&(qi.indexOf(o)<0&&qi.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(Ql):h.addEventListener("change",Ql)));return c&&i(o,function(u){return o.add(null,u)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(i){return i.kill(s,!0)})},n})(),Aa={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(i){return I0(i)})},timeline:function(t){return new Ae(t)},getTweensOf:function(t,e){return Gt.getTweensOf(t,e)},getProperty:function(t,e,s,i){de(t)&&(t=ss(t)[0]);var r=$i(t||{}).get,o=s?y0:m0;return s==="native"&&(s=""),t&&(e?o((Ye[e]&&Ye[e].get||r)(t,e,s,i)):function(a,h,l){return o((Ye[a]&&Ye[a].get||r)(t,a,h,l))})},quickSetter:function(t,e,s){if(t=ss(t),t.length>1){var i=t.map(function(c){return Le.quickSetter(c,e,s)}),r=i.length;return function(c){for(var u=r;u--;)i[u](c)}}t=t[0]||{};var o=Ye[e],a=$i(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;vn._pt=0,u.init(t,s?c+s:c,vn,0,[t]),u.render(1,u),vn._pt&&au(1,vn)}:a.set(t,h);return o?l:function(c){return l(t,h,s?c+s:c,a,1)}},quickTo:function(t,e,s){var i,r=Le.to(t,He((i={},i[e]="+=0.1",i.paused=!0,i.stagger=0,i),s||{})),o=function(h,l,c){return r.resetTo(e,h,l,c)};return o.tween=r,o},isTweening:function(t){return Gt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ji(t.ease,$n.ease)),nf($n,t||{})},config:function(t){return nf(Xe,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,i=t.plugins,r=t.defaults,o=t.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!Ye[a]&&!$e[a]&&Hr(e+" effect requires "+a+" plugin.")}),Uh[e]=function(a,h,l){return s(ss(a),He(h||{},r),l)},o&&(Ae.prototype[e]=function(a,h,l){return this.add(Uh[e](a,Is(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){mt[t]=ji(e)},parseEase:function(t,e){return arguments.length?ji(t,e):mt},getById:function(t){return Gt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Ae(t),i,r;for(s.smoothChildTiming=Ie(t.smoothChildTiming),Gt.remove(s),s._dp=0,s._time=s._tTime=Gt._time,i=Gt._first;i;)r=i._next,(e||!(!i._dur&&i instanceof ne&&i.vars.onComplete===i._targets[0]))&&Ts(s,i,i._start-i._delay),i=r;return Ts(Gt,s,0),s},context:function(t,e){return t?new X0(t,e):Ot},matchMedia:function(t){return new oA(t)},matchMediaRefresh:function(){return qi.forEach(function(t){var e=t.conditions,s,i;for(i in e)e[i]&&(e[i]=!1,s=1);s&&t.revert()})||Ql()},addEventListener:function(t,e){var s=ta[t]||(ta[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=ta[t],i=s&&s.indexOf(e);i>=0&&s.splice(i,1)},utils:{wrap:NT,wrapYoyo:WT,distribute:T0,random:C0,snap:A0,normalize:DT,getUnit:ye,clamp:BT,splitColor:E0,toArray:ss,selector:ql,mapRange:M0,pipe:LT,unitize:OT,interpolate:zT,shuffle:v0},install:u0,effects:Uh,ticker:Ve,updateRoot:Ae.updateRoot,plugins:Ye,globalTimeline:Gt,core:{PropTween:Fe,globals:d0,Tween:ne,Timeline:Ae,Animation:Zr,getCache:$i,_removeLinkedListItem:eh,reverting:function(){return ge},context:function(t){return t&&Ot&&(Ot.data.push(t),t._ctx=Ot),Ot},suppressOverwrites:function(t){return jc=t}}};Ee("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return Aa[n]=ne[n]});Ve.add(Ae.updateRoot);vn=Aa.to({},{duration:0});var aA=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},hA=function(t,e){var s=t._targets,i,r,o;for(i in e)for(r=s.length;r--;)o=t._ptLookup[r][i],o&&(o=o.d)&&(o._pt&&(o=aA(o,i)),o&&o.modifier&&o.modifier(e[i],t,s[r],i))},jh=function(t,e){return{name:t,headless:1,rawVars:1,init:function(i,r,o){o._onInit=function(a){var h,l;if(de(r)&&(h={},Ee(r,function(c){return h[c]=1}),r=h),e){h={};for(l in r)h[l]=e(r[l]);r=h}hA(a,r)}}}},Le=Aa.registerPlugin({name:"attr",init:function(t,e,s,i,r){var o,a,h;this.tween=s;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],i,r,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var s=e._pt;s;)ge?s.set(s.t,s.p,s.b,s):s.r(t,s.d),s=s._next}},{name:"endArray",headless:1,init:function(t,e){for(var s=e.length;s--;)this.add(t,s,t[s]||0,e[s],0,0,0,0,0,1)}},jh("roundProps",Kl),jh("modifiers"),jh("snap",A0))||Aa;ne.version=Ae.version=Le.version="3.14.2";c0=1;Kc()&&Kn();mt.Power0;mt.Power1;mt.Power2;mt.Power3;mt.Power4;mt.Linear;mt.Quad;mt.Cubic;mt.Quart;mt.Quint;mt.Strong;mt.Elastic;mt.Back;mt.SteppedEase;mt.Bounce;mt.Sine;mt.Expo;mt.Circ;var cf,ai,Dn,hu,Ui,uf,lu,lA=function(){return typeof window<"u"},Ks={},zi=180/Math.PI,Nn=Math.PI/180,dn=Math.atan2,df=1e8,cu=/([A-Z])/g,cA=/(left|right|width|margin|padding|x)/i,uA=/[\s,\(]\S/,As={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Jl=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},dA=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},fA=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},pA=function(t,e){return e.set(e.t,e.p,t===1?e.e:t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},gA=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},$0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},H0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},mA=function(t,e,s){return t.style[e]=s},yA=function(t,e,s){return t.style.setProperty(e,s)},xA=function(t,e,s){return t._gsap[e]=s},_A=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},bA=function(t,e,s,i,r){var o=t._gsap;o.scaleX=o.scaleY=s,o.renderTransform(r,o)},wA=function(t,e,s,i,r){var o=t._gsap;o[e]=s,o.renderTransform(r,o)},$t="transform",Be=$t+"Origin",SA=function n(t,e){var s=this,i=this.target,r=i.style,o=i._gsap;if(t in Ks&&r){if(this.tfm=this.tfm||{},t!=="transform")t=As[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return s.tfm[a]=zs(i,a)}):this.tfm[t]=o.x?o[t]:zs(i,t),t===Be&&(this.tfm.zOrigin=o.zOrigin);else return As.transform.split(",").forEach(function(a){return n.call(s,a,e)});if(this.props.indexOf($t)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Be,e,"")),t=$t}(r||e)&&this.props.push(t,e,r[t])},j0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},vA=function(){var t=this.props,e=this.target,s=e.style,i=e._gsap,r,o;for(r=0;r<t.length;r+=3)t[r+1]?t[r+1]===2?e[t[r]](t[r+2]):e[t[r]]=t[r+2]:t[r+2]?s[t[r]]=t[r+2]:s.removeProperty(t[r].substr(0,2)==="--"?t[r]:t[r].replace(cu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)i[o]=this.tfm[o];i.svg&&(i.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),r=lu(),(!r||!r.isStart)&&!s[$t]&&(j0(s),i.zOrigin&&s[Be]&&(s[Be]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},q0=function(t,e){var s={target:t,props:[],revert:vA,save:SA};return t._gsap||Le.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach(function(i){return s.save(i)}),s},K0,tc=function(t,e){var s=ai.createElementNS?ai.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):ai.createElement(t);return s&&s.style?s:ai.createElement(t)},Ge=function n(t,e,s){var i=getComputedStyle(t);return i[e]||i.getPropertyValue(e.replace(cu,"-$1").toLowerCase())||i.getPropertyValue(e)||!s&&n(t,Zn(e)||e,1)||""},ff="O,Moz,ms,Ms,Webkit".split(","),Zn=function(t,e,s){var i=e||Ui,r=i.style,o=5;if(t in r&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(ff[o]+t in r););return o<0?null:(o===3?"ms":o>=0?ff[o]:"")+t},ec=function(){lA()&&window.document&&(cf=window,ai=cf.document,Dn=ai.documentElement,Ui=tc("div")||{style:{}},tc("div"),$t=Zn($t),Be=$t+"Origin",Ui.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",K0=!!Zn("perspective"),lu=Le.core.reverting,hu=1)},pf=function(t){var e=t.ownerSVGElement,s=tc("svg",e&&e.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=t.cloneNode(!0),r;i.style.display="block",s.appendChild(i),Dn.appendChild(s);try{r=i.getBBox()}catch{}return s.removeChild(i),Dn.removeChild(s),r},gf=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},Z0=function(t){var e,s;try{e=t.getBBox()}catch{e=pf(t),s=1}return e&&(e.width||e.height)||s||(e=pf(t)),e&&!e.width&&!e.x&&!e.y?{x:+gf(t,["x","cx","x1"])||0,y:+gf(t,["y","cy","y1"])||0,width:0,height:0}:e},Q0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Z0(t))},bi=function(t,e){if(e){var s=t.style,i;e in Ks&&e!==Be&&(e=$t),s.removeProperty?(i=e.substr(0,2),(i==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(i==="--"?e:e.replace(cu,"-$1").toLowerCase())):s.removeAttribute(e)}},hi=function(t,e,s,i,r,o){var a=new Fe(t._pt,e,s,0,1,o?H0:$0);return t._pt=a,a.b=i,a.e=r,t._props.push(s),a},mf={deg:1,rad:1,turn:1},TA={grid:1,flex:1},wi=function n(t,e,s,i){var r=parseFloat(s)||0,o=(s+"").trim().substr((r+"").length)||"px",a=Ui.style,h=cA.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=i==="px",f=i==="%",g,p,m,y;if(i===o||!r||mf[i]||mf[o])return r;if(o!=="px"&&!d&&(r=n(t,e,s,"px")),y=t.getCTM&&Q0(t),(f||o==="%")&&(Ks[e]||~e.indexOf("adius")))return g=y?t.getBBox()[h?"width":"height"]:t[c],ee(f?r/g*u:r/100*g);if(a[h?"width":"height"]=u+(d?o:i),p=i!=="rem"&&~e.indexOf("adius")||i==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===ai||!p.appendChild)&&(p=ai.body),m=p._gsap,m&&f&&m.width&&h&&m.time===Ve.time&&!m.uncache)return ee(r/m.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+i,g=t[c],x?t.style[e]=x:bi(t,e)}else(f||o==="%")&&!TA[Ge(p,"display")]&&(a.position=Ge(t,"position")),p===t&&(a.position="static"),p.appendChild(Ui),g=Ui[c],p.removeChild(Ui),a.position="absolute";return h&&f&&(m=$i(p),m.time=Ve.time,m.width=p[c]),ee(d?g*r/u:g&&r?u/g*r:0)},zs=function(t,e,s,i){var r;return hu||ec(),e in As&&e!=="transform"&&(e=As[e],~e.indexOf(",")&&(e=e.split(",")[0])),Ks[e]&&e!=="transform"?(r=Jr(t,i),r=e!=="transformOrigin"?r[e]:r.svg?r.origin:Pa(Ge(t,Be))+" "+r.zOrigin+"px"):(r=t.style[e],(!r||r==="auto"||i||~(r+"").indexOf("calc("))&&(r=Ca[e]&&Ca[e](t,e,s)||Ge(t,e)||p0(t,e)||(e==="opacity"?1:0))),s&&!~(r+"").trim().indexOf(" ")?wi(t,e,r,s)+s:r},AA=function(t,e,s,i){if(!s||s==="none"){var r=Zn(e,t,1),o=r&&Ge(t,r,1);o&&o!==s?(e=r,s=o):e==="borderColor"&&(s=Ge(t,"borderTopColor"))}var a=new Fe(this._pt,t.style,e,0,1,U0),h=0,l=0,c,u,d,f,g,p,m,y,x,_,b,w;if(a.b=s,a.e=i,s+="",i+="",i.substring(0,6)==="var(--"&&(i=Ge(t,i.substring(4,i.indexOf(")")))),i==="auto"&&(p=t.style[e],t.style[e]=i,i=Ge(t,e)||i,p?t.style[e]=p:bi(t,e)),c=[s,i],B0(c),s=c[0],i=c[1],d=s.match(Sn)||[],w=i.match(Sn)||[],w.length){for(;u=Sn.exec(i);)m=u[0],x=i.substring(h,u.index),g?g=(g+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(g=1),m!==(p=d[l++]||"")&&(f=parseFloat(p)||0,b=p.substr((f+"").length),m.charAt(1)==="="&&(m=On(f,m)+b),y=parseFloat(m),_=m.substr((y+"").length),h=Sn.lastIndex-_.length,_||(_=_||Xe.units[e]||b,h===i.length&&(i+=_,a.e+=_)),b!==_&&(f=wi(t,e,p,_)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,m:g&&g<4||e==="zIndex"?Math.round:0});a.c=h<i.length?i.substring(h,i.length):""}else a.r=e==="display"&&i==="none"?H0:$0;return l0.test(i)&&(a.e=0),this._pt=a,a},yf={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},CA=function(t){var e=t.split(" "),s=e[0],i=e[1]||"50%";return(s==="top"||s==="bottom"||i==="left"||i==="right")&&(t=s,s=i,i=t),e[0]=yf[s]||s,e[1]=yf[i]||i,e.join(" ")},PA=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,i=s.style,r=e.u,o=s._gsap,a,h,l;if(r==="all"||r===!0)i.cssText="",h=1;else for(r=r.split(","),l=r.length;--l>-1;)a=r[l],Ks[a]&&(h=1,a=a==="transformOrigin"?Be:$t),bi(s,a);h&&(bi(s,$t),o&&(o.svg&&s.removeAttribute("transform"),i.scale=i.rotate=i.translate="none",Jr(s,1),o.uncache=1,j0(i)))}},Ca={clearProps:function(t,e,s,i,r){if(r.data!=="isFromStart"){var o=t._pt=new Fe(t._pt,e,s,0,0,PA);return o.u=i,o.pr=-10,o.tween=r,t._props.push(s),1}}},Qr=[1,0,0,1,0,0],J0={},ty=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},xf=function(t){var e=Ge(t,$t);return ty(e)?Qr:e.substr(7).match(h0).map(ee)},uu=function(t,e){var s=t._gsap||$i(t),i=t.style,r=xf(t),o,a,h,l;return s.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,r=[h.a,h.b,h.c,h.d,h.e,h.f],r.join(",")==="1,0,0,1,0,0"?Qr:r):(r===Qr&&!t.offsetParent&&t!==Dn&&!s.svg&&(h=i.display,i.display="block",o=t.parentNode,(!o||!t.offsetParent&&!t.getBoundingClientRect().width)&&(l=1,a=t.nextElementSibling,Dn.appendChild(t)),r=xf(t),h?i.display=h:bi(t,"display"),l&&(
vendor: 9,958 bytes, line 435
435a?o.insertBefore(t,a):o?o.appendChild(t):Dn.removeChild(t))),e&&r.length>6?[r[0],r[1],r[4],r[5],r[12],r[13]]:r)},sc=function(t,e,s,i,r,o){var a=t._gsap,h=r||uu(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],g=h[1],p=h[2],m=h[3],y=h[4],x=h[5],_=e.split(" "),b=parseFloat(_[0])||0,w=parseFloat(_[1])||0,S,v,T,A;s?h!==Qr&&(v=f*m-g*p)&&(T=b*(m/v)+w*(-p/v)+(p*x-m*y)/v,A=b*(-g/v)+w*(f/v)-(f*x-g*y)/v,b=T,w=A):(S=Z0(t),b=S.x+(~_[0].indexOf("%")?b/100*S.width:b),w=S.y+(~(_[1]||_[0]).indexOf("%")?w/100*S.height:w)),i||i!==!1&&a.smooth?(y=b-l,x=w-c,a.xOffset=u+(y*f+x*p)-y,a.yOffset=d+(y*g+x*m)-x):a.xOffset=a.yOffset=0,a.xOrigin=b,a.yOrigin=w,a.smooth=!!i,a.origin=e,a.originIsAbsolute=!!s,t.style[Be]="0px 0px",o&&(hi(o,a,"xOrigin",l,b),hi(o,a,"yOrigin",c,w),hi(o,a,"xOffset",u,a.xOffset),hi(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",b+" "+w)},Jr=function(t,e){var s=t._gsap||new D0(t);if("x"in s&&!e&&!s.uncache)return s;var i=t.style,r=s.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Ge(t,Be)||"0",c,u,d,f,g,p,m,y,x,_,b,w,S,v,T,A,P,M,I,C,k,E,F,B,N,O,R,D,z,Y,W,V;return c=u=d=p=m=y=x=_=b=0,f=g=1,s.svg=!!(t.getCTM&&Q0(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(i[$t]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[$t]!=="none"?h[$t]:"")),i.scale=i.rotate=i.translate="none"),v=uu(t,s.svg),s.svg&&(s.uncache?(N=t.getBBox(),l=s.xOrigin-N.x+"px "+(s.yOrigin-N.y)+"px",B=""):B=!e&&t.getAttribute("data-svg-origin"),sc(t,B||l,!!B||s.originIsAbsolute,s.smooth!==!1,v)),w=s.xOrigin||0,S=s.yOrigin||0,v!==Qr&&(M=v[0],I=v[1],C=v[2],k=v[3],c=E=v[4],u=F=v[5],v.length===6?(f=Math.sqrt(M*M+I*I),g=Math.sqrt(k*k+C*C),p=M||I?dn(I,M)*zi:0,x=C||k?dn(C,k)*zi+p:0,x&&(g*=Math.abs(Math.cos(x*Nn))),s.svg&&(c-=w-(w*M+S*C),u-=S-(w*I+S*k))):(V=v[6],Y=v[7],R=v[8],D=v[9],z=v[10],W=v[11],c=v[12],u=v[13],d=v[14],T=dn(V,z),m=T*zi,T&&(A=Math.cos(-T),P=Math.sin(-T),B=E*A+R*P,N=F*A+D*P,O=V*A+z*P,R=E*-P+R*A,D=F*-P+D*A,z=V*-P+z*A,W=Y*-P+W*A,E=B,F=N,V=O),T=dn(-C,z),y=T*zi,T&&(A=Math.cos(-T),P=Math.sin(-T),B=M*A-R*P,N=I*A-D*P,O=C*A-z*P,W=k*P+W*A,M=B,I=N,C=O),T=dn(I,M),p=T*zi,T&&(A=Math.cos(T),P=Math.sin(T),B=M*A+I*P,N=E*A+F*P,I=I*A-M*P,F=F*A-E*P,M=B,E=N),m&&Math.abs(m)+Math.abs(p)>359.9&&(m=p=0,y=180-y),f=ee(Math.sqrt(M*M+I*I+C*C)),g=ee(Math.sqrt(F*F+V*V)),T=dn(E,F),x=Math.abs(T)>2e-4?T*zi:0,b=W?1/(W<0?-W:W):0),s.svg&&(B=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!ty(Ge(t,$t)),B&&t.setAttribute("transform",B))),Math.abs(x)>90&&Math.abs(x)<270&&(r?(f*=-1,x+=p<=0?180:-180,p+=p<=0?180:-180):(g*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=c-((s.xPercent=c&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+o,s.y=u-((s.yPercent=u&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+o,s.z=d+o,s.scaleX=ee(f),s.scaleY=ee(g),s.rotation=ee(p)+a,s.rotationX=ee(m)+a,s.rotationY=ee(y)+a,s.skewX=x+a,s.skewY=_+a,s.transformPerspective=b+o,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(i[Be]=Pa(l)),s.xOffset=s.yOffset=0,s.force3D=Xe.force3D,s.renderTransform=s.svg?kA:K0?ey:MA,s.uncache=0,s},Pa=function(t){return(t=t.split(" "))[0]+" "+t[1]},qh=function(t,e,s){var i=ye(e);return ee(parseFloat(e)+parseFloat(wi(t,"x",s+"px",i)))+i},MA=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ey(t,e)},ki="0deg",ur="0px",Ii=") ",ey=function(t,e){var s=e||this,i=s.xPercent,r=s.yPercent,o=s.x,a=s.y,h=s.z,l=s.rotation,c=s.rotationY,u=s.rotationX,d=s.skewX,f=s.skewY,g=s.scaleX,p=s.scaleY,m=s.transformPerspective,y=s.force3D,x=s.target,_=s.zOrigin,b="",w=y==="auto"&&t&&t!==1||y===!0;if(_&&(u!==ki||c!==ki)){var S=parseFloat(c)*Nn,v=Math.sin(S),T=Math.cos(S),A;S=parseFloat(u)*Nn,A=Math.cos(S),o=qh(x,o,v*A*-_),a=qh(x,a,-Math.sin(S)*-_),h=qh(x,h,T*A*-_+_)}m!==ur&&(b+="perspective("+m+Ii),(i||r)&&(b+="translate("+i+"%, "+r+"%) "),(w||o!==ur||a!==ur||h!==ur)&&(b+=h!==ur||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Ii),l!==ki&&(b+="rotate("+l+Ii),c!==ki&&(b+="rotateY("+c+Ii),u!==ki&&(b+="rotateX("+u+Ii),(d!==ki||f!==ki)&&(b+="skew("+d+", "+f+Ii),(g!==1||p!==1)&&(b+="scale("+g+", "+p+Ii),x.style[$t]=b||"translate(0, 0)"},kA=function(t,e){var s=e||this,i=s.xPercent,r=s.yPercent,o=s.x,a=s.y,h=s.rotation,l=s.skewX,c=s.skewY,u=s.scaleX,d=s.scaleY,f=s.target,g=s.xOrigin,p=s.yOrigin,m=s.xOffset,y=s.yOffset,x=s.forceCSS,_=parseFloat(o),b=parseFloat(a),w,S,v,T,A;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=Nn,l*=Nn,w=Math.cos(h)*u,S=Math.sin(h)*u,v=Math.sin(h-l)*-d,T=Math.cos(h-l)*d,l&&(c*=Nn,A=Math.tan(l-c),A=Math.sqrt(1+A*A),v*=A,T*=A,c&&(A=Math.tan(c),A=Math.sqrt(1+A*A),w*=A,S*=A)),w=ee(w),S=ee(S),v=ee(v),T=ee(T)):(w=u,T=d,S=v=0),(_&&!~(o+"").indexOf("px")||b&&!~(a+"").indexOf("px"))&&(_=wi(f,"x",o,"px"),b=wi(f,"y",a,"px")),(g||p||m||y)&&(_=ee(_+g-(g*w+p*v)+m),b=ee(b+p-(g*S+p*T)+y)),(i||r)&&(A=f.getBBox(),_=ee(_+i/100*A.width),b=ee(b+r/100*A.height)),A="matrix("+w+","+S+","+v+","+T+","+_+","+b+")",f.setAttribute("transform",A),x&&(f.style[$t]=A)},IA=function(t,e,s,i,r){var o=360,a=de(r),h=parseFloat(r)*(a&&~r.indexOf("rad")?zi:1),l=h-i,c=i+l+"deg",u,d;return a&&(u=r.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*df)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*df)%o-~~(l/o)*o)),t._pt=d=new Fe(t._pt,e,s,i,l,dA),d.e=c,d.u="deg",t._props.push(s),d},_f=function(t,e){for(var s in e)t[s]=e[s];return t},EA=function(t,e,s){var i=_f({},s._gsap),r="perspective,force3D,transformOrigin,svgOrigin",o=s.style,a,h,l,c,u,d,f,g;i.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),o[$t]=e,a=Jr(s,1),bi(s,$t),s.setAttribute("transform",l)):(l=getComputedStyle(s)[$t],o[$t]=e,a=Jr(s,1),o[$t]=l);for(h in Ks)l=i[h],c=a[h],l!==c&&r.indexOf(h)<0&&(f=ye(l),g=ye(c),u=f!==g?wi(s,h,l,g):parseFloat(l),d=parseFloat(c),t._pt=new Fe(t._pt,a,h,u,d-u,Jl),t._pt.u=g||0,t._props.push(h));_f(a,i)};Ee("padding,margin,Width,Radius",function(n,t){var e="Top",s="Right",i="Bottom",r="Left",o=(t<3?[e,s,i,r]:[e+r,e+s,i+s,i+r]).map(function(a){return t<2?n+a:"border"+a+n});Ca[t>1?"border"+n:n]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(g){return zs(a,g,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(g,p){return f[g]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var sy={name:"css",register:ec,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,i,r){var o=this._props,a=t.style,h=s.vars.startAt,l,c,u,d,f,g,p,m,y,x,_,b,w,S,v,T,A;hu||ec(),this.styles=this.styles||q0(t),T=this.styles.props,this.tween=s;for(p in e)if(p!=="autoRound"&&(c=e[p],!(Ye[p]&&N0(p,e,s,i,t,r)))){if(f=typeof c,g=Ca[p],f==="function"&&(c=c.call(s,i,t,r),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=qr(c)),g)g(this,t,p,c,s)&&(v=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",pi.lastIndex=0,pi.test(l)||(m=ye(l),y=ye(c),y?m!==y&&(l=wi(t,p,l,y)+y):m&&(c+=m)),this.add(a,"setProperty",l,c,i,r,0,0,p),o.push(p),T.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(s,i,t,r):h[p],de(l)&&~l.indexOf("random(")&&(l=qr(l)),ye(l+"")||l==="auto"||(l+=Xe.units[p]||ye(zs(t,p))||""),(l+"").charAt(1)==="="&&(l=zs(t,p))):l=zs(t,p),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),p in As&&(p==="autoAlpha"&&(d===1&&zs(t,"visibility")==="hidden"&&u&&(d=0),T.push("visibility",0,a.visibility),hi(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=As[p],~p.indexOf(",")&&(p=p.split(",")[0]))),_=p in Ks,_){if(this.styles.save(p),A=c,f==="string"&&c.substring(0,6)==="var(--"){if(c=Ge(t,c.substring(4,c.indexOf(")"))),c.substring(0,5)==="calc("){var P=t.style.perspective;t.style.perspective=c,c=Ge(t,"perspective"),P?t.style.perspective=P:bi(t,"perspective")}u=parseFloat(c)}if(b||(w=t._gsap,w.renderTransform&&!e.parseTransform||Jr(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,b=this._pt=new Fe(this._pt,a,$t,0,1,w.renderTransform,w,0,-1),b.dep=1),p==="scale")this._pt=new Fe(this._pt,w,"scaleY",w.scaleY,(x?On(w.scaleY,x+u):u)-w.scaleY||0,Jl),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){T.push(Be,0,a[Be]),c=CA(c),w.svg?sc(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&hi(this,w,"zOrigin",w.zOrigin,y),hi(this,a,p,Pa(l),Pa(c)));continue}else if(p==="svgOrigin"){sc(t,c,1,S,0,this);continue}else if(p in J0){IA(this,w,p,d,x?On(d,x+c):c);continue}else if(p==="smoothOrigin"){hi(this,w,"smooth",w.smooth,c);continue}else if(p==="force3D"){w[p]=c;continue}else if(p==="transform"){EA(this,c,t);continue}}else p in a||(p=Zn(p)||p);if(_||(u||u===0)&&(d||d===0)&&!uA.test(c)&&p in a)m=(l+"").substr((d+"").length),u||(u=0),y=ye(c)||(p in Xe.units?Xe.units[p]:m),m!==y&&(d=wi(t,p,l,y)),this._pt=new Fe(this._pt,_?w:a,p,d,(x?On(d,x+u):u)-d,!_&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?gA:Jl),this._pt.u=y||0,_&&A!==c?(this._pt.b=l,this._pt.e=A,this._pt.r=pA):m!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=fA);else if(p in a)AA.call(this,t,p,l,x?x+c:c);else if(p in t)this.add(t,p,l||t[p],x?x+c:c,i,r);else if(p!=="parseTransform"){Qc(p,c);continue}_||(p in a?T.push(p,0,a[p]):typeof t[p]=="function"?T.push(p,2,t[p]()):T.push(p,1,l||t[p])),o.push(p)}}v&&G0(this)},render:function(t,e){if(e.tween._time||!lu())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:zs,aliases:As,getSetter:function(t,e,s){var i=As[e];return i&&i.indexOf(",")<0&&(e=i),e in Ks&&e!==Be&&(t._gsap.x||zs(t,"x"))?s&&uf===s?e==="scale"?_A:xA:(uf=s||{})&&(e==="scale"?bA:wA):t.style&&!qc(t.style[e])?mA:~e.indexOf("-")?yA:
435ou(t,e)},core:{_removeProperty:bi,_getMatrix:uu}};Le.utils.checkPrefix=Zn;Le.core.getStyleSaver=q0;(function(n,t,e,s){var i=Ee(n+","+t+","+e,function(r){Ks[r]=1});Ee(t,function(r){Xe.units[r]="deg",J0[r]=1}),As[i[13]]=n+","+t,Ee(s,function(r){var o=r.split(":");As[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");Ee("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Xe.units[n]="px"});Le.registerPlugin(sy);var ct=Le.registerPlugin(sy)||Le;ct.core.Tween;const FA={color:0,alpha:.8},bf="drop",Fo=.3,BA=28,RA=12,LA=80,OA=140,wf=1.08,DA=.7,Sf=1.04,NA=.9,WA=.12;class du extends j{constructor(t){super(),this.options=t,this.overlay=new Wt,this.panel=new j,this.opened=!1,this.ready=!1,this.dismissing=!1,this.visible=!1,this.overlayStyle={...FA,...t.overlay},this.dismissMode=t.dismiss??"backdrop",this.panelSize=t.content.size,this.frame=this.buildFrame(),this.panel.addChild(this.frame.view,...t.content.children),t.hint&&(t.hint.view.position.set(0,t.hint.y),this.panel.addChild(t.hint.view)),t.close&&(this.closeButton=this.buildCloseButton(t.close),this.placeCloseButton(),this.panel.addChild(this.closeButton)),this.addChild(this.overlay,this.panel),this.bindDismiss()}get isOpen(){return this.opened}get contentRect(){return Hc(this.panelSize,ba(this.options.frame))}get size(){return this.panelSize}setPanelSize(t){this.panelSize=t;const e=this.frame.view;this.frame=this.buildFrame(),this.panel.addChildAt(this.frame.view,0),this.panel.removeChild(e),e.destroy(),this.placeCloseButton()}layout(t){this.placement=t;const{backdrop:e,center:s,scale:i}=t;this.overlay.clear(),this.overlay.rect(e.x,e.y,e.width,e.height),this.overlay.fill({color:this.overlayStyle.color,alpha:1}),this.panel.scale.set(i),this.panel.x=s.x,(this.ready||!this.visible)&&(this.panel.y=s.y),this.options.content.layout?.(),this.updateTextResolution()}async open(){const t=this.requirePlacement();this.opened||(this.opened=!0,this.closing=void 0,this.visible=!0,this.ready=!1,this.dismissing=!1,this.panel.alpha=1,await this.animateIn(t),this.panel.y=t.center.y,this.ready=!0,this.startHintPulse(),this.options.onShown?.())}close(){if(this.closing)return this.closing;if(!this.opened)return Promise.resolve();const t=this.requirePlacement();return this.opened=!1,this.ready=!1,this.stopHintPulse(),this.resetCloseButton(),this.closing=this.animateOut(t).then(()=>{this.visible=!1,this.closing=void 0}),this.closing}setPointerCursor(t){this.dismissMode!=="none"&&(this.overlay.cursor=t),this.dismissMode==="anywhere"&&(this.cursor=t),this.closeButton&&(this.closeButton.cursor=t)}async present(){const t=new Promise(e=>{this.resolveDismissed=e});await this.open(),await t,this.parent?.removeChild(this),this.destroy({children:!0})}buildFrame(){const t=cT(this.options.texture,this.options.frame,n0(this.panelSize));return t.view.eventMode="static",t}buildCloseButton(t){const e=new j;e.addChild(t),e.eventMode="static",e.cursor="pointer";const s=i=>{ct.to(e.scale,{x:i,y:i,duration:WA})};return e.on("pointerover",()=>s(Sf)),e.on("pointerout",()=>s(1)),e.on("pointerupoutside",()=>s(1)),e.on("pointerdown",()=>s(NA)),e.on("pointerup",()=>s(Sf)),e.on("pointertap",i=>{i.stopPropagation(),this.dismiss()}),e}placeCloseButton(){const t=this.closeButton;if(!t)return;const e=t.children[0],s=uT(this.panelSize,ba(this.options.frame),{width:e.width,height:e.height},this.options.frame.closeOffset);t.position.set(s.x,s.y)}resetCloseButton(){this.closeButton&&(ct.killTweensOf(this.closeButton.scale),this.closeButton.scale.set(1))}bindDismiss(){const t=this.dismissMode;if(this.overlay.eventMode="static",t==="none")return;this.overlay.cursor="pointer",t==="anywhere"&&(this.cursor="pointer");const e=t==="anywhere"?this:this.overlay;t==="anywhere"&&(this.eventMode="static"),e.on("pointertap",()=>{this.dismiss()})}async dismiss(){if(!this.ready||this.dismissing)return;this.dismissing=!0,this.options.onDismiss?.(),await this.close(),this.dismissing=!1;const t=this.resolveDismissed;this.resolveDismissed=void 0,t?.()}requirePlacement(){if(!this.placement)throw new Error("Popup.layout() must run before the popup opens");return this.placement}animateIn(t){const e=this.options.animation??bf,{center:s,scale:i,backdrop:r}=t,o=this.overlayStyle.alpha;return ct.killTweensOf(this.panel),ct.killTweensOf(this.overlay),e==="none"?(this.overlay.alpha=o,this.panel.y=s.y,Promise.resolve()):(this.overlay.alpha=0,e==="fade"?(this.panel.y=s.y,this.panel.alpha=0,new Promise(a=>{ct.timeline({onComplete:()=>a()}).to(this.overlay,{alpha:o,duration:Fo}
435,0).to(this.panel,{alpha:1,duration:Fo},0)})):(this.panel.y=tf(r,this.panelSize.height,i,LA),new Promise(a=>{ct.timeline({onComplete:()=>a()}).to(this.overlay,{alpha:o,duration:.2,ease:"power1.out"},0).to(this.panel,{y:s.y+BA*i,duration:.48,ease:"power2.in"}).to(this.panel,{y:s.y-RA*i,duration:.14,ease:"power2.out"}).to(this.panel,{y:s.y,duration:.11,ease:"power1.inOut"})})))}animateOut(t){const e=this.options.animation??bf;if(ct.killTweensOf(this.panel),ct.killTweensOf(this.overlay),e==="none")return Promise.resolve();if(e==="fade")return new Promise(i=>{ct.timeline({onComplete:()=>i()}).to(this.overlay,{alpha:0,duration:Fo},0).to(this.panel,{alpha:0,duration:Fo},0)});const s=tf(t.backdrop,this.panelSize.height,t.scale,OA);return new Promise(i=>{ct.timeline({onComplete:()=>i()}).to(this.panel,{y:s,duration:.28,ease:"power2.in"}).to(this.overlay,{alpha:0,duration:.18,ease:"power1.in"},.04)})}startHintPulse(){const t=this.options.hint?.view;t&&(ct.killTweensOf(t.scale),t.scale.set(1),ct.to(t.scale,{x:wf,y:wf,duration:DA,ease:"sine.inOut",yoyo:!0,repeat:-1}))}stopHintPulse(){const t=this.options.hint?.view;t&&(ct.killTweensOf(t.scale),t.scale.set(1))}updateTextResolution(){const t=this.options.content.texts?.();if(!t)return;const e=Math.max(1,Math.min(window.devicePixelRatio||1,2));for(const s of t)s.resolution=e}}const Bo={en_us:{"bar.balance":"BALANCE","bar.bet":"PLAY AMOUNT","bar.win":"WIN","bar.fun":"FUN","bar.real":"REAL","lowBalance.title":"Low balance","lowBalance.message":"Your balance is too low to play. Please add more money to your balance before continuing.","lowBalance.ok":"OK","autoplay.title":"AUTOPLAY","autoplay.start":"START AUTOPLAY"},fr:{"bar.balance":"SOLDE","bar.bet":"MISE","bar.win":"GAIN","bar.fun":"DÉMO","bar.real":"RÉEL","lowBalance.title":"Solde insuffisant","lowBalance.message":"Votre solde est trop bas pour jouer. Veuillez approvisionner votre solde avant de continuer.","lowBalance.ok":"OK","autoplay.title":"JEU AUTOMATIQUE","autoplay.start":"LANCER"},cs:{"bar.balance":"ZŮSTATEK","bar.bet":"SÁZKA","bar.win":"VÝHRA","bar.fun":"DEMO","bar.real":"REÁLNÉ","lowBalance.title":"Nízký zůstatek","lowBalance.message":"Váš zůstatek je příliš nízký na hru. Než budete pokračovat, dobijte si prosím zůstatek.","lowBalance.ok":"OK","autoplay.title":"AUTOMATICKÁ HRA","autoplay.start":"SPUSTIT"},tr:{"bar.balance":"BAKİYE","bar.bet":"BAHİS","bar.win":"KAZANÇ","bar.fun":"DEMO","bar.real":"GERÇEK","lowBalance.title":"Yetersiz bakiye","lowBalance.message":"Bakiyeniz oynamak için çok düşük. Devam etmeden önce lütfen bakiyenize para ekleyin.","lowBalance.ok":"TAMAM","autoplay.title":"OTOMATİK OYUN","autoplay.start":"BAŞLAT"}},Tn="en_us",vf={en:"en_us","en-us":"en_us",fr:"fr","fr-fr":"fr",cs:"cs","cs-cz":"cs",cz:"cs",tr:"tr","tr-tr":"tr"};function zA(n){if(!n)return Tn;const t=n.trim().toLowerCase().replace(/_/g,"-");return vf[t]??vf[t.split("-")[0]]??Tn}const YA=/\{(\w+)\}/g;function VA(n,t){return t?n.replace(YA,(e,s)=>s in t?String(t[s]):e):n}function Tf(n){return Object.assign({},...n)}class An{constructor(){this.locale=Tn,this.active=Bo[Tn],this.fallback=Bo[Tn],this.warned=new Set}static getInstance(){return An.instance||(An.instance=new An),An.instance}init(t){const e=zA(t.locale);this.locale=e,this.active=Tf([Bo[e],...t.catalogs??[]]),this.fallback=Tf([Bo[Tn],...t.fallbackCatalogs??[]]),this.warned.clear(),Z.info(`i18n initialized: locale=${e}`)}getLocale(){return this.locale}t(t,e){const s=this.active[t]??this.fallback[t];return s===void 0?(this.warned.has(t)||(this.warned.add(t),Z.warn(`i18n missing key: "${t}" (locale=${this.locale})`)),t):VA(s,e)}}const ke=(n,t)=>An.getInstance().t(n,t);function iy(n,t,e,s){const i=n.reduce((h,l)=>h+l.getLocalBounds().height,0)+s*(n.length-1),r=i0(t,{width:e,height:i}),o=Hc(r,s0(t));let a=o.y;for(const h of n){const l=h.getLocalBounds();
435h.position.set(o.x+e/2-l.x-l.width/2,a-l.y),a+=l.height+s}return r}const ny=720,UA=40;function GA(n,t){const e=n.width??ny,s=n.gap,i=n.title(t.title),r=n.body(t.message,e),o=n.button(t.button,()=>{l.close()}),a=[i,r,o],h=iy(a,n.frame,e,s),l=new du({texture:n.texture,frame:n.frame,content:{children:a,size:h},dismiss:"none"});return l}function XA(n){return GA(n,{title:ke("lowBalance.title"),message:ke("lowBalance.message"),button:ke("lowBalance.ok")})}function $A(n,t,e={}){const s=n.width??ny,i=n.gap??UA,r=t.getRoundCountOptions(),o=r.map(g=>({count:g,option:n.option(g,()=>h(g))}));let a;const h=g=>{a=g;for(const p of o)p.option.setSelected(p.count===g)},l=e.initialCount!==void 0&&r.includes(e.initialCount)?e.initialCount:r[0];l!==void 0&&h(l);const c=()=>{a!==void 0&&(e.onStart?.(a),t.start(a),f.close())},u=[n.title(ke("autoplay.title")),HA(o.map(g=>g.option.view),i),...e.extras?[e.extras]:[],n.button(ke("autoplay.start"),c)],d=iy(u,n.frame,s,i),f=new du({texture:n.texture,frame:n.frame,content:{children:u,size:d},dismiss:"backdrop",close:n.close?.(),onDismiss:e.onDismiss});return f}function HA(n,t){const e=new j;let s=0;for(const i of n){const r=i.getLocalBounds();i.position.set(s-r.x,-r.y),s+=r.width+t,e.addChild(i)}return e}const jA={USD:"¢",EUR:"¢",GBP:"p",CAD:"¢",AUD:"¢"};class us{constructor(){this.config={code:"USD",symbol:"$",before:!0,decimalSeparator:".",thousandSeparator:",",decimalsNumber:2}}static getInstance(){return us.instance||(us.instance=new us),us.instance}setCurrencyConfig(t){this.config={...this.config,...t}}getCurrencyConfig(){return{...this.config}}getCurrencyCode(){return this.config.code}getCurrencySymbol(){return this.config.symbol}formatCurrency(t){if(isNaN(t)||!isFinite(t))return this.config.before?`${this.config.symbol}0${this.config.decimalSeparator}00`:`0${this.config.decimalSeparator}00${this.config.symbol}`;const e=Number(t.toFixed(this.config.decimalsNumber)),s=Math.abs(e).toString().split(".");let i=s[0],r=s[1]||"";for(;r.length<this.config.decimalsNumber;)r+="0";this.config.thousandSeparator&&i.length>3&&(i=this.addThousandsSeparator(i,this.config.thousandSeparator));let o=i;return this.config.decimalsNumber>0&&(o+=this.config.decimalSeparator+r),e<0&&(o="-"+o),this.config.before?`${this.config.symbol}${o}`:`${o}${this.config.symbol}`}formatCurrencyAuto(t){const{code:e,subUnitSymbol:s,decimalsNumber:i}=this.config,r=s??jA[e];return r&&i>0&&isFinite(t)&&t>0&&t<1?`${Number((t*10**i).toFixed(2))}${r}`:this.formatCurrency(t)}formatNumber(t){if(isNaN(t)||!isFinite(t))return`0${this.config.decimalSeparator}00`;const e=Number(t.toFixed(this.config.decimalsNumber)),s=Math.abs(e).toString().split(".");let i=s[0],r=s[1]||"";for(;r.length<this.config.decimalsNumber;)r+="0";this.config.thousandSeparator&&i.length>3&&(i=this.addThousandsSeparator(i,this.config.thousandSeparator));let o=i;return this.config.decimalsNumber>0&&(o+=this.config.decimalSeparator+r),e<0&&(o="-"+o),o}getLocaleString(){return{USD:"en-US",EUR:this.config.decimalSeparator===","?"de-DE":"en-US",GBP:"en-GB",JPY:"ja-JP",CAD:"en-CA",AUD:"en-AU",CHF:"de-CH",SEK:"sv-SE",NOK:"no-NO",DKK:"da-DK",AED:"ar-AE"}[this.config.code]||"en-US"}formatCurrencyIntl(t){try{return new Intl.NumberFormat(this.getLocaleString(),{style:"currency",currency:this.config.code,minimumFractionDigits:this.config.decimalsNumber,maximumFractionDigits:this.config.decimalsNumber}).format(t)}catch(e){return Z.warn("Intl.NumberFormat failed, using custom formatting:",e),this.formatCurrency(t)}}addThousandsSeparator(t,e){return t.replace(/\B(?=(\d{3})+(?!\d))/g,e)}setFunModeCurrency(){this.config={code:"USD",symbol:"$",before:!0,decimalSeparator:".",thousandSeparator:",",decimalsNumber:2}}resetToDefault(){this.config={code:"USD",symbol:"$",before:!0,decimalSeparator:".",thousandSeparator:",",decimalsNumber:2}}}const qA=.4,KA=.33;class fu extends j{constructor(t,e){super(),this.funLabel=null,t.enabled||(this.visible=!1),this.dataSource=e;const s=us.getInstance();this.bg=new Wt,this.addChild(this.bg);const i=t.betLabel??ke("bar.bet");this.textStyle=new wt({fontFamily:"Arial, Helvetica, sans-serif",fontSize:20,fill:16777215}),this.balanceText=new ht({text:`${ke("bar.balance")}: ${s.formatCurrency(t.initialBalance)}`,style:this.textStyle}),this.balanceText.anchor.set(0,.5),this.addChild(this.balanceText),t.isFunMode&&(this.funLabel=new ht({text:ke("bar.fun"),style:this.textStyle}),this.funLabel.anchor.set(.5,.5),this.addChild(this.funLabel)),this.betText=new ht({text:`${i}: ${s.formatCurrency(t.initialBetAmount)}`,style:this.textStyle}),this.betText.anchor.set(1,.5),this.addChild(this.betText),this.onBalanceBound=r=>{this.balanceText.text=`${ke("bar.balance")}: ${s.formatCurrency(r)}`},this.onBetAmountBound=r=>{this.betText.text=`${i}: ${s.formatCurrency(r)}`},e.onBalanceChanged(this.onBalanceBound),e.onBetAmountChanged(this.onBetAmountBound)}resize(t,e=fu.DEFAULT_HEIGHT){this.textStyle.fontSize=Math.round(e*qA),this.bg.clear(),this.bg.rect(0,0,t,e),this.bg.fill({color:0,alpha:.85});const s=Math.round(e*KA),i=e/2;this.balanceText.x=s,this.balanceText.y=i,this.funLabel&&(this.funLabel.x=t/2,this.funLabel.y=i),this.betText.x=t-s,this.betText.y=i}destroy(){this.dataSource.offBalanceChanged(this.onBalanceBound),this.dataSource.offBetAmountChanged(this.onBetAmountBound),super.destroy()}}fu.DEFAULT_HEIGHT=48;const Ro={idleOn:"idle_on",idleOff:"idle_off",offToOn:"off_to_on",onToOff:"on_to_off"};function ZA(n,t){const e=n?Ro.idleOff:Ro.idleOn;return t?{primary:n?Ro.onToOff:Ro.offToOn,primaryLoop:!1,follow:e}:{primary:e,primaryLoop:!0,follow:null}}const QA="anim_sound_toggle.json",JA="anim_sound_toggle.atlas",tC={fill:"#ffffff",fontSize:24,fontWeight:"800"};class eC extends j{constructor(t={}){super(),this.spineIcon=null,this.buttonSize=0,this.muted=!1,this.options=t,this.fallbackIcon=new ht({text:"♪",style:t.fallbackStyle??tC}
435),this.fallbackIcon.anchor.set(.5),this.addChild(this.fallbackIcon),this.updateFallbackIcon(),t.filters&&(this.filters=t.filters),this.attachSpineIcon()}isMuted(){return this.muted}setButtonSize(t){this.buttonSize=t,this.layoutIcon()}setMuted(t,e=!1){if(this.muted=t,this.updateFallbackIcon(),!this.spineIcon)return;const s=ZA(t,e);this.spineIcon.state.setAnimation(0,s.primary,s.primaryLoop),s.follow&&this.spineIcon.state.addAnimation(0,s.follow,!0,0),this.layoutIcon()}destroy(t){this.spineIcon&&this.options.onSpineDestroyed?.(this.spineIcon),super.destroy(t)}attachSpineIcon(){try{const t=ws.from({skeleton:this.options.skeletonAlias??QA,atlas:this.options.atlasAlias??JA});t.eventMode="none",this.spineIcon=t,this.addChildAt(t,0),this.fallbackIcon.visible=!1,this.options.onSpineCreated?.(t),this.setMuted(this.muted,!1),this.layoutIcon()}catch(t){Z.warn("Failed to create sound toggle Spine icon; using text fallback.",t),this.updateFallbackIcon()}}layoutIcon(){if(this.buttonSize<=0||(this.fallbackIcon.style.fontSize=this.buttonSize*.42,this.fallbackIcon.position.set(this.buttonSize/2,this.buttonSize/2),!this.spineIcon))return;this.spineIcon.update(0);const t=this.spineIcon.getLocalBounds(),e=Math.max(t.width,t.height,1),s=this.buttonSize*.62/e;this.spineIcon.scale.set(s),this.spineIcon.position.set(this.buttonSize/2-(t.x+t.width/2)*s,this.buttonSize/2-(t.y+t.height/2)*s)}updateFallbackIcon(){this.fallbackIcon.text=this.muted?"X":"♪",this.fallbackIcon.visible=this.spineIcon===null}}function sC(n,t){return t.gearSize/2+t.mainGap+t.menuButtonSize/2+n*(t.menuButtonSize+t.stackGap)}function iC(n,t){let e=0;return n.map(s=>s?sC(e++,t):null)}function Lo(n,t){return n<=0||t<=0?1:n/t}const nC=18,rC=1,Af=1.08,oC=.92,aC=.28,hC=.2;class lC extends j{constructor(t){super(),this.options=t,this.backdrop=new it($.WHITE),this.gearButton=new j,this.stack=[],this.soundIcon=null,this.interactiveTargets=[],this.expanded=!1,this.gearSize=0,this.menuButtonSize=0,this.gearTexture=t.textures.gear,this.closeTexture=t.textures.close,this.closeScale=t.closeScale??rC,this.stackGap=t.stackGap??nC,this.backdrop.anchor.set(.5),this.backdrop.alpha=0,this.backdrop.visible=!1,this.backdrop.eventMode="none",this.backdrop.cursor="default",this.backdrop.on("pointertap",()=>this.close()),this.gearSprite=it.from(this.gearTexture),this.gearSprite.anchor.set(.5),this.gearButton.addChild(this.gearSprite),t.gearFilters&&(this.gearButton.filters=t.gearFilters),this.addChild(this.backdrop,this.gearButton),this.wireButton(this.gearButton,()=>this.toggle(),!0,this.gearSprite),t.sound&&(this.soundIcon=new eC(t.sound),this.stack.push(this.buildSoundEntry(this.soundIcon,t.sound)));for(const e of t.buttons??[])this.stack.push(this.buildButtonEntry(e));for(const e of this.stack)this.addChild(e.container)}setCursorValues(t,e){for(const s of this.interactiveTargets)s.cursor=e;this.backdrop.cursor=t}get isExpanded(){return this.expanded}setSoundMuted(t,e){this.soundIcon?.setMuted(t,e)}isSoundMuted(){return this.soundIcon?.isMuted()??!1}open(){this.setExpanded(!0)}close(){this.setExpanded(!1)}toggle(){this.setExpanded(!this.expanded)}layout(t,e){this.gearSize=this.options.gearSize??($.from(this.gearTexture).height||this.gearSize),this.menuButtonSize=this.options.menuButtonSize??this.gearSize,this.sizeGear();for(const s of this.stack)s.applySize(this.menuButtonSize);this.backdrop.width=t*2,this.backdrop.height=e*2,this.backdrop.position.set(-this.x,-this.y),this.applyExpansion(!1)}sizeGear(){const t=this.gearSize*(this.expanded?this.closeScale:1),e=this.gearSprite.texture;this.gearSprite.scale.set(Lo(t,Math.max(e.width,e.height)))}get sizing(){return{gearSize:this.gearSize,menuButtonSize:this.menuButtonSize,mainGap:this.options.mainGap??this.stackGap,stackGap:this.stackGap}}destroy(t){ct.killTweensOf(this.gearButton.scale);for(const e of this.stack)ct.killTweensOf(e.container),ct.killTweensOf(e.container.position),ct.killTweensOf(e.container.scale);this.soundIcon?.destroy(),super.destroy(t)}setExpanded(t){this.expanded!==t&&(this.expanded=t,this.gearSprite.texture=$.from(t?this.closeTexture:this.gearTexture),this.sizeGear(),this.backdrop.visible=t,this.backdrop.eventMode=t?"static":"none",this.applyExpansion(!0),this.options.onExpandedChange?.(t))}refresh(){this.applyExpansion(this.expanded)}applyExpansion(t){const e=iC(this.stack.map(s=>s.isVisible()),this.sizing);this.stack.forEach((s,i)=>{const r=e[i],o=this.expanded&&r!==null,a=o?r:0;if(t){this.animateStackButton(s.container,o,a);return}ct.killTweensOf(s.container),ct.killTweensOf(s.container.position),s.container.eventMode=o?"static":"none",s.container.visible=o,s.container.alpha=o?1:0,s.container.position.set(0,a)})}animateStackButton(t,e,s){t.eventMode=e?"static":"none",e&&(t.visible=!0),ct.killTweensOf(t),ct.killTweensOf(t.position),ct.to(t,{alpha:e?1:0,duration:hC,ease:"none"}),ct.to(t.position,{y:s,duration:aC,ease:e?"back.out(1.4)":"back.in(1.4)",onComplete:()=>{e||(t.visible=!1)}})}buildSoundEntry(t,e){const s=new j,i=it.from(e.plate??this.options.textures.plate);return i.anchor.set(.5),s.addChild(i,t),s.alpha=0,s.visible=!1,this.wireButton(s,e.onToggle,!1,i),{container:s,isVisible:()=>!0,applySize:r=>{i.scale.set(Lo(r,i.texture.height)),t.setButtonSize(r),t.position.set(-r/2,-r/2)}}}buildButtonEntry(t){const e=new j,s=it.from(t.plate??this.options.textures.plate);s.anchor.set(.5),e.addChild(s);const i=t.content!==void 0,r=!i&&t.icon?it.from(t.icon):null;r&&(r.anchor.set(.5),e.addChild(r));const o=!i&&t.label?new ht({text:t.label.text,style:t.label.style}):null;o&&(o.anchor.set(.5),e.addChild(o));let a=null;return e.alpha=0,e.visible=!1,this.wireButton(e,t.onTap,!1,s),{container:e,isVisible:t.isVisible??(()=>!0),applySize:h=>{s.scale.set(Lo(h,s.texture.height)),t.content&&!a&&(a=t.content(h),e.addChild(a)),r&&r.scale.set(Lo(h*.6,r.texture.height)),o&&(o.style.fontSize=h*.5)}}}
435wireButton(t,e,s,i){t.eventMode=s?"static":"none",t.cursor="pointer",this.interactiveTargets.push(t);const r=this.options.pressTint,o=(a,h)=>{ct.to(t.scale,{x:a,y:a,duration:.1,ease:"power2.out"}),r!==void 0&&(i.tint=h?r:16777215)};t.on("pointerover",()=>o(Af,!1)),t.on("pointerout",()=>o(1,!1)),t.on("pointerdown",()=>o(oC,!0)),t.on("pointerup",()=>o(Af,!1)),t.on("pointerupoutside",()=>o(1,!1)),t.on("pointertap",()=>{this.options.onActivity?.(),e()})}}const Et=new re;class gi extends j{constructor(){super(),this.MiddleLayer=mi.getInstance(),this.events=Et,gi.instance||(gi.instance=this),this.boxInsideMask=new aT,this.MiddleLayer.addChild(this),this.events.on("setHowToPlayMode",t=>this.visible=!JSON.parse(String(t)))}resize(){this.boxInsideMask.resize()}static getInstance(){return gi.instance}}class ve extends j{constructor(){if(super(),this.particles=[],this.events=Et,!ve.sharedParticleTexture){const t=new Wt;t.circle(8,8,8),t.fill(16777215);const e=Rt.instance?.renderer;if(!e)throw new Error("No PIXI renderer found for generating particle texture. Please ensure Main.instance is initialized and has a renderer.");const s=Lc.create({width:16,height:16});e.render({target:s,container:t}),ve.sharedParticleTexture=s}ve.sparkTexture||(ve.sparkTexture=_t.getTexture("./images/effects/vfx_spark.png")),ve.starTexture||(ve.starTexture=_t.getTexture("./images/effects/vfx_star.png")),this.events.on("triggerParticleExplosion",t=>{this.createExplosion(t)}),this.animate=this.animate.bind(this),Zt.shared.add(this.animate)}static getInstance(){return ve.instance||(ve.instance=new ve),ve.instance}createExplosion(t){const i=Math.PI*2;for(let r=0;r<400;r++){const o=Math.random();let a,h;o<.5?(a="circle",h=ve.sharedParticleTexture):o<.8?(a="spark",h=ve.sparkTexture):(a="star",h=ve.starTexture);const l=new it(h);l.particleType=a,this.configureParticle(l,t,7,i),this.particles.push(l),this.addChild(l)}}configureParticle(t,e,s,i){const r=t.particleType==="spark"||t.particleType==="star",o=r?8:5,a=r?20:18,h=o+Math.random()*(a-o);if(t.width=h,t.height=h,t.particleType==="circle"){const f=[16776960,16769126,16761600,16777215,16753920];t.tint=f[Math.floor(Math.random()*f.length)]}else if(t.particleType==="spark"){const f=[16777215,16777164,16768324,16755200,16737792];t.tint=f[Math.floor(Math.random()*f.length)],t.scale.set(.1+Math.random()*.05)}else{const f=[16776960,16769126,16761600,16777215,16753920];t.tint=f[Math.floor(Math.random()*f.length)],t.scale.set(.3+Math.random()*.2)}t.alpha=1,t.anchor.set(.5),t.position.set(e.x,e.y);const l=Math.random()*i-i/4,c=r?s*(.8+Math.random()*.8):s*(.3+Math.random()*.7);t.velocity=new It(Math.cos(l)*c,Math.sin(l)*c);const u=1,d=1.5;t.life=r?d:u,t.maxLife=t.life}animate(t){const e=t.deltaMS?t.deltaMS/1e3:Math.min(Math.max(t.deltaTime,1),2)*.016666666666666666,s=5*e,i=e/4,r=[];for(const o of this.particles)o.particleType==="spark"?this.animateSparkle(o,s):this.animateParticle(o,s),o.x+=o.velocity.x*e*60,o.y+=o.velocity.y*e*60,o.life-=i,o.life<=0&&r.push(o);for(const o of r){this.removeChild(o);const a=this.particles.indexOf(o);a>-1&&this.particles.splice(a,1)}}animateSparkle(t,e){if(t.velocity.y+=e*.3,t.velocity.x*=.98,t.velocity.y*=.98,t.particleType==="spark")t.rotation+=.12,t.alpha=.7+.3*Math.sin(Date.now()*.01+t.x);else{t.rotation+=.08;const s=Math.max(0,t.life/t.maxLife);t.alpha=s*(.8+.2*Math.sin(Date.now()*.015+t.y))}}animateParticle(t,e){t.velocity.y+=e,t.alpha=Math.max(0,t.life/t.maxLife)}destroy(){Zt.shared.remove(this.animate),super.destroy()}}class mi extends ui{constructor(){super(),mi.instance||(mi.instance=this),this.boxInside=new ry,this.boxLayer=new gi;const t=ve.getInstance();this.addChild(t)}resize(){this.boxInside.resize(),this.boxLayer.resize()}static getInstance(){return mi.instance}}
435const cC="./images/scene/ui_box_inside.png",uC="./images/scene/ui_box_lines.png";class ry extends j{constructor(){super(),this.Main=Rt.getInstance(),this.MiddleLayer=mi.getInstance(),this.sprites=[],this.addBoxInside(),this.addBoxLines(),this.addToLayer()}resize(){this.sprites.forEach(t=>this.addBounds(t))}addBounds(t){const e=this.Main.getDim(),{inside:s}=di(e.width,e.height).box;t.anchor.set(.5),t.x=s.x,t.y=s.y,t.width=s.width,t.height=s.height}generateSpr(t){const e=_t.getTexture(t),s=new it(e);return this.addBounds(s),this.addChild(s),this.sprites.push(s),s}addBoxInside(){const t=this.generateSpr(cC);t.alpha=.8}addBoxLines(){this.generateSpr(uC)}addToLayer(){this.MiddleLayer.addChild(this)}}class Wn extends ui{constructor(){super(),Wn.instance||(Wn.instance=this),this.spineBackground=new Vl,this.boxInside=new ry}resize(){this.spineBackground.resize(),this.boxInside.resize()}static getInstance(){return Wn.instance}}var Ft=(n=>(n.checker="checker",n.stars="stars",n.stripes="stripes",n.swiggle="swiggle",n.full="full",n))(Ft||{}),zt=(n=>(n.red="red",n.purple="purple",n.green="green",n.blue="blue",n))(zt||{}),je=(n=>(n.click1="click_1",n.click2="click_2",n.click3="click_3",n.clickOnBadFirework="click_on_bad_firework",n.explode1="explode_1",n.explode2="explode_2",n.success="success",n.success2="success_2",n.background="background",n))(je||{}),vt=(n=>(n.semiOpacity="Semi-Opacity",n.show="visible_true",n.hide="visible_false",n))(vt||{}),yi=(n=>(n.max="MAX",n.min="MIN",n.nonExtreme="NON_EXTREME_VALUE",n))(yi||{});const oy=560,dC=150,fC=500,pC=3,ay=zt.purple,hy=Ft.full,pu={leftWidth:40,topHeight:40,rightWidth:40,bottomHeight:40,padding:{left:32,top:32,right:32,bottom:32},closeOffset:{x:12,y:-12}},ly={0:0,1:0,2:0,3:.1,4:1.4,5:4,6:10,7:18,8:70,9:100,10:2e3},Lr=["./images/winning_icons/icon_prize_baseball.png","./images/winning_icons/icon_prize_hotdog.png","./images/winning_icons/icon_prize_lemonade.png","./images/winning_icons/icon_prize_popsicle.png","./images/winning_icons/icon_prize_slice.png"],Qn={1:{type:Ft.checker,color:zt.red},2:{type:Ft.stars,color:zt.red},3:{type:Ft.swiggle,color:zt.red},4:{type:Ft.full,color:zt.red},5:{type:Ft.stripes,color:zt.red},6:{type:Ft.checker,color:zt.purple},7:{type:Ft.stars,color:zt.purple},8:{type:Ft.swiggle,color:zt.purple},9:{type:Ft.full,color:zt.purple},10:{type:Ft.stripes,color:zt.purple},11:{type:Ft.checker,color:zt.green},12:{type:Ft.stars,color:zt.green},13:{type:Ft.swiggle,color:zt.green},14:{type:Ft.full,color:zt.green},15:{type:Ft.stripes,color:zt.green},16:{type:Ft.checker,color:zt.blue},17:{type:Ft.stars,color:zt.blue},18:{type:Ft.swiggle,color:zt.blue},19:{type:Ft.full,color:zt.blue},20:{type:Ft.stripes,color:zt.blue}},gC={win:3,grid:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],prizes:[1,1,1,1,1,1],bonus:null},Kh=[{win:3,grid:[3,13,3,1,7,15,10,3,11,1,7,2,11,5,11,16],prizes:[0,0,0,0,4,4,4,0],bonus:{win:15,grid:[15,9,12,15,5,17,5,7,5,3,18,1,5,5,2,9],prizes:[2,2,0,3,2,0,3,3],bonus:{win:15,grid:[18,8,8,11,8,15,1,1,2,20,11,1,4,9,9,5],prizes:[0,3,0,0,2],bonus:null}}},{win:5,grid:[6,4,12,5,7,4,8,13,1,8,17,13,9,17,13,6],prizes:[2,1,0,0],bonus:null},{win:2,grid:[5,13,11,11,1,19,15,5,2,2,6,3,7,15,15,13],prizes:[1,2,1,3,0,0,3],bonus:{win:5,grid:[6,4,12,5,7,4,8,13,1,8,17,13,9,17,13,6],prizes:[2,1,0,0],bonus:null}},{win:19,grid:[19,19,12,14,6,20,6,12,9,19,2,15,13,4,5,1],prizes:[1,0,2,2,3,0,0],bonus:{win:17,grid:[17,10,16,17,8,17,9,8,4,20,17,13,5,8,4,19],prizes:[1,0,3,3,0,0,3],bonus:null}},{win:12,grid:[11,14,19,3,10,15,16,7,1,20,10,2,4,12,16,9],prizes:[2,0,3,1,0,0],bonus:null},{win:15,grid:[5,20,12,8,5,17,5,7,5,3,18,1,5,5,2,10],prizes:[2,2,0,3,2,0,3,2,0],bonus:{win:15,grid:[18,8,8,11,8,15,1,1,2,20,11,1,4,9,9,5],prizes:[0,3,0,0,2],bonus:null}},{win:13,grid:[3,7,4,14,15,4,18,15,20,14,5,2,15,18,3,4],prizes:[1,4,1,2,1,0,2,1,0],bonus:null}];var _r;typeof self>"u"&&typeof process<"u"&&process.hrtime?_r=function(){var n=process.hrtime();return n[0]*1e3+n[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?_r=self.performance.now.bind(self.performance):Date.now!==void 0?_r=Date.now:_r=function(){return new Date().getTime()};
435var Cn=_r,Cf=(function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},n.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},n.prototype.update=function(t,e){var s=Object.keys(this._tweens);if(s.length===0)return!1;for(t=t!==void 0?t:Cn();s.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<s.length;i++){var r=this._tweens[s[i]];r&&r.update(t)===!1&&(r.playing=!1,e||delete this._tweens[s[i]])}s=Object.keys(this._tweensAddedDuringUpdate)}return!0},n})(),Or={Linear:{None:function(n){return n}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.cos(n*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.cos(Math.PI*n))}},Exponential:{In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}},Back:{In:function(n){var t=1.70158;return n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-Or.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Or.Bounce.In(n*2)*.5:Or.Bounce.Out(n*2-1)*.5+.5}}},Pn={Linear:function(n,t){var e=n.length-1,s=e*t,i=Math.floor(s),r=Pn.Utils.Linear;return t<0?r(n[0],n[1],s):t>1?r(n[e],n[e-1],e-s):r(n[i],n[i+1>e?e:i+1],s-i)},Bezier:function(n,t){for(var e=0,s=n.length-1,i=Math.pow,r=Pn.Utils.Bernstein,o=0;o<=s;o++)e+=i(1-t,s-o)*i(t,o)*n[o]*r(s,o);return e},CatmullRom:function(n,t){var e=n.length-1,s=e*t,i=Math.floor(s),r=Pn.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(i=Math.floor(s=e*(1+t))),r(n[(i-1+e)%e],n[i],n[(i+1)%e],n[(i+2)%e],s-i)):t<0?n[0]-(r(n[0],n[0],n[1],n[1],-s)-n[0]):t>1?n[e]-(r(n[e],n[e],n[e-1],n[e-1],s-e)-n[e]):r(n[i?i-1:0],n[i],n[e<i+1?e:i+1],n[e<i+2?e:i+2],s-i)},Utils:{Linear:function(n,t,e){return(t-n)*e+n},Bernstein:function(n,t){var e=Pn.Utils.Factorial;return e(n)/e(t)/e(n-t)},Factorial:(function(){var n=[1];return function(t){var e=1;if(n[t])return n[t];for(var s=t;s>1;s--)e*=s;return n[t]=e,e}})(),CatmullRom:function(n,t,e,s,i){var r=(e-n)*.5,o=(s-t)*.5,a=i*i,h=i*a;return(2*t-2*e+r+o)*h+(-3*t+3*e-2*r-o)*a+r*i+t}}},cy=(function(){function n(){}return n._nextId=0,n.nextId=function(){return n._nextId++},n})(),uy=(function(){function n(t,e){this.playing=!1,this.paused=!1,this.pauseStart=0,this.valuesStart={},this.valuesEnd={},this.valuesStartRepeat={},this.durationValue=1e3,this.repeatValue=0,this.yoyoValue=!1,this.reversed=!1,this.delayTime=0,this.startTime=0,this.easingFunction=Or.Linear.None,this.interpolationFunction=Pn.Linear,this.chainedTweens=[],this.onStartCallbackFired=!1,this.id=cy.nextId(),this.object=t,this.groupRef=e||n.TWEEN}return n.inject=function(t){n.TWEEN=t},n.prototype.getId=function(){return this.id},n.prototype.isPlaying=function(){return this.playing},n.prototype.isPaused=function(){return this.paused},n.prototype.to=function(t,e){return this.valuesEnd=Object.create(t),e!==void 0&&(this.durationValue=e),this},n.prototype.duration=function(t){return this.durationValue=t,this},n.prototype.start=function(t){this.groupRef.add(this),this.playing=!0,this.paused=!1,this.onStartCallbackFired=!1,this.startTime=t!==void 0?typeof t=="string"?Cn()+parseFloat(t):t:Cn(),this.startTime+=this.delayTime;for(var e in this.valuesEnd){if(this.valuesEnd[e]instanceof Array){if(this.valuesEnd[e].length===0)continue;this.valuesEnd[e]=[this.object[e]].concat(this.valuesEnd[e])}this.object[e]!==void 0&&(typeof this.valuesStart[e]>"u"&&(this.valuesStart[e]=this.object[e]),this.valuesStart[e]instanceof Array||(this.valuesStart[e]*=1),this.valuesStartRepeat[e]=this.valuesStart[e]||0)}return this},n.prototype.stop=function(){return this.playing?(this.groupRef.remove(this),this.playing=!1,this.paused=!1,this.onStopCallback&&this.onStopCallback(this.object),this.stopChainedTweens(),this):this},n.prototype.end=function(){return this.update(1/0),this},n.prototype.pause=function(t){return this.paused||!this.playing?this:(this.paused=!0,this.pauseStart=t===void 0?Cn():t,this.groupRef.remove(this),this)},n.prototype.resume=function(t){return!this.paused||!this.playing?this:(this.paused=!1,this.startTime+=(t===void 0?Cn():t)-this.pauseStart,this.pauseStart=0,this.groupRef.add(this),this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this.chainedTweens.length;t<e;t++)this.chainedTweens[t].stop()},n.prototype.group=function(t){return this.groupRef=t,this},n.prototype.delay=function(t){return this.delayTime=t,this},n.prototype.repeat=function(t){return this.repeatValue=t,this},n.prototype.repeatDelay=function(t){return this.repeatDelayTime=t,this},n.prototype.yoyo=function(t){return this.yoyoValue=t,this},n.prototype.easing=function(t){return this.easingFunction=t,this},n.prototype.interpolation=function(t){return this.interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.chainedTweens=t,this},n.prototype.onStart=function(t){return this.onStartCallback=t,this},n.prototype.onUpdate=function(t){return this.onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this.onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this.onCompleteCallback=t,this},n.prototype.onStop=function(t){return this.onStopCallback=t,this},n.prototype.update=function(t){t===void 0&&(t=0);var e,s,i;if(t<this.startTime)return!0;this.onStartCallbackFired===!1&&(this.onStartCallback&&this.onStartCallback(this.object),this.onStartCallbackFired=!0),s=(t-this.startTime)/this.durationValue,s=this.durationValue===0||s>1?1:s,i=this.easingFunction(s);for(e in this.valuesEnd)if(this.valuesStart[e]!==void 0){var r=this.valuesStart[e]||0,o=this.valuesEnd[e];o instanceof Array?this.object[e]=this.interpolationFunction(o,i):(typeof o=="str
435ing"&&(o.charAt(0)==="+"||o.charAt(0)==="-"?o=r+parseFloat(o):o=parseFloat(o)),typeof o=="number"&&(this.object[e]=r+(o-r)*i))}if(this.onUpdateCallback&&this.onUpdateCallback(this.object,s),s===1)if(this.repeatValue>0){isFinite(this.repeatValue)&&this.repeatValue--;for(e in this.valuesStartRepeat){if(typeof this.valuesEnd[e]=="string"&&(this.valuesStartRepeat[e]=this.valuesStartRepeat[e]+parseFloat(this.valuesEnd[e])),this.yoyoValue){var a=this.valuesStartRepeat[e];this.valuesStartRepeat[e]=this.valuesEnd[e],this.valuesEnd[e]=a}this.valuesStart[e]=this.valuesStartRepeat[e]}return this.yoyoValue&&(this.reversed=!this.reversed),this.repeatDelayTime!==void 0?this.startTime=t+this.repeatDelayTime:this.startTime=t+this.delayTime,this.onRepeatCallback&&this.onRepeatCallback(this.object),!0}else{this.onCompleteCallback&&this.onCompleteCallback(this.object);for(var h=0,l=this.chainedTweens.length;h<l;h++)this.chainedTweens[h].start(this.startTime+this.durationValue);return!1}return!0},n})(),mC="18.6.0",yC=(function(){var n=function(t,e){return n=Object.
435setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var r in i)i.hasOwnProperty(r)&&(s[r]=i[r])},n(t,e)};return function(t,e){n(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}})(),xC=(function(n){yC(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.version=mC,e.now=Cn,e.Group=Cf,e.Easing=Or,e.Interpolation=Pn,e.nextId=cy.nextId,e.Tween=uy,e}return t})(Cf),J=new xC;uy.inject(J);class fs{constructor(){}update(t){J.update(t)}}class Ma extends fs{constructor(t,e,s,i){super(),new J.Tween(t).to({alpha:e},s).easing(J.Easing.Linear.None).onComplete(()=>i()).start()}}const _C={y:0,height:570},bC={stripes:{y:3,height:565}};class wC extends j{constructor(){super(),this.Main=Rt.getInstance(),this.TopLayer=Ki.getInstance(),this.events=Et,this.currColor=ay,this.currType=hy,this.getTexture=t=>t==Ft.full?new $($.EMPTY):_t.getTexture(`./images/scene/frame_b2_${t}.png`),this.addBounds(),this.addFrame(),this.addTypeFrame(),this.addToLayer(),this.events.on("updateWFireworkTexture",t=>this.updateTexture(t))}addBounds(){this.dim=this.Main.getDim();const{frame:t}=di(this.dim.width,this.dim.height).box;this.x=t.x,this.y=t.y}resize(){this.addBounds()}addFrame(){const t=this.getTexture(zt.purple),{frame:e}=di(this.dim.width,this.dim.height).box;this.frame=new it(t),this.frame.width=e.width,this.frame.height=e.height,this.frame.anchor.set(.5),this.addChild(this.frame)}addTypeFrame(){const t=this.getTexture(Ft.full),{frame:e}=di(this.dim.width,this.dim.height).box;this.typeFrame=new it(t),this.typeFrame.width=e.width,this.typeFrame.height=e.height,this.typeFrame.anchor.set(.5),this.addChild(this.typeFrame)}updateTexture(t){const e=Qn[t];if(e.color==this.currColor&&e.type==this.currType)return;const s=bC[e.type]||_C;new Ma(this,.3,200,()=>{this.frame.texture=this.getTexture(e.color),this.typeFrame.texture=this.getTexture(e.type),this.typeFrame.height=s.height,this.typeFrame.y=s.y,new Ma(this,1,200,()=>{this.currColor=e.color,this.currType=e.type})})}addToLayer(){this.TopLayer.addChild(this)}}class Ki extends ui{constructor(){super(),Ki.instance||(Ki.instance=this),this.boxFrame=new wC}resize(){this.boxFrame.resize()}static getInstance(){return Ki.instance}}const me={BetAmountChanged:"betAmountChanged",LoadingStarted:"loadingStarted",LoadingProgress:"loadingProgress",LoadingEnded:"loadingEnded",GameReady:"gameReady",RoundStarted:"roundStarted",GameError:"gameError"};class lt extends re{constructor(){super(),this.balance=0,this.currency=null,this.betAmount=0,this.betIndex=0,this.totalWin=0,this.funMode=!1,this.infoBarEnabled=!1,this.language="en",this.gameId=null,this.walletId=null,this.sessionId=null,this.playerId=null,this.operatorId=null,this.inRound=!1,this.autoplayActive=!1,this.backendStatus="starting"}static getInstance(){return lt.instance||(lt.instance=new lt),lt.instance}getBalance(){return this.balance}setBalance(t){Z.info(`Set balance: ${t}`),t!==this.balance&&(this.balance=t,this.emit("balanceChanged",t))}getCurrency(){return this.currency}setCurrency(t){this.currency=t,this.emit("currencyChanged",t)}getBetAmount(){return this.betAmount}setBetAmount(t){t!==this.betAmount&&(this.betAmount=t,this.emit("betAmountChanged",t))}getBetIndex(){return this.betIndex}setBetIndex(t){this.betIndex=t}getTotalWin(){return this.totalWin}setTotalWin(t){t!==this.totalWin&&(this.totalWin=t,this.emit("totalWinChanged",t))}isFunMode(){return this.funMode}setFunMode(t){t!==this.funMode&&(this.funMode=t,this.emit("funModeChanged",t))}isInfoBarEnabled(){return this.infoBarEnabled}setInfoBarEnabled(t){this.infoBarEnabled=t}canAffordBet(){return this.balance>=this.betAmount}getLanguage(){return this.language}setLanguage(t){this.language=t}getGameId(){return this.gameId}setGameId(t){this.gameId=t}getWalletId(){return this.walletId}setWalletId(t){this.walletId=t}getSessionId(){return this.sessionId}setSessionId(t){this.sessionId=t}getPlayerId(){return this.playerId}setPlayerId(t){this.playerId=t}getOperatorId(){return this.operatorId}setOperatorId(t){this.operatorId=t}
435startRound(){this.inRound=!0,this.emit("roundStarted")}endRound(){this.inRound=!1,this.emit("roundEnded")}isInRound(){return this.inRound}isAutoplayActive(){return this.autoplayActive}setAutoplayActive(t){t!==this.autoplayActive&&(this.autoplayActive=t,this.emit("autoplayActiveChanged",t))}reportError(t,e){this.emit("gameError",t,e)}triggerRealityCheck(t){this.emit("realityCheck",t)}getBackendStatus(){return this.backendStatus}setBackendStatus(t){t!==this.backendStatus&&(this.backendStatus=t,this.emit("backendStatusChanged",t))}}function SC(){if(!(typeof performance>"u"))return Math.round(performance.now())}function dy(n){return{durationMs:n,sinceNavigationMs:SC()}}const Zh={STAKE_TOO_LOW:"STAKE_TOO_LOW",STAKE_TOO_HIGH:"STAKE_TOO_HIGH",INVALID_AMOUNT:"INVALID_AMOUNT"};class Cs{constructor(){this.configService=null}static getInstance(){return Cs.instance||(Cs.instance=new Cs),Cs.instance}init(t,e=0){this.configService=t,t.onBetsUpdated(()=>{this.handleBetsUpdated()});const s=t.getConfig();Z.info(`Stakes min: ${s.stakeConfiguration.min}, max: ${s.stakeConfiguration.max}, presets: ${s.stakeConfiguration.presetAmounts}`);const i=this.getAvailableAmounts(),r=i.length>0?Math.max(0,Math.min(i.length-1,e)):0,o=i.length>0?i[r]:1,a=lt.getInstance();a.setBetIndex(r),a.setBetAmount(o)}canStep(t){const e=lt.getInstance().getBetIndex()+t;return e>=0&&e<this.getAvailableAmounts().length}stepBet(t){const e=lt.getInstance(),s=this.getAvailableAmounts(),i=e.getBetIndex(),r=Math.max(0,Math.min(s.length-1,i+t));if(r===i)return{isValid:!0};const o=s[r],a=this.validateAmount(o);return a.isValid?(e.setBetIndex(r),e.setBetAmount(o)):Z.warn("Invalid bet amount after step:",a),a}handleBetsUpdated(){Z.info("Bets config updated");const t=lt.getInstance(),e=t.getBetAmount(),s=this.getAvailableAmounts(),i=this.validateAmount(e);if(!i.isValid){Z.info("Current bet amount invalid after update:",i);const o=i.suggestedAmount||s[0];if(s.includes(o)){Z.info("Updating to suggested amount:",o);const a=s.indexOf(o);t.setBetIndex(a===-1?0:a),t.setBetAmount(o);return}}const r=s.indexOf(t.getBetAmount());t.setBetIndex(r===-1?0:r)}getAvailableAmounts(){if(!this.configService)return[];const{min:t,max:e}=this.configService.getConfig().stakeConfiguration;return this.configService.getPresetAmounts().filter(s=>s>=t&&s<=e)}validateAmount(t){if(!this.configService)throw Z.error("StakeService must be initialized before calling validateAmount"),new Error("StakeService must be initialized before calling validateAmount");const{min:e,max:s,presetAmounts:i,allowCustomAmounts:r}=this.configService.getConfig().stakeConfiguration;return t<e?{isValid:!1,errorCode:Zh.STAKE_TOO_LOW,errorMessage:`Minimum stake is ${e}`,suggestedAmount:e}:t>s?{isValid:!1,errorCode:Zh.STAKE_TOO_HIGH,errorMessage:`Maximum stake is ${s}`,suggestedAmount:s}:!r&&i&&i.length>0&&!i.includes(t)?{isValid:!1,errorCode:Zh.INVALID_AMOUNT,errorMessage:"Please select from available amounts",suggestedAmount:this.findClosestPresetAmount(t,i)}:{isValid:!0}}findClosestPresetAmount(t,e){return e.reduce((s,i)=>Math.abs(i-t)<Math.abs(s-t)?i:s)}}
435const vC="./images/scene/ui_pay_amount.png";let TC=class extends j{constructor(t){super(),this.events=Et,this.onBetChanged=()=>this.refresh(),this.Bounds=t,this.x=t.x,this.y=t.y,this.addBg(),this.addAmount(),this.events.on("increaseAmount",()=>Cs.getInstance().stepBet(1)),this.events.on("decreaseAmount",()=>Cs.getInstance().stepBet(-1)),this.events.on("setBetByValue",e=>this.setBetByValue(e)),lt.getInstance().on(me.BetAmountChanged,this.onBetChanged)}destroy(t){lt.getInstance().off(me.BetAmountChanged,this.onBetChanged),super.destroy(t)}setBetByValue(t){const e=Cs.getInstance();if(!e.validateAmount(t).isValid)return;const s=e.getAvailableAmounts().indexOf(t);if(s<0)return;const i=lt.getInstance();i.setBetAmount(t),i.setBetIndex(s)}addBg(){const t=_t.getTexture(vC);this.bg=new it(t),this.bg.width=this.Bounds.width,this.bg.height=this.Bounds.height,this.bg.anchor.set(.5),this.addChild(this.bg)}relayout(t){this.Bounds=t,this.x=t.x,this.y=t.y,this.bg.width=t.width,this.bg.height=t.height,this.amountText.style.fontSize=t.fontSize}addAmount(){const t={fill:16777215,fontSize:this.Bounds.fontSize};this.amountText=new ht({text:"",style:t}),this.amountText.anchor.set(.5),this.amountText.x=0,this.amountText.y=17,this.amountText.style.fontWeight="700",this.addChild(this.amountText),this.refresh()}refresh(){const t=us.getInstance(),e=lt.getInstance().getBetAmount();this.amountText.text=t.formatCurrency(e),this.emitStatus()}emitStatus(){const t=Cs.getInstance();t.canStep(-1)?t.canStep(1)?this.events.emit("betAmountStatus",yi.nonExtreme):this.events.emit("betAmountStatus",yi.max):this.events.emit("betAmountStatus",yi.min)}},fy;function AC(n){return fy=n,n}function to(){return fy}class ic{static setParamValue(t,e){if(t.setValueAtTime){const s=to().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}class CC extends re{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}let PC=0;const nc=class extends re{constructor(n){super(),this.id=PC++,this.init(n)}set(n,t){if(this[n]===void 0)throw new Error(`Property with name ${n} does not exist.`);switch(n){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:n}=this._source;return n/this._duration}get paused(){return this._paused}set paused(n){this._paused=n,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(n){this._playing=!1,this._duration=n.source.duration;const t=this._source=n.source.cloneNode(!1);t.src=n.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),n.context.on("refresh",this.refresh,this),n.context.on("refreshPaused",this.refreshPaused,this),this._media=n}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(n){this._speed=n,this.refresh()}get volume(){return this._volume}set volume(n){this._volume=n,this.refresh()}get loop(){return this._loop}set loop(n){this._loop=n,this.refresh()}get muted(){return this._muted}set muted(n){this._muted=n,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(n){console.warn("HTML Audio does not support filters")}refresh(){const n=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=n.volume*(n.muted?0:1),s=t.volume*(t.muted?0:1),i=this._volume*(this._muted?0:1);this._source.volume=i*e*s,this._source.playbackRate=this._speed*n.speed*t.speed}refreshPaused(){const n=this._media.context,t=this._media.parent,e=this._paused||t.paused||n.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit
435("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(n){const{start:t,end:e,speed:s,loop:i,volume:r,muted:o}=n;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=r,this._loop=!!i,this._muted=o,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-nc.PADDING),this._end=Math.min(this._end+nc.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Zt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){Zt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){Zt.shared.remove(this._onUpdate,this),this.removeAllListeners();const n=this._source;n&&(n.onended=null,n.onplay=null,n.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let py=nc;py.PADDING=.1;class MC extends re{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new py(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const h=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,h)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const i=()=>{a(),s.isLoaded=!0;const h=s.autoPlayStart();t&&t(null,s,h)},r=()=>{a(),t&&t(new Error("Sound loading has been aborted"))},o=()=>{a();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},a=()=>{e.removeEventListener("canplaythrough",i),e.removeEventListener("load",i),e.removeEventListener("abort",r),e.removeEventListener("error",o)};e.addEventListener("canplaythrough",i,!1),e.addEventListener("load",i,!1),e.addEventListener("abort",r,!1),e.addEventListener("error",o,!1),e.load()}}class kC{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const ka=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],IC=["audio/mpeg","audio/ogg"],Ia={};function EC(n){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"'},e=document.createElement("audio"),s={},i=/^no$/;ka.forEach(r=>{const o=e.canPlayType(`audio/${r}`).replace(i,""),a=t[r]?e.canPlayType(t[r]).replace(i,""):"";s[r]=!!o||!!a}),Object.assign(Ia,s)}EC();let FC=0;class BC extends re{constructor(t){super(),this.id=FC++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}
435stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),i=e.volume*(e.muted?0:1),r=this._volume*(this._muted?0:1);ic.setParamValue(this._gain.gain,r*i*s),ic.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e}),t.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:i,loop:r,volume:o,muted:a,filters:h}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=i,this._volume=o,this._loop=!!r,this._muted=a,this._filters=h,this.refresh();const u=this._source.buffer.duration;this._duration=u,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){Zt.shared.remove(this._updateListener,this),t&&Zt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const i=this._source.playbackRate.value;this._elapsed+=s*i,this._lastUpdate=e;const r=this._duration;let o;if(this._source.loopStart){const a=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%a)/r}else o=this._elapsed%r/r;this._progress=o,this.emit("progress",this._progress,r)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class gy{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}
435set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const my=class extends gy{constructor(n){const t=n.audioContext,e=t.createBufferSource(),s=t.createGain(),i=t.createAnalyser();e.connect(i),i.connect(s),s.connect(n.destination),super(i,s),this.context=n,this.bufferSource=e,this.gain=s,this.analyser=i}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(my.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const n=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=n.buffer,ic.setParamValue(t.playbackRate,n.playbackRate.value),t.loop=n.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let yy=my;yy.BUFFER_SIZE=0;class RC{init(t){this.parent=t,this._nodes=new yy(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new BC(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await ft.get().fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(i,r)=>{if(i)e&&e(i);else{this.parent.isLoaded=!0,this.buffer=r;const o=this.parent.autoPlayStart();e&&e(null,this.parent,o)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const mn=class{static from(n){let t={};typeof n=="string"?t.url=n:n instanceof ArrayBuffer||n instanceof AudioBuffer||n instanceof HTMLAudioElement?t.source=n:Array.isArray(n)?t.url=n:t=n,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=to().useLegacy?new MC:new RC;return new mn(e,t)}constructor(n,t){this.media=n,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(n){const[t]=n.map(e=>({url:e,ext:ie.extname(e).slice(1)})).filter(({ext:e})=>Ia[e]).sort((e,s)=>ka.indexOf(e.ext)-ka.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return to().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(n){this._paused=n,this.refreshPaused()}get speed(){return this._speed}set speed(n){this._speed=n,this.refresh()}get filters(){return this.media.filters}set filters(n){this.media.filters=n}addSprites(n,t){if(typeof n=="object"){const s={};for(const i in n)s[i]=this.addSprites(i,n[i]);return s}console.assert(!this._sprites[n],`Alias ${n} is already taken`);const e=new kC(this,t);return this._sprites[n]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(n){if(n){const t=this._sprites[n];t!==void 0&&(t.destroy(),delete this._sprites[n])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let n=this._instances.length-1;n>=0;n--)this._instances[n].stop();return this}play(n,t){let e;if(typeof n=="string"?e={sprite:n,loop:this.loop,complete:t}:typeof n=="function"?(e={},e.complete=n):e=n,e={complete:null,loaded:null,sprite:null,end:null,
435start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const i=e.sprite;console.assert(!!this._sprites[i],`Alias ${i} is not available`);const r=this._sprites[i];e.start=r.start+(e.start||0),e.end=r.end,e.speed=r.speed||1,e.loop=r.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(i=>{this._preloadQueue.push(()=>{i(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((i,r)=>{this._preload((o,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?r(o):(e.loaded&&e.loaded(o,a,h),i(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const n=this._instances.length;for(let t=0;t<n;t++)this._instances[t].refresh()}refreshPaused(){const n=this._instances.length;for(let t=0;t<n;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(n){this._volume=n,this.refresh()}get muted(){return this._muted}set muted(n){this._muted=n,this.refresh()}get loop(){return this._loop}set loop(n){this._loop=n,this.refresh()}_preload(n){this.media.load(n)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let n;return this.autoPlay&&(n=this.play(this._autoPlayOptions)),n}_removeInstances(){for(let n=this._instances.length-1;n>=0;n--)this._poolInstance(this._instances[n]);this._instances.length=0}_onComplete(n){if(this._instances){const t=this._instances.indexOf(n);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(n)}_createInstance(){if(mn._pool.length>0){const n=mn._pool.pop();return n.init(this.media),n}return this.media.create()}_poolInstance(n){n.destroy(),mn._pool.indexOf(n)<0&&mn._pool.push(n)}};let Ea=mn;Ea._pool=[];class eo extends gy{constructor(){const t=window,e=new eo.AudioContext,s=e.createDynamicsCompressor(),i=e.createAnalyser();i.connect(s),s.connect(e.destination),super(i,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new eo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=i,this.events=new re,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=r=>{e(new Error(r?.message||"Unable to decode file"))},i=this._offlineCtx.decodeAudioData(t,r=>{e(null,r)},s);i&&i.catch(s)}}class LC{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new eo),this._htmlAudioContext=new CC,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return eo.AudioContext!==null}add(t,e){if(typeof t=="object"){const r={};for(const o in t){const a=this._getOptions(t[o],e);r[o]=this.add(o,a)}return r}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ea)return this._sounds[t]=e,e;const s=this._getOptions(e),i=Ea.from(s);return this._sounds[t]=i,i}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const Pf=n=>{const t=n.src;let e=n?.alias?.[0];return(!e||n.src===e)&&(e=ie.basename(t,ie.extname(t))),e},OC={extension:X.Asset,detection:{test:async()=>!0,add:async n=>[...n,...ka.filter(t=>Ia[t])],remove:async n=>n.filter(t=>n.includes(t))},loader:{name:"sound",extension:{type:[X.LoadParser],priority:ds.High},test(n){const t=ie.extname(n).slice(1);return!!Ia[t]||IC.some(e=>n.startsWith(`data:${e}`))},async load(n,t){const e=await new Promise((s,i)=>Ea.from({...t.data,url:n,preload:!0,loaded(r,o){r?i(r):s(o),t.data?.loaded?.(r,o)}}));return to().add(Pf(t),e),e},async unload(n,t){to().remove(Pf(t))}}};yt.add(OC);const Ns=AC(new LC);class DC{getString(t){return localStorage.getItem(t)??void 0}setString(t,e){localStorage.setItem(t,e)}
435getNumber(t){const e=this.getString(t)??void 0,s=Number(e);return isNaN(s)?null:s}setNumber(t,e){this.setString(t,String(e))}getBool(t){const e=localStorage.getItem(t);return e?!!e.toLowerCase():void 0}setBool(t,e){localStorage.setItem(t,String(e))}getObject(t){const e=this.getString(t);if(e)try{return JSON.parse(e)}catch(s){Z.warn(s);return}}setObject(t,e){this.setString(t,JSON.stringify(e))}}const Qs=new DC;function Dr(n){for(const t of[n,`main/sounds/${n}`]){if(Ns.exists(t))return Ns.find(t);try{const e=ae.get(t);if(e&&typeof e.play=="function")return e}catch(e){Z.error(`Error resolving sound "${t}" from Assets:`,e)}}}class NC{constructor(){this.volume=1}async play(t,e){if(this.currentAlias!==t)try{const s=Dr(t);if(s&&this.isAlreadyPlaying(s)){this.currentAlias=t;return}if(this.fadeOutCurrent(),this.current=s,!this.current){Z.error(`Background music not available: ${t}`),this.currentAlias=void 0;return}this.currentAlias=t,this.current.play({loop:!0,...e}),this.current.volume=0;const i=this.volume;ct.to(this.current,{volume:i,duration:1,ease:"none"})}catch(s){Z.warn(`Failed to play sound: ${t}`,s),this.currentAlias=void 0}}isAlreadyPlaying(t){return this.current?.isPlaying?t===this.current?!0:!!t.url&&t.url===this.current.url:!1}fadeOutCurrent(){if(!this.current||(ct.killTweensOf(this.current),!this.current.isPlaying))return;const t=this.current;ct.to(t,{volume:0,duration:1,ease:"none",onComplete(){t.stop()}})}getVolume(){return this.volume}setVolume(t){this.volume=t,this.current&&(this.current.volume=this.volume)}pause(){this.current&&this.current.isPlaying&&this.current.pause()}resume(){this.current&&this.current.paused?(this.current.resume(),this.current.volume=this.volume):this.current&&!this.current.isPlaying&&this.currentAlias&&this.play(this.currentAlias)}isPlaying(){return this.current?this.current.isPlaying:!1}isPaused(){return this.current?this.current.paused:!1}}class WC{constructor(){this.volume=1}play(t,e,s=0){const i=Dr(t);if(!i){s<3?(Z.warn(`Sound not registered yet: ${t}, retrying... (attempt ${s+1}/3)`),setTimeout(()=>{this.play(t,e,s+1)},200+s*200)):Z.error(`Sound not available after 3 attempts: ${t}`);return}try{const r=this.volume*(e?.volume??1);i.play({...e,volume:r})}catch(r){Z.error(`Error playing sound ${t}:`,r)}}getVolume(){return this.volume}setVolume(t){this.volume=t}}var Ei=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},fe=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},yn,We,xn,br,ea;const zC=.8,YC=.25,VC=.8,UC=2;class GC extends re{constructor(){super(...arguments),yn.set(this,!1),this.prefix="",We.set(this,!0),xn.set(this,!1),br.set(this,"once"),ea.set(this,`DO YOU WANT TO
436ENABLE SOUNDS?`),this.bgm=new NC,this.sfx=new WC,this.soundPromptStyle=null}init(t){this.prefix=t.prefix,Ei(this,yn,!0,"f"),Ns.disableAutoPause=!0;const e=Qs.getString(this.key("sound-enabled"));e!==void 0&&(Ei(this,We,e==="true","f"),Ei(this,xn,!0,"f")),this.applySoundState()}get initialized(){return fe(this,yn,"f")}get enabled(){return fe(this,We,"f")}set enabled(t){Ei(this,We,t,"f"),Ei(this,xn,!0,"f"),Qs.setString(this.key("sound-enabled"),String(t)),this.applySoundState(),this.emit("enabledChanged",t)}get hasAskedForSoundPermission(){return fe(this,xn,"f")}set soundPromptMode(t){Ei(this,br,t,"f")}get soundPromptMode(){return fe(this,br,"f")}set soundPromptMessage(t){Ei(this,ea,t,"f")}get soundPromptMessage(){return fe(this,ea,"f")}get shouldShowSoundPrompt(){switch(fe(this,br,"f")){case"always":return!0;case"never":return!1;case"once":return!fe(this,xn,"f")}}get masterVolume(){return Qs.getNumber(this.volumeKey("volume-master"))??zC}set masterVolume(t){Qs.setNumber(this.volumeKey("volume-master"),t),fe(this,We,"f")&&this.applyMasterVolume(t)}get bgmVolume(){return Qs.getNumber(this.volumeKey("volume-bgm"))??YC}set bgmVolume(t){Qs.setNumber(this.volumeKey("volume-bgm"),t),fe(this,We,"f")&&this.bgm.setVolume(t)}get sfxVolume(){return Qs.getNumber(this.volumeKey("volume-sfx"))??VC}set sfxVolume(t){Qs.setNumber(this.volumeKey("volume-sfx"),t),fe(this,We,"f")&&this.sfx.setVolume(t)}registerSounds(t){for(const[e,s]of Object.entries(t))Ns.add(e,{url:s,preload:!0})}playSFX(t,e){!fe(this,yn,"f")||!fe(this,We,"f")||this.sfx.play(t,e)}
436playBackgroundMusic(t){this.lastBgmAlias=t,!(!fe(this,yn,"f")||!fe(this,We,"f"))&&this.checkSoundExists(t)&&this.bgm.play(t)}stopBackgroundMusic(){this.bgm.current&&this.bgm.current.stop()}stopSFX(t){Dr(t)?.stop()}findSFX(t){return Dr(t)??null}resumeBackgroundMusic(){fe(this,We,"f")&&this.lastBgmAlias&&(this.bgm.currentAlias=void 0,this.playBackgroundMusic(this.lastBgmAlias))}pauseAll(){Ns.pauseAll()}resumeAll(){fe(this,We,"f")&&Ns.resumeAll()}key(t){return`${this.prefix}:${t}`}volumeKey(t){return this.key(`${t}-v${UC}`)}applyMasterVolume(t){Ns.volumeAll=t,t?Ns.unmuteAll():Ns.muteAll()}applySoundState(){if(fe(this,We,"f")){const t=this.masterVolume,e=this.bgmVolume,s=this.sfxVolume;this.applyMasterVolume(t),this.bgm.setVolume(e),this.sfx.setVolume(s);const i=this.bgm.isPlaying();this.bgm.isPaused()?this.bgm.resume():!i&&this.lastBgmAlias&&(this.bgm.currentAlias=void 0,this.bgm.play(this.lastBgmAlias))}else this.applyMasterVolume(0),this.bgm.setVolume(0),this.sfx.setVolume(0),this.bgm.current&&this.bgm.pause()}checkSoundExists(t){return Dr(t)!==void 0}}yn=new WeakMap,We=new WeakMap,xn=new WeakMap,br=new WeakMap,ea=new WeakMap;function gu(n){return Math.max(1,window.innerHeight/n*(window.devicePixelRatio||1))}const xy={overlayColor:0,overlayAlpha:.3,panelWidth:810,panelHeight:330,panelColor:1710638,panelRadius:10,panelBorderColor:4473958,panelBorderWidth:2,panelHeaderHeight:0,buttonYesColor:3066944,buttonNoColor:13382451,buttonHoverYesColor:4053839,buttonHoverNoColor:14500932,buttonWidth:180,buttonHeight:60,buttonRadius:12,buttonOffsetY:60,fontSize:32,fontFamily:"Arial",textColor:16777215,textStrokeColor:"black",textStrokeWidth:4,titleFontSize:40,titleFontWeight:"bold",titleY:-120,messageFontWeight:"normal",messageY:-50,buttonFontWeight:"bold",buttonLabelOffsetX:0,buttonLabelOffsetY:0,dropShadow:null,yesLabel:"YES",noLabel:"NO",spacing:40,animationDuration:.3,enterAnimation:"drop"},XC=["panelHeaderColor","titleFontFamily","titleColor","titleStrokeColor","titleStrokeWidth","messageFontFamily","messageColor","messageStrokeColor","messageStrokeWidth","buttonLabelFontFamily","buttonLabelFontSize","buttonLabelColor","buttonLabelStrokeColor","buttonLabelStrokeWidth"],$C=[...Object.keys(xy),...XC],HC=1.05;class jC extends j{constructor(t={}){super(),this.textElements=[],this.lastHeight=0,this.theme={...xy,...t.theme},this.onComplete=t.onComplete;const e=t.assets??{};if(this.overlay=new Wt,this.overlay.interactive=!0,this.addChild(this.overlay),this.panel=new j,e.panelScale!==void 0&&this.panel.scale.set(e.panelScale),this.addChild(this.panel),e.panelView){const{panelWidth:l,panelHeight:c}=this.theme,u=e.panelView(l,c);u.position.set(-l/2,-c/2),this.panel.addChild(u)}else if(e.panelTexture){const l=new it(e.panelTexture);l.anchor.set(.5),l.width=this.theme.panelWidth,l.height=this.theme.panelHeight,this.panel.addChild(l)}else{const l=new Wt;l.roundRect(-this.theme.panelWidth/2,-this.theme.panelHeight/2,this.theme.panelWidth,this.theme.panelHeight,this.theme.panelRadius),l.fill(this.theme.panelColor),this.drawPanelHeader(l),this.theme.panelBorderWidth>0&&(l.roundRect(-this.theme.panelWidth/2,-this.theme.panelHeight/2,this.theme.panelWidth,this.theme.panelHeight,this.theme.panelRadius),l.stroke({color:this.theme.panelBorderColor,width:this.theme.panelBorderWidth})),this.panel.addChild(l)}if(t.title){const l=new wt({fontFamily:this.theme.titleFontFamily??this.theme.fontFamily,fontSize:this.theme.titleFontSize,fontWeight:this.theme.titleFontWeight,fill:this.theme.titleColor??this.theme.textColor,stroke:{color:this.theme.titleStrokeColor??this.theme.textStrokeColor,width:this.theme.titleStrokeWidth??this.theme.textStrokeWidth,join:"round"},align:"center",...this.dropShadowStyle()}),c=new ht({text:t.title,style:l});c.anchor.set(.5),c.y=this.theme.titleY,this.panel.addChild(c),this.textElements.push(c)}const s=t.message??se.soundPromptMessage,i=new wt({fontFamily:this.theme.messageFontFamily??this.theme.fontFamily,fontSize:this.theme.fontSize+4,fontWeight:this.theme.messageFontWeight,fill:this.theme.messageColor??this.theme.textColor,stroke:{color:this.theme.messageStrokeColor??this.theme.textStrokeColor,width:this.theme.messageStrokeWidth??this.theme.textStrokeWidth,join:"round"},align:"center",...this.dropShadowStyle()}),r=new ht({text:s,style:i});r.anchor.set(.5),r.y=this.theme.messageY,this.panel.addChild(r),this.textElements.push(r);const o=e.tintAndLabelSpriteButtons===!0,a=e.yesButtonTexture?this.createSpriteButton(e.yesButtonTexture,o?this.theme.yesLabel:"",o?this.theme.buttonYesColor:16777215,o?this.theme.buttonHoverYesColor:16777215,()=>this.handleChoice(!0)):this.createButton(this.theme.yesLabel,this.theme.buttonYesColor,this.theme.buttonHoverYesColor,()=>this.handleChoice(!0));a.x=-(this.theme.buttonWidth+this.theme.spacing)/2,a.y=this.theme.buttonOffsetY,this.panel.addChild(a);const h=e.noButtonTexture?this.createSpriteButton(e.noButtonTexture,o?this.theme.noLabel:"",o?this.theme.buttonNoColor:16777215,o?this.theme.buttonHoverNoColor:16777215,()=>this.handleChoice(!1)):this.createButton(this.theme.noLabel,this.theme.buttonNoColor,this.theme.buttonHoverNoColor,()=>this.handleChoice(!1));h.x=(this.theme.buttonWidth+this.theme.spacing)/2,h.y=this.theme.buttonOffsetY,this.panel.addChild(h)}dropShadowStyle(){return{dropShadow:this.theme.dropShadow??!1}}createSpriteButton(t,e,s,i,r){const o=new j;o.interactive=!0,o.cursor="pointer";const a=new it(t);if(a.anchor.set(.5),a.width=this.theme.buttonWidth,a.height=this.theme.buttonHeight,a.tint=s,o.addChild(a),e){const h=new wt({fontFamily:this.theme.buttonLabelFontFamily??this.theme.fontFamily,fontSize:this.theme.buttonLabelFontSize??this.theme.fontSize,fontWeight:this.theme.buttonFontWeight,fill:this.theme.buttonLabelColor??this.theme.textColor,stroke:{color:this.theme.buttonLabelStrokeColor??this.theme.textStrokeColor,width:this.theme.buttonLabelStrokeWidth??this.theme.textStrokeWidth,join:"round"},...this.dropShadowStyle()}),l=new ht({text:e,style:h});l.anchor.set(.5),l.position.set(this.theme.buttonLabelOffsetX,this.theme.buttonLabelOffsetY),o.addChild(l),this.textElements.push(l)}return o.on("pointerover",()=>{a.tint=i,o.scale.set(HC)}),o.on("pointerout",()=>{a.tint=s,o.scale.set(1)}),o.on("pointertap",r),o}drawRoundedButton(t,e){t.clear(),t.roundRect(-this.theme.buttonWidth/2,-this.theme.buttonHeight/2,this.theme.buttonWidth,this.theme.buttonHeight,this.theme.buttonRadius),t.fill(e)}createButton(t,e,s,i){const r=new j;r.interactive=!0,r.cursor="pointer";const o=new Wt;this.drawRoundedButton(o,e),r.addChild(o);const a=new wt({fontFamily:this.theme.buttonLabelFontFamily??this.theme.fontFamily,fontSize:this.theme.buttonLabelFontSize??this.theme.fontSize,fill:this.theme.buttonLabelColor??this.theme.textColor,stroke:{color:this.theme.buttonLabelStrokeColor??this.theme.textStrokeColor,width:this.theme.buttonLabelStrokeWidth??this.theme.textStrokeWidth,join:"round"},fontWeight:this.theme.buttonFontWeight,...this.dropShadowStyle()}),h=new ht({text:t,style:a});
436return h.anchor.set(.5),h.position.set(this.theme.buttonLabelOffsetX,this.theme.buttonLabelOffsetY),r.addChild(h),this.textElements.push(h),r.on("pointerover",()=>{this.drawRoundedButton(o,s),r.scale.set(1.05)}),r.on("pointerout",()=>{this.drawRoundedButton(o,e),r.scale.set(1)}),r.on("pointertap",i),r}handleChoice(t){se.enabled=t,this.hide().then(()=>{this.onComplete?.(t)})}resize(t,e){this.overlay.clear(),this.overlay.rect(-t*2,-e*2,t*5,e*5),this.overlay.fill({color:this.theme.overlayColor,alpha:this.theme.overlayAlpha}),this.panel.x=t/2,this.panel.y=e/2,this.lastHeight=e;const i=gu(e);for(const r of this.textElements)r.resolution=i}offscreenPanelY(){return this.theme.enterAnimation==="rise"?this.lastHeight+this.theme.panelHeight:-this.theme.panelHeight}async show(){this.visible=!0;const t=this.theme.animationDuration;if(this.theme.enterAnimation==="fade"){this.alpha=0,await ct.to(this,{alpha:1,duration:t,ease:"power2.out"});return}this.alpha=1;const e=this.panel.y;this.overlay.alpha=0,this.panel.alpha=0,this.panel.y=this.offscreenPanelY(),ct.to(this.overlay,{alpha:1,duration:t,ease:"power2.out"}),ct.to(this.panel,{alpha:1,duration:t*.6,ease:"power1.out"}),await ct.to(this.panel,{y:e,duration:t,ease:"back.out(1.4)"})}async hide(){const t=this.theme.animationDuration;this.theme.enterAnimation==="fade"?await ct.to(this,{alpha:0,duration:t,ease:"power2.in"}):(ct.to(this.overlay,{alpha:0,duration:t,ease:"power2.in"}),ct.to(this.panel,{alpha:0,duration:t,ease:"power1.in"}),await ct.to(this.panel,{y:this.offscreenPanelY(),duration:t,ease:"back.in(1.2)"})),this.visible=!1,this.parent&&this.parent.removeChild(this),this.destroy({children:!0})}drawPanelHeader(t){const{panelWidth:e,panelHeight:s,panelRadius:i,panelHeaderHeight:r}=this.theme;if(r<=0)return;const o=-e/2,a=-s/2,h=this.theme.panelHeaderColor??this.theme.panelColor;t.roundRect(o,a,e,r,i),t.fill(h);const l=Math.min(i,r);t.rect(o,a+r-l,e,l),t.fill(h)}}const se=new GC,Qh="./images/buttons/";class Ti extends it{constructor(t,e,s=!0){super(),this.events=Et,this.label=t,this.soundType=e,this.ButtonLayer=ks.getInstance(),this.anchor.set(.5),s?(this.generateButtonPaths(),this.addInterActivity(),this.addTexture(),this.addToContainer(),this.handleEvents()):(this.addInterActivity(),this.handleEvents()),this.events.on("setAllButtonIntractvy",i=>this.setInterActivity(!!i))}handlePress(){}generateButtonPaths(){this.regular=`${Qh}btn_${this.label}.png`,this.hover=`${Qh}btn_${this.label}_hover.png`,this.pressed=`${Qh}btn_${this.label}_pressed.png`}handleEvents(){this.on("mousedown",()=>this._handlePress()),this.on("mouseover",()=>this.exchangeTexture(this.hover)),this.on("mouseout",()=>this.exchangeTexture(this.regular)),this.on("mouseup",()=>this.exchangeTexture(this.regular)),this.on("touchstart",()=>this._handlePress()),this.on("touchend",()=>this.exchangeTexture(this.regular))}_handlePress(){this.exchangeTexture(this.pressed),se.playSFX(this.soundType),this.handlePress()}addTexture(){this.exchangeTexture(this.regular)}exchangeTexture(t){const e=_t.getTexture(t);this.texture=e}addInterActivity(){this.interactive=!0,this.cursor="pointer"}setInterActivity(t){this.interactive=t}addToContainer(){this.ButtonLayer.addChild(this)}}class qC extends Ti{constructor(t,e){super("plus",je.click1),Object.assign(this,e),this.con=t,this.addToContainer=this.addContainer,this.events.on("betAmountStatus",s=>this.setAvaible(s))}setAvaible(t){t==yi.max?(this.interactive=!1,this.exchangeTexture(this.pressed)):t==yi.nonExtreme&&(this.interactive=!0,this.exchangeTexture(this.regular))}handlePress(){this.events.emit("increaseAmount")}addContainer(){this.con.addChild(this)}}class KC extends Ti{constructor(t,e){super("minus",je.click1),Object.assign(this,e),this.con=t,this.addToContainer=this.addContainer,this.events.on("betAmountStatus",s=>this.setAvaible(s))}setAvaible(t){t==yi.min?(this.interactive=!1,this.exchangeTexture(this.pressed)):t==yi.nonExtreme&&(this.interactive=!0,this.exchangeTexture(this.regular))}handlePress(){this.events.emit("decreaseAmount")}addContainer(){this.con.addChild(this)}}class ZC extends j{constructor(t){super(),this.ButtonLayer=ks.getInstance(),this.Bounds=t,this.addBg(),this.addPlusButton(),this.addMinusButton(),this.addToLayer()}plusBounds(t){return{x:t.x+60,y:t.y+16,width:33,height:33}}minusBounds(t){return{x:t.x-60,y:t.y+16,width:33,height:33}}addBg(){this.payAmountBg=new TC(this.Bounds),this.addChild(this.payAmountBg)}addPlusButton(){this.plus=new qC(this,this.plusBounds(this.Bounds)),this.addChild(this.plus)}addMinusButton(){this.minus=new KC(this,this.minusBounds(this.Bounds)),this.addChild(this.minus)}relayout(t){this.Bounds=t,this.payAmountBg.relayout(t),Object.assign(this.plus,this.plusBounds(t)),Object.assign(this.minus,this.minusBounds(t))}
436addToLayer(){this.ButtonLayer.addChild(this)}}const Mf=1.3;class QC extends fs{constructor(t){super();const e=t.scale.x;new J.Tween(t.scale).to({x:e*Mf,y:e*Mf},120).easing(J.Easing.Quadratic.Out).yoyo(!0).repeat(1).start()}}class JC extends fs{constructor(t,e,s,i=800,r=()=>{}){super(),new J.Tween(t).to({width:e*.8,height:s*.8,alpha:1,rotation:Math.PI*.25},i*.3).easing(J.Easing.Cubic.Out).onComplete(()=>{new J.Tween(t).to({width:e,height:s,alpha:0,rotation:Math.PI*.5},i*.7).easing(J.Easing.Quadratic.In).onComplete(()=>{setTimeout(()=>{r()},20)}).start()}).start()}}const tP=n=>({fill:16777215,fontSize:n,fontWeight:"700"}),eP={fill:16777215,fontSize:90,fontWeight:"bold",align:"center",stroke:{color:0,width:4},dropShadow:{color:0,blur:8,distance:0,alpha:1,angle:0}},mu={fontFamily:"Anton",fontSize:36,fontWeight:"bold",fill:16777215,align:"center",dropShadow:{blur:4,distance:2,angle:Math.PI/4,alpha:.7,color:"#000000"}},sP={fontFamily:"Arial",fontSize:22,fontWeight:"bold",fill:16777215,align:"center",lineHeight:30},iP="./images/scene/u
436i_total_won.png",fn={SCALE:1,DISPLAY_DURATION:1e3,FADE_IN_DURATION:300,FADE_OUT_DURATION:100};class nP extends j{constructor(t){super(),this.Main=Rt.getInstance(),this.ButtonLayer=ks.getInstance(),this.events=Et,this.totalWon=0,this.Bounds=t,this.x=t.x,this.y=t.y,this.addBg(),this.addtotalWonText(),this.addToLayer(),this.setTotalWonText(),this.events.on("setBonusWin",e=>{this.showBonusPopup(e)}),this.events.on("setPrize",e=>{const s=e.multiplier.multiplier*e.betAmount;this.showPrize(s,e.multiplier)}),this.events.on("resetTotalWon",()=>{this.resetTotalWon()})}addBg(){const t=_t.getTexture(iP);this.bg=new it(t),this.bg.width=this.Bounds.width,this.bg.height=this.Bounds.height,this.bg.anchor.set(.5),this.addChild(this.bg)}relayout(t){this.Bounds=t,this.x=t.x,this.y=t.y,this.bg.width=t.width,this.bg.height=t.height,this.totalWonText.style.fontSize=t.fontSize}addtotalWonText(){this.totalWonText=new ht({text:"",style:tP(this.Bounds.fontSize)}),this.totalWonText.x=0,this.totalWonText.y=17,this.totalWonText.anchor.set(.5),this.addChild(this.totalWonText)}showBonusPopup(t){const e=this.Main.getDim(),s={red:"./images/explosion/vfx_explosion_red.png",blue:"./images/explosion/vfx_explosion_blue.png",green:"./images/explosion/vfx_explosion_green.png",yellow:"./images/explosion/vfx_explosion_yellow.png",purple:"./images/explosion/vfx_explosion_purple.png",default:"./images/explosion/vfx_explosion_purple.png"},i=t&&t.color&&s[t.color]||s.default;[{x:-100,y:-100},{x:100,y:-100},{x:-100,y:100},{x:100,y:100}].forEach((a,h)=>{setTimeout(()=>{const l=new it(_t.getTexture(i));l.anchor.set(.5),l.x=e.width/2+a.x,l.y=e.height/2+a.y,l.alpha=0,l.width=2,l.height=2,this.ButtonLayer.addChild(l),new JC(l,300,300,1e3,()=>{this.ButtonLayer.removeChild(l)})},h*200)});const o=new it(_t.getTexture("./images/texts/ui_text_bonus_game.png"));o.anchor.set(.5),o.x=e.width/2,o.y=e.height/2,o.alpha=0,o.zIndex=2,o.scale.set(.8),this.ButtonLayer.addChild(o),new J.Tween(o).to({alpha:1,y:o.y-30},500).easing(J.Easing.Back.Out).start(),setTimeout(()=>{new J.Tween(o).to({alpha:0},300).onComplete(()=>{this.ButtonLayer.removeChild(o)}).start()},1e3)}
436async showPrize(t,e){const s=this.formatAmountText(t),i=this.Main.getDim();e&&e.count>=4&&await this.showWinTypeIcon(e.count);let r=40;if(e){let a=e.count;e.isBonus&&(a+=1),r=Math.max(40,Math.min(120,40+(a-3)*20))}const o=new ht({text:s,style:{...eP,fontSize:r}});o.anchor.set(.5),o.x=i.width/2,o.y=i.height/2,o.alpha=0,o.scale.set(1),this.ButtonLayer.addChild(o),new J.Tween(o).to({alpha:1},200).easing(J.Easing.Back.Out).start(),setTimeout(()=>{const a=this.toGlobal(new It(0,16));new J.Tween(o).to({x:a.x,y:a.y},500).easing(J.Easing.Quadratic.Out).start(),new J.Tween(o.scale).to({x:.1,y:.1},500).easing(J.Easing.Quadratic.Out).start(),new J.Tween(o).to({alpha:.6},500).easing(J.Easing.Quadratic.Out).onComplete(()=>{new J.Tween(o).to({alpha:0},300).onComplete(()=>{this.ButtonLayer.removeChild(o),this.setTotalWonText(t)}).start()}).start()},900)}formatAmountText(t){return t>=1?`$${t.toFixed(2)}`:`${Math.round(t*100)}¢`}setBonusWin(){this.showBonusPopup()}resetTotalWon(){this.totalWon=0,this.setTotalWonText(0)}setTotalWonText(t=0){this.totalWon+=t,this.totalWonText.text=`$${this.totalWon.toFixed(2)}`,this.totalWon!==0&&new QC(this.totalWonText)}addToLayer(){this.ButtonLayer.addChild(this)}async showWinTypeIcon(t){if(t<4)return;const e=this.Main.getDim();let s,i;t===4?(s="./images/texts/ui_text_win.png",i=1):t===5||t===6?(s="./images/texts/ui_text_big_win.png",i=2):(s="./images/texts/ui_text_hot_win.png",i=3);const r=new it(_t.getTexture(s));r.anchor.set(.5),r.x=e.width/2,r.y=e.height/2,r.alpha=0,r.scale.set(.1),r.zIndex=10,this.ButtonLayer.addChild(r),await this.animateWinTypeEntrance(r,i),await new Promise(o=>setTimeout(o,fn.DISPLAY_DURATION)),await this.animateWinTypeExit(r)}async animateWinTypeEntrance(t,e){const s=fn.SCALE;return new Promise(i=>{t.alpha=.1,t.scale.set(.1),new J.Tween(t).to({alpha:1},fn.FADE_IN_DURATION).easing(J.Easing.Quadratic.Out).start(),new J.Tween(t.scale).to({x:s,y:s},fn.FADE_IN_DURATION).easing(J.Easing.Back.Out).onComplete(()=>{e>=3&&this.addPulseEffect(t,s),i()}).start()})}async animateWinTypeExit(t){return new Promise(e=>{new J.Tween(t).to({alpha:0},fn.FADE_OUT_DURATION).easing(J.Easing.Quadratic.In).onComplete(()=>{this.ButtonLayer.removeChild(t),e()}).start(),new J.Tween(t.scale).to({x:.8,y:.8},fn.FADE_OUT_DURATION).easing(J.Easing.Quadratic.In).start()})}addPulseEffect(t,e){const s=e*1.05,i=600,r=()=>{t.parent&&new J.Tween(t.scale).to({x:s,y:s},i).easing(J.Easing.Quadratic.InOut).onComplete(()=>{t.parent&&new J.Tween(t.scale).to({x:e,y:e},i).easing(J.Easing.Quadratic.InOut).onComplete(()=>{t.parent&&setTimeout(r,200)}).start()}).start()};setTimeout(r,300)}}class rP extends Ti{constructor(t){super("prize_chart",je.click1),Object.assign(this,t),this.anchor.set(.5),this.events.off("setAllButtonIntractvy",this.setInterActivity)}handlePress(){this.events.emit("showPrizeChart")}setInterActivity(t){this.interactive=!0}}class oP extends Ti{constructor(t,e){super("play",je.click3),this.isVertical=!1,Object.assign(this,t),this.isVertical=e,this.hitArea=new no(0,0,t.width-8),this.events.on("setPlayButStatus",s=>this.setButton(s)),this.setButton(vt.semiOpacity)}handlePress(){this.setAvaible(!1),this.events.emit("setAPlayButStatus",vt.semiOpacity),this.events.emit("spin")}setButton(t){t==vt.semiOpacity?(this.setAvaible(!1),this.setVisible(!0)):t==vt.show?(this.setAvaible(!0),this.setVisible(!0)):t==vt.hide&&(this.setAvaible(!1),this.setVisible(!1))}setAvaible(t){this.alpha=t?1:.5,this.setInteractivity(t)}setInteractivity(t){this.interactive=t}setVisible(t){this.visible=t,this.exchangeTexture(this.regular)}}class aP extends Ti{constructor(t){super("auto_play",je.click3),this.autoplay=Rt.getInstance().autoplay,this.status=vt.show,Object.assign(this,t),this.events.on("setAPlayButStatus",e=>this.setButtonStatus(e)),this.autoplay.on("change",()=>this.render()),this.render()}handlePress(){this.events.emit("showAutoplayPicker")}setButtonStatus(t){this.status=t,this.render()}render(){const t=this.status===vt.show;this.alpha=t?1:.5,this.interactive=t,this.visible=this.autoplay.isAvailable()&&this.status!==vt.hide&&this.autoplay.getSnapshot().status!=="running",this.exchangeTexture(this.regular)}}class hP extends Ti{constructor(t){super("bonus_play",je.click2),Object.assign(this,t),this.setVisible(!1),this.events.on("setBPlayButStatus",e=>this.setButton(e))}handlePress(){this.setAvaible(!1),this.events.emit("spin")}setButton(t){t==vt.semiOpacity?(this.setAvaible(!1),this.setVisible(!0)):t==vt.show?(this.setAvaible(!0),this.setVisible(!0)):t==vt.hide&&(this.setAvaible(!1),this.setVisible(!1))}setAvaible(t){this.alpha=t?1:.5,this.setInteractivity(t)}setInteractivity(t){this.interactive=t}setVisible(t){this.visible=t,this.exchangeTexture(this.regular)}}class lP extends it{constructor(t){super(),this.Main=Rt.getInstance(),Object.assign(this,t),this.texture=_t.getTexture("./images/scene/logo_instructions.png"),this.anchor.set(.5)}remove(){this.parent.removeChild(this),this.destroy()}}class ks extends j{constructor(t,e){super(),this.UILayer=xi.getInstance(),this.events=Et,this.explodeLabel=null,this.isManualExplode=!1,ks.instance||(ks.instance=this),this.payAmount=new ZC(t.payAmount),this.totalWon=new nP(t.totalWon),this.createSettingsFab(t.optionsButton),this.prizeChartButton=new rP(t.prizeChartButton),this.PlayButton=new oP(t.playButton,e),this.AutoPlayButton=new aP(t.autoPlayButton),this.bonusButton=new hP(t.playButton),this.logo=new lP(t.logo),this.addChild(this.logo),this.events.on("setHowToPlayMode",s=>{setTimeout(()=>{this.visible=!JSON.parse(String(s))},100)}),this.addToLayer()}createSettingsFab(t){this.settingsFab=new lC({textures:{gear:"btn_options",close:"btn_x",plate:"btn_menu_plate"},gearSize:47,menuButtonSize:44,mainGap:8,stackGap:6,sound:{onToggle:()=>{const i=!se.enabled;se.enabled=i,this.settingsFab.setSoundMuted(!i,!0)}},buttons:[{label:{text:"i",style:new wt({fill:"#ffffff",fontSize:26,fontWeight:"800"})},onTap:()=>{this.settingsFab.close(),this.events.emit("setHowToPlayMode",JSON.stringify(!0))}},{content:i=>this.buildExplodeToggle(i),onTap:()=>this.toggleExplodeMode()}],onActivity:()=>se.playSFX(je.click1)}),this.settingsFab.setSoundMuted(!se.enabled,!1),this.settingsFab.position.set(t.x,t.y),this.settingsFab.layout(2e3,2e3),this.sortableChildren=!0,this.settingsFab.zIndex=100,this.addChild(this.settingsFab);const s=i=>{this.settingsFab.interactiveChildren=i,i||this.settingsFab.close()};this.events.on("spin",()=>s(!1)),this.events.on("gameIsCompleted",()=>s(!0))}buildExplodeToggle(t){const e=new j;return this.explodeLabel=new ht({text:this.explodeLabelText(),style:new wt({fill:"#ffffff",fontSize:t*.6,fontWeight:"800"})}),this.explodeLabel.anchor.set(.5),e.addChild(this.explodeLabel),e}explodeLabelText(){return this.isManualExplode?"M":"A"}toggleExplodeMode(){this.isManualExplode=!this.isManualExplode,this.events.emit("setManuelExplode",this.isManualExplode),this.explodeLabel&&(this.explodeLabel.text=this.explodeLabelText())}relayout(t,e){this.payAmount.relayout(t.payAmount),this.totalWon.relayout(t.totalWon),this.settingsFab.position.set(t.optionsButton.x,t.optionsButton.y),Object.assign(this.prizeChartButton,t.prizeChartButton),Ob
436ject.assign(this.PlayButton,t.playButton),this.PlayButton.isVertical=e,this.PlayButton.hitArea=new no(0,0,t.playButton.width-8),Object.assign(this.AutoPlayButton,t.autoPlayButton),Object.assign(this.bonusButton,t.playButton),Object.assign(this.logo,t.logo)}payAmountBounds(){const t=this.payAmount.getBounds();return{x:t.x,y:t.y,width:t.width,height:t.height}}addToLayer(){this.UILayer.addChild(this)}static getInstance(){return ks.instance}}const cP="./images/scene/ui_stop.png";class uP extends j{constructor(t){super(),this.UILayer=xi.getInstance(),this.autoplay=Rt.getInstance().autoplay,this.bounds=t,Object.assign(this,t),this.addStopButton(),this.addGameCountDown(),this.addToLayer(),this.render(this.autoplay.getSnapshot()),this.autoplay.on("change",e=>this.render(e))}render({status:t,remaining:e}){this.visible=t==="running",this.count.text=e.toString()}addStopButton(){const t=_t.getTexture(cP),e=new it(t);e.anchor.set(.5),e.width=this.bounds.width,e.height=this.bounds.height,e.x=0,e.y=0,e.interactive=!0,e.cursor="pointer",e.on("pointerdown",()=>this.autoplay.requestStop()),this.addChild(e)}addGameCountDown(){this.count=new ht({text:"0",style:{fontFamily:"Arial",fontSize:22,fill:16777215,fontWeight:"bold",align:"center",stroke:{color:0,width:2}}}),this.count.anchor.set(.5),this.count.x=24,this.count.y=0,this.addChild(this.count)}addToLayer(){this.UILayer.addChild(this)}}class dP extends fs{constructor(t,e){super();const s=t.x,i=t.y,r=Math.atan2(0-i,0-s)+Math.PI/2;new J.Tween(t).to({x:0,y:-40,rotation:r},900).easing(J.Easing.Quadratic.Out).chain(new J.Tween(t).to({y:0,rotation:0},400).easing(J.Easing.Quadratic.In).onComplete(()=>e())).start()}}const Oo=1;class fP{constructor(t,e,s,i){this.events=Et,window.rocket=t,this.run(t,e,s,i)}getFireSprite(t){return t.children[0]}async run(t,e,s,i){const r=this.getFireSprite(t);r&&(r.visible=!1),await t.fadeBg(!0),await this.shake(t,700),await this.shootUp(t,e),await this.flyInFromEdge(t,e,i),t.fadeBg(!1),await this.explode(t),s&&s()}shake(t,e){return new Promise(s=>{const i=t.x,r=t.y,o=t.scale.x,a=t.scale.y,h=10,l=performance.now();function c(u){const d=u-l,f=Math.min(d/e,1),g=Math.sin(d/40*Math.PI*2)*h*(1-f);t.x=i+g,t.y=r+g,f<1?requestAnimationFrame(c):(t.x=i,t.y=r,t.scale.set(o,a),s())}requestAnimationFrame(c)})}shootUp(t,e){return new Promise(s=>{const i=t.y,r=i-e.height*.7,o=500,a=performance.now(),h=t.children[0];h&&(h.visible=!0,h.rotation=0);function l(c){const u=c-a,d=Math.min(u/o,1);
436t.y=i+(r-i)*d,d<1?requestAnimationFrame(l):(h&&(h.visible=!1),t.visible=!1,s())}requestAnimationFrame(l)})}flyInFromEdge(t,e,s){return new Promise(i=>{const r=new It(s?.x??0,s?.y??0),o=t.parent.toLocal(r),a=o.x,h=o.y,l=["top","bottom","left","right"],c=l[Math.floor(Math.random()*l.length)];let u=0,d=0;const f=t.parent.getBounds(),g=50;switch(c){case"top":u=Math.random()*(f.width-g*2)+(-f.width/2+g),d=-f.height/2-g;break;case"bottom":u=Math.random()*(f.width-g*2)+(-f.width/2+g),d=f.height/2+g;break;case"left":u=-f.width/2-g,d=Math.random()*(f.height-g*2)+(-f.height/2+g);break;case"right":u=f.width/2+g,d=Math.random()*(f.height-g*2)+(-f.height/2+g);break}t.x=u,t.y=d,t.visible=!0,t.alpha=1,t.scale.set(Oo,Oo);const p=this.getFireSprite(t);p&&(p.visible=!0,p.rotation=0);const m=a-u,y=h-d,x=Math.atan2(y,m)+Math.PI/2;t.rotation=x,this.flyingMovement(t,u,d,a,h,x,p,e,i)})}flyingMovement(t,e,s,i,r,o,a,h,l){const u=performance.now(),d=i,f=r,g=e-d,p=s-f,m=Math.sqrt(g*g+p*p),y=Math.max(h.width,h.height),x=Math.atan2(f-s,d-e),_=Math.max(m*1.2,y*.8),b=d-_*Math.cos(x),w=f-_*Math.sin(x),S=Math.atan2(w-f,b-d);let v=S-Math.PI/2;t.rotation=v,t.x=b,t.y=w;function T(P){return 1-Math.pow(1-P,3)}function A(P){const M=P-u,I=Math.min(M/3e3,1),C=T(I),k=Math.PI*3,E=S+k*C,F=_*(1-C),B=d+F*Math.cos(E),N=f+F*Math.sin(E);t.x=B,t.y=N;const R=Math.min(C+.001,1),D=S+k*R,z=_*(1-R),Y=d+z*Math.cos(D),W=f+z*Math.sin(D),V=Y-B,H=W-N;let tt=Math.atan2(H,V)+Math.PI/2-v;for(;tt>Math.PI;)tt-=Math.PI*2;for(;tt<-Math.PI;)tt+=Math.PI*2;v+=tt*.12,t.rotation=v,t.scale.set(Oo,Oo),I<.8?requestAnimationFrame(A):(a&&(a.visible=!1),l())}requestAnimationFrame(A)}async explode(t){const e=this.getFireSprite(t);e&&(e.visible=!1),await this.shake(t,200);const s=t.getGlobalPosition();this.events.emit("triggerParticleExplosion",s);const i=100,r=performance.now(),o=3,a=t.scale.x;function h(l){const c=l-r,u=Math.min(c/i,1);t.scale.set(a+o*u,a+o*u),t.alpha=1-u,u<1?requestAnimationFrame(h):(t.scale.set(1,1),t.rotation=0,t.position.set(0,0))}requestAnimationFrame(h)}}class pP extends fs{constructor(t,e){super(),new J.Tween(t).to({width:e.width,height:e.height},800).easing(J.Easing.Quadratic.InOut).repeat(1/0).yoyo(!0).start()}}const gP="./images/winning_icons/icon_prize_star.png";class mP extends j{constructor(t){super(),this.distance=t,this.visible=!1,this.add()}addStar(t){const e=_t.getTexture(gP),s=new it(e);s.anchor.set(.5),Object.assign(s,t),new pP(s,{width:t.width*1.2,height:t.height*1.2}),this.addChild(s)}hide(){this.visible=!1}show(){this.visible=!0}add(){this.addStar({x:Math.cos(-Math.PI/2)*this.distance,y:Math.sin(-Math.PI/2)*this.distance,width:50,height:50,rotation:0}),this.addStar({x:Math.cos(-(Math.PI*(3.5/5)))*this.distance,y:Math.sin(-(Math.PI*(3.5/5)))*this.distance,width:50,height:50,rotation:-Math.PI/5}),this.addStar({x:Math.cos(-(Math.PI*(1.5/5)))*this.distance,y:Math.sin(-(Math.PI*(1.5/5)))*this.distance,width:50,height:50,rotation:Math.PI/5})}}
436const yP="./images/scene/ui_one_fire_box.png";class xP extends j{constructor(t){super(),this.Main=Rt.getInstance(),this.UILayer=xi.getInstance(),this.events=Et,this.index=-1,this.currColor=ay,this.currType=hy,this.getFrameTexture=e=>e==Ft.full?new $($.EMPTY):_t.getTexture(`./images/scene/frame_b1_${e}.png`),this.generateFireworkPath=e=>`./images/fireworks/firework-${e}.png`,this.Bounds=t,this.starCon=new mP(this.Bounds.width/2+30),this.addChild(this.starCon),this.addCoords(),this.addBg(),this.addFrame(),this.addTypeFrame(),this.addTransparentBackground(),this.addWFireworkCon(),this.addFire(),this.addWinningFirework(),this.UILayer.addChild(this),this.events.on("setBonusGame",e=>this.setStarCon(!!e)),this.events.on("updateWFireworkTexture",e=>{this.updateFrame(e),this.updateTexture(e)}),this.events.on("FireworkFlyOut",e=>{new fP(this.WFireworkCon,this.Main.getDim(),()=>{},e)})}setStarCon(t){if(t)return this.starCon.show();this.starCon.hide()}addCoords(){this.x=this.Bounds.x,this.y=this.Bounds.y}addWFireworkCon(){this.WFireworkCon=new j,this.WFireworkCon.fadeBg=this.fadeBg.bind(this),this.WFireworkCon.zIndex=2,this.addChild(this.WFireworkCon)}addWinningFirework(){const t=new $($.EMPTY);this.WFirework=new it(t),this.WFirework.width=this.Bounds.width*.85,this.WFirework.height=this.Bounds.height*.85,this.WFirework.y=0,this.WFirework.anchor.set(.5),this.WFireworkCon.addChild(this.WFirework)}addFire(){const t=_t.getTexture("./images/fireworks/fire.png");this.fire=new it(t),this.fire.y=50,this.fire.anchor.set(.5,.1),this.fire.scale.set(.2),this.fire.visible=!1,this.WFireworkCon.addChild(this.fire)}addBg(){const t=_t.getTexture(yP),e=new it(t);e.anchor.set(.5),e.width=this.Bounds.width-25,e.height=this.Bounds.height-25,this.addChild(e)}generateFrame(t){const e=this.getFrameTexture(t),s=new it(e);return s.anchor.set(.5),s.width=this.Bounds.width,s.height=this.Bounds.height,s}addFrame(){this.frame=this.generateFrame(this.currColor),this.addChild(this.frame)}addTypeFrame(){this.typeFrame=this.generateFrame(this.currType),this.typeFrame.anchor.set(.5,.5),this.addChild(this.typeFrame)}addTransparentBackground(){const t=this.Main.getDim(),e=10,s=new It(0,0),i=this.toLocal(s,void 0,void 0,!1),r=new Wt;r.alpha=0,r.visible=!1,r.rect(i.x-e,i.y-e,t.width+e*2,t.height+e*2),r.fill({color:0,alpha:.7}),r.zIndex=1,this.addChildAt(r,0),this.bg=r}async fadeBg(t){if(this.bg)return new Promise(e=>{if(t){this.bg.visible=!0,this.bg.alpha=0;const s=200,i=performance.now(),r=o=>{const a=o-i;this.bg.alpha=Math.min(a/s,1),a<s?requestAnimationFrame(r):(this.bg.alpha=1,e())};requestAnimationFrame(r)}else{const i=this.bg.alpha,r=performance.now(),o=a=>{const h=a-r;this.bg.alpha=Math.max(i*(1-h/200),0),h<200?requestAnimationFrame(o):(this.bg.alpha=0,this.bg.visible=!1,e())};requestAnimationFrame(o)}})}updateFrame(t){const e=Qn[t];e.color==this.currColor&&e.type==this.currType||new Ma(this.frame,.3,200,()=>{this.frame.texture=this.getFrameTexture(e.color),this.typeFrame.texture=this.getFrameTexture(e.type),new Ma(this.frame,1,200,()=>{this.currColor=e.color,this.currType=e.type})})}updateTexture(t){if(this.index=t,!this.fire.visible){const e=this.generateFireworkPath(this.index),s=_t.getTexture(e);this.WFireworkCon.alpha=1,this.WFireworkCon.visible=!0,this.WFireworkCon.y=this.Main.getDim().height+93,this.WFireworkCon.x=Math.random()*300-150,this.WFirework.texture=s,this.fire.visible=!0,new dP(this.WFireworkCon,()=>{this.fire.visible=!1,this.WFireworkCon.x=0})}}}function Jn(n,t="./"){return`${t.endsWith("/")?t:`${t}/`}${n.replace(/^\/+/,"")}`}const Su=class Su{static async loadHowToPlay(){if(this.howToPlayText==null)try{const t=await fetch(Jn("how-to-play.md"),{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status}`);this.howToPlayText=await t.text(),this.howToPlayText=this.howToPlayText.trim(),Rt.getInstance?.()}catch(t){Z.error("[ContentManager] Failed to load how-to-play.md:",t),this.howToPlayText="How to Play content failed to load."}}static getHowToPlay(){return this.howToPlayText??"Loading..."}};Su.howToPlayText=null;let Fa=Su;class _P extends j{constructor(){super(),this.scrollAxis="both",this.viewWidth=0,this.viewHeight=0,this.contentWidth=0,this.contentHeight=0,this.lastPointerPosition={x:0,y:0},this.currentScrollPosition={x:0,y:0},this.lastScrollPosition={x:0,y:0},this.scrollVelocity={x:0,y:0},this.isDragging=!1,this.hasScrolled=!1,this.startDragPosition={x:0,y:0},this.dragThreshold=10,this.friction=.9,this.minVelocity=.02,this.body=new j,this.addChild(this.body),this.content=new j,this.body.addChild(this.content),this.maskGraphics=new Wt,this.body.mask=this.maskGraphics,this.body.addChild(this.maskGraphics),this.setupInteraction()}setupInteraction(){this.eventMode="static",this.on("pointerdown",this.onPointerDown.bind(this)),this.on("pointermove",this.onPointerMove.bind(this)),this.on("pointerup",this.onPointerUp.bind(this)),this.on("pointerupoutside",this.onPointerUp.bind(this)),this.on("wheel",this.onWheel.bind(this))}onPointerDown(t){const e=t.global;this.lastPointerPosition.x=e.x,this.lastPointerPosition.y=e.y,this.startDragPosition.x=e.x,this.startDragPosition.y=e.y,this.isDragging=!0,this.hasScrolled=!1,this.scrollVelocity.x=0,this.scrollVelocity.y=0,this.lastScrollPosition.x=this.currentScrollPosition.x,this.lastScrollPosition.y=this.currentScrollPosition.y}onPointerMove(t){if(!this.isDragging)return;const e=t.global,s=this.startDragPosition.x-e.x,i=this.startDragPosition.y-e.y;if(Math.sqrt(s*s+i*i)>this.dragThreshold||this.hasScrolled){const o=e.x-this.lastPointerPosition.x,a=e.y-this.lastPointerPosition.y;this.scrollBy(o,a),this.hasScrolled=!0,this.lastPointerPosition.x=e.x,this.lastPointerPosition.y=e.y}}onPointerUp(t){this.isDragging=!1,this.hasScrolled&&t.stopPropagation(),this.hasScrolled=!1}onWheel(t){const e=t.deltaY;this.scrollVelocity.y-=e*.03,t.preventDefault()}scrollBy(t,e){const s=this.scrollAxis==="y"?0:t,i=this.scrollAxis==="x"?0:e,r=this.currentScrollPosition.x+s,o=this.currentScrollPosition.y+i,a=this.scrollAxis==="y"?0:Math.min(0,this.viewWidth-this.contentWidth),h=this.scrollAxis==="y"?0:Math.max(a,Math.min(0,r)),l=this.scrollAxis==="x"?0:Math.min(0,this.viewHeight-this.contentHeight),c=this.scrollAxis==="x"?0:Math.max(l,Math.min(0,o));this.currentScrollPosition.x=h,this.currentScrollPosition.y=c,this.content.x=h,this.content.y=c,h!==r&&(this.scrollVelocity.x=0),c!==o&&(this.scrollVelocity.y=0)}setSize(t,e){this.viewWidth=t,this.viewHeight=e,this.maskGraphics.clear(),this.maskGraphics.rect(0,0,t,e).fill(16777215);const s=new Wt;s.rect(0,0,t,e).fill({color:0,alpha:0}),s.eventMode="static";const i=this.children.find(r=>r.label==="interactiveArea");i&&this.removeChild(i),s.label="interactiveArea",this.addChildAt(s,0)}setAxis(t){this.scrollAxis=t,t==="y"?(this.currentScrollPosition.x=0,this.lastScrollPosition.x=0,this.scrollVelocity.x=0,this.content.x=0):t==="x"&&(this.currentScrollPosition.y=0,this.lastScrollPosition.y=0,this.scrollVelocity.y=0,this.content.y=0)}setContentSize(t,e){this.contentWidth=t,this.contentHeight=e,this.scrollBy(0,0)}addContent(t){this.content.addChild(t)}
436removeContent(t){this.content.removeChild(t)}clearContent(){this.content.removeChildren()}getContentContainer(){return this.content}getScrollPosition(){return{...this.currentScrollPosition}}getScrollProgress(){const t=Math.min(0,this.viewWidth-this.contentWidth),e=Math.min(0,this.viewHeight-this.contentHeight),s=t===0?0:this.currentScrollPosition.x/t,i=e===0?0:this.currentScrollPosition.y/e;return{x:s,y:i}}getScrollRatio(){const t=this.contentWidth===0?1:this.viewWidth/this.contentWidth,e=this.contentHeight===0?1:this.viewHeight/this.contentHeight;return{x:Math.min(1,t),y:Math.min(1,e)}}getMaxScrollPosition(){const t=Math.min(0,this.viewWidth-this.contentWidth),e=Math.min(0,this.viewHeight-this.contentHeight);return{x:t,y:e}}update(t){const e={x:this.currentScrollPosition.x-this.lastScrollPosition.x,y:this.currentScrollPosition.y-this.lastScrollPosition.y};(Math.abs(e.x)>0||Math.abs(e.y)>0)&&(this.scrollVelocity.x=(this.scrollVelocity.x+e.x/t)/2,this.scrollVelocity.y=(this.scrollVelocity.y+e.y/t)/2),this.isDragging||(Math.sqrt(this.scrollVelocity.x*this.scrollVelocity.x+this.scrollVelocity.y*this.scrollVelocity.y)>this.minVelocity?(this.scrollBy((this.scrollAxis==="y"?0:this.scrollVelocity.x)*t,(this.scrollAxis==="x"?0:this.scrollVelocity.y)*t),this.scrollVelocity.x*=this.friction,this.scrollVelocity.y*=this.friction):(this.scrollVelocity.x=this.scrollAxis==="y"?0:this.scrollVelocity.x,this.scrollVelocity.y=this.scrollAxis==="x"?0:this.scrollVelocity.y)),this.lastScrollPosition.x=this.currentScrollPosition.x,this.lastScrollPosition.y=this.currentScrollPosition.y}scrollToTop(){this.currentScrollPosition.x=0,this.currentScrollPosition.y=0,this.lastScrollPosition.x=0,this.lastScrollPosition.y=0,this.content.x=0,this.content.y=0,this.scrollVelocity.x=0,this.scrollVelocity.y=0}destroy(){this.off("pointerdown"),this.off("pointermove"),this.off("pointerup"),this.off("pointerupoutside"),this.off("wheel"),super.destroy()}}class Ba{static normalize(t,e,s){return(t-e)/(s-e)}static lerp(t,e,s){return(s-e)*t+e}static map(t,e,s,i,r){return Ba.lerp(Ba.normalize(t,e,s),i,r)}static clamp(t,e,s){return Math.min(Math.max(t,Math.min(e,s)),Math.max(e,s))}}const kf=Ba.map;class bP extends j{constructor(t,e=!0,s={}){super(),this.scrollView=t,this.isVertical=e,this.trackColor=s.trackColor??0,this.thumbColor=s.thumbColor??6710886,this.trackAlpha=s.trackAlpha??.1,this.thumbAlpha=s.thumbAlpha??.3,this.trackSize=s.trackSize??8,this.thumbMinSize=s.thumbMinSize??20,this.alwaysShow=s.alwaysShow??!1,this.trackHeight=0,this.track=new Wt,this.thumb=new Wt,this.addChild(this.track),this.addChild(this.thumb),this.visible=this.alwaysShow}setSize(t){this.trackHeight=t,this.drawTrack(t),this.updateThumb()}drawTrack(t){this.track.clear(),this.isVertical?this.track.roundRect(0,0,this.trackSize,t,this.trackSize/2):this.track.roundRect(0,0,t,this.trackSize,this.trackSize/2),this.track.fill({color:this.trackColor,alpha:this.trackAlpha})}updateThumb(){const t=this.scrollView.getScrollRatio(),e=this.scrollView.getScrollPosition(),s=this.scrollView.getMaxScrollPosition();if(this.thumb.clear(),this.isVertical){const i=this.trackHeight,r=Math.max(this.thumbMinSize,i*t.y);let o=0;s.y<0&&(o=Math.abs(e.y/s.y)),o=Math.max(0,Math.min(1,o));const a=kf(o,0,1,0,i-r);this.thumb.roundRect(0,0,this.trackSize,r,this.trackSize/2),this.thumb.fill({color:this.thumbColor,alpha:this.thumbAlpha}),this.thumb.y=a,this.visible=this.alwaysShow||t.y<1}else{const i=this.track.getBounds().width,r=Math.max(this.thumbMinSize,i*t.x);let o=0;s.x<0&&(o=Math.abs(e.x/s.x)),o=Math.max(0,Math.min(1,o));const a=kf(o,0,1,0,i-r);this.thumb.roundRect(a,0,r,this.trackSize,this.trackSize/2),this.thumb.fill({color:this.thumbColor,alpha:this.thumbAlpha}),this.visible=this.alwaysShow||t.x<1}}update(){this.updateThumb()}setColors(t,e,s=.1,i=.3){this.trackColor=t,this.thumbColor=e,this.trackAlpha=s,this.thumbAlpha=i,this.updateThumb()}setTrackSize(t){this.trackSize=t}setThumbMinSize(t){this.thumbMinSize=t}setAlwaysShow(t){this.alwaysShow=t,this.updateThumb()}getAlwaysShow(){return this.alwaysShow}}class wP{constructor(t,e){this.contentWidth=t,this.lineSpacing=8,this.paragraphSpacing=20,this.bulletIndent=30,this.styles={header1:new wt({fontFamily:"Anton",fontSize:32,fontWeight:"bold",fill:16777215,wordWrap:!0,wordWrapWidth:t,align:"center",dropShadow:{blur:4,distance:2,angle:Math.PI/4,alpha:.7,color:"#000000"}}),header2:new wt({fontFamily:"Anton",fontSize:26,fontWeight:"bold",fill:16777215,wordWrap:!0,wordWrapWidth:t,align:"left",dropShadow:{blur:3,distance:1,angle:Math.PI/4,alpha:.6,color:"#000000"}}),bold:new wt({fontFamily:"Anton",fontSize:20,fontWeight:"bold",fill:16777215,wordWrap:!0,wordWrapWidth:t,align:"left",dropShadow:{blur:2,distance:1,angle:Math.PI/4,alpha:.5,color:"#000000"}}),italic:new wt({fontFamily:"Anton",fontSize:18,fontStyle:"italic",fill:16777215,wordWrap:!0,wordWrapWidth:t,align:"left"}),normal:new wt({fontFamily:"Anton",fontSize:18,fill:16777215,wordWrap:!0,wordWrapWidth:t,align:"left",lineHeight:24}),bullet:new wt({fontFamily:"Anton",fontSize:18,fill:16777215,wordWrap:!0,wordWrapWidth:t-this.bulletIndent,align:"left",lineHeight:24})},e&&(e.header1&&(this.styles.header1=new wt(e.header1)),e.header2&&(this.styles.header2=new wt(e.header2)),e.bold&&(this.styles.bold=new wt(e.bold)),e.italic&&(this.styles.italic=new wt(e.italic)),e.normal&&(this.styles.normal=new wt(e.normal)),e.bullet&&(this.styles.bullet=new wt(e.bullet)))}parseMarkdown(t){if(!t||typeof t!="string"){Z.error("Invalid markdown text provided:",t);const o=new j,a=new ht({text:"Error: No content available",style:this.styles.normal});return o.addChild(a),{container:o,height:a.height+40}}const e=new j;let s=20;const i=t.split(/\r?\n/);let r=0;for(;r<i.length;){const o=i[r].trim();if(o===""){s+=this.paragraphSpacing*.5,r++;continue}if(o.startsWith("**")&&o.endsWith("**")&&o.length>4){const a=o.slice(2,-2),h=new ht({text:a,style:this.styles.header1});h.x=10,h.y=s,e.addChild(h),s+=h.height+this.paragraphSpacing}else if(o.startsWith("* ")){const a=o.slice(2),h=Math.max(0,this.contentWidth-this.bulletIndent-30),{normal:l,bold:c}=this.getInlineStylesForWidth(h),u=new j,d=new ht({text:"• ",style:this.styles.bullet});d.x=10+this.bulletIndent,d.y=0,u.addChild(d);const f=this.parseInlineFormatting(a,l,c);f.x=d.x+d.width,f.y=0,u.addChild(f),u.x=0,u.y=s,e.addChild(u);let g=d.height;for(const p of f.children)p instanceof ht&&(g=Math.max(g,p.height));for(s+=g+this.lineSpacing,r++;r<i.length&&i[r].trim().startsWith("  * ");){const p=i[r].trim().slice(4),m=Math.max(0,this.contentWidth-this.bulletIndent-50),{normal:y,bold:x}=this.getInlineStylesForWidth(m),_=new j,b=new ht({text:"◦ ",style:this.styles.bullet});b.x=10+this.bulletIndent+20,b.y=0,_.addChild(b);const w=this.parseInlineFormatting(p,y,x);w.x=b.x+b.width,w.y=0,_.addChild(w),_.x=0,_.y=s,e.addChild(_);let S=b.height;for(const v of w.children)v instanceof ht&&(S=Math.max(S,v.height));s+=S+this.lineSpacing,r++}r--,s+=this.lineSpacing}else{const a=this.parseInlineFormatting(o,this.styles.normal,this.styles.bold);a.x=10,a.y=s,e.addChild(a),s+=a.height+this.paragraphSpacing}r++}return s+=20,{container:e,height:s}}parseInlineFormatting(t,e,s){const i=new j,r=new wt(e??this.styles.normal),o=new wt(s??this.styles.bold),a=Math.max(0,r.wordWrapWidth||this.contentWidth-20);if(t.startsWith("**")&&t.endsWith("**")&&t.length>4){const g=t.slice(2,-2).replaceAll("\\!","!"),p=new ht({text:g,style:o});return i.addChild(p),i}const h=this.parseInlineBold(t),l=[];for(const g of h){const p=g.text.split(/(\s+)/);for(const m of p)m!==""&&l.push({text:m,isBold:g.isBold})}let c=0,u=0;const d=Math.max(r.lineHeight??Math.round(r.fontSize*1.2),o.lineHeight??Math.round(o.fontSize*1.2)),f=g=>{const p=new wt(g);return p.wordWrap=!1,p};for(const g of l){const p=g.isBold?o:r,m=f(p),y=new ht({text:g.text.replaceAll("\\!","!"),style:m}),x=y.width;!/^\s+$/.test(g.text)&&c>0&&c+x>a?(c=0,u+=d,y.x=c,y.y=u,i.addChild(y),c+=x):(y.x=c,y.y=u,i.addChild(y),c+=x)}return i}getInlineStylesForWidth(t){const e=new wt(this.styles.normal);e.wordWrapWidth=t;const s=new wt(this.styles.bold);return s.wordWrapWidth=t,{normal:e,bold:s}}parseInlineBold(t){const e=[];let s=0;for(;s<t.length;){const i=t.indexOf("**",s);if(i===-1){s<t.length&&e.push({text:t.slice(s),isBold:!1});break}i>s&&e.push({text:t.slice(s,i),isBold:!1});const r=t.indexOf("**",i+2);if(r===-1){e.push({text:t.slice(i),isBold:!1});break}const o=t.slice(i+2,r);e.push({text:o,isBold:!0}),s=r+2}return e}setContentWidth(t){this.contentWidth=t,this.styles.header1.wordWrapWidth=t,this.styles.header2.wordWrapWidth=t,this.styles.bold.wordWrapWidth=t,this.styles.italic.wordWrapWidth=t,this.styles.normal.wordWrapWidth=t,this.styles.bullet.wordWrapWidth=t-this.bulletIndent}setStyles(t){Object.assign(this.styles,t)}setSpacing(t,e){this.lineSpacing=t,this.paragraphSpacing=e}setBulletIndent(t){this.bulletIndent=t,this.styles.bullet.wordWrapWidth=this.contentWidth-60-t}}const _y="popup_frame",SP="btn_x",vP=40;function by(){const n=it.from(SP);return n.anchor.set(.5),n.setSize(vP),n}class yu extends j{frame({size:t,children:e,dismiss:s,closable:i=!1,layout:r,onDismiss:o}){this.mount(new du({texture:$.from(_y),frame:pu,content:{children:e,size:t,layout:r},dismiss:s,close:i?by():void 0,onDismiss:o}))}mount(t){this.view=t,this.addChild(t)}resize(){const{layout:t}=Rt.getInstance();this.view.layout(fT(t.getSolution().design,this.view.size,{backdrop:t.viewportInDesign()}))}open(){return this.resize(),this.view.open()}}class If extends yu{constructor(t,e){super(),this.mount(t),Et.on(e,()=>{this.open()})}}const Ef={width:860,height:500}
436,Ff={width:600,height:380},Bf=.75;function Rf(n){const t=(e,s,i)=>Math.min(i,Math.max(s,e));return{width:t(n.width*Bf,Ff.width,Ef.width),height:t(n.height*Bf,Ff.height,Ef.height)}}const TP=52,Lf=8,AP=12,CP=20;class PP extends yu{constructor(){super(),this.title=new ht({text:"How To Play",style:mu}),this.scroll=new _P,this.scrollbar=new bP(this.scroll,!0,{trackColor:16777215,thumbColor:16766287,trackAlpha:.15,thumbAlpha:.8,trackSize:Lf,thumbMinSize:24}),this.parser=new wP(0),this.textWidth=0,this.content=null,this.tick=t=>{this.view.isOpen&&(this.scroll.update(t.deltaTime),this.scrollbar.update())},this.title.anchor.set(.5,0),this.scroll.setAxis("y"),this.frame({size:Rf(Rt.getInstance().getDim()),children:[this.title,this.scroll,this.scrollbar],dismiss:"backdrop",closable:!0,layout:()=>this.layoutContent(),onDismiss:()=>Et.emit("setHowToPlayMode",JSON.stringify(!1))}),Rt.getInstance().ticker.add(this.tick),Et.on("setHowToPlayMode",t=>{JSON.parse(String(t))?this.open():this.view.close()})}resize(){const t=Rf(Rt.getInstance().getDim());(t.width!==this.view.size.width||t.height!==this.view.size.height)&&this.view.setPanelSize(t),super.resize()}open(){return this.resize(),this.renderContent(),this.view.open()}layoutContent(){const t=this.view.contentRect,e=t.y+TP,s=t.width-AP,i=t.y+t.height-e;this.title.position.set(0,t.y),this.scroll.position.set(t.x,e),this.scroll.setSize(s,i),this.scrollbar.position.set(t.x+t.width-Lf,e),this.scrollbar.setSize(i);const r=s-CP;this.textWidth!==r&&(this.textWidth=r,this.parser.setContentWidth(r),this.content&&this.renderContent())}renderContent(){this.content&&(this.scroll.clearContent(),this.content.destroy({children:!0}));const{container:t,height:e}=this.parser.parseMarkdown(Fa.getHowToPlay());this.content=t,this.scroll.addContent(t),this.scroll.setContentSize(this.scroll.width,e),this.scroll.scrollToTop(),this.scrollbar.update()}destroy(t){Rt.getInstance().ticker.remove(this.tick),super.destroy(t)}}class wy extends Ti{constructor(t,e="blue"){super("button_ok",je.click1,!1),this.variant=e,Object.assign(this,t),this.anchor.set(.5),this.generateButtonPaths(),this.addTexture(),this.addToContainer()}generateButtonPaths(){const t="./images/prize_chart/";this.regular=`${t}btn_ok_${this.variant}.png`,this.hover=`${t}btn_ok_white.png`,this.pressed=`${t}btn_ok_${this.variant}.png`}}const Jh="./images/prize_chart/";class Of extends Ti{constructor(t,e){super("arrow",je.click1,!1),Object.assign(this,t),e==="left"&&(this.scale.x*=-1),this.generateButtonPaths(),this.addTexture()}generateButtonPaths(){this.regular=`${Jh}btn_arrow_blue.png`,this.hover=`${Jh}btn_arrow_white.png`,this.pressed=`${Jh}btn_arrow_blue.png`}}const Bs={COLUMN_SPACING:150,ROW_SPACING:35,COLUMN_OFFSET_Y:-10,TEXT_FONT_SIZE:17,PRIZE_FONT_SIZE:18,ICON_SCALE:.2,HEADER_FONT_SIZE:15,INNER_COLUMN_SPACING:70},MP=8,Df=-80,Nf=120,kP=20,IP=175,EP=[3,4,5,6],FP=[7,8,9,10];class BP extends yu{constructor(){super(),this.currentIconSprite=new it,this.contentContainer=new j,this.currentPage=0;const t=new it(_t.getTexture("./images/prize_chart/popup_prize_chart.png"));t.anchor.set(.5),t.x=MP,this.currentIconSprite.anchor.set(.5),this.currentIconSprite.y=Df,this.currentIconSprite.scale.set(Bs.ICON_SCALE),this.contentContainer.y=kP;const e=this.createButtons();this.frame({size:i0(pu,t),children:[t,this.currentIconSprite,this.contentContainer,...e],dismiss:"none"}),Et.on("showPrizeChart",()=>this.show()),Et.on("hidePrizeChart",()=>{this.view.close()}),Et.on("setAllButtonIntractvy",()=>{for(const s of e)s.interactive=!0})}createButtons(){const t=new wy({x:0,y:IP,width:80,height:40},"blue");t.on("pointerdown",()=>Et.emit("hidePrizeChart"));const e={y:Df,width:40,height:40},s=new Of({...e,x:-Nf},"left");s.on("pointerdown",()=>this.turnPage(-1));const i=new Of({...e,x:Nf},"right");return i.on("pointerdown",()=>this.turnPage(1)),[t,s,i]}show(){this.currentPage=0,this.updateContent(),this.open()}turnPage(t){this.currentPage=(this.currentPage+t+Lr.length)%Lr.length,this.updateContent()}updateContent(){this.currentIconSprite.texture=_t.getTexture(Lr[this.currentPage]),this.contentContainer.removeChildren();const t=Bs.COLUMN_SPACING/2,e=this.createColumnContainer(EP);e.position.set(-t,Bs.COLUMN_OFFSET_Y);const s=this.createColumnContainer(FP);s.position.set(t,Bs.COLUMN_OFFSET_Y),this.contentContainer.addChild(e,s)}createColumnContainer(t){const e=new j,s=-70/2,i=Bs.INNER_COLUMN_SPACING/2,r=Bs.HEADER_FONT_SIZE;return e.addChild(Do("MATCHES",r,16777215,s,-40),Do("PRIZE",r,16777215,i,-40)),t.forEach((o,a)=>{const h=a*Bs.ROW_SPACING,l=ly[o];e.addChild(Do(`${o}`,Bs.TEXT_FONT_SIZE,16777215,s,h),Do(`x${l.toFixed(2)}`,Bs.PRIZE_FONT_SIZE,65280,i,h))}),e}}function Do(n,t,e,s,i){const r=new ht({text:n,style:{fontFamily:"Arial",fontSize:t,fill:e,fontWeight:"bold",stroke:{color:0,width:2}}});return r.anchor.set(.5),r.position.set(s,i),r}const RP={width:120,height:50};function Sy(){return{texture:$.from(_y),frame:pu,width:440,gap:24,title:n=>new ht({text:n,style:mu}),body:(n,t)=>new ht({text:n,style:{...sP,wordWrap:!0,wordWrapWidth:t}}),button:(n,t)=>{const e=new wy({x:0,y:0,...RP},"blue");return e.handlePress=t,e}}}const LP=3383273,Wf=3881813,OP=4854904,DP={color:11827455,width:4},NP={...mu,fontSize:28};function vy(n,t,e,s){const i=new Wt,r=new ht({text:n,style:NP,anchor:.5}),o=new j({children:[i,r]});return o.eventMode="static",o.cursor="pointer",o.on("pointertap",()=>{se.playSFX(je.click3),s()}),{view:o,fill:h=>{i.clear().roundRect(-t/2,-e/2,t,e,14).fill(h).stroke(DP)}}}function WP(n,t){const e=vy(String(n),80,64,t);return e.fill(Wf),{view:e.view,setSelected:s=>e.fill(s?OP:Wf)}}function zP(){return{...Sy(),button:(n,t)=>{const e=vy(n,260,56,t);return e.fill(LP),e.view},option:WP,close:by}}class xi extends ui{constructor(){super(),this.Main=Rt.getInstance(),xi.instance||(xi.instance=this);const t=this.Main.getDim(),e=di(t.width,t.height),s=t.width<t.height;new ks(e,s),this.winningFirework=new xP(e.winningElement),this.autoPlayStopBar=new uP(e.autoPlayButton),this.popups=[new PP,new BP,
436new If(XA(Sy()),"showLowBalance"),new If($A(zP(),this.Main.autoplay,{onDismiss:()=>se.playSFX(je.click3)}),"showAutoplayPicker")],this.addChild(...this.popups)}resize(t,e){ks.getInstance()?.relayout(t,e),Object.assign(this.winningFirework,t.winningElement),Object.assign(this.autoPlayStopBar,t.autoPlayButton);for(const s of this.popups)s.resize()}static getInstance(){return xi.instance}}class YP extends it{constructor(t){super(),this.generateFireworkPath=e=>`./images/fireworks/firework-${e}.png`,this.label=this.generateFireworkPath(t),this.x=0,this.y=0,this.width=125,this.height=125,this.anchor.set(.5),this.addTexture()}addTexture(){const t=_t.getTexture(this.label);this.texture=t}}const VP="./images/string/firework_string_sprite_sheet.png",UP=70,GP=50;let XP=class extends j{constructor(){super(),this.textures=[],this.generateTextures(),this.generateAnimatedString()}generateTextures(){const r=_t.getTexture(VP);for(let o=0;o<80;o++){const a=o%5*287,h=Math.floor(o/5)*199,l=new qt(a,h,287,199),c=new $({source:r,frame:l});this.textures.push(c)}}destroyString(){this.removeChild(this.string),this.string.destroy()}generateAnimatedString(){this.animString=new da(this.textures),this.animString.x=0,this.animString.y=45,this.animString.width=UP,this.animString.height=GP,this.animString.loop=!1,this.animString.anchor.set(.9,.5),this.addChild(this.animString)}runAnimation(t){this.animString.play(),setTimeout(()=>{t()},1e3)}};class $P extends fs{constructor(t,e,s,i,r=()=>{}){super(),new J.Tween(t).to({width:e,height:s,alpha:i},800).easing(J.Easing.Linear.None).onComplete(()=>{i==1&&(t.alpha=0),setTimeout(()=>{r()},20)}).start()}}class wr extends j{constructor(t,e,s){super(),this.BoxLayer=gi.getInstance(),this.rotating=!1,this.x=e,this.y=s,this.bgExplosion=new it(_t.getTexture("./images/explosion/vfx_explosion_blue.png")),this.bgExplosion.anchor.set(.5),this.bgExplosion.width=t==0?120:150,this.bgExplosion.height=t==0?120:150,this.bgExplosion.visible=!1,this.bgExplosion.alpha=.7,this.addChild(this.bgExplosion),this.bgExplosionYellow=new it(_t.getTexture("./images/explosion/vfx_explosion_yellow.png")),this.bgExplosionYellow.anchor.set(.5),this.bgExplosionYellow.width=t==0?120:150,this.bgExplosionYellow.height=t==0?120:150,this.bgExplosionYellow.visible=!1,this.bgExplosionYellow.alpha=.7,this.addChild(this.bgExplosionYellow),this.iconSprite=new it,this.iconSprite.anchor.set(.5),this.iconSprite.width=t==0?100:125,this.iconSprite.height=t==0?100:125,this.addTexture(t),this.addChild(this.iconS
436prite),this.BoxLayer.addChild(this),this.winIndex=t}setTail(t){}setGlow(t){t?(this.bgExplosion.visible=!0,this.bgExplosion.rotation=0,this.rotating=!0,this.animateExplosion(),this.popIcon()):(this.bgExplosion.visible=!1,this.rotating=!1,this.iconSprite.scale.set(this._originalScaleX||1,this._originalScaleY||1))}setYellowGlow(t){t?(this.bgExplosionYellow.visible=!0,this.bgExplosionYellow.rotation=0,this.rotating=!0,this.animateYellowExplosion(),this.popIcon()):(this.bgExplosionYellow.visible=!1,this.rotating=!1,this.iconSprite.scale.set(this._originalScaleX||1,this._originalScaleY||1))}popIcon(){this._originalScaleX===void 0&&(this._originalScaleX=this.iconSprite.scale.x,this._originalScaleY=this.iconSprite.scale.y);const t=this._originalScaleX,e=this._originalScaleY,s=t*1.2,i=e*1.2;let r=0;const o=10,a=()=>{if(r<o){const l=++r/o;this.iconSprite.scale.set(t+(s-t)*l,e+(i-e)*l),requestAnimationFrame(a)}else h()},h=()=>{if(r>0){const l=--r/o;this.iconSprite.scale.set(t+(s-t)*l,e+(i-e)*l),requestAnimationFrame(h)}else this.iconSprite.scale.set(t,e)};a()}animateExplosion(){this.rotating&&(this.bgExplosion.rotation+=.1,requestAnimationFrame(()=>this.animateExplosion()))}animateYellowExplosion(){this.rotating&&(this.bgExplosionYellow.rotation+=.1,requestAnimationFrame(()=>this.animateYellowExplosion()))}addTexture(t){const e=Lr[t],s=_t.getTexture(e);this.iconSprite.texture=s}remove(){this.parent.removeChild(this),this.destroy()}}class HP{constructor(t){this.MiddleLayer=mi.getInstance(),this.Grid=La.getInstance(),this.events=Et,this.Firework=t}run(){const t=this.Firework.wIconIndex>-1?Qn[this.Firework.index].color:"empty",e=t=="empty"?0:1,s=_t.getTexture(this.Firework.generateAssetsPath(t));this.Firework.hideFirework();const i=new it(s);i.x=this.Firework.x,i.y=this.Firework.y,i.anchor.set(.5),i.width=169*.3,i.height=153*.3,this.MiddleLayer.addChild(i),new $P(i,169*.9,153*.9,e,()=>{if(i.parent.removeChild(i),i.destroy(),this.Firework.wIconIndex>-1){const r=this.Grid.winningFireworks.find(l=>l.firework==this.Firework);if(r===void 0)return;const o=new wr(this.Firework.wIconIndex,this.Firework.x,this.Firework.y),a=this.Grid.winningFireworks.indexOf(r),h=this.Firework.getGridCoord();this.Grid.winningFireworks.splice(a,1),setTimeout(()=>this.Firework.remove(),1e3),this.Grid.grid[Number(h.c)][Number(h.r)]=o,this.Grid.winningFireworks.length==0&&this.events.emit("gameIsCompleted")}})}}class jP extends it{constructor(){super(),this.addTexture()}addTexture(){this.texture=_t.getTexture("./images/fireworks/fire.png"),this.y=
43650,this.anchor.set(.5,.1),this.scale.set(.2)}}class qP extends fs{constructor(t){super(),this.winningFirework=t;const e=t.width*1.1,s=t.height*1.1;this.animation=new J.Tween(t).to({width:e,height:s},800).easing(J.Easing.Quadratic.InOut).repeat(1/0).yoyo(!0)}start(){this.animation.start()}stop(){this.animation.stop()}}class zf extends fs{constructor(t,e){super(),this.originalScale=t.scale.x,this.originalX=t.x,this.originalY=t.y,this.target=t,this.onComplete=e}start(){const t=()=>this.originalX+(Math.random()*20-10),e=()=>this.originalY+(Math.random()*10-5);new J.Tween(this.target).to({x:t(),y:e()},100).yoyo(!0).repeat(8).easing(J.Easing.Quadratic.InOut).onRepeat(()=>{this.target.x=t(),this.target.y=e()}).chain(new J.Tween(this.target).to({x:this.originalX,y:this.originalY},150).onComplete(()=>{this.target.x=this.originalX,this.target.y=this.originalY,this.onComplete()}),new J.Tween(this.target.scale).to({x:this.originalScale*1.4,y:this.originalScale*1.4},50)).start(),new J.Tween(this.target.scale).to({x:this.originalScale*1.2,y:this.originalScale*1.2},800).easing(J.Easing.Quadratic.In).start()}}const Yf=.8;class Vf extends fs{constructor(t,e){super(),this.target=t,this.originalScale=t.scale.x,this.onComplete=e}start(){new J.Tween(this.target.scale).to({x:this.originalScale*Yf,y:this.originalScale*Yf},400).easing(J.Easing.Back.In).onComplete(this.onComplete).start()}}class KP extends j{constructor(t,e,s,i,r){super(),this.wIconIndex=-1,this.generateAssetsPath=o=>`./images/explosion/vfx_explosion_${o}.png`,this.setWinIconIndex=o=>{this.wIconIndex=o},this.getWinIconIndex=()=>this.wIconIndex,this.startAnimation=()=>this.animation&&this.animation.start(),this.stopAnimation=()=>this.animation&&this.animation.stop(),this.index=t,this.x=e,this.y=s,this.scale.set(.9),this.Explosion=new HP(this),this.setGridCoord(i,r),this.addFire(),this.addString(),this.setTail(!1),this.addFireworkBody(),this.setInteractivity(!0),this.animation=new qP(this),this.on("mousedown",this.handleMousedown),this.on("touchstart",this.handleMousedown)}addFireworkBody(){this.FireworkBody=new YP(this.index),this.addChild(this.FireworkBody)}setTail(t){if(t){this.String.visible=!0,this.Fire.visible=!1;return}this.String.visible=!1,this.Fire.visible=!0}addFire(){this.Fire=new jP,this.addChild(this.Fire)}
436addString(){this.String=new XP,this.addChild(this.String)}setInteractivity(t){this.interactive=t,this.cursor=t?"pointer":"default"}playAnticipation(t){this.wIconIndex!==-1?new zf(this,t):new Vf(this,t)}handleMousedown(){this.setInteractivity(!1),this.playAnticipation(()=>{this.explode(),this.wIconIndex===-1&&se.playSFX(je.clickOnBadFirework,{volume:.05})})}hideFirework(){this.String.alpha=0,this.FireworkBody.alpha=0}explode(){const t=this.wIconIndex!==-1?new zf(this,()=>this.Explosion.run()):new Vf(this,()=>this.Explosion.run());this.String.runAnimation(()=>t.start())}setGridCoord(t,e){this.gridCoord=`${t}x${e}`}getGridCoord(){const[t,e]=this.gridCoord.split("x");return{c:t,r:e}}remove(){this.animation&&this.animation.stop(),this.parent.removeChild(this),this.destroy()}}const ZP=ly;function xu(n,t){const e={};for(const s of n)e[s]=(e[s]??0)+1;return Object.entries(e).filter(([,s])=>s>=3).map(([s,i])=>({index:parseInt(s,10),count:i,multiplier:ZP[i+(t?1:0)]??0,isBonus:t}))}function QP(n,t,e){return xu(n,t).reduce((s,i)=>s+i.multiplier*e,0)}function Ty(n,t){let e=0,s=n,i=!1;for(;s;)e+=QP(s.prizes,i,t),s=s.bonus,i=!0;return e}class Ra{constructor(t,e,s,i){this.Main=Rt.getInstance(),this.events=Et,this.grid=[[],[],[],[]],this.winningFireworks=[],this.prizes=[],this.allMultipliers=[],this.hand=t,this.initialHand=s,this.yOffset=e,this.newHandTime=Date.now(),this.gridDataManager=i,this.generateGrid(),this.calcMultipliers()}calcMultipliers(){this.initialHand||(this.allMultipliers=xu(this.hand.prizes,this.gridDataManager.isBonusFlag))}static cellPosition(t,e,s,i,r){const o=di(t,e).grid;return{x:o.originX+o.stepX*i,y:o.originY+o.stepY*s+r}}generateGrid(){this.prizes=this.hand.prizes.slice(0);const t=this.Main.getDim(),e=Array(4).fill(Array(4).fill("e"));let s=0;e.forEach((i,r)=>i.forEach((o,a)=>{const{x:h,y:l}=Ra.cellPosition(t.width,t.height,r,a,this.yOffset),c=this.hand.grid[s],u=new KP(c,h,l,r,a);u.setInteractivity(!this.initialHand),this.grid[r][a]=u,this.calculateWinningFirework(c,u),s++}))}emitWinningFirework(t){this.events.emit("updateWFireworkTexture",t)}calculateWinningFirework(t,e){const s=this.hand.win,i=Qn[s],r=Qn[t];if(this.emitWinningFirework(s),i.type==r.type||i.color==r.color){const o=this.prizes.shift()||0;e.setWinIconIndex(o);const a={firework:e,isSameType:i.type==r.type,isSameColor:i.color==r.color};this.winningFireworks.push(a)}}}class JP extends fs{constructor(t,e){super(),this.isOnCompFinished=!1,this.grid=t.grid,this.animDuration=e,this.onComp=()=>{this.isOnCompFinished=!0,t.onComp()},this.startAnim()}startAnim(){this.generateWaterFall().forEach((e,s)=>{setTimeout(()=>{e.forEach(i=>{const r={y:i.y-oy};new J.Tween(i).to(r,this.animDuration).easing(J.Easing.Linear.None).onComplete(()=>s==pC&&!this.isOnCompFinished?this.onComp():"").start()})},s*100)})}generateWaterFall(){return[[this.grid[0][0]],[this.grid[1][0],this.grid[0][1]],[this.grid[2][0],this.grid[1][1],this.grid[0][2]],[this.grid[3][0],this.grid[2][1],this.grid[1][2],this.grid[0][3]],[this.grid[3][1],this.grid[2][2],this.grid[1][3]],[this.grid[3][2],this.grid[2][3]],[this.grid[3][3]]]}}const t2=n=>{for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},e2=oy,s2=dC,i2=fC,In=class In{constructor(t,e){this.BoxLayer=gi.getInstance(),this.events=Et,this.prevGrid=[[],[],[],[]],this.grid=[[],[],[],[]],this.winningFireworks=[],this.isManuelExplode=!1,this.showFWString=s=>setTimeout(()=>this.grid.flat().forEach(i=>i.setTail(!0)),s),In.instance||(In.instance=this),this.gridDataManager=e,this.setHand(t),this.generateGrid(0),this.events.on("explAllWFireworks",()=>this.explodeAllWFireworks()),this.events.on("setHowToPlayMode",s=>this.isOpenHTP=!!s),this.events.on("setManuelExplode",s=>this.isManuelExplode=!!s),setTimeout(()=>{this.events.emit("setPlayButStatus",vt.show)},1400)}get betAmount(){return lt.getInstance().getBetAmount()}setHand(t){this.hand=t}getHand(){return this.hand}runGridAnimation(t){this.hand=t,this.generateGrid(e2);const e=()=>{if(this.showFWString(500),lt.getInstance().isAutoplayActive()||!this.isManuelExplode){setTimeout(()=>this.explodeAllWFireworks(),1e3);return}this.addInteractivityWFireworks()};if(this.prevGrid[0].length>0){const s=()=>{this.addInteractivityWFireworks(),setTimeout(()=>this.destoryPrevGrid(),3e3)};this.startAnimation(this.prevGrid,s2,s)}setTimeout(()=>this.startAnimation(this.grid,i2,e),300)}explodeAllWFireworks(){let t=0;if(this.winningFireworks.length==0)return this.events.emit("gameIsCompleted");
436t2(this.grid.flat()).forEach(s=>{const i=[70,110,130][Math.floor(Math.random()*3)];t+=i,setTimeout(()=>{s.explode()},t)})}startWinFwShrinkAnim(){setTimeout(()=>{Date.now()>this.newHandTime+4e3&&this.winningFireworks.forEach(t=>t.firework.startAnimation())},5e3)}addInteractivityWFireworks(){this.startWinFwShrinkAnim(),this.winningFireworks.forEach(t=>t.firework.setInteractivity(!0))}removeInteractivityWFireworks(t){t.alpha=0,t.setInteractivity(!1)}destoryPrevGrid(){this.prevGrid.forEach(t=>t.forEach(e=>e.remove())),this.prevGrid=[]}startAnimation(t,e,s){new JP({grid:t,onComp:()=>s()},e)}generateGrid(t){this.grid[0].length>0&&(this.prevGrid=this.grid,this.grid=[]);const e=new Ra(this.hand,t,!this.newHandTime,this.gridDataManager);e.grid.forEach(s=>s.forEach(i=>{t==0&&i.setTail(!0),this.BoxLayer.addChild(i)})),Object.assign(this,e),this.currentGrid=e}resize(){const{width:t,height:e}=Rt.getInstance().getDim(),s=i=>i.forEach((r,o)=>r.forEach((a,h)=>{if(!a)return;const{x:l,y:c}=Ra.cellPosition(t,e,o,h,0);a.x=l,a.y=c}));s(this.grid),s(this.prevGrid)}};In.getInstance=()=>In.instance;let La=In;const Fi=.4,tl=.6;
436class n2 extends j{constructor(t,e){super(),this.TopLayer=Ki.getInstance(),this.rotating=!1,this.isWild=!0,this.currentIconIndex=-1,this.x=t,this.y=e,this.bgExplosion=new it(_t.getTexture("./images/explosion/vfx_explosion_blue.png")),this.bgExplosion.anchor.set(.5),this.bgExplosion.width=150,this.bgExplosion.height=150,this.bgExplosion.visible=!1,this.bgExplosion.alpha=.7,this.addChild(this.bgExplosion),this.bgExplosionYellow=new it(_t.getTexture("./images/explosion/vfx_explosion_yellow.png")),this.bgExplosionYellow.anchor.set(.5),this.bgExplosionYellow.width=150,this.bgExplosionYellow.height=150,this.bgExplosionYellow.visible=!1,this.bgExplosionYellow.alpha=.7,this.addChild(this.bgExplosionYellow),this.starSprite=new it(_t.getTexture("./images/winning_icons/icon_prize_star.png")),this.starSprite.anchor.set(.5),this.starSprite.scale.set(Fi),this.starSprite.visible=!0,this.addChild(this.starSprite),this.iconSprite=new it,this.iconSprite.anchor.set(.5),this.iconSprite.width=125,this.iconSprite.height=125,this.iconSprite.visible=!1,this.addChild(this.iconS
436prite),this.TopLayer.addChild(this)}setGlow(t){t?(this.bgExplosion.visible=!0,this.bgExplosion.rotation=0,this.rotating=!0,this.animateExplosion(),this.popIcon()):(this.bgExplosion.visible=!1,this.rotating=!1,this.restoreScale())}setYellowGlow(t){t?(this.bgExplosionYellow.visible=!0,this.bgExplosionYellow.rotation=0,this.rotating=!0,this.animateYellowExplosion(),this.popIcon()):(this.bgExplosionYellow.visible=!1,this.rotating=!1,this.restoreScale())}popIcon(){const t=this.isWild?this.starSprite:this.iconSprite,e=t;e._originalScaleX||(e._originalScaleX=t.scale.x,e._originalScaleY=t.scale.y);const s=e._originalScaleX,i=e._originalScaleY,r=s*1.2,o=i*1.2;let a=0;const h=10,l=()=>{if(a<h){const u=++a/h;t.scale.set(s+(r-s)*u,i+(o-i)*u),requestAnimationFrame(l)}else c()},c=()=>{if(a>0){const u=--a/h;t.scale.set(s+(r-s)*u,i+(o-i)*u),requestAnimationFrame(c)}else t.scale.set(s,i)};l()}restoreScale(){(this.isWild?this.starSprite:this.iconSprite).scale.set(1,1)}animateExplosion(){this.rotating&&(this.bgExplosion.rotation+=.1,requestAnimationFrame(()=>this.animateExplosion()))}animateYellowExplosion(){this.rotating&&(this.bgExplosionYellow.rotation+=.1,requestAnimationFrame(()=>this.animateYellowExplosion()))}async transformToIcon(t){await this.playAnticipationAnimation(),this.isWild=!1,this.currentIconIndex=t;const e=Lr[t],s=_t.getTexture(e);this.iconSprite.texture=s,this.iconSprite.width=t===0?100:125,this.iconSprite.height=t===0?100:125,this.starSprite.visible=!1,this.iconSprite.visible=!0,await this.playPopInAnimation()}async transformBackToWild(){this.isWild=!0,this.currentIconIndex=-1,this.iconSprite.visible=!1,this.starSprite.visible=!0,await this.playWildPopAnimation()}animateWildStar(){return!this.isWild||!this.starSprite.visible?Promise.resolve():new Promise(t=>{const e=Fi,s=tl;let i=0;const r=15,o=3,a=()=>{if(i<r){const h=++i/r,l=e+(s-e)*h,c=(Math.random()-.5)*o,u=(Math.random()-.5)*o;this.starSprite.scale.set(l,l),this.starSprite.x=c,this.starSprite.y=u,requestAnimationFrame(a)}else if(i<r*2){const h=(++i-r)/r,l=s-(s-e)*h,c=(Math.random()-.5)*o*(1-h),u=(Math.random()-.5)*o*(1-h);this.starSprite.scale.set(l,l),this.starSprite.x=c,this.starSprite.y=u,requestAnimationFrame(a)}else this.starSprite.scale.set(e,e),this.starSprite.x=0,this.starSprite.y=0,t()};a()})}async playWildPopAnimation(){return new Promise(t=>{const e=Fi,s=tl;let i=0;const r=8,o=()=>{if(i<r){const a=++i/r,h=e+(s-e)*Math.sin(a*Math.PI/2);this.starSprite.scale.set(h,h),requestAnimationFrame(o)}else if(i<r*2){const a=(++i-r)/r,h=s-(s-e)*Math.sin(a*Math.PI/2);this.starSprite.scale.set(h,h),requestAnimationFrame(o)}else this.starSprite.scale.set(e,e),t()};o()})}async playAnticipationAnimation(){return new Promise(t=>{let e=0;const s=12,i=2,r=()=>{if(e<s){const o=++e/s,a=Fi+(tl-Fi)*Math.sin(o*Math.PI/2),h=Math.sin(o*Math.PI)*i,l=(Math.random()-.5)*h,c=(Math.random()-.5)*h;this.starSprite.scale.set(a,a),this.starSprite.x=l,this.starSprite.y=c,requestAnimationFrame(r)}else this.starSprite.scale.set(Fi,Fi),this.starSprite.x=0,this.starSprite.y=0,t()};r()})}async playPopInAnimation(){return new Promise(t=>
436{const e=this.iconSprite.scale.x,s=this.iconSprite.scale.y,i=1.2;let r=0;const o=6,a=4;this.iconSprite.scale.set(e*.3,s*.3);const h=()=>{if(r<o){const l=++r/o,c=1-Math.pow(1-l,3),u=e*(.3+(i-.3)*c),d=s*(.3+(i-.3)*c);this.iconSprite.scale.set(u,d),requestAnimationFrame(h)}else if(r<o+a){const l=(++r-o)/a,c=e*(i-(i-1)*l),u=s*(i-(i-1)*l);this.iconSprite.scale.set(c,u),requestAnimationFrame(h)}else this.iconSprite.scale.set(e,s),t()};h()})}async showWithPopAnimation(){this.visible=!0,this.isWild&&await this.playWildPopAnimation()}hide(){this.visible=!1}show(){this.visible=!0,this.playWildPopAnimation()}getCurrentIconIndex(){return this.currentIconIndex}getIsWild(){return this.isWild}remove(){this.parent.removeChild(this),this.destroy()}}async function rc(n=1200){return new Promise(t=>setTimeout(t,n))}const _u={INSUFFICIENT_FUNDS:"INSUFFICIENT_FUNDS"};function r2(n){const t={initialize:()=>n.initialize(),dispose:()=>n.dispose(),async playRound(e){const s=await n.playRound(e),i=lt.getInstance();return s.ok&&!i.isInRound()&&i.startRound(),s},async finalizeRound(){await n.finalizeRound();const e=lt.getInstance();e.isInRound()&&e.endRound()}};return n.refreshBalance&&(t.refreshBalance=()=>n.refreshBalance()),t}let oc=null;function o2(n){oc=r2(n)}function bu(){if(!oc)throw new Error("Backend not initialized — call setBackend() first");return oc}function wu(){Et.emit("setBPlayButStatus",vt.hide),Et.emit("setPlayButStatus",vt.show),Et.emit("setAPlayButStatus",vt.show),Et.emit("setBonusGame",!1)}function Uf(n){n===_u.INSUFFICIENT_FUNDS&&Et.emit("showLowBalance"),wu()}class Mn{constructor(t){this.events=Et,this.wildWinIcon=null,this.gridManager=t}static getInstance(t){return Mn.instance||(Mn.instance=new Mn(t)),Mn.instance}async handleBonusPreCalculation(){const t=this.gridManager.Grid.currentGrid.allMultipliers;if(!t.length)return;const e=this.gridManager.Grid.grid;await this.triggerFireworkFlyOutAndWait(),this.showWildIconAfterExplosion(t,e)}async triggerFireworkFlyOutAndWait(){const e=this.gridManager.Grid.grid,s=e[0][0],i=e[e.length-1][e[0].length-1],r=s.toGlobal(new It(0,0)),o=i.toGlobal(new It(0,0)),a=(r.x+o.x)/2,h=(r.y+o.y)/2;return this.events.emit("FireworkFlyOut",{x:a,y:h}),new Promise(l=>setTimeout(l,4300))}showWildIconAfterExplosion(t,e){if(t.length===0)return;setTimeout(()=>{if(this.createWildWinIcon(e),this.wildWinIcon){this.wildWinIcon.scale.set(.1);const i=1,r=500,o=performance.now(),a=h=>{const l=h-o,c=Math.min(l/r,1),u=1-Math.pow(1-c,3),d=.1+(i-.1)*u;this.wildWinIcon.scale.set(d),c<1&&requestAnimationFrame(a)};requestAnimationFrame(a)}},600)}createWildWinIcon(t){if(this.wildWinIcon){this.wildWinIcon.show();return}let e=0,s=0;try{const i=ks.getInstance();i&&i.PlayButton&&(e=i.PlayButton.x,s=i.PlayButton.y)}catch{const i=t.length,r=t[0]?t[0].length:0;if(i!==0&&r!==0){const o=t[i-1][r-1];e=(r-1)*150+150,s=(i-1)*150,o&&typeof o.x=="number"&&(e=o.x+150,s=o.y)}}this.wildWinIcon=new n2(e,s),this.wildWinIcon.show()}async handleGameCompleted(){if(this.gridManager.isBonusFlag&&(await this.handleBonusPreCalculation(),await rc(2500)),await this.showWinValues(),this.gridManager.isBonusGame()){this.gridManager.currGameIndex++,this.gridManager.isBonusFlag=!0,await this.showBonusPop(),this.wildWinIcon&&this.wildWinIcon.hide();const e=lt.getInstance().isAutoplayActive();if(this.events.emit("setBPlayButStatus",e?vt.semiOpacity:vt.show),this.events.emit("setPlayButStatus",vt.hide),this.events.emit("setAPlayButStatus",vt.hide),this.events.emit("setBonusGame",!0),e){await rc(1e3),this.gridManager.handleGamesData(this.gridManager.games.bonus);return}this.events.emit("bonusReady");return}if(bu().finalizeRound(),this.events.emit("roundSettled"),this.gridManager.games=null,this.gridManager.currGameIndex=0,this.gridManager.isBonusFlag=!1,this.wildWinIcon&&this.wildWinIcon.hide(),lt.getInstance().isAutoplayActive()){this.events.emit("setBonusGame",!1),this.events.emit("setBPlayButStatus",vt.hide),this.events.emit("setPlayButStatus",vt.semiOpacity);return}const t=this.gridManager.Grid.currentGrid.allMultipliers.length===0?300:2e3;setTimeout(wu,t)}async showWinValues(){const t=this.gridManager.Grid.currentGrid.allMultipliers;if(t.length===0)return;const e=this.gridManager.Grid.grid;for(const s of t)await this.glowBatch(s,e)}glowBatch(t,e){const s=t.index,i=t.count,r=this.gridManager.Grid.betAmount,o=i<=3?0:1500;return setTimeout(()=>{this.events.emit("setPrize",{multiplier:t,betAmount:r})},500),new Promise(a=>{const h=[];e.forEach(l=>{l.forEach(c=>{c instanceof wr&&c.winIndex===s&&(c.setGlow(!0),h.push(c))})}),this.wildWinIcon&&(this.wildWinIcon.transformToIcon(s),this.wildWinIcon.setGlow(!0)),setTimeout(()=>{h.forEach(l=>l.setGlow(!1)),this.wildWinIcon&&(this.wildWinIcon.setGlow(!1),this.wildWinIcon.transformBackToWild()),a()},2e3+o)})}async showBonusPop(){setTimeout(()=>{const s=Qn[this.gridManager.games?.win||""];this.events.emit("setBonusWin",s)},500);const t=this.gridManager.Grid.grid,e=[];for(let s=0;s<t.length;s++){for(let i=0;i<=t[s].length-4;i++)if(t[s].slice(i,i+4).every(o=>o instanceof wr)){e.push(...t[s].slice(i,i+4).filter(o=>o instanceof wr));break}if(e.length>0)break}if(e.length===0)for(let s=0;s<t[0].length;s++){for(let i=0;i<=t.length-4;i++)if([0,1,2,3].every(o=>t[i+o][s]instanceof wr)){for(let o=0;o<4;
436o++)e.push(t[i+o][s]);break}if(e.length>0)break}return e.length>0?new Promise(s=>{e.forEach(i=>i.setYellowGlow(!0)),setTimeout(()=>{e.forEach(i=>i.setYellowGlow(!1)),s()},2e3)}):new Promise(s=>s())}}const a2=500;class li{constructor(){this.events=Et,this.games=null,this.currGameIndex=0,this.isBonusFlag=!1,this.Grid=new La(gC,this),this.winManager=Mn.getInstance(this),window.gridDataManager=this,this.events.on("spin",()=>this.handleSpin()),this.events.on("gameIsCompleted",()=>this.winManager.handleGameCompleted()),lt.getInstance().on("autoplayActiveChanged",t=>{this.events.emit("setAllButtonIntractvy",!t),t||wu()})}static getInstance(){return li.instance||(li.instance=new li),li.instance}isBonusGame(){return this.games&&this.games.bonus!==null}handleSpin(){if(!this.games?.bonus){this.playNewRound();return}this.events.emit("resetTotalWon"),this.events.emit("setBPlayButStatus",vt.semiOpacity),this.events.emit("setPlayButStatus",vt.hide),this.events.emit("setAPlayButStatus",vt.semiOpacity),this.handleGamesData(this.games.bonus)}async playAutoplayRound(){const t=await this.playNewRound();return t.ok&&(await new Promise(e=>this.events.once("roundSettled",e)),await rc(a2)),t}async playNewRound(){this.events.emit("resetTotalWon"),this.events.emit("setBPlayButStatus",vt.hide),this.events.emit("setPlayButStatus",vt.semiOpacity),this.events.emit("setAPlayButStatus",vt.semiOpacity);const t=lt.getInstance().getBetAmount();let e;try{e=await bu().playRound({betAmount:t})}catch(s){throw Uf(void 0),s}if(!e.ok){const{code:s}=e;return Z.warn(`Round rejected: ${s}`),Uf(s),e}return this.handleGamesData(e.round.hand),e}runGame(t){if(!t){Z.info("No hand data");return}this.Grid.runGridAnimation(t)}handleGamesData(t){this.games=t,this.runGame(t)}}class Zi extends j{constructor(){super(),this.Game=zn.getInstance(),Zi.instance||(Zi.instance=this),this.addLayers(),this.addToGame()}addLayers(){this.bottomLayer=new Wn,this.middleLayer=new mi,this.topLayer=new Ki,this.uiLayer=new xi,li.getInstance()}resize(t,e){const s=di(t,e),i=t<e;this.bottomLayer.resize(),this.middleLayer.resize(),this.topLayer.resize(),this.uiLayer.resize(s,i),li.getInstance().Grid.resize()}setHowToPlay(t){}addHowToPlay(){}removeHowToPlay(){}addToGame(){this.Game.addChild(this)}static getInstance(){return Zi.instance}}class zn extends j{constructor(){super(),this.Main=Rt.getInstance(),zn.instance||(zn.instance=this),new Zi,this.addToStage()}addToStage(){this.Main.world.addChild(this)}static getInstance(){return zn.instance}}var h2=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Gf=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Sr;class l2 extends j{constructor(){super(...arguments),Sr.set(this,!1)}get isActive(){return h2(this,Sr,"f")}onResize(t,e){}onUpdate(t){}activate(){Gf(this,Sr,!0,"f")}deactivate(){Gf(this,Sr,!1,"f")}}Sr=new WeakMap;var De=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},we;class c2{constructor(t,e={}){we.set(this,[]),this.transitioning=!1,this.tick=()=>{const s=this.current;s&&s.onUpdate(this.app.ticker.deltaTime)},this.app=t,this.parent=e.parent??t.stage,this.getSize=e.getSize,this.app.ticker.add(this.tick,this)}sizeOnMount(t){const e=this.getSize?.();e&&t.onResize(e.width,e.height)}get current(){return De(this,we,"f").length>0?De(this,we,"f")[De(this,we,"f").length-1]:null}get stack(){return De(this,we,"f")}async push(t,e){if(!this.transitioning){this.transitioning=!0;try{const s=this.current;s&&s.deactivate(),De(this,we,"f").push(t),this.parent.addChild(t),t.activate(),await t.onEnter(e),this.sizeOnMount(t)}finally{this.transitioning=!1}}}async pop(){if(this.transitioning||De(this,we,"f").length===0)return null;this.transitioning=!0;try{const t=De(this,we,"f").pop();t.deactivate(),await t.onExit(),this.parent.removeChild(t);const e=this.current;return e&&(e.activate(),this.sizeOnMount(e)),t}finally{this.transitioning=!1}}async replace(t,e){if(!this.transitioning){this.transitioning=!0;try{const s=De(this,we,"f").pop();s&&(s.deactivate(),await s.onExit(),this.parent.removeChild(s)),De(this,we,"f").push(t),this.parent.addChild(t),t.activate(),await t.onEnter(e),this.sizeOnMount(t)}finally{this.transitioning=!1}}}resize(t,e){for(const s of De(this,we,"f"))s.onResize(t,e)}async clear(){for(;De(this,we,"f").length>0;)await this.pop()}destroy(){this.app.ticker.remove(this.tick,this);for(const t of De(this,we,"f"))t.deactivate(),this.parent.removeChild(t);De(this,we,"f").length=0}}we=new WeakMap;const Ay={top:0,right:0,bottom:0,left:0};function ze(n){return n<1?1:n}function u2(n,t,e){return Math.min(Math.max(n,t),e)}
436function d2(n){return"landscape"in n&&"portrait"in n}function f2(n,t){const{design:e,orientation:s}=n;if(!d2(e))return{width:e.width,height:e.height};const r=(s==="lock-portrait"?!0:s==="lock-landscape"?!1:t.height>t.width)?e.portrait:e.landscape;return{width:r.width,height:r.height}}function p2(n,t){const e=n.width==="auto",s=n.height==="auto",i=t.width/t.height;if(e&&s)return{width:ze(t.width),height:ze(t.height)};if(e){const r=ze(n.height);return{width:ze(i*r),height:r}}if(s){const r=ze(n.width);return{width:r,height:ze(r/i)}}return{width:ze(n.width),height:ze(n.height)}}function g2(n){return n===void 0?Ay:typeof n=="number"?{top:n,right:n,bottom:n,left:n}:n}function Xf(n,t){if(n.kind==="fixed")return Math.max(0,n.px);const e=n.of==="width"?t.width:t.height;return u2(e*n.factor,n.min,n.max)}function m2(n,t,e,s,i){const r=t/s,o=e/i;switch(n){case"fit":return Math.min(r,o);case"cover":return Math.max(r,o);case"fit-width":return r;case"fit-height":return o;default:return Math.min(r,o)}}function y2(n){const{config:t,dpr:e}=n,s={width:ze(n.viewport.width),height:ze(n.viewport.height)},i=t.safeArea===!1?Ay:n.insets,r=g2(t.padding),o=i.left+r.left,a=i.right+r.right,h=i.top+r.top,l=i.bottom+r.bottom,c=o,u=h,d=ze(s.width-o-a),f=ze(s.height-h-l);let g=t.bars?.top?Xf(t.bars.top.height,s):0,p=t.bars?.bottom?Xf(t.bars.bottom.height,s):0;g=Math.min(g,f),p=Math.min(p,Math.max(0,f-g));const m=t.bars?.top!==void 0?{x:c,y:u,width:d,height:g}:void 0,y=t.bars?.bottom!==void 0?{x:c,y:u+f-p,width:d,height:p}:void 0,x={x:c,y:u+g,width:d,height:ze(f-g-p)},_=x.x,b=x.y,w=x.width,S=x.height,v=p2(f2(t,s),{width:w,height:S}),T=t.fit==="stretch";let A,P;if(T)A=w/v.width,P=S/v.height;else{const B=m2(t.fit,w,S,v.width,v.height);A=B,P=B}t.maxScale!==void 0&&(A=Math.min(A,t.maxScale),P=Math.min(P,t.maxScale));const M=Math.min(A,P),I=v.width*A,C=v.height*P,k=_+(w-I)/2,E=b+(S-C)/2,F=s.height/v.height*e;return{scale:M,scaleX:A,scaleY:P,offset:{x:k,y:E},design:v,content:{x:k,y:E,width:I,height:C},topBar:m,bottomBar:y,insets:i,textResolution:F}}function x2(){if(typeof document>"u"||typeof getComputedStyle!="function")return{top:0,right:0,bottom:0,left:0};const n=document.createElement("div");n.style.position="fixed",n.style.visibility="hidden",n.style.pointerEvents="none",n.style.top="env(safe-area-inset-top)",n.style.right="env(safe-area-inset-right)",n.style.bottom="env(safe-area-inset-bottom)",n.style.left="env(safe-area-inset-left)",document.body.appendChild(n);const t=getComputedStyle(n),e={top:No(t.top),right:No(t.right),bottom:No(t.bottom),left:No(t.left)};return n.remove(),e}function No(n){const t=Number.parseFloat(n);return Number.isFinite(t)?t:0}function _2(n,t){const{scaleX:e,scaleY:s,offset:i}=n;return{x:(0-i.x)/e,y:(0-i.y)/s,width:t.width/e,height:t.height/s}}class tr{constructor(t,e,s){this.observers=new Set,this.rafId=null,this.settleRafId=null,this.viewport={width:0,height:0},this.onResize=()=>{this.rafId!==null&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.resolveAndBroadcast()})},this.onOrientationChange=()=>{let i=this.readViewport(),r=!1,o=0,a=0;const h=()=>{a+=1;const l=this.readViewport();l.width!==i.width||l.height!==i.height?(r=!0,o=0,i=l):r&&(o+=1),this.resolveAndBroadcast(),!(r&&o>=2)&&a<tr.SETTLE_MAX_FRAMES?this.settleRafId=requestAnimationFrame(h):this.settleRafId=null};this.settleRafId!==null&&cancelAnimationFrame(this.settleRafId),this.settleRafId=requestAnimationFrame(h)},this.app=t,this.config=e,this.target=s?.target??t.stage,this.solution=this.solve(),this.apply(),window.addEventListener("resize",this.onResize),window.visualViewport?.addEventListener("resize",this.onResize),window.addEventListener("orientationchange",this.onOrientationChange)}getSolution(){return this.solution}viewportInDesign(){return _2(this.solution,this.viewport)}addResizable(t){this.observers.add(t)}removeResizable(t){this.observers.delete(t)}handOverTo(t){for(const i of this.observers)t.observers.add(i);this.observers.clear();const{width:e,height:s}=t.solution.design;for(const i of t.observers)i.resize(e,s)}destroy(){window.removeEventListener("resize",this.onResize),window.visualVie
436wport?.removeEventListener("resize",this.onResize),window.removeEventListener("orientationchange",this.onOrientationChange),this.rafId!==null&&cancelAnimationFrame(this.rafId),this.settleRafId!==null&&cancelAnimationFrame(this.settleRafId),this.observers.clear()}readViewport(){const t=window.visualViewport;return t?{width:t.width,height:t.height}:{width:window.innerWidth,height:window.innerHeight}}readInsets(){return this.config.safeArea===!1?{top:0,right:0,bottom:0,left:0}:x2()}solve(){return y2({viewport:this.readViewport(),dpr:window.devicePixelRatio||1,insets:this.readInsets(),config:this.config})}apply(){const{scaleX:t,scaleY:e,offset:s}=this.solution,i=this.readViewport();this.viewport=i,this.app.renderer.resize(i.width,i.height),this.target.scale.set(t,e),this.target.x=s.x,this.target.y=s.y}resolveAndBroadcast(){this.solution=this.solve(),this.apply();for(const t of this.observers)t.resize(this.solution.design.width,this.solution.design.height);this.app.ticker.started||this.app.renderer.render(this.app.stage)}}tr.SETTLE_MAX_FRAMES=40;const $f=60;function b2(n,t="game-container"){const e=typeof t=="string"?document.getElementById(t):t;if(!e)throw new Error(`#${t} not found in index.html`);return e.appendChild(n.canvas),n.ticker.maxFPS=$f,Zt.shared.maxFPS=$f,e}const w2={background:"#1E1E1E",textColor:"#ffffff",accentColor:"#ffd54a",fontFamily:"Arial, Helvetica, sans-serif"};function S2(n){return{...w2,...n}}const v2={height:{kind:"fixed",px:32},slots:{left:"balance",center:"mode",right:"bet"}};function el(n){return n<10?`0${n}`:`${n}`}function Hf(n){const t=Math.max(0,Math.floor(n));return`${el(Math.floor(t/3600))}:${el(Math.floor(t%3600/60))}:${el(t%60)}`}function jf(n){return new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit"}).format(n)}function T2(n,t){const{dataSource:e,currency:s,style:i}=t;if(typeof n!="string")return{view:new ht({text:"",style:i}),destroy:()=>{}};switch(n){case"balance":{const r=h=>`${ke("bar.balance")}: ${s.formatCurrency(h)}`,o=new ht({text:r(e.getBalance()),style:i}),a=h=>{o.text=r(h)};return e.onBalanceChanged(a),{view:o,destroy:()=>e.offBalanceChanged(a)}}case"bet":{const r=h=>`${ke("bar.bet")}: ${s.formatCurrency(h)}`,o=new ht({text:r(e.getBetAmount()),style:i}),a=h=>{o.text=r(h)};return e.onBetAmountChanged(a),{view:o,destroy:()=>e.offBetAmountChanged(a)}}case"total-win":{const r=h=>`${ke("bar.win")}: ${s.formatCurrency(h)}`,o=new ht({text:r(e.getTotalWin()),style:i}),a=h=>{o.text=r(h)};return e.onTotalWinChanged(a),{view:o,destroy:()=>e.offTotalWinChanged(a)}}case"mode":{const r=h=>ke(h?"bar.fun":"bar.real"),o=new ht({text:r(e.isFunMode()),style:i}),a=h=>{o.text=r(h)};return e.onFunModeChanged(a),{view:o,destroy:()=>e.offFunModeChanged(a)}}case"clock":{const r=new ht({text:jf(new Date),style:i}),o=setInterval(()=>{r.text=jf(new Date)},1e3);return{view:r,destroy:()=>clearInterval(o)}}case"session-time":{let r=0,o=!1;const a=new ht({text:Hf(0),style:i}),h=()=>{o=!0};e.onRoundStarted(h);const l=setInterval(()=>{o&&(r+=1,a.text=Hf(r))},1e3);return{view:a,destroy:()=>{clearInterval(l),e.offRoundStarted(h)}}}}}const A2=.4,C2=.33,P2=8;function M2(n,t,e){const s=t/2-e-e;if(s<=0)return 1;const i=n.left+n.center/2,r=n.right+n.center/2;let o=1;return i>0&&(o=Math.min(o,s/i)),r>0&&(o=Math.min(o,s/r)),Math.min(1,o)}class k2 extends j{constructor(t,e,s=us.getInstance()){super(),this.slots=[],this.barStyle=S2(t.style),this.bg=new Wt,this.addChild(this.bg),this.textStyle=new wt({fontFamily:this.barStyle.fontFamily,fontSize:20,fill:this.barStyle.textColor});const i={dataSource:e,currency:s,style:this.textStyle};this.addSlot(t.slots.left,0,i),this.addSlot(t.slots.center,.5,i),this.addSlot(t.slots.right,1,i)}addSlot(t,e,s){if(t===void 0)return;const i=T2(t,s);i.view.anchor.set(e,.5),this.addChild(i.view),this.slots.push({widget:i,anchorX:e})}resize(t){this.x=t.x,this.y=t.y,this.bg.clear(),this.bg.rect(0,0,t.width,t.height),this.bg.fill(this.barStyle.background);const e=Math.round(t.height*C2),s=Math.round(t.height*A2);this.textStyle.fontSize=s,this.shrinkFontToFit(t.width,e,s);const i=t.height/2;
436for(const{widget:r,anchorX:o}of this.slots)r.view.y=i,r.view.x=o===0?e:o===1?t.width-e:t.width/2}shrinkFontToFit(t,e,s){const i={left:0,center:0,right:0};try{for(const{widget:o,anchorX:a}of this.slots){const h=o.view.width;a===0?i.left=h:a===1?i.right=h:i.center=h}}catch{return}const r=M2(i,t,e);r<1&&(this.textStyle.fontSize=Math.max(P2,Math.floor(s*r)))}destroy(){for(const{widget:t}of this.slots)t.destroy();super.destroy({children:!0})}}function I2(n){return{getBalance:()=>n.getBalance(),onBalanceChanged:t=>n.on("balanceChanged",t),offBalanceChanged:t=>n.off("balanceChanged",t),getBetAmount:()=>n.getBetAmount(),onBetAmountChanged:t=>n.on("betAmountChanged",t),offBetAmountChanged:t=>n.off("betAmountChanged",t),getTotalWin:()=>n.getTotalWin(),onTotalWinChanged:t=>n.on("totalWinChanged",t),offTotalWinChanged:t=>n.off("totalWinChanged",t),isFunMode:()=>n.isFunMode(),onFunModeChanged:t=>n.on("funModeChanged",t),offFunModeChanged:t=>n.off("funModeChanged",t),onRoundStarted:t=>n.on("roundStarted",t),offRoundStarted:t=>n.off("roundStarted",t)}}const E2={x:.5,y:.5};function qf(n){return n<1?1:n}function Kf(n,t){return n}function Zf(n,t,e,s,i=E2,r){const o=qf(e),a=qf(s),h=t.width/o,l=t.height/a;let c,u;switch(n){case"stretch":c=h,u=l;break;case"cover":{const m=Math.max(h,l);c=m,u=m;break}case"fit-width":c=h,u=h;break;case"fit-height":c=l,u=l;break;default:{const m=Math.min(h,l);c=m,u=m;break}}c=Kf(c),u=Kf(u);const d=o*c,f=a*u,g=t.x+(t.width-d)*i.x,p=t.y+(t.height-f)*i.y;return{scaleX:c,scaleY:u,x:g,y:p,width:d,height:f}}const Qf={x:.5,y:.5};function sl(n){return"spine"in n}class F2 extends j{constructor(t){super(),this.entries=[],this.rect={x:0,y:0,width:1,height:1},this.scrollValue=0,this.autoTimer=null,this.maskGraphic=null,this.buildPromise=this.build(t.layers)}ready(){return this.buildPromise}async build(t){for(const e of t)sl(e.source)?await this.addSpineLayer(e):this.addImageLayer(e);this.resize(this.rect)}addImageLayer(t){if(sl(t.source))return;const e=ae.get(t.source.image);if(!e)return;const s=t.anchor??Qf,i=t.mask==="rect";if(t.scroll){const r=new I1({texture:e,width:1,height:1});this.addChild(r),this.entries.push({kind:"tiling",display:r,fit:t.fit,anchor:s,scroll:t.scroll,masked:i})}else{const r=new it(e);r.anchor.set(0,0),this.addChild(r),this.entries.push({kind:"sprite",display:r,texture:e,fit:t.fit,anchor:s,masked:i})}}async addSpineLayer(t){if(!sl(t.source))return;const{skeleton:e,atlas:s,animation:i,scale:r}=t.source.spine;try{const h=(await import("@esotericsoftware/spine-pixi-v8")).Spine.from({skeleton:e,atlas:s});r!==void 0&&h.scale.set(r),h.state?.data&&i&&h.state.setAnimation(0,i,!0),this.addChild(h),this.entries.push({kind:"spine",display:h,fit:t.fit,anchor:t.anchor??Qf,masked:t.mask==="rect",width:h.width,height:h.height})}catch{}}resize(t){this.rect=t;for(const e of this.entries)if(e.kind==="tiling")e.display.position.set(t.x,t.y),e.display.width=t.width,e.display.height=t.height;else if(e.kind==="sprite"){const s=Zf(e.fit,t,e.texture.width,e.texture.height,e.anchor);e.display.scale.set(s.scaleX,s.scaleY),e.display.position.set(s.x,s.y)}else{const s=Zf(e.fit,t,e.width,e.height,e.anchor);e.display.scale.set(s.scaleX,s.scaleY),e.display.position.set(s.x+s.width/2,s.y+s.height/2)}this.applyMask(t),this.applyScroll()}applyMask(t){if(this.entries.some(e=>e.masked)){this.maskGraphic===null&&(this.maskGraphic=new Wt,this.addChild(this.maskGraphic)),this.maskGraphic.clear(),this.maskGraphic.rect(t.x,t.y,t.width,t.height).fill(16777215);for(const e of this.entries)e.masked&&(e.display.mask=this.maskGraphic)}}setScroll(t){this.scrollValue=t,this.applyScroll()}applyScroll(){for(const t of this.entries){if(t.kind!=="tiling")continue;const e=-this.scrollValue*t.scroll.factor;t.scroll.axis==="x"?t.display.tilePosition.x=e:t.display.tilePosition.y=e}}autoScroll(t){this.stopAutoScroll();const e=16,s=t.speed*e/1e3;this.autoTimer=setInterval(()=>{this.setScroll(this.scrollValue+s)},e)}stopAutoScroll(){this.autoTimer!==null&&(clearInterval(this.autoTimer),this.autoTimer=null)}destroy(){this.stopAutoScroll();for(const t of this.entries)t.display.mask=null;this.maskGraphic=null,this.entries.length=0,super.destroy({children:!0})}}const B2={};function R2(){return B2?.VITE_DEBUG_BOUNDS==="1"}function L2(n,t,e={}){if(!(e.enabled??R2()))return()=>{};const i=e.color??16711680,r=e.widthPx??1,o=new Wt;o.zIndex=1e5,o.eventMode="none",t.target.addChild(o);const a=()=>{const{design:l,scale:c}=t.getSolution();o.clear().rect(0,0,l.width,l.height).stroke({width:r/(c||1),color:i,alignment:0})},h={resize:()=>a()};return a(),t.addResizable(h),()=>{t.removeResizable(h),o.destroy()}}
436const O2="Welcome to Firework Frenzy! Match fireworks by color or design to win. Toggle between Automatic and Puzzle modes from the info page.",D2=[{heading:"HOW TO PLAY",lines:["Choose your bet, then press PLAY.","Match at least 3 of the same prize to win.","4 in a row (or column) triggers a bonus round."]},{heading:"MODES",lines:["Automatic Mode: fireworks burst automatically after pressing PLAY.","Puzzle Mode: click on the winning fireworks to trigger the explosions."]}],N2="Click anywhere to continue";class W2 extends l2{constructor(t,e,s,i,r){super(),this.sceneManager=t,this.app=e,this.sceneWidth=s,this.sceneHeight=i,this.onStartGame=r}async onEnter(){this.bg=new Wt,this.drawBg(),this.bg.interactive=!0,this.bg.cursor="pointer",this.bg.on("pointertap",()=>this.startGame()),this.addChild(this.bg),this.content=this.buildContent(),this.addChild(this.content),this.layoutContent()}buildContent(){const t=new j,e=Math.min(700,this.sceneWidth*.85),s=gu(this.sceneHeight),i=new it(_t.getTexture("./images/scene/logo_instructions.png"));i.anchor.set(.5,0);const o=Math.min(1,120/i.height);i.scale.set(o),t.addChild(i);let a=i.height+24;const h=new wt({fontFamily:"Luckiest Guy",fontSize:16,fill:13421772,
436wordWrap:!0,wordWrapWidth:e,lineHeight:24}),l=new wt({fontFamily:"Luckiest Guy",fontSize:24,fill:16766287,padding:10}),c=new ht({text:O2,style:h,resolution:s});c.anchor.set(.5,0),c.y=a,t.addChild(c),a+=c.height+30;for(const f of D2){const g=new ht({text:f.heading,style:l,resolution:s});g.anchor.set(.5,0),g.y=a,t.addChild(g),a+=g.height+12;for(const p of f.lines){const m=new ht({text:`- ${p}`,style:h,resolution:s});m.anchor.set(.5,0),m.y=a,t.addChild(m),a+=m.height+6}a+=20}const u=new wt({fontFamily:"Luckiest Guy",fontSize:18,fill:8947848,fontStyle:"italic"}),d=new ht({text:N2,style:u,resolution:s});return d.anchor.set(.5,0),d.y=a+10,t.addChild(d),t}coverRect(){const t=this.app.layout.getSolution(),e=t.scale||1;return{x:-t.offset.x/e,y:-t.offset.y/e,width:this.app.screen.width/e,height:this.app.screen.height/e}}drawBg(){const{x:t,y:e,width:s,height:i}=this.coverRect();this.bg.clear().rect(t,e,s,i).fill(657946)}layoutContent(){this.content.x=this.sceneWidth/2,this.content.y=Math.max(30,(this.sceneHeight-this.content.height)/2)}async startGame(){await this.sceneManager.clear(),this.onStartGame()}onResize(t,e){this.sceneWidth=t,this.sceneHeight=e,this.bg&&this.drawBg(),this.content&&(this.content.destroy({children:!0}),this.content=this.buildContent(),this.addChild(this.content),this.layoutContent())}onExit(){}}function z2(){return!1}function Y2(n){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get(n)==="true"}async function V2(n={}){if(!(n.enabled??z2()))return()=>{};const e=n.queryParam===void 0?"eruda":n.queryParam;if(e!==null&&!Y2(e))return()=>{};const s=(await ci(async()=>{const{default:i}=await import("./eruda-COjdTsxf.js").then(r=>r.e);return{default:i}},[],import.meta.url)).default;return s.init(),()=>s.destroy()}class U2{constructor(){this.pending=null}set(t,{sticky:e=!1}={}){this.pending={value:t,sticky:e}}clear(){this.pending=null}peek(){return this.pending}take(){const t=this.pending;if(t)return t.sticky||(this.pending=null),t.value}}const G2="https://www.googletagmanager.com/gtm.js";function X2(n){const t=window,e=t.dataLayer??(t.dataLayer=[]);e.push({"gtm.start":Date.now(),event:"gtm.js"});const s=document.createElement("script");return s.async=!0,s.src=`${G2}?id=${encodeURIComponent(n)}`,s.addEventListener("error",()=>{Z.warn(`GTM container ${n} failed to load — analytics inert`)}),document.head.appendChild(s),{push:i=>{e.push(i)}}}const dr={GameLaunched:"game_launched",GameLoaded:"game_loaded",RoundPlayed:"round_played",GameInteractive:"game_interactive",GameError:"game_error"};var le=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},fr=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},sa,Rs,Oa,Da,Na,Cy,ia,na,ra,oa,Py;const $2=100;class H2{constructor(){sa.add(this),Rs.set(this,null),Oa.set(this,""),Da.set(this,void 0),Na.set(this,void 0),ia.set(this,t=>{this.track(dr.GameLoaded,{load_duration_ms:t?.durationMs,time_to_loaded_ms:t?.sinceNavigationMs})}),na.set(this,t=>{this.track(dr.GameInteractive,{boot_duration_ms:t?.durationMs,time_to_interactive_ms:t?.sinceNavigationMs})}),ra.set(this,(t,e)=>{this.track(dr.GameError,{error_message:t.slice(0,$2),error_code:e})}),oa.set(this,()=>{const t=lt.getInstance();this.track(dr.RoundPlayed,{bet_amount:t.getBetAmount()})})}init(t){if(le(this,Rs,"f")){Z.warn("Analytics already initialised — ignoring repeat init()");return}const e=le(this,sa,"m",Cy).call(this,t);if(!e)return;fr(this,Rs,e,"f"),fr(this,Oa,t.gameName,"f"),fr(this,Da,t.gameVersion,"f"),fr(this,Na,t.environment,"f");const s=lt.getInstance();s.on(me.LoadingEnded,le(this,ia,"f")),s.on(me.GameReady,le(this,na,"f")),s.on(me.RoundStarted,le(this,oa,"f")),s.on(me.GameError,le(this,ra,"f")),this.track(dr.GameLaunched)}dispose(){if(!le(this,Rs,"f"))return;const t=lt.getInstance();t.off(me.LoadingEnded,le(this,ia,"f")),t.off(me.GameReady,le(this,na,"f")),t.off(me.RoundStarted,le(this,oa,"f")),t.off(me.GameError,le(this,ra,"f")),fr(this,Rs,null,"f")}isEnabled(){return le(this,Rs,"f")!==null}track(t,e={}){le(this,Rs,"f")&&le(this,Rs,"f").push({event:t,...le(this,sa,"m",Py).call(this),...e})}}Rs=new WeakMap,Oa=new WeakMap,Da=new WeakMap,Na=new WeakMap,ia=new WeakMap,na=new WeakMap,ra=new WeakMap,oa=new WeakMap,sa=new WeakSet,Cy=function(t){const e=t.gtmId?.trim();return e?t.transport?t.transport:typeof window>"u"?null:X2(e):null},Py=function(){const t=lt.getInstance();return{game_name:le(this,Oa,"f"),game_version:le(this,Da,"f"),environment:le(this,Na,"f"),sdk_version:Qm,game_id:t.getGameId(),operator_id:t.getOperatorId(),player_id:t.getPlayerId(),wallet_id:t.getWalletId(),fun_mode:t.isFunMode(),game_session_id:t.getSessionId(),game_language:t.getLanguage(),game_currency:us.getInstance().getCurrencyCode()}};const j2=new H2,q2={VITE_GTM_ID:"GTM-MXBH54NW"};function K2(){return{appVersion:"1.3.0",gitSha:"973defa",gitDescribe:"v1.3.0-2-g973defa",buildTime:"2026-10-01T15:49:30.507Z"}}function Z2(){const n=q2;return{gtmId:n?.VITE_GTM_ID,environment:n?.VITE_ENVIRONMENT}}function My(){return typeof performance<"u"?performance.now():Date.now()}let ac=null;function Q2(){ac=My()}function J2(){return ac===null?0:Math.round(My()-ac)}let hc=!1;function tM(){if(hc){Z.warn("markGameReady called more than once; ignoring.");return}hc=!0,lt.getInstance().emit(me.GameReady,dy(J2()))}function Jf(){return hc}const eM=15e3;function sM(n,t=eM){if(t===null)return()=>{};let e=null;const s=()=>{e||Jf()||(e=setTimeout(()=>{e=null,!Jf()&&Z.warn(`No markGameReady() ${t}ms after loading finished — ${n} never declared itself playable, so game_interactive will not fire and the multiplay host is still waiting`)},t))},i=lt.getInstance();return i.on(me.LoadingEnded,s),()=>{e&&clearTimeout(e),e=null,i.off(me.LoadingEnded,s)}}const iM=10;
436function lc(n){if(n instanceof Error)return n.stack??`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}function tp(n){return n instanceof Error?`${n.name}: ${n.message}`:lc(n).split(`
437`,1)[0]}function nM(n={}){if(typeof window>"u")return()=>{};const t=n.limit??iM;let e=0;const s=(o,a,h)=>{e>=t||(e+=1,Z.fatal(`Uncaught ${h}: ${a}`),lt.getInstance().reportError(o,h),e===t&&Z.fatal(`Error limit (${t}) reached; further errors are muted.`))},i=o=>{if(!o.error&&!o.message)return;const a=o.error?tp(o.error):o.message;s(a,o.error?lc(o.error):o.message,"error")},r=o=>{s(tp(o.reason),lc(o.reason),"unhandledrejection")};return window.addEventListener("error",i,!0),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",i,!0),window.removeEventListener("unhandledrejection",r)}}function rM(n){Q2();const t=K2(),e=Z2();sT(n),iT({gameName:n,gameVersion:t.appVersion,gitSha:t.gitSha,gitDescribe:t.gitDescribe,buildTime:t.buildTime}),nM(),sM(n),j2.init({gtmId:e.gtmId,gameName:n,gameVersion:Jm({gameVersion:t.appVersion,gitDescribe:t.gitDescribe}),environment:e.environment})}const oM=2;function aM(){return Math.max(1,Math.min(window.devicePixelRatio||1,oM))}function hM(n={}){const{size:t,containerId:e,...s}=n;return{...s,width:t?.width??window.innerWidth,height:t?.height??window.innerHeight,resolution:aM(),autoDensity:!0}}function lM(n,t={}){const{pauseTicker:e=!0,onHide:s,onShow:i}=t;if(typeof document>"u")return()=>{};let r=!1,o=!1;const a=()=>{o||(o=!0,e&&n.ticker.started&&(n.ticker.stop(),r=!0),s?.())},h=()=>{o&&(o=!1,e&&r&&(n.ticker.start(),r=!1),i?.())},l=()=>{document.hidden?a():h()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l),e&&r&&(n.ticker.start(),r=!1)}}function cM(n,t={}){const{pauseGsap:e=!0,pauseSharedTicker:s=!1,onHide:i,onShow:r}=t;return lM(n,{onHide:()=>{se.pauseAll(),e&&ct.ticker.sleep(),s&&Zt.shared.stop(),i?.()},onShow:()=>{se.resumeAll(),e&&ct.ticker.wake(),s&&Zt.shared.start(),r?.()}})}let ky;function uM(n){ky=n}function ep(){return ky}const sp=Object.freeze({status:"idle",total:0,played:0,remaining:0});class dM extends re{constructor(t){super(),this.options=t,this.snapshot=sp,this.stopReason="user",this.disposed=!1,this.dispatching=!1,this.pendingNotifications=[],this.unsubscribeHost=t.hostAdapter?.onStopAutoplayRequested?.(()=>this.stop("host"))??(()=>{})}isAvailable(){const t=this.getHostRestrictions();return ep()?.enabled===!0&&t?.allowed!==!1&&this.getRoundCountOptions().length>0}getRoundCountOptions(){const t=ep()?.roundCounts??[],e=this.getHostRestrictions()?.roundLimit;if(e===void 0)return[...t];if(e<1)return[];const s=t.filter(i=>i<=e);return s.length>0||t.length===0?s:[e]}getSnapshot(){return this.snapshot}start(t){if(!(this.disposed||this.snapshot.status!=="idle")){if(!this.isAvailable()||!this.getRoundCountOptions().includes(t)){Z.warn(`Autoplay of ${t} rounds refused`);return}this.stopReason="user",this.update({status:"running",total:t,played:0,remaining:t}),lt.getInstance().setAutoplayActive(!0),this.run()}}requestStop(){this.stop("user")}dispose(){this.disposed||(this.disposed=!0,this.unsubscribeHost(),this.removeAllListeners(),this.snapshot.status!=="idle"&&lt.getInstance().setAutoplayActive(!1))}getHostRestrictions(){return this.options.hostAdapter?.getAutoplayRestrictions?.()??null}stop(t){this.snapshot.status==="running"&&(this.stopReason=t,this.update({...this.snapshot,status:"stopping"}))}async run(){for(await Promise.resolve();!this.disposed;){if(this.snapshot.status==="stopping"){this.end(this.stopReason);return}let t;try{t=await this.options.playRound()}catch(s){Z.error("Autoplay round failed:",s),this.disposed||this.end("error");return}if(this.disposed)return;if(!t.ok){this.end(t.code===_u.INSUFFICIENT_FUNDS?"insufficientFunds":"error");return}const e=this.snapshot.remaining-1;if(this.update({...this.snapshot,played:this.snapshot.played+1,remaining:e}),e===0){this.end("completed");return}}}end(t){const e={reason:t,played:this.snapshot.played};this.update(sp),lt.getInstance().setAutoplayActive(!1),this.dispatch(()=>
437this.emit("ended",e))}update(t){const e=Object.freeze(t);this.snapshot=e,this.dispatch(()=>this.emit("change",e))}dispatch(t){if(this.pendingNotifications.push(t),!this.dispatching){this.dispatching=!0;try{for(let e=this.pendingNotifications.shift();e;e=this.pendingNotifications.shift())e()}finally{this.dispatching=!1}}}}function fM(n,t={}){const e=n.getConfig();se.soundPromptMode=e.soundConfiguration.promptMode,se.soundPromptMessage=e.soundConfiguration.promptMessage,se.soundPromptStyle=e.soundConfiguration.prompt??null,lt.getInstance().setInfoBarEnabled(e.infoBarConfiguration.enabled),uM(e.autoplayConfiguration),Cs.getInstance().init(n,t.initialBetIndex)}function ip(n,t){return{fit:"fit",orientation:"adapt",safeArea:!1,...n,...t?{bars:{bottom:t}}:{}}}function pM(n,t){const e=t.world??new j;e.parent===null&&n.stage.addChild(e);let s=new tr(n,ip(t.layout),{target:e}),i=null;const r={resize:(a,h)=>{t.onResize?.(a,h);const l=s.getSolution().bottomBar;if(i&&l){const{width:c,height:u}=n.renderer.screen;i.resize({x:0,y:u-l.height,width:c,height:l.height})}}};return s.addResizable(r),{world:e,get layoutEngine(){return s},get barView(){return i},enableBottomBar(a=v2){const h=lt.getInstance();if(!h.isInfoBarEnabled()||i)return;const l=new tr(n,ip(t.layout,a),{target:e});i=new k2(a,I2(h),us.getInstance()),i.visible=!1,n.stage.addChild(i);const c=s;s=l,c.handOverTo(l),c.destroy()},setBarVisible(a){i&&(i.visible=a)},refresh:()=>{const{design:a}=s.getSolution();r.resize(a.width,a.height)},dispose(){s.removeResizable(r),s.destroy(),i?.destroy(),i=null,e.parent?.removeChild(e),e.destroy({children:!0})}}}function cc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Iy(n,t){const e={...n};for(const[s,i]of Object.entries(t)){const r=e[s];e[s]=cc(r)&&cc(i)?Iy(r,i):i}return e}const gM={};let Wo=null;function Ey(){return Wo??(Wo=mM().catch(n=>{throw Wo=null,n})),Wo}async function Fy(n){const t=await fetch(n);if(!t.ok)throw new Error(`Failed to load config ${n}: HTTP ${t.status}`);if(By(t))throw new Error(`Failed to load config ${n}: got an HTML page, not JSON`);return Ry(await t.json(),n)}async function mM(){const n=gM?.VITE_SKIN,[t,e]=await Promise.all([Fy(Jn("config/default.json")),n?yM(Jn(`config/default.${n}.json`)):null]);return e?Iy(t,e):t}async function yM(n){const t=await fetch(n);if(t.status===404||By(t))return null;if(!t.ok)throw new Error(`Failed to load config ${n}: HTTP ${t.status}`);return Ry(await t.json(),n)}function By(n){return n.headers.get("content-type")?.includes("text/html")??!1}function Ry(n,t){if(!cc(n))throw new Error(`Invalid config ${t}: expected a JSON object`);return n}const uc={showBackground:!0,backgroundColor:"#000000",backgroundImage:"",logo:"",logoWidth:256,logoBarGap:64,barColor:"#FFFFFF",barTrackColor:"#1F2937",barWidth:400,barHeight:12,showProgressBar:!0,shimmer:!0,shimmerCycleMs:2e3,showPercentage:!0,loadingText:"Loading your game...",textColor:"#9CA3AF",spineAnimation:"",spineAtlas:"",spineScale:1,spineAnimationName:"animation",preloadAssets:[],progressLerpFactor:.1,minDisplayTimeMs:500,exitDelayMs:300};function pn(n){const t=n.replace("#","");return parseInt(t,16)}function il(){return typeof performance<"u"?performance.now():Date.now()}class Wa extends re{constructor(t={}){super(),this.initialized=!1,this.startedAt=0,this.allLoaded=!1,this.manifest=null,this.loadingConfig={...uc},this.loadedBundles=new Set,this.basePath=t.basePath??Jn("assets/"),this.manifestPath=t.manifestPath??Jn("manifest.json",this.basePath),this.loadingConfigOverrides=t.loadingConfigOverrides??{}}get isInitialized(){return this.initialized}async initialize(){if(this.initialized){Z.warn("AssetLoader already initialized");return}const[t,e]=await Promise.all([this.fetchManifest(),this.fetchLoadingConfig()]);this.manifest=t,this.loadingConfig={...uc,...e,...this.loadingConfigOverrides},await ae.init({manifest:this.manifest,basePath:this.basePath}),this.initialized=!0,this.manifest.bundles.find(i=>i.name==="preload")&&(await ae.loadBundle("preload"),this.loadedBundles.add("preload"))}getLoadingConfig(){return this.loadingConfig}async loadAll(){if(!this.initialized)throw new Error("AssetLoader not initialized. Call initialize() first.");if(this.allLoaded)return;const t=this.manifest?.bundles.filter(i=>!this.loadedBundles.has(i.name))??[];if(t.length===0){this.allLoaded=!0,this.startedAt=il(),this.emit
437("loadingStarted"),this.emit("loadingProgress",100),this.emit("loadingEnded",0);return}this.startedAt=il(),this.emit("loadingStarted");const e=t.reduce((i,r)=>i+(r.assets?.length??0),0);let s=0;try{for(const i of t){const r=i.assets?.length??0,o=s;await ae.loadBundle(i.name,a=>{const h=a*r,l=e>0?(o+h)/e*100:100;this.emit("loadingProgress",Math.min(l,100))}),s+=r,this.loadedBundles.add(i.name)}this.allLoaded=!0,this.emit("loadingProgress",100),this.emit("loadingEnded",Math.round(il()-this.startedAt))}catch(i){const r=i instanceof Error?i.message:String(i);Z.error(`Asset loading failed: ${r}`),this.emit("loadingError",r)}}get(t){const e=ae.get(t);if(e===void 0)throw new Error(`Asset '${t}' not found`);return e}getTexture(t){const e=this.get(t);if(!(e instanceof $))throw new Error(`Asset '${t}' is not a Texture`);return e}has(t){try{return ae.get(t)!==void 0}catch{return!1}}isBundleLoaded(t){return this.loadedBundles.has(t)}getLoadedBundles(){return Array.from(this.loadedBundles)}async fetchManifest(){try{const t=await fetch(this.manifestPath);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){const e=t instanceof Error?t.message:String(t);return Z.error(`Failed to load manifest: ${e}`),{bundles:[]}}}async fetchLoadingConfig(){try{const{loading:t}=await Ey();return t===void 0?(Z.warn("No loading section in config/default.json, using defaults"),{}):t}catch(t){const e=t instanceof Error?t.message:String(t);return Z.warn(`${e}, using default loading config`),{}}}}const xM=800;class Ly extends j{constructor(t,e){super(),this.progress=0,this.displayedProgress=0,this.elapsedMs=0,this.startTime=0,this.loadingComplete=!1,this.completeCalled=!1,this.bg=null,this.bgImage=null,this.logo=null,this.barTrack=null,this.barFill=null,this.barMask=null,this.shimmer=null,this.shimmerTexture=null,this.percentText=null,this.loadingText=null,this.spine=null,this.viewportWidth=0,this.viewportHeight=0,this.barActualWidth=0,this.logoTextureLoaded=null,this.bgImageTextureLoaded=null,this.assetLoader=t,this.onComplete=e,this.config={...uc,...t.getLoadingConfig()}}static async create(t,e){const s=new this(t,e);return await s.init(),s}update(t){this.elapsedMs+=t;const e=this.config.progressLerpFactor??.1,s=Math.min(1,e*(t/(1e3/60)));this.displayedProgress+=(this.progress-this.displayedProgress)*s,this.progress>=100&&this.displayedProgress>99.5&&(this.displayedProgress=100),this.updateProgressVisual(),this.updateShimmer(),this.updateLogoFade(),this.checkComplete()}resize(t,e){this.viewportWidth=t,this.viewportHeight=e,this.layoutBackground(t,e),this.layoutDefaultElements(t,e),this.layout(t,e)}destroy(){this.shimmerTexture?.destroy(!0),this.shimmerTexture=null,this.assetLoader.off("loadingProgress"),this.assetLoader.off("loadingEnded"),super.destroy({children:!0})}buildBackground(){}buildLogo(){}buildProgressBar(){}buildText(){}layout(t,e){}async init(){this.startTime=Date.now(),this.viewportWidth=window.innerWidth,this.viewportHeight=window.innerHeight;const t=[];this.config.logo&&t.push(this.loadImage(this.config.logo,"logoTexture")),this.config.backgroundImage&&t.push(this.loadImage(this.config.backgroundImage,"bgImageTexture")),await Promise.all(t),await this.loadPreloadAssets(),await this.setupSpine(),this.config.showBackground&&(this.buildSolidBackground(),this.setupBackground()),this.setupLogo(),this.config.showProgressBar&&(this.buildDefaultProgressBar(),this.buildProgressBar()),this.buildDefaultText(),this.buildText(),this.resize(this.viewportWidth,this.viewportHeight);const e=lt.getInstance();this.assetLoader.on("loadingProgress",s=>{this.progress=s,e.emit(me.LoadingProgress,s)}),this.assetLoader.on("loadingEnded",s=>{this.loadingComplete=!0,e.emit(me.LoadingEnded,dy(s))}),e.emit(me.LoadingStarted),this.assetLoader.loadAll().catch(()=>{})}async loadImage(t,e){try{const s=await ae.load(t);e==="logoTexture"?this.logoTextureLoaded=s:this.bgImageTextureLoaded=s}catch{}}setupBackground(){this.config.backgroundImage&&this.bgImageTextureLoaded?(this.bgImage=new it(this.bgImageTextureLoaded),this.bgImage.anchor.set(.5),this.addChild(this.bgImage)):this.buildBackgroun
437d()}setupLogo(){if(this.spine)this.addChild(this.spine);else if(this.config.logo&&this.logoTextureLoaded){this.logo=new it(this.logoTextureLoaded),this.logo.anchor.set(.5),this.logo.alpha=0;const e=this.config.logoWidth/this.logo.texture.width;this.logo.scale.set(e),this.addChild(this.logo)}else this.buildLogo()}async loadPreloadAssets(){if(this.config.preloadAssets.length!==0)try{await ae.load(this.config.preloadAssets)}catch{}}async setupSpine(){if(!(!this.config.spineAnimation||!this.config.spineAtlas))try{await ae.load([this.config.spineAnimation,this.config.spineAtlas]);const{Spine:t}=await ci(async()=>{const{Spine:s}=await import("./index-B3xsMURc.js");return{Spine:s}},[],import.meta.url),e=t.from({skeleton:this.config.spineAnimation,atlas:this.config.spineAtlas});e.scale.set(this.config.spineScale),e.state?.data&&e.state.setAnimation(0,this.config.spineAnimationName,!0),this.spine=e}catch{}}buildSolidBackground(){this.bg=new Wt,this.addChild(this.bg)}buildDefaultProgressBar(){const t=pn(this.config.barColor),e=pn(this.config.barTrackColor),{barHeight:s}=this.config;this.barTrack=new Wt,this.barTrack.roundRect(0,0,1,s,s/2),this.barTrack.fill({color:e}),this.addChild(this.barTrack);const i=new j;this.addChild(i),this.barFill=new Wt,this.barFill.roundRect(0,0,1,s,s/2),this.barFill.fill({color:t}),i.addChild(this.barFill),this.config.shimmer&&(this.shimmer=new it($.WHITE),i.addChild(this.shimmer)),this.barMask=new Wt,this.addChild(this.barMask),i.mask=this.barMask}buildDefaultText(){this.config.showPercentage&&(this.percentText=new ht({text:"0%",style:{fontFamily:"Arial, sans-serif",fontSize:24,fontWeight:"700",fill:16777215}}),this.percentText.anchor.set(.5),this.addChild(this.percentText)),this.config.loadingText&&(this.loadingText=new ht({text:this.config.loadingText,style:{fontFamily:"Arial, sans-serif",fontSize:14,fontWeight:"500",fill:pn(this.config.textColor)}}),this.loadingText.anchor.set(.5),this.addChild(this.loadingText))}layoutBackground(t,e){if(this.bg&&(this.bg.clear(),this.bg.rect(0,0,t,e),this.bg.fill({color:pn(this.config.backgroundColor)})),this.bgImage&&this.bgImage.texture.width>0){const s=this.bgImage.texture.width,i=this.bgImage.texture.height,r=Math.max(t/s,e/i);this.bgImage.scale.set(r),this.bgImage.position.set(t/2,e/2)}}layoutDefaultElements(t,e){const{barHeight:s,logoBarGap:i}=this.config;this.barActualWidth=Math.min(this.config.barWidth,t*.8),this.rebuildBar();const r=this.spine?this.spine.height:0,o=this.logo?this.logo.texture.height*this.logo.scale.y:0,a=r||o,h=(a>0?a+i:0)+s+16+(this.percentText?.height??0)+(this.loadingText?32+this.loadingText.height:0);let c=(e-h)/2;this.spine?(this.spine.position.set(t/2,c+r/2),c+=r+i):this.logo&&(this.logo.position.set(t/2,c+o/2),c+=o+i);const u=(t-this.barActualWidth)/2;this.barTrack&&this.barTrack.position.set(u,c),this.barFill?.parent&&this.barFill.parent.position.set(u,c),this.barMask&&this.barMask.position.set(u,c),c+=s+16,this.percentText&&(this.percentText.position.set(t/2,c+this.percentText.height/2),c+=this.percentText.height),this.loadingText&&(c+=32,this.loadingText.position.set(t/2,c+this.loadingText.height/2));const d=gu(e);this.percentText&&(this.percentText.resolution=d),this.loadingText&&(this.loadingText.resolution=d),this.config.shimmer&&this.shimmer&&(this.shimmerTexture?.destroy(!0),this.shimmerTexture=_M(Math.ceil(this.barActualWidth),s),this.shimmer.texture=this.shimmerTexture)}rebuildBar(){const{barHeight:t}=this.config,e=pn(this.config.barColor),s=pn(this.config.barTrackColor);this.barTrack&&(this.barTrack.clear(),this.barTrack.roundRect(0,0,this.barActualWidth,t,t/2),this.barTrack.fill({color:s})),this.barFill&&(this.barFill.clear(),this.barFill.roundRect(0,0,this.barActualWidth,t,t/2),this.barFill.fill({color:e}))}updateProgressVisual(){if(this.barMask){const t=Math.max(0,this.displayedProgress/100*this.barActualWidth);this.barMask.clear(),this.barMask.roundRect(0,0,t,this.config.barHeight,this.config.barHeight/2),this.barMask.fill(16777215)}this.percentText&&(this.percentText.text=`${Math.floor(this.displayedProgress)}%`)}updateShimmer(){if(!this.shimmer||!this.config.shimmer)return;const t=this.config.shimmerCycleMs,e=this.elapsedMs%t/t;this.shimmer.x=-this.barActualWidth+e*this.barActualWidth*2}updateLogoFade(){if(!this.logo)return;const t=xM,e=Math.min(1,this.elapsedMs/t),s=1-Math.pow(1-e,3);this.logo.alpha=s}checkComplete(){if(this.completeCalled||!this.loadingComplete)return;const t=Date.now()-this.startTime,e=this.config.minDisplayTimeMs,s=this.config.exitDelayMs;t>=e+s&&this.displayedProgress>=99.5&&(this.completeCalled=!0,this.onComplete())}}function _M(n,t){const e=document.createElement("canvas");e.width=Math.max(1,n),e.height=Math.max(1,t);const s=e.getContext("2d");if(!s)return $.WHITE;const i=s.createLinearGradient(0,0,n,0);return i.addColorStop(0,"rgba(255,255,255,0)"),i.addColorStop(.5,"rgba(255,255,255,0.30)"),i.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=i,s.fillRect(0,0,n,t),$.from(e)}async function bM(n,t){const e=t.assets instanceof Wa?t.assets:new Wa(t.assets);if(e.isInitialized||await e.initialize(),t.sizeToViewport)return wM(n,t,e);const s=t.world??new j;t.world||n.stage.addChild(s);const i=t.layoutEngine??new tr(n,SM(t),{target:s});return await new Promise(r=>{let o;const a=()=>o.update(n.ticker.deltaMS),h=()=>{i.removeResizable(o),n.ticker.remove(a),s.removeChild(o),o.destroy(),r({world:s,layoutEngine:i,assetLoader:e,design:i.getSolution().design})},l=t.createLoadingScene??((c,u)=>Ly.create(c,u));Promise.resolve(l(e,h)).then(c=>{o=c,s.addChild(o);const{design:u}=i.getSolution();o.resize(u.width,u.height),i.addResizable(o),n.ticker.add(a)})})}async function wM(n,t,e){const s=t.world??n.stage;return await new Promise(i=>{let r;const o=()=>r.update(n.ticker.deltaMS),a=()=>{n.renderer.resize(window.innerWidth,window.innerHeight),r.resize(window.innerWidth,window.innerHeight)},h=()=>{n.ticker.remove(o),window.removeEventListener("resize",a),s.removeChild(r),r.destroy(),i({world:s,assetLoader:e,design:{width:window.innerWidth,height:window.innerHeight}})},l=t.createLoadingScene??((c,u)=>Ly.create(c,u));Promise.resolve(l(e,h)).then(c=>{r=c,s.addChild(r),r.resize(window.innerWidth,window.innerHeight),window.addEventListener("resize",a),n.ticker.add(o)})})}function SM(n){if(!n.layout)throw new Error("presentLoadingScene requires either `layout` or `layoutEngine`.");return n.layout}function vM(n,t,e,s){const i=Math.min(1,n/e,t/s);return{scale:i,width:n/i,height:t/i}}const TM={width:900,height:560};async function AM(n,t){if(!se.shouldShowSoundPrompt)return t.backgroundMusic&&se.playBackgroun
437dMusic(t.backgroundMusic),se.enabled;const e=t.reference??TM,s=t.parent??n.stage,i=CM(t.options,se.soundPromptStyle);return await new Promise(r=>{let o=!1;const a=new jC({...i,onComplete:c=>{o||(o=!0,t.layoutEngine.removeResizable(l),t.backgroundMusic&&se.playBackgroundMusic(t.backgroundMusic),t.options?.onComplete?.(c),r(c))}});a.zIndex=t.zIndex??1e3;const h=()=>{const{width:c,height:u}=n.renderer.screen,d=t.fitToFrame?t.layoutEngine.getSolution().scale:vM(c,u,e.width,e.height).scale;a.scale.set(d),a.resize(c/d,u/d)},l={resize:h};s.addChild(a),h(),a.show(),t.layoutEngine.addResizable(l)})}function CM(n,t){return t?{message:n?.message,title:t.title,theme:t.theme}:n}async function PM(n,t,e){const s=()=>typeof e=="function"?e():e,i=t.layers.flatMap(h=>"image"in h.source?[h.source.image]:[]);i.length>0&&await ae.load(i);const r=new F2(t);r.zIndex=0,n.stage.addChildAt(r,0),await r.ready();const o=()=>{const{width:h,height:l}=n.renderer.screen;r.resize({x:0,y:0,width:h,height:l})},a={resize:o};return o(),s().addResizable(a),{view:r,dispose:()=>{s().removeResizable(a),r.parent?.removeChild(r),r.destroy()}}}const MM=[1,2,5,10,15,20,30,50];class Nr{constructor(t){this.betsCallbacks=new Set,Nr.validateStakes(t.stakeConfiguration),t.autoplayConfiguration&&Nr.validateAutoplay(t.autoplayConfiguration),this.validate(t),this.config=structuredClone(t)}validate(t){}static validateStakes(t){if(typeof t.min!="number"||!Number.isFinite(t.min)||t.min<=0)throw new Error("Invalid game config: bets.min must be a positive finite number");if(typeof t.max!="number"||!Number.isFinite(t.max)||t.max<=0)throw new Error("Invalid game config: bets.max must be a positive finite number");if(t.presetAmounts!==void 0){if(!Array.isArray(t.presetAmounts)||t.presetAmounts.length===0)throw new Error("Invalid game config: bets.presetAmounts must be a non-empty array");for(let e=0;e<t.presetAmounts.length;e++){const s=t.presetAmounts[e];if(typeof s!="number"||!Number.isFinite(s)||s<=0)throw new Error(`Invalid game config: bets.presetAmounts[${e}] must be a positive finite number`);if(e>0&&s<=t.presetAmounts[e-1])throw new Error(`Invalid game config: bets.presetAmounts must be sorted ascending (bets.presetAmounts[${e}] <= bets.presetAmounts[${e-1}])`)}}}static validateAutoplay(t){if(typeof t.enabled!="boolean")throw new Error("Invalid game config: autoplay.enabled must be a boolean");const e=t.roundCounts;if(!Array.isArray(e))throw new Error("Invalid game config: autoplay.roundCounts must be an array");if(t.enabled&&e.length===0)throw new Error("Invalid game config: autoplay.roundCounts must not be empty when autoplay is enabled");for(let s=0;s<e.length;s++){const i=e[s];if(!Number.isInteger(i)||i<=0)throw new Error(`Invalid game config: autoplay.roundCounts[${s}] must be a positive integer`);if(s>0&&i<=e[s-1])throw new Error(`Invalid game config: autoplay.roundCounts must be sorted ascending (autoplay.roundCounts[${s}] <= autoplay.roundCounts[${s-1}])`)}}getConfig(){return this.config}getPresetAmounts(){const t=this.config.stakeConfiguration.presetAmounts;return t!==void 0&&t.length>0?t:[...MM]}updateBets(t){Nr.validateStakes(t),this.config={...this.config,stakeConfiguration:{...t}},this.betsCallbacks.forEach(e=>e(this.config.stakeConfiguration))}onBetsUpdated(t){this.betsCallbacks.add(t)}offBetsUpdated(t){this.betsCallbacks.delete(t)}}const kM=new Set(["overlayColor","panelColor","panelBorderColor","panelHeaderColor","buttonYesColor","buttonNoColor","buttonHoverYesColor","buttonHoverNoColor","textColor","titleColor","messageColor","buttonLabelColor"]);function IM(n){const t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n.trim());if(!t)return null;const e=t[1].length===3?[...t[1]].map(s=>s+s).join(""):t[1];return parseInt(e,16)}function EM(n){if(typeof n!="object"||n===null)return{};const t={};for(const[e,s]of Object.entries(n)){if(!$C.includes(e)){Z.warn(`Ignoring unknown sound prompt theme key "${e}"`);continue}t[e]=kM.has(e)&&typeof s=="string"?IM(s)??s:s}return t}function FM(n){if(typeof n!="object"||n===null)return null;const{title:t,theme:e}=n;return{...typeof t=="string"?{title:t}:{},theme:EM(e)}}let zo=null;function BM(n){return n??{}}function RM(n){const t=n,e=FM(t?.prompt);return{promptMode:t?.promptMode??"once",promptMessage:t?.promptMessage??`DO YOU WANT TO
438ENABLE SOUNDS?`,...e?{prompt:e}:{}}}function LM(n){return{enabled:n?.enabled??!1}}function OM(n){if(n===void 0)return;const t=n;return{enabled:t?.enabled??!1,roundCounts:t?.roundCounts??[]}}function DM(n){const t=OM(n.autoplay);return{stakeConfiguration:BM(n.bets),soundConfiguration:RM(n.sound),infoBarConfiguration:LM(n.infoBar),...t?{autoplayConfiguration:t}:{}}}function NM(){return zo??(zo=Ey().then(n=>new Nr(DM(n))).catch(n=>{throw zo=null,n})),zo}
438async function WM(n){return n(await Fy(Jn("config/game.json")))}const np="A",zM="Ž";function YM(n){return n?`${np}${zM}`:np}const VM="16px",Oy="normal";async function UM({faces:n=[],cssFonts:t=[],extendedLatin:e=!1}){!("fonts"in document)||typeof FontFace>"u"||await Promise.all([...n.flatMap(s=>(s.weights??[Oy]).map(i=>GM(s,i))),...t.map(s=>XM(s,e))])}async function GM({family:n,url:t},e){try{const s=new FontFace(n,`url("${t}")`,{weight:e});document.fonts.add(await s.load())}catch(s){Z.warn(`Failed to load font "${n}" ${e} (${t})`,s)}}async function XM({family:n,weight:t=Oy},e){try{await document.fonts.load(`${t} ${VM} ${n}`,YM(e))}catch(s){Z.warn(`Failed to load CSS font "${n}"`,s)}}async function $M(n){rM(n.name),await V2();const t=n.app??new yc;await t.init(hM(n.appOptions)),b2(t,n.appOptions?.containerId),se.init({prefix:n.soundPrefix??n.name});const e=pM(t,{layout:n.layout,onResize:n.onResize,world:typeof n.world=="function"?n.world(t):n.world});n.fonts&&await UM(n.fonts);const s=n.loading?.assets,i=s instanceof Wa?s:new Wa(s);let r;n.backdrop&&(await i.initialize(),r=await PM(t,n.backdrop,()=>e.layoutEngine));const o={...n.loading,assets:i},{assetLoader:a}=await bM(t,o.sizeToViewport?o:{...o,world:e.world,layoutEngine:e.layoutEngine});cM(t,n.pause);const h=(g,p)=>{Z.fatal(`Boot failed at ${g}
438:`,p),n.onFatal?.(g,p,{app:t,gameWorld:e})};let l,c;try{[l,c]=await Promise.all([NM(),n.gameConfig?WM(n.gameConfig):void 0])}catch(g){h("config",g);return}fM(l,{initialBetIndex:n.initialBetIndex}),n.bottomBar!==!1&&e.enableBottomBar();const u=n.backend?.({app:t,configService:l,gameConfig:c});if(u){o2(u.backend),u.hostAdapter&&(u.hostAdapter,void 0);try{await u.hostAdapter?.initialize(),await u.backend.initialize()}catch(g){h("backend",g);return}}let d=g=>{};const f={app:t,gameWorld:e,assetLoader:a,configService:l,gameConfig:c,backend:u?bu():void 0,hostAdapter:u?.hostAdapter,setDevPanelVisible:g=>d(),disposeBackdrop:()=>{r?.dispose(),r=void 0},promptForSound:g=>AM(t,{...g,layoutEngine:e.layoutEngine})};await n.prepare?.(f),tM(),await n.start(f)}function HM(n){const t=new Map;for(const e of n){const s=Number(Ty(e,1).toFixed(6)),i=s===0,r=i?e.bonus?"lose-bonus":"lose":`x${s}`,o=[...t.get(r)?.hands??[],e];t.set(r,{id:r,label:i?`Lose${e.bonus?" + bonus":""}`:`×${s} ${jM(o)}`,multiplier:s,hands:o})}return[...t.values()].sort((e,s)=>e.multiplier-s.multiplier)}function jM(n){return[...new Set(n.map(qM))].join(" / ")}function qM(n){const t=xu(n.prizes,!1).map(({count:s})=>s).sort((s,i)=>i-s);return[t.length>0?`${t.join(" + ")}
438 matching prizes`:"",n.bonus&&"bonus"].filter(Boolean).join(" + ")}const KM=1e3;class ZM{constructor(){this.lastWin=0,this.testIndex=-1,this.tiers=HM(Kh),this.controls={forced:new U2,outcomeTiers:()=>this.tiers}}async initialize(){lt.getInstance().setBalance(KM),lt.getInstance().setBackendStatus("ready")}async playRound(t){const e=lt.getInstance();if(e.getBalance()<t.betAmount)return{ok:!1,code:_u.INSUFFICIENT_FUNDS,message:"Insufficient funds"};const s=this.nextHand(this.controls.forced.take());return e.setTotalWin(0),e.setBalance(e.getBalance()-t.betAmount),this.lastWin=Ty(s,t.betAmount),{ok:!0,round:{hand:s,totalWon:this.lastWin,balance:e.getBalance()}}}nextHand(t){if(t?.kind!=="tier")return this.testIndex++,Kh[this.testIndex%Kh.length];const e=this.tiers.find(({id:s})=>s===t.tier.id);if(!e)throw new Error(`unknown outcome tier ${t.tier.id}`);return e.hands[Math.floor(Math.random()*e.hands.length)]}async finalizeRound(){const t=lt.getInstance();t.setTotalWin(this.lastWin),t.setBalance(t.getBalance()+this.lastWin),this.lastWin=0}async dispose(){}}class QM{async initialize(){us.getInstance().setFunModeCurrency(),lt.getInstance().setFunMode(!0)}getState(){return{ready:!0,suspended:!1,audioSettings:{musicOn:null,sfxOn:null},tokenBalance:null}}isAvailable(){return!1}setGameController(t){}}class Rt extends yc{constructor(){super(),this.world=new j,this.setDevPanelVisible=()=>{},this.Animation=new fs,Rt.instance||(Rt.instance=this)}get layout(){return this.gameWorld.layoutEngine}async prepareGame(t){this.gameWorld=t.gameWorld,this.setDevPanelVisible=t.setDevPanelVisible,this.autoplay=new dM({playRound:()=>li.getInstance().playAutoplayRound(),hostAdapter:t.hostAdapter}),this.stage.sortableChildren=!0,this.gameWorld.barView&&(this.gameWorld.barView.zIndex=9999),await Fa.loadHowToPlay()}async showInstructions(t){const e=new c2(this,{parent:this.world,getSize:()=>this.layout.getSolution().design});this.layout.addResizable(e);const{width:s,height:i}=this.getDim();await e.push(new W2(e,this,s,i,()=>this.startGame())),await t.promptForSound({backgroundMusic:"background",options:{theme:{fontFamily:"Luckiest Guy"}}})}startGame(){new zn,this.gameWorld.setBarVisible(!0),this.setDevPanelVisible(!0),this.layout.addResizable({resize:(t,e)=>Zi.getInstance()?.resize(t,e)}),this.ticker.add(t=>this.update(t)),L2(this,this.layout)}static getInstance(){return Rt.instance}getDim(){const{width:t,height:e}=this.layout.getSolution().design;return{width:t,height:e}}update(t){this.Animation.update(t.lastTime)}}const vr=new Rt;window.context=vr;$M({name:"firework-frenzy",app:vr,appOptions:{antialias:!0,backgroundAlpha:0},world:vr.world,layout:{design:{landscape:t0,portrait:e0}},fonts:{cssFonts:[{family:"Anton"},{family:"Luckiest Guy"}],extendedLatin:!1},pause:{pauseSharedTicker:!0},initialBetIndex:1,backend:()=>({backend:new ZM,hostAdapter:new QM}),e2e:void 0,prepare:n=>vr.prepareGame(n),start:n=>vr.showInstructions(n)});export{ck as $,mk as A,ri as B,vs as C,Wd as D,Q as E,ao as F,Ga as G,ho as H,oo as I,sn as J,Ys as K,ak as L,xe as M,ym as N,AS as O,$r as P,Ji as Q,at as R,io as S,pS as T,Xs as U,zc as V,Rm as W,wS as X,ro as Y,Me as Z,zd as _,mc as a,hm as a$,ir as a0,Bl as a1,Ol as a2,Dl as a3,Nl as a4,Rl as a5,Ll as a6,Po as a7,ei as a8,qo as a9,Si as aA,Pm as aB,Nc as aC,Gr as aD,Fm as aE,Bm as aF,Wc as aG,Ms as aH,dS as aI,ok as aJ,nt as aK,mm as aL,gm as aM,dm as aN,fm as aO,Xi as aP,ga as aQ,SS as aR,rm as aS,om as aT,Te as aU,am as aV,pa as aW,pe as aX,em as aY,bs as aZ,yk as a_,Pl as aa,xm as ab,Yt as ac,um as ad,rk as ae,Ho as af,Yd as ag,U as ah,q as ai,si as aj,Ko as ak,Sm as al,Ml as am,bm as an,wm as ao,cs as ap,Ja as aq,Am as ar,Zo as as,Mm as at,vm as au,Cm as av,km as aw,kl as ax,Ka as ay,Tm as az,Dp as b,Gn as b$,lm as b0,cm as b1,$s as b2,CS as b3,Vc as b4,gv as b5,yv as b6,ya as b7,Gd as b8,xk as b9,Dm as bA,Nm as bB,bS as bC,Uc as bD,rt as bE,Fl as bF,_m as bG,sm as bH,im as bI,nm as bJ,Se as bK,G as bL,Al as bM,js as bN,lk as bO,xS as bP,_S as bQ,yS as bR,re as bS,ut as bT,Ct as bU,$ as bV,Tl as bW,Vn as bX,Js as bY,qt as bZ,Sl as b_,ma as ba,Vi as bb,Em as bc,El as bd,Im as be,Yc as bf,qa as bg,Lm as bh,Il as bi,oe as bj,Ev as bk,hs as bl,uS as bm,Jg as bn,mS as bo,tm as bp,ce as bq,fS as br,Gs as bs,hk as bt,Mt as bu,nr as bv,Om as bw,Wm as bx,zm as by,Ym as bz,Gc as c,fh as c$,Co as c0,Nt as c1,wt as c2,Ng as c3,Wg as c4,ts as c5,nk as c6,q1 as c7,O1 as c8,Bt as c9,It as cA,dx as cB,pb as cC,en as cD,ed as cE,Yo as cF,gc as cG,$p as cH,Pe as cI,la as cJ,wc as cK,cg as cL,ik as cM,vc as cN,dg as cO,Uo as cP,Qy as cQ,$b as cR,Re as cS,mp as cT,ns as cU,Va as cV,Nu as cW,it as cX,oS as cY,kx as cZ,zu as c_,Dt as ca,gt as cb,Qx as cc,yb as cd,l_ as ce,Ps as cf,Lt as cg,Kt as ch,Tt as ci,En as cj,Ya as ck,ot as cl,X as cm,$a as cn,Jb as co,d1 as cp,hw as cq,Hs as cr,Ha as cs,Pp as ct,ft as cu,qp as cv,Gi as cw,yt as cx,Zt as cy,Wr as cz,j as d,Yu as d0,Ex as d1,xp as d2,Lc as d3,Mg as d4,Kp as d5,so as d6,F_ as d7,P_ as d8,bc as d9,bb as da,Sc as db,ug as dc,w1 as dd,Tc as de,fg as df,pg as dg,g1 as dh,Wt as e,pv as f,Yy as g,ht as h,ws as i,Ud as j,Vd as k,pm as l,Oc as m,Xr as n,fk as o,vS as p,TS as q,ja as r,kr as s,PS as t,Ir as u,Qa as v,Cl as w,nn as x,Dc as y,Za as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.