1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/browserAllBV2Umc7m.js","js/webworkerAllhQFdFxWW.js","js/vue-runtimeBHGad_ZB.js","js/cjs-helpersC4iS2aBk.js","js/chunkReloadRecoveryrjuMb-b8.js","js/bootstrap-vue-nextDXY4qsO1.js","assets/bootstrap-vue-nexthA7rx8St.css","js/dexie2jmnBxhj.js","assets/chunkReloadRecoveryUbLNi8xK.css","js/textEmbeddingUtilsBRNkRshv.js","js/item-name.utilsBH3paGZr.js","js/useBgEventsC6VPqwnW.js","js/CategoryMatchServiceDl5Lq4E2.js","js/TextEmbeddingServiceD7QjSnH7.js","js/sentryUtilsC8JjCXHs.js","js/analysis-utilsDkY9KbJt.js","js/constantsDW26WJ6H.js","js/categoryExplorerSetsCylUBCaq.js","js/itemImageSourcesCubmTdva.js","js/extraction.pure.utilsDQPW8yIh.js","js/WebGPURendererDIHxjEOV.js","js/BufferResourceuU3uyIxp.js","js/RenderTargetSystemwjjcqTQN.js","js/WebGLRendererSdgh8bid.js","js/CanvasRendererBF3ilCQX.js","js/BitmapFontCVK7f5yV.js"])))=>i.map(i=>d[i]); 2var Xl=Object.defineProperty;var jl=(s,t,e)=>t in s?Xl(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var Q=(s,t,e)=>jl(s,typeof t!="symbol"?t+"":t,e);import{v as ot,c as Ht,d as ql,a3 as Kl,a8 as Zl,B as Ql,P as Jl,i as fe,a4 as th,b as V,o as $,e as B,z as bt,u as st,j as lr,l as ct,F as Wt,k as ss,q as is,n as ns,y as eh,a7 as sh,U as hr,S as cr,N as ih}from"./vue-runtimeBHGad_ZB.js";import{am as De,t as Lt,e as nh,ak as rh,b as oh,l as On,x as ah,e8 as lh,aD as hh,aE as ch,_ as uh}from"./chunkReloadRecoveryrjuMb-b8.js";import{a as dh}from"./cjs-helpersC4iS2aBk.js";import{c as Uo,h as fh,b as Wo}from"./textEmbeddingUtilsBRNkRshv.js";import{u as ph}from"./useBgEventsC6VPqwnW.js";import{C as gh}from"./CategoryMatchServiceDl5Lq4E2.js";import{D as We}from"./categoryExplorerSetsCylUBCaq.js";import{g as rn}from"./itemImageSourcesCubmTdva.js";import{r as mh}from"./item-name.utilsBH3paGZr.js";var G=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.TextureUploaderWebGL="texture-uploader-webgl",s.TextureUploaderWebGPU="texture-uploader-webgpu",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(G||{});const on=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Es=(s,t)=>on(s).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(on).forEach(t=>{t.type.forEach(e=>{var i,n;return(n=(i=this._removeHandlers)[e])==null?void 0:n.call(i,t)})}),this},add(...s){return s.map(on).forEach(t=>{t.type.forEach(e=>{var r,o;const i=this._addHandlers,n=this._queue;i[e]?(o=i[e])==null||o.call(i,t):(n[e]=n[e]||[],(r=n[e])==null||r.push(t))})}),this},handle(s,t,e){var o;const i=this._addHandlers,n=this._removeHandlers;if(i[s]||n[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,n[s]=e;const r=this._queue;return r[s]&&((o=r[s])==null||o.forEach(a=>t(a)),delete r[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(r=>r.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((r,o)=>Es(o.value,e)-Es(r.value,e)))},i=>{const n=t.findIndex(r=>r.name===i.name);n!==-1&&t.splice(n,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((n,r)=>Es(r,e)-Es(n,e)))},i=>{const n=t.indexOf(i.ref);n!==-1&&t.splice(n,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},yh={extension:{type:G.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await De(()=>import("./browserAllBV2Umc7m.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))}},xh={extension:{type:G.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await De(()=>import("./webworkerAllhQFdFxWW.js"),__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))}};class St{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new St(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))}}var zo={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function n(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function r(l,h,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new n(c,u||l,f),p=e?e+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],d]:l._events[p].push(d):(l._events[p]=d,l._eventsCount++),l}function o(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function a(){this._events=new i,this._eventsCount=0}
vendor: 7,190 bytes, line 2
2a.prototype.eventNames=function(){var h=[],c,u;if(this._eventsCount===0)return h;for(u in c=this._events)t.call(c,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},a.prototype.listeners=function(h){var c=e?e+h:h,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,p=new Array(d);f<d;f++)p[f]=u[f].fn;return p},a.prototype.listenerCount=function(h){var c=e?e+h:h,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(h,c,u,f,d,p){var g=e?e+h:h;if(!this._events[g])return!1;var m=this._events[g],y=arguments.length,x,_;if(m.fn){switch(m.once&&this.removeListener(h,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,f),!0;case 5:return m.fn.call(m.context,c,u,f,d),!0;case 6:return m.fn.call(m.context,c,u,f,d,p),!0}for(_=1,x=new Array(y-1);_<y;_++)x[_-1]=arguments[_];m.fn.apply(m.context,x)}else{var b=m.length,S;for(_=0;_<b;_++)switch(m[_].once&&this.removeListener(h,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,f);break;default:if(!x)for(S=1,x=new Array(y-1);S<y;S++)x[S-1]=arguments[S];m[_].fn.apply(m[_].context,x)}}return!0},a.prototype.on=function(h,c,u){return r(this,h,c,u,!1)},a.prototype.once=function(h,c,u){return r(this,h,c,u,!0)},a.prototype.removeListener=function(h,c,u,f){var d=e?e+h:h;if(!this._events[d])return this;if(!c)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===c&&(!f||p.once)&&(!u||p.context===u)&&o(this,d);else{for(var g=0,m=[],y=p.length;g<y;g++)(p[g].fn!==c||f&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[d]=m.length===1?m[0]:m:o(this,d)}return this},a.prototype.removeAllListeners=function(h){var c;return h?(c=e?e+h:h,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,s.exports=a})(zo);var _h=zo.exports;const Kt=dh(_h),bh=Math.PI*2,wh=180/Math.PI,vh=Math.PI/180;class Mt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new Mt(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 Mi.x=0,Mi.y=0,Mi}}const Mi=new Mt;class j{constructor(t=1,e=0,i=0,n=1,r=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=n,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,i,n,r,o){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new Mt;const i=t.x,n=t.y;return e.x=this.a*i+this.c*n+this.tx,e.y=this.b*i+this.d*n+this.ty,e}applyInverse(t,e){e=e||new Mt;const i=this.a,n=this.b,r=this.c,o=this.d,a=this.tx,l=this.ty,h=1/(i*o+r*-n),c=t.x,u=t.y;return e.x=o*h*c+-r*h*u+(l*r-a*o)*h,e.y=i*h*u+-n*h*c+(-l*i+a*n)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a,r=this.c,o=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=r*e-this.d*i,this.d=r*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,n=this.c,r=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*r,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*r,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*r+this.ty,this}appendFrom(t,e){const i=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,f=e.d;return this.a=i*h+n*u,this.b=i*c+n*f,this.c=r*h+o*u,this.d=r*c+o*f,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*f+e.ty,this}setTransform(t,e,i,n,r,o,a,l,h){return this.a=Math.cos(a+h)*r,this.b=Math.sin(a+h)*r,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+n*this.c),this.ty=e-(i*this.b+n*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,n=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*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,i=this.b,n=this.c,r=this.d,o=t.pivot,a=-Math.atan2(-n,r),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(bh-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(n*n+r*r),t.position.x=this.tx+(o.x*e+o.y*n),t.position.y=this.ty+(o.x*i+o.y*r),t}invert(){const t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,o=t*n-e*i;return this.a=n/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-n*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 j;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 Ah.identity()}static get shared(){return Sh.identity()}}const Sh=new j,Ah=new j,ye=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_e=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],be=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],an=[],Ho=[],Ls=Math.sign;function Ch(){for(let s=0;s<16;s++){const t=[];an.push(t);for(let e=0;e<16;e++){const i=Ls(ye[s]*ye[e]+_e[s]*xe[e]),n=Ls(xe[s]*ye[e]+be[s]*xe[e]),r=Ls(ye[s]*_e[e]+_e[s]*be[e]),o=Ls(xe[s]*_e[e]+be[s]*be[e]);for(let a=0;a<16;a++)if(ye[a]===i&&xe[a]===n&&_e[a]===r&&be[a]===o){t.push(a);break}}}for(let s=0;s<16;s++){const t=new j;t.set(ye[s],xe[s],_e[s],be[s],0,0),Ho.push(t)}}Ch();const X={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:s=>ye[s],uY:s=>xe[s],vX:s=>_e[s],vY:s=>be[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>an[s][t],sub:(s,t)=>an[s][X.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?X.S:X.N:Math.abs(t)*2<=Math.abs(s)?s>0?X.E:X.W:t>0?s>0?X.SE:X.SW:s>0?X.NE:X.NW,matrixAppendRotationInv:(s,t,e=0,i=0,n=0,r=0)=>{const o=Ho[X.inv(t)],a=o.a,l=o.b,h=o.c,c=o.d,u=e-Math.min(0,a*n,h*r,a*n+h*r),f=i-Math.min(0,l*n,c*r,l*n+c*r),d=s.a,p=s.b,g=s.c,m=s.d;
2s.a=a*d+l*g,s.b=a*p+l*m,s.c=h*d+c*g,s.d=h*p+c*m,s.tx=u*d+f*g+s.tx,s.ty=u*p+f*m+s.ty},transformRectCoords:(s,t,e,i)=>{const{x:n,y:r,width:o,height:a}=s,{x:l,y:h,width:c,height:u}=t;return e===X.E?(i.set(n+l,r+h,o,a),i):e===X.S?i.set(c-r-a+l,n+h,a,o):e===X.W?i.set(c-n-o+l,u-r-a+h,o,a):e===X.N?i.set(r+l,u-n-o+h,a,o):i.set(n+l,r+h,o,a)}},Fs=[new Mt,new Mt,new Mt,new Mt];class gt{constructor(t=0,e=0,i=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(n)}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 gt(0,0,0,0)}clone(){return new gt(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,n=.5){const{width:r,height:o}=this;if(r<=0||o<=0)return!1;const a=this.x,l=this.y,h=i*(1-n),c=i-h,u=a-h,f=a+r+h,d=l-h,p=l+o+h,g=a+c,m=a+r-c,y=l+c,x=l+o-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>g&&t<m&&e>y&&e<x)}intersects(t,e){if(!e){const L=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=L)return!1;const C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}const i=this.left,n=this.right,r=this.top,o=this.bottom;if(n<=i||o<=r)return!1;const a=Fs[0].set(t.left,t.top),l=Fs[1].set(t.left,t.bottom),h=Fs[2].set(t.right,t.top),c=Fs[3].set(t.right,t.bottom);if(h.x<=a.x||l.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(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=n||Math.max(a.y,l.y,h.y,c.y)<=r||Math.min(a.y,l.y,h.y,c.y)>=o))return!1;const f=u*(l.y-a.y),d=u*(a.x-l.x),p=f*i+d*r,g=f*n+d*r,m=f*i+d*o,y=f*n+d*o;if(Math.max(p,g,m,y)<=f*a.x+d*a.y||Math.min(p,g,m,y)>=f*c.x+d*c.y)return!1;const x=u*(a.y-h.y),_=u*(h.x-a.x),b=x*i+_*r,S=x*n+_*r,w=x*i+_*o,v=x*n+_*o;return!(Math.max(b,S,w,v)<=x*a.x+_*a.y||Math.min(b,S,w,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),i=Math.min(this.x+this.width,t.x+t.width),n=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(i-e,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,n=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=n-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),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=n,this.height=r-n,this}getBounds(t){return t||(t=new gt),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,n=t.x+t.width,r=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height}set(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Ti={default:-1};function pt(s="default"){return Ti[s]===void 0&&(Ti[s]=-1),++Ti[s]}const ur=new Set,ft="8.0.0",Mh="8.3.4",Fe={quiet:!1,noColor:!1},q=(s,t,e=3)=>{if(Fe.quiet||ur.has(t))return;let i=new Error().stack;const n=`${t} 3Deprecated since v${s}`,r=typeof console.groupCollapsed=="function"&&!Fe.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",n):(i=i.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",n),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",n),console.warn(i))),ur.add(t)};
5Object.defineProperties(q,{quiet:{get:()=>Fe.quiet,set:s=>{Fe.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>Fe.noColor,set:s=>{Fe.noColor=s},enumerable:!0,configurable:!1}});const Vo=()=>{};function ze(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function dr(s){return!(s&s-1)&&!!s}function $o(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const fr=Object.create(null);function Th(s){const t=fr[s];return t===void 0&&(fr[s]=pt("resource")),t}const Yo=class Xo extends Kt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Xo.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){q(ft,"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=Th(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Yo.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let He=Yo;const jo=class qo extends Kt{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=pt("textureSource"),this._resourceType="textureSource",this._resourceId=pt("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={...qo.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 He($o(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.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: 4,728 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(){var t,e;this._resourceId=pt("resource"),this.emit("change",this),this.emit("unload",this);for(const i in this._gpuData)(e=(t=this._gpuData[i])==null?void 0:t.destroy)==null||e.call(t);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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const n=Math.round(t*i),r=Math.round(e*i);return this.width=n/i,this.height=r/i,this._resolution=i,this.pixelWidth===n&&this.pixelHeight===r?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=r,this.emit("resize",this),this._resourceId=pt("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=dr(this.pixelWidth)&&dr(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};jo.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 Ot=jo;class Nn extends Ot{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Nn.extension=G.TextureSource;const pr=new j;class kh{constructor(t,e){this.mapCoord=new j,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){var e;this._texture!==t&&((e=this._texture)==null||e.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 i=this.mapCoord;for(let n=0;n<t.length;n+=2){const r=t[n],o=t[n+1];e[n]=r*i.a+o*i.c+i.tx,e[n+1]=r*i.b+o*i.d+i.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 i=t.orig,n=t.trim;n&&(pr.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(pr));const r=t.source,o=this.uClampFrame,a=this.clampMargin/r._resolution,l=this.clampOffset/r._resolution;return o[0]=(t.frame.x+a+l)/r.width,o[1]=(t.frame.y+a+l)/r.height,o[2]=(t.frame.x+t.frame.width-a+l)/r.width,o[3]=(t.frame.y+t.frame.height-a+l)/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}}class et extends Kt{constructor({source:t,label:e,frame:i,orig:n,trim:r,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=pt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new gt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(t==null?void 0:t.source)??new Ot,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=n||this.frame,this.trim=r,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit
vendor: 19,817 bytes, line 5
5("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new kh(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:n}=this._source,r=e.x/i,o=e.y/n,a=e.width/i,l=e.height/n;let h=this.rotate;if(h){const c=a/2,u=l/2,f=r+c,d=o+u;h=X.add(h,X.NW),t.x0=f+c*X.uX(h),t.y0=d+u*X.uY(h),h=X.add(h,2),t.x1=f+c*X.uX(h),t.y1=d+u*X.uY(h),h=X.add(h,2),t.x2=f+c*X.uX(h),t.y2=d+u*X.uY(h),h=X.add(h,2),t.x3=f+c*X.uX(h),t.y3=d+u*X.uY(h)}else t.x0=r,t.y0=o,t.x1=r+a,t.y1=o,t.x2=r+a,t.y2=o+l,t.x3=r,t.y3=o+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return q(ft,"Texture.baseTexture is now Texture.source"),this._source}}et.EMPTY=new et({label:"EMPTY",source:new Ot({label:"EMPTY"})});et.EMPTY.destroy=Vo;et.WHITE=new et({source:new Nn({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});et.WHITE.destroy=Vo;function Ko(s,t,e){const{width:i,height:n}=e.orig,r=e.trim;if(r){const o=r.width,a=r.height;s.minX=r.x-t._x*i,s.maxX=s.minX+o,s.minY=r.y-t._y*n,s.maxY=s.minY+a}else s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*n,s.maxY=s.minY+n}const gr=new j;class Dt{constructor(t=1/0,e=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=gr,this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new gt);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=gr,this}set(t,e,i,n){this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,e,i,n,r){r||(r=this.matrix);const o=r.a,a=r.b,l=r.c,h=r.d,c=r.tx,u=r.ty;let f=this.minX,d=this.minY,p=this.maxX,g=this.maxY,m=o*t+l*e+c,y=a*t+h*e+u;m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=o*i+l*e+c,y=a*i+h*e+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=o*t+l*n+c,y=a*t+h*n+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=o*i+l*n+c,y=a*i+h*n+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),this.minX=f,this.minY=d,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,n=this.maxX,r=this.maxY,{a:o,b:a,c:l,d:h,tx:c,ty:u}=t;let f=o*e+l*i+c,d=a*e+h*i+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*n+l*i+c,d=a*n+h*i+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*e+l*r+c,d=a*e+h*r+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*n+l*r+c,d=a*n+h*r+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,n){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>n&&(this.maxY=n),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 Dt(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}addVertexData(t,e,i,n){let r=this.minX,o=this.minY,a=this.maxX,l=this.maxY;n||(n=this.matrix);const h=n.a,c=n.b,u=n.c,f=n.d,d=n.tx,p=n.ty;for(let g=e;g<i;g+=2){const m=t[g],y=t[g+1],x=h*m+u*y+d,_=c*m+f*y+p;r=x<r?x:r,o=_<o?_:o,a=x>a?x:a,l=_>l?_:l}this.minX=r,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var Ph={grad:.9,turn:360,rad:360/(2*Math.PI)},te=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},wt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},Bt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Zo=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},mr=function(s){return{r:Bt(s.r,0,255),g:Bt(s.g,0,255),b:Bt(s.b,0,255),a:Bt(s.a)}},ki=function(s){return{r:wt(s.r),g:wt(s.g),b:wt(s.b),a:wt(s.a,3)}},Ih=/^#([0-9a-f]{3,8})$/i,Bs=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Qo=function(s){var t=s.r,e=s.g,i=s.b,n=s.a,r=Math.max(t,e,i),o=r-Math.min(t,e,i),a=o?r===t?(e-i)/o:r===e?2+(i-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:n}},Jo=function(s){var t=s.h,e=s.s,i=s.v,n=s.a;t=t/360*6,e/=100,i/=100;var r=Math.floor(t),o=i*(1-e),a=i*(1-(t-r)*e),l=i*(1-(1-t+r)*e),h=r%6;return{r:255*[i,a,o,o,l,i][h],g:255*[l,i,i,a,o,o][h],b:255*[o,o,l,i,i,a][h],a:n}},yr=function(s){return{h:Zo(s.h),s:Bt(s.s,0,100),l:Bt(s.l,0,100),a:Bt(s.a)}},xr=function(s){return{h:wt(s.h),s:wt(s.s),l:wt(s.l),a:wt(s.a,3)}},_r=function(s){return Jo((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},ys=function(s){return{h:(t=Qo(s)).h,s:(n=(200-(e=t.s))*(i=t.v)/100)>0&&n<200?e*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,e,i,n},Rh=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Eh=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Lh=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fh=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ln={string:[[function(s){var t=Ih.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?wt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?wt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Lh.exec(s)||Fh.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:mr({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(s){var t=Rh.exec(s)||Eh.exec(s);if(!t)return null;var e,i,n=yr({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(Ph[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return _r(n)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,n=s.a,r=n===void 0?1:n;return te(t)&&te(e)&&te(i)?mr({r:Number(t),g:Number(e),b:Number(i),a:Number(r)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,n=s.a,r=n===void 0?1:n;if(!te(t)||!te(e)||!te(i))return null;var o=yr({h:Number(t),s:Number(e),l:Number(i),a:Number(r)});return _r(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,n=s.a,r=n===void 0?1:n;if(!te(t)||!te(e)||!te(i))return null;var o=function(a){return{h:Zo(a.h),s:Bt(a.s,0,100),v:Bt(a.v,0,100),a:Bt(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(r)});return Jo(o)},"hsv"]]},br=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},Bh=function(s){return typeof s=="string"?br(s.trim(),ln.string):typeof s=="object"&&s!==null?br(s,ln.object):[null,void 0]},Pi=function(s,t){var e=ys(s);return{h:e.h,s:Bt(e.s+100*t,0,100),l:e.l,a:e.a}},Ii=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},wr=function(s,t){var e=ys(s);return{h:e.h,s:e.s,l:Bt(e.l+100*t,0,100),a:e.a}},hn=function(){function s(t){this.parsed=Bh(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return wt(Ii(this.rgba),2)},s.prototype.isDark=function(){return Ii(this.rgba)<.5},s.prototype.isLight=function(){return Ii(this.rgba)>=.5},s.prototype.toHex=function(){return t=ki(this.rgba),e=t.r,i=t.g,n=t.b,o=(r=t.a)<1?Bs(wt(255*r)):"","#"+Bs(e)+Bs(i)+Bs(n)+o;var t,e,i,n,r,o},s.prototype.toRgb=function(){return ki(this.rgba)},s.prototype.toRgbString=function(){return t=ki(this.rgba),e=t.r,i=t.g,n=t.b,(r=t.a)<1?"rgba("+e+", "+i+", "+n+", "+r+")":"rgb("+e+", "+i+", "+n+")";var t,e,i,n,r},s.prototype.toHsl=function(){return xr(ys(this.rgba))},s.prototype.toHslString=function(){return t=xr(ys(this.rgba)),e=t.h,i=t.s,n=t.l,(r=t.a)<1?"hsla("+e+", "+i+"%, "+n+"%, "+r+")":"hsl("+e+", "+i+"%, "+n+"%)";var t,e,i,n,r},s.prototype.toHsv=function(){return t=Qo(this.rgba),{h:wt(t.h),s:wt(t.s),v:wt(t.v),a:wt(t.a,3)};var t},s.prototype.invert=function(){return Xt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),Xt(Pi(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Xt(Pi(this.rgba,-t))},s.prototype.grayscale=function(){return Xt(Pi(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Xt(wr(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Xt(wr(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?Xt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):wt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=ys(this.rgba);return typeof t=="number"?Xt({h:t,s:e.s,l:e.l,a:e.a}):wt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Xt(t).toHex()},s}(),Xt=function(s){return s instanceof hn?s:new hn(s)},vr=[],Gh=function(s){s.forEach(function(t){vr.indexOf(t)<0&&(t(hn,ln),vr.push(t))})};function Dh(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var n in e)i[e[n]]=n;var r={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,f="black";if(!r.length)for(var d in e)r[d]=new s(e[d]).toRgb();for(var p in e){var g=(a=c,l=r[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<u&&(u=g,f=p)}return f}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new s(l).toRgb():null},"name"])}Gh([Dh]);const Ve=class fs{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 fs)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,i,n]=this._components;return{r:t,g:e,b:i,a:n}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(n*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,n,r]=this._components;return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,n]=this._components;return t[0]=e,t[1]=i,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,n,r]=fs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=n,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 i=this._int>>16&255,n=this._int>>8&255,r=this._int&255;return e&&(i=i*t+.5|0,n=n*t+.5|0,r=r*t+.5|0),(t*255<<24)+(i<<16)+(n<<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,i,n,r;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,n=(o&255)/255,r=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,n,r=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,n,r=255]=t,e/=255,i/=255,n/=255,r/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=fs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Xt(t);o.isValid()&&({r:e,g:i,b:n,a:r}=o.rgba,e/=255,i/=255,n/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=n,this._components[3]=r,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((n,r)=>{t[r]=Math.min(Math.max(n,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof fs||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}};Ve.shared=new Ve;Ve._temp=new Ve;Ve.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let lt=Ve;const Oh={cullArea:null,cullable:!1,cullableChildren:!0};let Ri=0;const Sr=500;function at(...s){Ri!==Sr&&(Ri++,Ri===Sr?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const Ps={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)}
vendor: 5,328 bytes, line 5
5,release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};class Nh{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){var i;let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),(i=e.init)==null||i.call(e,t),e}return(t){var e;(e=t.reset)==null||e.call(t),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 Uh{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 Nh(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const It=new Uh;Ps.register(It);const Wh={get isCachedAsTexture(){var s;return!!((s=this.renderGroup)!=null&&s.isCachedAsTexture)},cacheAsTexture(s){typeof s=="boolean"&&s===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(s===!0?{}:s))},updateCacheTexture(){var s;(s=this.renderGroup)==null||s.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(s){q("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function zh(s,t,e){const i=s.length;let n;if(t>=i||e===0)return;e=t+e>i?i-t:e;const r=i-e;for(n=t;n<r;++n)s[n]=s[n+e];s.length=r}const Hh={allowChildren:!0,removeChildren(s=0,t){var r;const e=t??this.children.length,i=e-s,n=[];if(i>0&&i<=e){for(let a=e-1;a>=s;a--){const l=this.children[a];l&&(n.push(l),l.parent=null)}zh(this.children,s,e);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(n);for(let a=0;a<n.length;++a){const l=n[a];(r=l.parentRenderLayer)==null||r.detach(l),this.emit("childRemoved",l,this,a),n[a].emit("removed",this)}return n.length>0&&this._didViewChangeTick++,n}else if(i===0&&this.children.length===0)return n;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(s){const t=this.getChildAt(s);return this.removeChild(t)},getChildAt(s){if(s<0||s>=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||q(ft,"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(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const i=s.parent===this;if(s.parent){const r=s.parent.children.indexOf(s);if(i){if(r===t)return s;s.parent.children.splice(r,1)}else s.removeFromParent()}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s._updateFlags=15;const n=this.renderGroup||this.parentRenderGroup;return n&&n.addChild(s),this.sortableChildren&&(this.sortDirty=!0),i||(this.emit("childAdded",s,this,t),s.emit("added",this)),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s},replaceChild(s,t){s.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(s)),t.setFromMatrix(s.localTransform),t.updateLocalTransform(),this.removeChild(s)}},Vh={collectRenderables(s,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(s,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,s):this.collectRenderablesWithEffects(s,t,e))},collectRenderablesSimple(s,t,e){const i=this.children,n=i.length;for(let r=0;r<n;r++)i[r].collectRenderables(s,t,e)},collectRenderablesWithEffects(s,t,e){const{renderPipes:i}=t;
vendor: 6,234 bytes, line 5
5for(let n=0;n<this.effects.length;n++){const r=this.effects[n];i[r.pipe].push(r,this,s)}this.collectRenderablesSimple(s,t,e);for(let n=this.effects.length-1;n>=0;n--){const r=this.effects[n];i[r.pipe].pop(r,this,s)}}};class Ar{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 $h{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 i=this._tests[e];if(i.test(t))return It.get(i.maskClass,t)}return t}returnMaskEffect(t){It.return(t)}}const cn=new $h;it.handleByList(G.MaskEffect,cn._effectClasses);const Yh={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)},addEffect(s){this.effects.indexOf(s)===-1&&(this.effects.push(s),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),cn.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=cn.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},setMask(s){this._maskOptions={...this._maskOptions,...s},s.mask&&(this.mask=s.mask),this._markStructureAsChanged()},set filters(s){var r;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new Ar);s=s;const e=(s==null?void 0:s.length)>0,i=((r=t.filters)==null?void 0:r.length)>0,n=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),n&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new Ar),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},Xh={label:null,get name(){return q(ft,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){q(ft,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const n=e[i];if(n.label===s||s instanceof RegExp&&s.test(n.label))return n}if(t)for(let i=0;i<e.length;i++){const r=e[i].getChildByLabel(s,!0);if(r)return r}return null},getChildrenByLabel(s,t=!1,e=[]){const i=this.children;for(let n=0;n<i.length;n++){const r=i[n];(r.label===s||s instanceof RegExp&&s.test(r.label))&&e.push(r)}if(t)for(let n=0;n<i.length;n++)i[n].getChildrenByLabel(s,!0,e);return e}},Tt=It.getPool(j),ie=It.getPool(Dt),jh=new j,qh={getFastGlobalBounds(s,t){t||(t=new Dt),t.clear(),this._getGlobalBoundsRecursive(!!s,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(s,t,e){let i=t;if(s&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const n=!!this.effects.length;if((this.renderGroup||n)&&(i=ie.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;i.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(s,i,e)}if(n){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,i.applyMatrix(o.worldTransform)),this.effects[a].addBounds(i,!0));r&&i.applyMatrix(o.worldTransform.copyTo(jh).invert()),t.addBounds(i),ie.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),ie.return(i))}};function ta(s,t,e){e.clear();let i,n;return s.parent?t?i=s.parent.worldTransform:(n=Tt.get().identity(),i=Un(s,n)):i=j.IDENTITY,ea(s,e,i,t),n&&Tt.return(n),e.isValid||e.set(0,0,0,0),e}function ea(s,t,e,i){var a,l;if(!s.visible||!s.measurable)return;let n;i?n=s.worldTransform:(s.updateLocalTransform(),n=Tt.get(),n.appendFrom(s.localTransform,e));const r=t,o=!!s.effects.length;if(o&&(t=ie.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{const h=s.bounds;h&&!h.isEmpty()&&(t.matrix=n,t.addBounds(h));for(let c=0;c<s.children.length;c++)ea(s.children[c],t,n,i)}if(o){for(let h=0;h<s.effects.length;h++)(l=(a=s.effects[h]).addBounds)==null||l.call(a,t);r.addBounds(t,j.IDENTITY),ie.return(t)}i||Tt.return(n)}function Un(s,t){const e=s.parent;return e&&(Un(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function sa(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;const e=s>>16&255,i=s>>8&255,n=s&255,r=t>>16&255,o=t>>8&255,a=t&255,l=e*r/255|0,h=i*o/255|0,c=n*a/255|0;return(l<<16)+(h<<8)+c}const Cr=16777215;function Mr(s,t){return s===Cr?t:t===Cr?s:sa(s,t)}function Js(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const Kh={getGlobalAlpha(s){if(s)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(s=new j,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=Un(this,Tt.get().identity());return s.appendFrom(this.localTransform,e),Tt.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?Js(this.renderGroup.worldColor):this.parentRenderGroup?Js(Mr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Mr(t,e.localColor),e=e.parent;return Js(t)}};function ia(s,t,e){return t.clear(),e||(e=j.IDENTITY),na(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function na(s,t,e,i,n){var l,h;let r;
vendor: 10,190 bytes, line 5
5if(n)r=Tt.get(),r=e.copyTo(r);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const c=s.localTransform;r=Tt.get(),r.appendFrom(c,e)}const o=t,a=!!s.effects.length;if(a&&(t=ie.get().clear()),s.boundsArea)t.addRect(s.boundsArea,r);else{s.renderPipeId&&(t.matrix=r,t.addBounds(s.bounds));const c=s.children;for(let u=0;u<c.length;u++)na(c[u],t,r,i,!1)}if(a){for(let c=0;c<s.effects.length;c++)(h=(l=s.effects[c]).addLocalBounds)==null||h.call(l,t,i);o.addBounds(t,j.IDENTITY),ie.return(t)}Tt.return(r)}function ra(s,t){const e=s.children;for(let i=0;i<e.length;i++){const n=e[i],r=n.uid,o=(n._didViewChangeTick&65535)<<16|n._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,n.children.length&&ra(n,t)}return t.didChange}const Zh=new j,Qh={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(s,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=s/t*e:this.scale.x=e},_setHeight(s,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=s/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Dt});const s=this._localBoundsCacheData;return s.index=1,s.didChange=!1,s.data[0]!==this._didViewChangeTick&&(s.didChange=!0,s.data[0]=this._didViewChangeTick),ra(this,s),s.didChange&&ia(this,s.localBounds,Zh),s.localBounds},getBounds(s,t){return ta(this,s,t||new Dt)}},Jh={_onRender:null,set onRender(s){const t=this.renderGroup||this.parentRenderGroup;if(!s){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=s},get onRender(){return this._onRender}},tc={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(s){this._zIndex!==s&&(this._zIndex=s,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(ec))}};function ec(s,t){return s._zIndex-t._zIndex}const sc={getGlobalPosition(s=new Mt,t=!1){return this.parent?this.parent.toGlobal(this._position,s,t):(s.x=this._position.x,s.y=this._position.y),s},toGlobal(s,t,e=!1){const i=this.getGlobalTransform(Tt.get(),e);return t=i.apply(s,t),Tt.return(i),t},toLocal(s,t,e,i){t&&(s=t.toGlobal(s,e,i));const n=this.getGlobalTransform(Tt.get(),i);return e=n.applyInverse(s,e),Tt.return(n),e}};class Wn{constructor(){this.uid=pt("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 ic=0;class nc{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new He(this.textureOptions)}createTexture(t,e,i,n){const r=new Ot({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:n});return new et({source:r,label:`texturePool_${ic++}`})}getOptimalTexture(t,e,i=1,n,r=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=ze(o),a=ze(a);const l=n?1:0,h=r?1:0,c=(o<<17)+(a<<2)+(h<<1)+l;this._texturePool[c]||(this._texturePool[c]=[]);let u=this._texturePool[c].pop();return u||(u=this.createTexture(o,a,n,r)),u.source._resolution=i,u.source.width=o/i,u.source.height=a/i,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 i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let n=0;n<i.length;n++)i[n].destroy(!0)}this._texturePool={}}}const pi=new nc;Ps.register(pi);class rc{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new j,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 Wn,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 i=0;i<e.length;i++){const n=e[i];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(pi.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 i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let n=0;n<i.length;n++)this._getChildren(i[n],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new j),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new j),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(this._matrixDirty&4))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new j),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 oc(s,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(s[i]=t[i])}const Ei=new St(null),Gs=new St(null),Li=new St(null,1,1),Ds=new St(null),Tr=1,ac=2,Fi=4;class At extends Kt{constructor(t={}){var e,i;super(),this.uid=pt("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 j,this.relativeGroupTransform=new j,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new St(this,0,0),this._scale=Li,this._pivot=Gs,this._origin=Ds,this._skew=Ei,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.localBlendM
vendor: 4,569 bytes, line 5
5ode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],oc(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(n=>this.addChild(n)),(i=t.parent)==null||i.addChild(this)}static mixin(t){q("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),it.mixin(At,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||q(ft,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let n=0;n<t.length;n++)this.addChild(t[n]);return t[0]}const e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let n=0;n<t.length;n++)this.removeChild(t[n]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=It.get(rc,this),this.groupTransform=j.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),It.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new j),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*wh}set angle(t){this.rotation=t*vh}get pivot(){return this._pivot===Gs&&(this._pivot=new St(this,0,0)),this._pivot}set pivot(t){this._pivot===Gs&&(this._pivot=new St(this,0,0),this._origin!==Ds&&at("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===Ei&&(this._skew=new St(this,0,0)),this._skew}set skew(t){this._skew===Ei&&(this._skew=new St(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Li&&(this._scale=new St(this,1,1)),this._scale}set scale(t){this._scale===Li&&(this._scale=new St(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===Ds&&(this._origin=new St(this,0,0)),this._origin}set origin(t){this._origin===Ds&&(this._origin=new St(this,0,0),this._pivot!==Gs&&at("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;
vendor: 4,522 bytes, line 5
5this._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 i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){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,i=this._scale,n=this._pivot,r=this._origin,o=this._position,a=i._x,l=i._y,h=n._x,c=n._y,u=-r._x,f=-r._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*l,e.d=this._sy*l,e.tx=o._x-(h*e.a+c*e.c)+(u*e.a+f*e.c)-u,e.ty=o._y-(h*e.b+c*e.d)+(u*e.b+f*e.d)-f}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Tr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=lt.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Tr,this._onUpdate())}get tint(){return Js(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ac,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|=Fi,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|=Fi,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|=Fi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var n;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==null?void 0:t.children)&&e)for(let r=0;r<e.length;++r)e[r].destroy(t);(n=this.renderGroup)==null||n.destroy(),this.renderGroup=null}}it.mixin(At,Hh,qh,sc,Jh,Qh,Yh,Xh,tc,Oh,Wh,Kh,Vh);class zn extends At{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 Dt(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:i,y:n}=t;return i>=e.minX&&i<=e.maxX&&n>=e.minY&&n<=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)}unload(){var t;
5this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:n}=e;n.blendMode.pushBlendMode(this,this.groupBlendMode,t);const o=n[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,t),this.didViewUpdate=!1;const a=this.children,l=a.length;for(let h=0;h<l;h++)a[h].collectRenderables(t,e,i);n.blendMode.popBlendMode(t)}}class $e extends zn{constructor(t=et.EMPTY){t instanceof et&&(t={texture:t});const{texture:e=et.EMPTY,anchor:i,roundPixels:n,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 St({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=n??!1,r!==void 0&&(this.width=r),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof et?new $e(t):new $e(et.from(t,e))}set texture(t){t||(t=et.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 Ko(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return q("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:n,height:r}=e.orig;i.minX=-t._x*n,i.maxX=i.minX+n,i.minY=-t._y*r,i.maxY=i.minY+r}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const lc=new Dt;function oa(s,t,e){const i=lc;s.measurable=!0,ta(s,e,i),t.addBoundsMask(i),s.measurable=!1}function aa(s,t,e){const i=ie.get();s.measurable=!0;const n=Tt.get().identity(),r=la(s,e,n);ia(s,i,r),s.measurable=!1,t.addBoundsMask(i),Tt.return(n),ie.return(i)}function la(s,t,e){return s?(s!==t&&(la(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(at("Mask bounds, renderable is not inside the root container"),e)}class ha{constructor(t){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof $e),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||oa(this.mask,t,e)}addLocalBounds(t,e){aa(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof $e}}ha.extension=G.MaskEffect;class ca{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}ca.extension=G.MaskEffect;class ua{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&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){oa(this.mask,t,e)}addLocalBounds(t,e){aa(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof At}}ua.extension=G.MaskEffect;const hc={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>
vendor: 4,283 bytes, line 5
5new DOMParser().parseFromString(s,"text/xml")};let kr=hc;const K={get(){return kr},set(s){kr=s}};class da extends Ot{constructor(t){t.resource||(t.resource=K.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const n=super.resize(t,e,i);return n&&this.resizeCanvas(),n}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"))}}da.extension=G.TextureSource;class Ye extends Ot{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}}Ye.extension=G.TextureSource;var ni=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(ni||{});class Bi{constructor(t,e=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=n}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 fa=class Rt{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 Bi(null,null,1/0),this.deltaMS=1/Rt.targetFPMS,this.elapsedMS=1/Rt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=ni.NORMAL){return this._addListener(new Bi(t,e,i))}addOnce(t,e,i=ni.NORMAL){return this._addListener(new Bi(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const r=t-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=t-r%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Rt.targetFPMS;const i=this._head;let n=i.next;for(;n;
vendor: 4,911 bytes, line 5
5)n=n.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(Math.max(0,t)/1e3,Rt.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(!Rt._shared){const t=Rt._shared=new Rt;t.autoStart=!0,t._protected=!0}return Rt._shared}static get system(){if(!Rt._system){const t=Rt._system=new Rt;t.autoStart=!0,t._protected=!0}return Rt._system}};fa.targetFPMS=.06;let Be=fa,Gi;async function pa(){return Gi??(Gi=(async()=>{var o;const t=K.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(a=>{const l=document.createElement("video");l.onloadeddata=()=>a(l),l.onerror=()=>a(null),l.autoplay=!1,l.crossOrigin="anonymous",l.preload="auto",l.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",l.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const r=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,r),t.deleteFramebuffer(n),t.deleteTexture(i),(o=t.getExtension("WEBGL_lose_context"))==null||o.loseContext(),r[0]<=r[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Gi}const gi=class ga extends Ot{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ga.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=Be.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 pa(),this._load=new Promise((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,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: 9,111 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&&(Be.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||(Be.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Be.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};gi.extension=G.TextureSource;gi.defaultOptions={...Ot.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};gi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let xs=gi;const Vt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class cc{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||at(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Vt(t);let n;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.test(e)){n=h.getCacheableAssets(i,e);break}}const r=new Map(Object.entries(n||{}));n||i.forEach(l=>{r.set(l,e)});const o=[...r.keys()],a={cacheKeys:o,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const h=n?n[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&at("[Cache] already has key:",l),this._cache.set(l,r.get(l))})}remove(t){if(!this._cacheMap.has(t)){at(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(n=>{this._cache.delete(n)}),e.keys.forEach(n=>{this._cacheMap.delete(n)})}get parsers(){return this._parsers}}const vt=new cc,un=[];it.handleByList(G.TextureSource,un);function ma(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let n=0;n<un.length;n++){const r=un[n];if(r.test(e))return new r(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function uc(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,n=e?s:{resource:s};if(!t&&vt.has(i))return vt.get(i);const r=new et({source:ma(n)});return r.on("destroy",()=>{vt.has(i)&&vt.remove(i)}),t||vt.set(i,r),r}function dc(s,t=!1){return typeof s=="string"?vt.get(s):s instanceof Ot?new et({source:s}):uc(s,t)}et.from=dc;Ot.from=ma;it.add(ha,ca,ua,xs,Ye,da,Nn);var ue=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(ue||{});function zt(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function rs(s){return s.split("?")[0].split("#")[0]}function fc(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pc(s,t,e){return s.replace(new RegExp(fc(t),"g"),e)}function gc(s,t){let e="",i=0,n=-1,r=0,o=-1;for(let a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(n===a-1||r===1))if(n!==a-1&&r===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),n=a,r=0;continue}}else if(e.length===2||e.length===1){e="",i=0,n=a,r=0;continue}}}else e.length>0?e+=`/${s.slice(n+1,a)}`:e=s.slice(n+1,a),i=a-n-1;n=a,r=0}else o===46&&r!==-1?++r:r=-1}return e}const Et={toPosix(s){return pc(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){zt(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(zt(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=rs(this.toPosix(t??K.get().getBaseUrl())),n=rs(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?Et.join(n,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(zt(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=gc(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return zt(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(zt(i),i.length>0)if(t===void 0)t=i;else{const n=s[e-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(zt(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,n=!0;const r=this.getProtocol(s),o=s;s=s.slice(r.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!n){i=a;break}}else n=!1;return i===-1?e?"/":this.isUrl(o)?r+s:r:e&&i===1?"//":r+s.slice(0,i)},rootname(s){zt(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){zt(s),t&&zt(t),s=rs(this.toPosix(s));let e=0,i=-1,n=!0,r;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let o=t.length-1,a=-1;for(r=s.length-1;r>=0;--r){const l=s.charCodeAt(r);if(l===47){if(!n){e=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=r):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(r=s.length-1;r>=0;--r)if(s.charCodeAt(r)===47){if(!n){e=r+1;break}}else i===-1&&(n=!1,i=r+1);return i===-1?"":s.slice(e,i)},extname(s){zt(s),s=rs(this.toPosix(s));let t=-1,e=0,i=-1,n=!0,r=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!n){e=o+1;break}continue}i===-1&&(n=!1,i=o+1),a===46?t===-1?t=o:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||i===-1||r===0||r===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){zt(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=rs(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let n;t.root=this.rootname(s),i||this.hasProtocol(s)?n=1:n=0;let r=-1,o=0,a=-1,l=!0,h=s.length-1,c=0;for(;h>=n;--h){if(e=s.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?r===-1?r=h: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&&i?t.base=t.name=s.slice(1,a):t.base=t.name=s.slice(o,a)):(o===0&&i?(t.name=s.slice(1,r),t.base
5=s.slice(1,a)):(t.name=s.slice(o,r),t.base=s.slice(o,a)),t.ext=s.slice(r,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function ya(s,t,e,i,n){const r=t[e];for(let o=0;o<r.length;o++){const a=r[o];e<t.length-1?ya(s.replace(i[e],a),t,e+1,i,n):n.push(s.replace(i[e],a))}}function mc(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const n=[];e.forEach(r=>{const o=r.substring(1,r.length-1).split(",");n.push(o)}),ya(s,n,0,e,i)}else i.push(s);return i}const ri=s=>!Array.isArray(s);class Ke{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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Vt(e||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(o=>(o==null?void 0:o.src)??o):r!=null&&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&&at("[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 i=[];let n=e;Array.isArray(e)||(n=Object.entries(e).map(([r,o])=>typeof o=="string"||Array.isArray(o)?{alias:r,src:o}:{alias:r,...o})),n.forEach(r=>{const o=r.src,a=r.alias;let l;if(typeof a=="string"){const h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{const h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...r,alias:l,src:o})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=r=>{this.hasKey(r)&&at(`[Resolver] already has key: ${r} overwriting`)},Vt(e).forEach(r=>{const{src:o}=r;let{data:a,format:l,loadParser:h,parser:c}=r;const u=Vt(o).map(g=>typeof g=="string"?mc(g):Array.isArray(g)?g:[g]),f=this.getAlias(r);Array.isArray(f)?f.forEach(i):i(f);const d=[],p=g=>{const m=this._parsers.find(y=>y.test(g));return{src:g,...m==null?void 0:m.parse(g)}};u.forEach(g=>{g.forEach(m=>{let y={};if(typeof m!="object"?y=p(m):(a=m.data??a,l=m.format??l,(m.loadParser||m.parser)&&(h=m.loadParser??h,c=m.parser??c),y={...p(m.src),...m}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:f,data:a,format:l,loadParser:h,parser:c,progressSize:r.progressSize}),d.push(y)})}),f.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=ri(t);t=Vt(t);const i={};return t.forEach(n=>{const r=this._bundles[n];if(r){const o=this.resolve(r),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(n,l)]=h}i[n]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const n in e)i[n]=e[n].src;return i}return e.src}resolve(t){const e=ri(t);t=Vt(t);const i={};return t.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let r=this._assetMap[n];const o=this._getPreferredOrder(r);
vendor: 4,143 bytes, line 5
5o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const h=r.filter(c=>c[a]?c[a]===l:!1);h.length&&(r=h)})}),this._resolverHash[n]=r[0]}else this._resolverHash[n]=this._buildResolvedAsset({alias:[n],src:n},{});i[n]=this._resolverHash[n]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[e],n=this._preferredOrder.find(r=>r.params.format.includes(i.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:n,loadParser:r,parser:o,format:a,progressSize:l}=e;return(this._basePath||this._rootPath)&&(t.src=Et.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...n||{},...t.data},t.loadParser=r??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??yc(t.src),l!==void 0&&(t.progressSize=l),t}}Ke.RETINA_PREFIX=/@([0-9\.]+)x/;function yc(s){return s.split(".").pop().split("?").shift().split("#").shift()}const dn=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},xa=class ps{constructor(t,e){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof Ot&&(i={texture:t,data:e});const{texture:n,data:r,cachePrefix:o=""}=i;this.cachePrefix=o,this._texture=n instanceof et?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=r;const a=parseFloat(r.meta.scale);a?(this.resolution=a,n.source.resolution=this.resolution):this.resolution=n.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<=ps.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 i=t;const n=e?1/0:ps.BATCH_SIZE;for(;i-t<n&&i<this._frameKeys.length;){const r=this._frameKeys[i],o=this._frames[r],a=o.frame;if(a){let l=null,h=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new gt(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?l=new gt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):l=new gt(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&&(h=new gt(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 et({source:this.textureSource,frame:l,orig:u,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:r.toString()})}i++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const n=t[e][i];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ps.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ps.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};xa.BATCH_SIZE=1e3;let Pr=xa;const xc=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function _a(s,t,e){const i={};if(s.forEach(n=>{i[n]=t}),Object.keys(t.textures).forEach(n=>{i[`${t.cachePrefix}${n}`]=t.textures[n]}),!e){const n=Et.dirname(s[0]);
5t.linkedSheets.forEach((r,o)=>{const a=_a([`${n}/${t.data.meta.related_multi_packs[o]}`],r,!0);Object.assign(i,a)})}return i}const _c={extension:G.Asset,cache:{test:s=>s instanceof Pr,getCacheableAssets:(s,t)=>_a(s,t,!1)},resolver:{extension:{type:G.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),n=e.pop();return i==="json"&&xc.includes(n)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=Ke.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:G.LoadParser,priority:ue.Normal,name:"spritesheetLoader"},async testParse(s,t){return Et.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var u,f;const{texture:i,imageFilename:n,textureOptions:r,cachePrefix:o}=(t==null?void 0:t.data)??{};let a=Et.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(i instanceof et)l=i;else{const d=dn(a+(n??s.meta.image),t.src);l=(await e.load([{src:d,data:r}]))[d]}const h=new Pr({texture:l.source,data:s,cachePrefix:o});await h.parse();const c=(u=s==null?void 0:s.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(c)){const d=[];for(const g of c){if(typeof g!="string")continue;let m=a+g;(f=t.data)!=null&&f.ignoreMultiPack||(m=dn(m,t.src),d.push(e.load({src:m,data:{textureOptions:r,ignoreMultiPack:!0}})))}const p=await Promise.all(d);h.linkedSheets=p,p.forEach(g=>{g.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==g))})}return h},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};it.add(_c);const Di=Object.create(null),Ir=Object.create(null);function Hn(s,t){let e=Ir[s];return e===void 0&&(Di[t]===void 0&&(Di[t]=1),Ir[s]=e=Di[t]++),e}let ke;function ba(){return(!ke||ke!=null&&ke.isContextLost())&&(ke=K.get().createCanvas().getContext("webgl",{})),ke}let Os;function bc(){if(!Os){Os="mediump";const s=ba();s&&s.getShaderPrecisionFormat&&(Os=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return Os}function wc(s,t,e){return t?s:e?(s=s.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 ${s} 13 `):` 14 15 #ifdef GL_ES // This checks if it is WebGL1 16 #define in attribute 17 #define out varying 18 #endif 19 ${s} 20 `}function vc(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let n=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float; 21${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function Sc(s,t){return t?`#version 300 es 22${s}`:s}const Ac={},Cc={};function Mc(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?Ac:Cc;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`} 23${s}`}function Tc(s,t){return t?s.replace("#version 300 es",""):s}const Oi={stripVersion:Tc,ensurePrecision:vc,addProgramDefines:wc,setProgramName:Mc,insertVersion:Sc},os=Object.create(null),wa=class fn{constructor(t){t={...fn.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:bc()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let n=t.fragment,r=t.vertex;Object.keys(Oi).forEach(o=>{const a=i[o];n=Oi[o](n,a,!0),r=Oi[o](r,a,!1)}),this.fragment=n,this.vertex=r,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Hn(`${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,os[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return os[e]||(os[e]=new fn(t),os[e]._cacheKey=e),os[e]}};wa.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let mi=wa;const Rr={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 kc(s){return Rr[s]??Rr.float32}const Pc={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"},Er=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Lr(s,t){let e;for(;(e=Er.exec(s))!==null;){const i=Pc[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:i,stride:kc(i).stride,offset:0,instance:!1,start:0}}Er.lastIndex=0}function Ic(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Rc({source:s,entryPoint:t}){const e={},i=Ic(s),n=i.indexOf(`fn ${t}(`);if(n===-1)return e;const r=i.indexOf("->",n);if(r===-1)return e;const o=i.substring(n,r);if(Lr(o,e),Object.keys(e).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const l=a[1],h=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),c=i.match(h);c&&Lr(c[1],e)}}return e}function Ni(s){var u,f;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>
23)? (\w+)/,r=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=(u=s.match(t))==null?void 0:u.map(d=>({group:parseInt(d.match(e)[1],10),binding:parseInt(d.match(i)[1],10),name:d.match(n)[2],isUniform:d.match(n)[1]==="<uniform>",type:d.match(r)[1]}));if(!h)return{groups:[],structs:[]};const c=((f=s.match(o))==null?void 0:f.map(d=>{const p=d.match(l)[1],g=d.match(a).reduce((m,y)=>{const[x,_]=y.split(":");return m[x.trim()]=_.trim(),m},{});return g?{name:p,members:g}:null}).filter(({name:d})=>h.some(p=>p.type===d||p.type.includes(`<${d}>`))))??[];return{groups:h,structs:c}}var we=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(we||{});function Ec({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:we.VERTEX|we.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:we.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:we.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:we.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:we.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Lc({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Fc(s,t){const e=new Set,i=new Set,n=[...s.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),r=[...s.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:n,groups:r}}const as=Object.create(null);class Ze{constructor(t){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:n,gpuLayout:r,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=i,e.source===i.source){const h=Ni(e.source);this.structsAndGroups=h}else{const h=Ni(i.source),c=Ni(e.source);this.structsAndGroups=Fc(h,c)}this.layout=n??Lc(this.structsAndGroups),this.gpuLayout=r??Ec(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((l=this.layout[1])==null?void 0:l.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Hn(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Rc(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,as[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return as[e]||(as[e]=new Ze(t),as[e]._cacheKey=e),as[e]}}const va=["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>"],Bc=va.reduce((s,t)=>(s[t]=!0,s),{});function Gc(s,t){switch(s){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 Sa=class Aa{constructor(t,e){this._touched=0,this.uid=pt("uniform"),this._resourceType="uniformGroup",this._resourceId=pt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Aa.defaultOptions,...e},this.uniformStructures=t;const i={};for(const n in t){const r=t[n];if(r.name=n,r.size=r.size??1,!Bc[r.type]){const o=r.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${r.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${r.type} is not supported. Supported uniform types are: ${va.join(", ")}`)}r.value??(r.value=Gc(r.type,r.size)),i[n]=r.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Hn(Object.keys(i).map(n=>`${n}-${t[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Sa.defaultOptions={ubo:!1,isStatic:!1};let Ca=Sa;class ti{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const n=t[i];this.setResource(n,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var n,r;const i=this.resources[e];t!==i&&((n=i==null?void 0:i.off)==null||n.call(i,"change",this.onResourceChange,this),(r=t.on)==null||r.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const n in i)i[n]._gcLastUsed=t,i[n]._touched=e}destroy(){var e;const t=this.resources;for(const i in t){const n=t[i];(e=n==null?void 0:n.off)==null||e.call(n,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var pn=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(pn||{});class yi extends Kt{constructor(t){super(),this.uid=pt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:n,resources:r,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=pn.WEBGPU),i&&(o|=pn.WEBGL)),this.compatibleRenderers=o;const l={};if(!r&&!n&&(r={}),r&&n)throw new Error("[Shader] Cannot have both resources and groups");
23if(!e&&n&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&n&&a)for(const h in a)for(const c in a[h]){const u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&n&&!a){const h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(r){n={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(const c in r)l[c]||(n[99]||(n[99]=new ti,this._ownedBindGroups.push(n[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(const c in r){const u=c;let f=r[c];!f.source&&!f._resourceType&&(f=new Ca(f));const d=l[u];d&&(n[d.group]||(n[d.group]=new ti,this._ownedBindGroups.push(n[d.group])),n[d.group].setResource(f,d.binding))}}this.groups=n,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(n,l)}addResource(t,e,i){var n,r;(n=this._uniformBindMap)[e]||(n[e]={}),(r=this._uniformBindMap[e])[i]||(r[i]=t),this.groups[e]||(this.groups[e]=new ti,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const n in e){const r=e[n];Object.defineProperty(i,r.name,{get(){return t[r.group].getResource(r.binding)},set(o){t[r.group].setResource(o,r.binding)}})}return i}destroy(t=!1){var e,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(n=>{n.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...n}=t;let r,o;return e&&(r=Ze.from(e)),i&&(o=mi.from(i)),new yi({gpuProgram:r,glProgram:o,...n})}}const Dc={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},Ui=0,Wi=1,zi=2,Hi=3,Vi=4,$i=5,gn=class Ma{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ui)}set blend(t){!!(this.data&1<<Ui)!==t&&(this.data^=1<<Ui)}get offsets(){return!!(this.data&1<<Wi)}set offsets(t){!!(this.data&1<<Wi)!==t&&(this.data^=1<<Wi)}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<<zi)}set culling(t){!!(this.data&1<<zi)!==t&&(this.data^=1<<zi)}get depthTest(){return!!(this.data&1<<Hi)}set depthTest(t){!!(this.data&1<<Hi)!==t&&(this.data^=1<<Hi)}get depthMask(){return!!(this.data&1<<$i)}set depthMask(t){!!(this.data&1<<$i)!==t&&(this.data^=1<<$i)}get clockwiseFrontFace(){return!!(this.data&1<<Vi)}set clockwiseFrontFace(t){!!(this.data&1<<Vi)!==t&&(this.data^=1<<Vi)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Dc[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 Ma;return t.depthTest=!1,t.blend=!0,t}};gn.default2d=gn.for2d();let Vn=gn;const Ta=class mn extends yi{constructor(t){t={...mn.defaultOptions,...t},super(t),this.enabled=!0,this._state=Vn.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(t,e,i,n){t.applyFilter(this,e,i,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const{gpu:e,gl:i,...n}=t;let r,o;return e&&(r=Ze.from(e)),i&&(o=mi.from(i)),new mn({gpuProgram:r,glProgram:o,...n})}};Ta.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Oc=Ta;const yn=[];it.handleByNamedList(G.Environment,yn);async function Nc(s){if(!s)for(let t=0;t<yn.length;t++){const e=yn[t];if(e.value.test()){await e.value.load();return}}}let ls;function Uc(){if(typeof ls=="boolean")return ls;try{ls=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ls=!1}return ls}function Fr(s,t,e=2){const i=t&&t.length,n=i?t[0]*e:s.length;let r=ka(s,0,n,e,!0);const o=[];if(!r||r.next===r.prev)return o;let a,l,h;if(i&&(r=$c(s,t,r,e)),s.length>80*e){a=s[0],l=s[1];let c=a,u=l;for(let f=e;f<n;f+=e){const d=s[f],p=s[f+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>u&&(u=p)}h=Math.max(c-a,u-l),h=h!==0?32767/h:0}return Ss(r,o,e,a,l,h,0),o}function ka(s,t,e,i,n){let r;if(n===su(s,t,e,i)>0)for(let o=t;o<e;o+=i)r=Br(o/i|0,s[o],s[o+1],r);else for(let o=e-i;o>=t;o-=i)r=Br(o/i|0,s[o],s[o+1],r);return r&&Xe(r,r.next)&&(Cs(r),r=r.next),r}function Ce(s,t){if(!s)return s;t||(t=s);let e=s,i;do if(i=!1,!e.steiner&&(Xe(e,e.next)||ut(e.prev,e,e.next)===0)){if(Cs(e),e=t=e.prev,e===e.next)break;
vendor: 5,212 bytes, line 23
23i=!0}else e=e.next;while(i||e!==t);return t}function Ss(s,t,e,i,n,r,o){if(!s)return;!o&&r&&Kc(s,i,n,r);let a=s;for(;s.prev!==s.next;){const l=s.prev,h=s.next;if(r?zc(s,i,n,r):Wc(s)){t.push(l.i,s.i,h.i),Cs(s),s=h.next,a=h.next;continue}if(s=h,s===a){o?o===1?(s=Hc(Ce(s),t),Ss(s,t,e,i,n,r,2)):o===2&&Vc(s,t,e,i,n,r):Ss(Ce(s),t,e,i,n,r,1);break}}}function Wc(s){const t=s.prev,e=s,i=s.next;if(ut(t,e,i)>=0)return!1;const n=t.x,r=e.x,o=i.x,a=t.y,l=e.y,h=i.y,c=Math.min(n,r,o),u=Math.min(a,l,h),f=Math.max(n,r,o),d=Math.max(a,l,h);let p=i.next;for(;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&gs(n,a,r,l,o,h,p.x,p.y)&&ut(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function zc(s,t,e,i){const n=s.prev,r=s,o=s.next;if(ut(n,r,o)>=0)return!1;const a=n.x,l=r.x,h=o.x,c=n.y,u=r.y,f=o.y,d=Math.min(a,l,h),p=Math.min(c,u,f),g=Math.max(a,l,h),m=Math.max(c,u,f),y=xn(d,p,t,e,i),x=xn(g,m,t,e,i);let _=s.prevZ,b=s.nextZ;for(;_&&_.z>=y&&b&&b.z<=x;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==n&&_!==o&&gs(a,c,l,u,h,f,_.x,_.y)&&ut(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=d&&b.x<=g&&b.y>=p&&b.y<=m&&b!==n&&b!==o&&gs(a,c,l,u,h,f,b.x,b.y)&&ut(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==n&&_!==o&&gs(a,c,l,u,h,f,_.x,_.y)&&ut(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=g&&b.y>=p&&b.y<=m&&b!==n&&b!==o&&gs(a,c,l,u,h,f,b.x,b.y)&&ut(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Hc(s,t){let e=s;do{const i=e.prev,n=e.next.next;!Xe(i,n)&&Ia(i,e,e.next,n)&&As(i,n)&&As(n,i)&&(t.push(i.i,e.i,n.i),Cs(e),Cs(e.next),e=s=n),e=e.next}while(e!==s);return Ce(e)}function Vc(s,t,e,i,n,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Jc(o,a)){let l=Ra(o,a);o=Ce(o,o.next),l=Ce(l,l.next),Ss(o,t,e,i,n,r,0),Ss(l,t,e,i,n,r,0);return}a=a.next}o=o.next}while(o!==s)}function $c(s,t,e,i){const n=[];for(let r=0,o=t.length;r<o;r++){const a=t[r]*i,l=r<o-1?t[r+1]*i:s.length,h=ka(s,a,l,i,!1);h===h.next&&(h.steiner=!0),n.push(Qc(h))}n.sort(Yc);for(let r=0;r<n.length;r++)e=Xc(n[r],e);return e}function Yc(s,t){let e=s.x-t.x;if(e===0&&(e=s.y-t.y,e===0)){const i=(s.next.y-s.y)/(s.next.x-s.x),n=(t.next.y-t.y)/(t.next.x-t.x);e=i-n}return e}function Xc(s,t){const e=jc(s,t);if(!e)return t;const i=Ra(e,s);return Ce(i,i.next),Ce(e,e.next)}function jc(s,t){let e=t;const i=s.x,n=s.y;let r=-1/0,o;if(Xe(s,e))return e;do{if(Xe(s,e.next))return e.next;if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){const u=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=i&&u>r&&(r=u,o=e.x<e.next.x?e:e.next,u===i))return o}e=e.next}while(e!==t);if(!o)return null;const a=o,l=o.x,h=o.y;let c=1/0;e=o;do{if(i>=e.x&&e.x>=l&&i!==e.x&&Pa(n<h?i:r,n,l,h,n<h?r:i,n,e.x,e.y)){const u=Math.abs(n-e.y)/(i-e.x);As(e,s)&&(u<c||u===c&&(e.x>o.x||e.x===o.x&&qc(o,e)))&&(o=e,c=u)}e=e.next}while(e!==a);return o}function qc(s,t){return ut(s.prev,s,t.prev)<0&&ut(t.next,s,s.next)<0}function Kc(s,t,e,i){let n=s;do n.z===0&&(n.z=xn(n.x,n.y,t,e,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==s);n.prevZ.nextZ=null,n.prevZ=null,Zc(n)}function Zc(s){let t,e=1;do{let i=s,n;s=null;let r=null;for(t=0;i;){t++;let o=i,a=0;for(let h=0;h<e&&(a++,o=o.nextZ,!!o);h++);let l=e;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||i.z<=o.z)?(n=i,i=i.nextZ,a--):(n=o,o=o.nextZ,l--),r?r.nextZ=n:s=n,n.prevZ=r,r=n;i=o}r.nextZ=null,e*=2}while(t>1);return s}function xn(s,t,e,i,n){return s=(s-e)*n|0,t=(t-i)*n|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function Qc(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function Pa(s,t,e,i,n,r,o,a){return(n-o)*(t-a)>=(s-o)*(r-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(r-a)>=(n-o)*(i-a)}function gs(s,t,e,i,n,r,o,a){return!(s===o&&t===a)&&Pa(s,t,e,i,n,r,o,a)}function Jc(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!tu(s,t)&&(As(s,t)&&As(t,s)&&eu(s,t)&&(ut(s.prev,s,t.prev)||ut(s,t.prev,t))||Xe(s,t)&&ut(s.prev,s,s.next)>0&&ut(t.prev,t,t.next)>0)}function ut(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Xe(s,t){return s.x===t.x&&s.y===t.y}function Ia(s,t,e,i){const n=Us(ut(s,t,e)),r=Us(ut(s,t,i)),o=Us(ut(e,i,s)),a=Us(ut(e,i,t));return!!(n!==r&&o!==a||n===0&&Ns(s,e,t)||r===0&&Ns(s,i,t)||o===0&&Ns(e,s,i)||a===0&&Ns(e,t,i))}function Ns(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Us(s){return s>0?1:s<0?-1:0}function tu(s,t){let e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&Ia(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function As(s,t){return ut(s.prev,s,s.next)<0?ut(s,t,s.next)>=0&&ut(s,s.prev,t)>=0:ut(s,t,s.prev)<0||ut(s,s.next,t)<0}function eu(s,t){let e=s,i=!1;const n=(s.x+t.x)/2,r=(s.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&n<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function Ra(s,t){const e=_n(s.i,s.x,s.y),i=_n(t.i,t.x,t.y),n=s.next,r=t.prev;return s.next=t,t.prev=s,e.next=n,n.prev=e,i.next=e,e.prev=i,r.next=i,i.prev=r,i}function Br(s,t,e,i){const n=_n(s,t,e);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}
vendor: 4,635 bytes, line 23
23function Cs(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function _n(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function su(s,t,e,i){let n=0;for(let r=t,o=e-i;r<e;r+=i)n+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return n}const iu=Fr.default||Fr;var Ea=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(Ea||{});class nu{constructor(t){this.items=[],this._name=t}emit(t,e,i,n,r,o,a,l){const{name:h,items:c}=this;for(let u=0,f=c.length;u<f;u++)c[u][h](t,e,i,n,r,o,a,l);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 ru=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],La=class Fa extends Kt{constructor(t){super(),this.tick=0,this.uid=pt("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=[...ru,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Nc(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...Fa.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){this.tick++;let i=t;if(i instanceof At&&(i={container:i},e&&(q(ft,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const n=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=n?i.clearColor:lt.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,e,i){const n=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==n&&this.runners.resolutionChange.emit(i)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Ea.ALL);const{clear:i,clearColor:n,target:r,mipLevel:o,layer:a}=t;lt.shared.setValue(n??this.background.colorRgba),e.renderTarget.clear(r,i,lt.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 nu(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const n in this.runners)this.runners[n].add(i);return this}_addPipes(t,e){const i=e.reduce((n,r)=>(n[r.name]=r.value,n),{});t.forEach(n=>{const r=n.value,o=n.name,a=i[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)&&Ps.release(),Object.values(this.runners).forEac
23h(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(!Uc())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()}};La.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Ba=La,Ws;function ou(s){return Ws!==void 0||(Ws=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??Ba.defaultOptions.failIfMajorPerformanceCaveat};try{if(!K.get().getWebGLRenderingContext())return!1;let n=K.get().createCanvas().getContext("webgl",t);const r=!!((e=n==null?void 0:n.getContextAttributes())!=null&&e.stencil);if(n){const o=n.getExtension("WEBGL_lose_context");o&&o.loseContext()}return n=null,r}catch{return!1}})()),Ws}let zs;async function au(s={}){return zs!==void 0||(zs=await(async()=>{const t=K.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),zs}const Gr=["webgl","webgpu","canvas"];async function lu(s){let t=[];s.preference?Array.isArray(s.preference)?t=s.preference.slice():(t.push(s.preference),Gr.forEach(r=>{r!==s.preference&&t.push(r)})):t=Gr.slice();let e,i={};for(let r=0;r<t.length;r++){const o=t[r];if(o==="webgpu"&&await au()){const{WebGPURenderer:a}=await De(async()=>{const{WebGPURenderer:l}=await import("./WebGPURendererDIHxjEOV.js");return{WebGPURenderer:l}},__vite__mapDeps([20,21,22,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));e=a,i={...s,...s.webgpu};break}else if(o==="webgl"&&ou(s.failIfMajorPerformanceCaveat??Ba.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await De(async()=>{const{WebGLRenderer:l}=await import("./WebGLRendererSdgh8bid.js");return{WebGLRenderer:l}},__vite__mapDeps([23,21,22,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));e=a,i={...s,...s.webgl};break}else if(o==="canvas"){const{CanvasRenderer:a}=await De(async()=>{const{CanvasRenderer:l}=await import("./CanvasRendererBF3ilCQX.js");return{CanvasRenderer:l}},__vite__mapDeps([24,22,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));e=a,i={...s,...s.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!e)throw new Error("No available renderer for the current environment");const n=new e;return await n.init(i),n}const Ga="8.19.0";class Da{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,Ga)}static destroy(){}}Da.extension=G.Application;class hu{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Ga)}destroy(){this._renderer=null}}hu.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"initHook",priority:-10};class Oa{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,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;e=n,i=r}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Oa.extension=G.Application;class Na{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,ni.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Be.shared:new Be,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Na.extension=G.Application;it.add(Oa);it.add(Na);const Ua=class bn{constructor(...t){this.stage=new At,t[0]!==void 0&&q(ft,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new At),this.renderer=await lu(t),bn._plugins.forEach(e
vendor: 4,244 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 q(ft,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var t;return(t=this.renderer.renderPipes.dom)==null?void 0:t._domElement}destroy(t=!1,e=!1){const i=bn._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Ua._plugins=[];let Wa=Ua;it.handleByList(G.Application,Wa._plugins);it.add(Da);const Yi={test(s){return typeof s=="string"&&s.startsWith("info face=")},parse(s){const t=s.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const u in t){const f=t[u].match(/^[a-z]+/gm)[0],d=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(const g in d){const m=d[g].split("="),y=m[0],x=m[1].replace(/"/gm,""),_=parseFloat(x),b=isNaN(_)?x:_;p[y]=b}e[f].push(p)}const i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[n]=e.info,[r]=e.common,[o]=e.distanceField??[];o&&(i.distanceField={range:parseInt(o.distanceRange,10),type:o.fieldType}),i.fontSize=parseInt(n.size,10),i.fontFamily=n.face,i.lineHeight=parseInt(r.lineHeight,10);const a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});const l={};i.baseLineOffset=i.lineHeight-parseInt(r.base,10);const h=e.char;for(let u=0;u<h.length;u++){const f=h[u],d=parseInt(f.id,10);let p=f.letter??f.char??String.fromCharCode(d);p==="space"&&(p=" "),l[d]=p,i.chars[p]={id:d,page:parseInt(f.page,10)||0,x:parseInt(f.x,10),y:parseInt(f.y,10),width:parseInt(f.width,10),height:parseInt(f.height,10),xOffset:parseInt(f.xoffset,10),yOffset:parseInt(f.yoffset,10),xAdvance:parseInt(f.xadvance,10),kerning:{}}}const c=e.kerning||[];for(let u=0;u<c.length;u++){const f=parseInt(c[u].first,10),d=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);i.chars[l[d]]&&(i.chars[l[d]].kerning[l[f]]=p)}return i}},Dr={test(s){const t=s;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(s){const t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=s.getElementsByTagName("info")[0],i=s.getElementsByTagName("common")[0],n=s.getElementsByTagName("distanceField")[0];n&&(t.distanceField={type:n.getAttribute("fieldType"),range:parseInt(n.getAttribute("distanceRange"),10)});const r=s.getElementsByTagName("page"),o=s.getElementsByTagName("char"),a=s.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let h=0;h<r.length;h++)t.pages.push({id:parseInt(r[h].getAttribute("id"),10)||0,file:r[h].getAttribute("file")});const l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let h=0;h<o.length;h++){const c=o[h],u=parseInt(c.getAttribute("id"),10);let f=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);f==="space"&&(f=" "),l[u]=f,t.chars[f]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<a.length;h++){const c=parseInt(a[h].getAttribute("first"),10),u=parseInt(a[h].getAttribute("second"),10),f=parseInt(a[h].getAttribute("amount"),10);t.chars[l[u]]&&(t.chars[l[u]].kerning[l[c]]=f)}return t}},Or={test(s){return typeof s=="string"&&s.match(/<font(\s|>)/)?Dr.test(K.get().parseXML(s)):!1},parse(s){return Dr.parse(K.get().parseXML(s))}},cu=[".xml",".fnt"],uu={extension:{type:G.CacheParser,name:"cacheBitmapFont"},test:s=>!!(s!=null&&s.pages)&&!!(s!=null&&s.chars)&&typeof(s==null?void 0:s.fontFamily)=="string"&&s.fontFamily!=="",getCacheableAssets(s,t){const e={};
23return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},du={extension:{type:G.LoadParser,priority:ue.Normal},name:"loadBitmapFont",id:"bitmap-font",test(s){return cu.includes(Et.extname(s).toLowerCase())},async testParse(s){return Yi.test(s)||Or.test(s)},async parse(s,t,e){const i=Yi.test(s)?Yi.parse(s):Or.parse(s),{src:n}=t,{pages:r}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let f=0;f<r.length;++f){const d=r[f].file;let p=Et.join(Et.dirname(n),d);p=dn(p,n),o.push({src:p,data:a})}const[l,{BitmapFont:h}]=await Promise.all([e.load(o),De(()=>import("./BitmapFontCVK7f5yV.js"),__vite__mapDeps([25,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))]),c=o.map(f=>l[f.src]);return new h({data:i,textures:c},n)},async load(s,t){return await(await K.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class fu{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&&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 i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}const pu={extension:{type:G.CacheParser,name:"cacheTextureArray"},test:s=>Array.isArray(s)&&s.every(t=>t instanceof et),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((n,r)=>{e[i+(r===0?"":r+1)]=n})}),e}};async function za(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const gu={extension:{type:G.DetectionParser,priority:1},test:async()=>za("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Nr=["png","jpg","jpeg"],mu={extension:{type:G.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Nr],remove:async s=>s.filter(t=>!Nr.includes(t))},yu="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function xi(s){return yu?!1:document.createElement("video").canPlayType(s)!==""}const xu={extension:{type:G.DetectionParser,priority:0},test:async()=>xi("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},_u={extension:{type:G.DetectionParser,priority:0},test:async()=>xi("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},bu={extension:{type:G.DetectionParser,priority:0},test:async()=>xi("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},wu={extension:{type:G.DetectionParser,priority:0},test:async()=>za("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")},Ha=class ei{constructor(){this.loadOptions={...ei.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let n=null,r=null;if((e.parser||e.loadParser)&&(r=this._parserHash[e.parser||e.loadParser],e.loadParser&&at(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),r||at(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!r){for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.load&&((o=h.test)!=null&&o.call(h,t,e,this))){r=h;break}}if(!r)return at(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}n=await r.load(t,e,this),i.parser=r;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];h.parse&&h.parse&&await((a=h.testParse)==null?void 0:a.call(h,n,e,this))&&(n=await h.parse(n,e,this)||n,i.parser=h)}return n})(),i}
23async load(t,e){this._parsersValidated||this._validateParsers();const i=typeof e=="function"?{...ei.defaultOptions,...this.loadOptions,onProgress:e}:{...ei.defaultOptions,...this.loadOptions,...e||{}},{onProgress:n,onError:r,strategy:o,retryCount:a,retryDelay:l}=i;let h=0;const c={},u=ri(t),f=Vt(t,g=>({alias:[g],src:g,data:{}})),d=f.reduce((g,m)=>g+(m.progressSize||1),0),p=f.map(async g=>{const m=Et.toAbsolute(g.src);c[g.src]||(await this._loadAssetWithRetry(m,g,{onProgress:n,onError:r,strategy:o,retryCount:a,retryDelay:l},c),h+=g.progressSize||1,n&&n(h/d))});return await Promise.all(p),u?c[f[0].src]:c}async unload(t){const i=Vt(t,n=>({alias:[n],src:n})).map(async n=>{var a,l;const r=Et.toAbsolute(n.src),o=this.promiseCache[r];if(o){const h=await o.promise;delete this.promiseCache[r],await((l=(a=o.parser)==null?void 0:a.unload)==null?void 0:l.call(a,h,n,this))}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?at("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&at(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,i,n){let r=0;const{onError:o,strategy:a,retryCount:l,retryDelay:h}=i,c=u=>new Promise(f=>setTimeout(f,u));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),n[e.src]=await this.promiseCache[t].promise;return}catch(u){delete this.promiseCache[t],delete n[e.src],r++;const f=a!=="retry"||r>l;if(a==="retry"&&!f){o&&o(u,e),await c(h);continue}if(a==="skip"){o&&o(u,e);return}o&&o(u,e);const d=new Error(`[Loader.load] Failed to load ${t}. 24${u}`);
vendor: 4,842 bytes, line 24
24throw u instanceof Error&&u.stack&&(d.stack=u.stack),d}}};Ha.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let vu=Ha;function Qe(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function Je(s,t){const e=s.split("?")[0],i=Et.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const Su=".json",Au="application/json",Cu={extension:{type:G.LoadParser,priority:ue.Low},name:"loadJson",id:"json",test(s){return Qe(s,Au)||Je(s,Su)},async load(s){return await(await K.get().fetch(s)).json()}},Mu=".txt",Tu="text/plain",ku={name:"loadTxt",id:"text",extension:{type:G.LoadParser,priority:ue.Low,name:"loadTxt"},test(s){return Qe(s,Tu)||Je(s,Mu)},async load(s){return await(await K.get().fetch(s)).text()}},Pu=["normal","bold","100","200","300","400","500","600","700","800","900"],Iu=[".ttf",".otf",".woff",".woff2"],Ru=["font/ttf","font/otf","font/woff","font/woff2"],Eu=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Lu(s){const t=Et.extname(s),n=Et.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1));let r=n.length>0;for(const a of n)if(!a.match(Eu)){r=!1;break}let o=n.join(" ");return r||(o=`"${o.replace(/[\\"]/g,"\\$&")}"`),o}const Fu=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Bu(s){return Fu.test(s)?s:encodeURI(s)}const Gu={extension:{type:G.LoadParser,priority:ue.Low},name:"loadWebFont",id:"web-font",test(s){return Qe(s,Ru)||Je(s,Iu)},async load(s,t){var i,n,r;const e=K.get().getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Lu(s),l=((r=(n=t.data)==null?void 0:n.weights)==null?void 0:r.filter(c=>Pu.includes(c)))??["normal"],h=t.data??{};for(let c=0;c<l.length;c++){const u=l[c],f=new FontFace(a,`url('${Bu(s)}')`,{...h,weight:u});await f.load(),e.add(f),o.push(f)}return vt.has(`${a}-and-url`)?vt.get(`${a}-and-url`).entries.push({url:s,faces:o}):vt.set(`${a}-and-url`,{entries:[{url:s,faces:o}]}),o.length===1?o[0]:o}return at("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){const t=Array.isArray(s)?s:[s],e=t[0].family,i=vt.get(`${e}-and-url`),n=i.entries.find(r=>r.faces.some(o=>t.indexOf(o)!==-1));n.faces=n.faces.filter(r=>t.indexOf(r)===-1),n.faces.length===0&&(i.entries=i.entries.filter(r=>r!==n)),t.forEach(r=>{K.get().getFontFaceSet().delete(r)}),i.entries.length===0&&vt.remove(`${e}-and-url`)}},Xi={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Du=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Ou=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function Nu(s){const t=[];return s.replace(Du,(e,i,n)=>{let r=i.toLowerCase(),o=i;const a=Uu(n);for(r==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),r="l",o=o==="m"?"l":"L");;){if(a.length===Xi[r])return t.push([o,...a]),"";if(a.length<Xi[r])throw new Error("malformed path data");t.push([o,...a.splice(0,Xi[r])])}}),t}function Uu(s){const t=s.match(Ou);return t?t.map(Number):[]}function Wu(s,t){const e=Nu(s),i=[];let n=null,r=0,o=0;for(let a=0;a<e.length;a++){const l=e[a],h=l[0],c=l;switch(h){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(),i.length>0&&(n=i.pop(),n?(r=n.startX,o=n.startY):(r=0,o=0)),n=null;break;default:at(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:r,startY:o},i.push(n))}return t}class Oe{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Oe(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-t,r=this.y-e;return n*=n,r*=r,n+r<=i}strokeContains(t,e,i,n=.5){if(this.radius===0)return!1;const r=this.x-t,o=this.y-e,a=this.radius,l=(1-n)*i,h=Math.sqrt(r*r+o*o);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new gt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.he
vendor: 5,164 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 $n{constructor(t=0,e=0,i=0,n=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=n}clone(){return new $n(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,n=(e-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(t,e,i,n=.5){const{halfWidth:r,halfHeight:o}=this;if(r<=0||o<=0)return!1;const a=i*(1-n),l=i-a,h=r-l,c=o-l,u=r+a,f=o+a,d=t-this.x,p=e-this.y,g=d*d/(h*h)+p*p/(c*c),m=d*d/(u*u)+p*p/(f*f);return g>1&&m<=1}getBounds(t){return t||(t=new gt),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 zu(s,t,e,i,n,r){const o=s-e,a=t-i,l=n-e,h=r-i,c=o*l+a*h,u=l*l+h*h;let f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=i):f>1?(d=n,p=r):(d=e+f*l,p=i+f*h);const g=s-d,m=t-p;return g*g+m*m}let Hu,Vu;class _s{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let n=0,r=e.length;n<r;n++)i.push(e[n].x,e[n].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let n=0;n<i;n+=2){const r=e[n],o=e[n+1],a=e[(n+2)%i],l=e[(n+3)%i];t+=(a-r)*(l+o)}return t<0}containsPolygon(t){const e=this.getBounds(Hu),i=t.getBounds(Vu);if(!e.containsRect(i))return!1;const n=t.points;for(let r=0;r<n.length;r+=2){const o=n[r],a=n[r+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new _s(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const n=this.points.length/2;for(let r=0,o=n-1;r<n;o=r++){const a=this.points[r*2],l=this.points[r*2+1],h=this.points[o*2],c=this.points[o*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,n=.5){const r=i*i,o=r*(1-n),a=r-o,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){const u=l[c],f=l[c+1],d=l[(c+2)%l.length],p=l[(c+3)%l.length],g=zu(t,e,u,f,d,p),m=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(g<=(m<0?a:o))return!0}return!1}getBounds(t){t||(t=new gt);const e=this.points;let i=1/0,n=-1/0,r=1/0,o=-1/0;for(let a=0,l=e.length;a<l;a+=2){const h=e[a],c=e[a+1];i=h<i?h:i,n=h>n?h:n,r=c<r?c:r,o=c>o?c:o}return t.x=i,t.width=n-i,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 q("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return q("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 Hs=(s,t,e,i,n,r,o)=>{const a=s-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=n-r&&h<=n+o};class Yn{constructor(t=0,e=0,i=0,n=0,r=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=n,this.radius=r}getBounds(t){return t||(t=new gt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Yn(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let n=t-(this.x+i),r=e-(this.y+i);const o=i*i;if(n*n+r*r<=o||(n=t-(this.x+this.width-i),n*n+r*r<=o)||(r=e-(this.y+this.height-i),n*n+r*r<=o)||(n=t-(this.x+i),n*n+r*r<=o))return!0}return!1}strokeContains(t,e,i,n=.5){const{x:r,y:o,width:a,height:l,radius:h}=this,c=i*(1-n),u=i-c,f=r+h,d=o+h,p=a-h*2,g=l-h*2,m=r+a,y=o+l;return(t>=r-c&&t<=r+u||t>=m-u&&t<=m+c)&&e>=d&&e<=d+g||(e>=o-c&&e<=o+u||e>=y-u&&e<=y+c)&&t>=f&&t<=f+p?!0:t<f&&e<d&&Hs(t,e,f,d,h,u,c)||t>m-h&&e<d&&Hs(t,e,m-h,d,h,u,c)||t>m-h&&e>y-h&&Hs(t,e,m-h,y-h,h,u,c)||t<f&&e>y-h&&Hs(t,e,f,y-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const Va={};function $u(s,t,e){let i=2166136261;for(let n=0;n<t;n++)i^=s[n].uid,i=Math.imul(i,16777619),i>>>=0;return Va[i]||Yu(s,t,i,e)}function Yu(s,t,e,i){const n={};let r=0;for(let a=0;a<i;a++){const l=a<t?s[a]:et.EMPTY.source;n[r++]=l.source,n[r++]=l.style}const o=new ti(n);return Va[e]=o,o}
24class Ur{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 Wr(s,t,e,i){if(e??(e=0),i??(i=Math.min(s.byteLength-e,t.byteLength)),!(e&7)&&!(i&7)){const n=i/8;new Float64Array(t,0,n).set(new Float64Array(s,e,n))}else if(!(e&3)&&!(i&3)){const n=i/4;new Float32Array(t,0,n).set(new Float32Array(s,e,n))}else new Uint8Array(t).set(new Uint8Array(s,e,i))}const Xu={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var ju=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",s[s.NONE=5]="NONE",s))(ju||{});function zr(s,t){return t.alphaMode==="no-premultiply-alpha"&&Xu[s]||s}const qu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` 25`);function Ku(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=` 26else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function Zu(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=qu.replace(/%forloop%/gi,Ku(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}}finally{t.deleteShader(e)}return s}let Pe=null;function Qu(){var t;if(Pe)return Pe;const s=ba();
26return Pe=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),Pe=Zu(Pe,s),(t=s.getExtension("WEBGL_lose_context"))==null||t.loseContext(),Pe}class Ju{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 td{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ju,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 bs=[];let oi=0;Ps.register({clear:()=>{if(bs.length>0)for(const s of bs)s&&s.destroy();bs.length=0,oi=0}});function Hr(){return oi>0?bs[--oi]:new td}function Vr(s){s.elements=null,bs[oi++]=s}let hs=0;const $a=class Ya{constructor(t){this.uid=pt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...Ya.defaultOptions,...t},t.maxTextures||(q("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Qu());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:n}=t;this.attributeBuffer=new Ur(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Vr(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 i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;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 i=Hr(),n=i.textures;n.clear();const r=e[this.elementStart];let o=zr(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 l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",p=[];const g=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const y=e[m];e[m]=null;const _=y.texture._source,b=zr(y.blendMode,_),S=o!==b||a!==y.topology;if(_._batchTick===hs&&!S){y._textureId=_._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,h,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,h,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=i,p.push(y);continue}_._batchTick=hs,(n.count>=g||S)&&(this._finishBatch(i,f,u-f,n,o,a,t,d,p),d="renderBatch",f=u,o=b,a=y.topology,i=Hr(),n=i.textures,n.clear(),p=[],++hs),y._textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,y._batch=i,p.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,h,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,h,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,f,u-f,n,o,a,t,d,p),f=u,++hs),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,i,n,r,o,a,l,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=n,t.blendMode=r,t.topology=o,t.start=e,t.size=i,t.elements=h,++hs,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),i=new Ur(e);Wr(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let r=0;r<e.length;r++)n[r]=e[r];else Wr(e.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,n){const r=t.indices,o=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<o;h++)e[i++]=n+r[h+a]-l}destroy(t={}){var e;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)Vr(this.batches[i]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((e=this.shader)==null||e.destroy(),this.shader=null);for(let i=0;i<this._elements.length;i++)this._elements[i]&&(this._elements[i]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};$a.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let ed=$a;var Pt=(s=>(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(Pt||{});class Ms extends Kt{constructor(t){let{data:e,size:i}=t;const{usage:n,label:r,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=pt("buffer"),this._resourceType="buffer",this._resourceId=pt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e==null?void 0:e.byteLength);const a=!!e;this.descriptor={size:i,usage:n,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&Pt.STATIC)}set static(t){t?this.descriptor.usage|=Pt.STATIC:this.descriptor.usage&=~Pt.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit
26("update",this);return}const n=this._data;if(this._data=t,this._dataInt32=null,!n||n.length!==t.length){!this.shrinkToFit&&n&&t.byteLength<n.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=pt("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||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 Xa(s,t){if(!(s instanceof Ms)){let e=t?Pt.INDEX:Pt.VERTEX;s instanceof Array&&(t?(s=new Uint32Array(s),e=Pt.INDEX|Pt.COPY_DST):(s=new Float32Array(s),e=Pt.VERTEX|Pt.COPY_DST)),s=new Ms({data:s,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return s}function sd(s,t,e){const i=s.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const n=i.buffer.data;let r=1/0,o=1/0,a=-1/0,l=-1/0;const h=n.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let f=c;f<n.length;f+=u){const d=n[f],p=n[f+1];d>a&&(a=d),p>l&&(l=p),d<r&&(r=d),p<o&&(o=p)}return e.minX=r,e.minY=o,e.maxX=a,e.maxY=l,e}function id(s){return(s instanceof Ms||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=Xa(s.buffer,!1),s}class nd extends Kt{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=pt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Dt,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:n}=t;if(this.buffers=[],this.attributes={},e)for(const r in e)this.addAttribute(r,e[r]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=n||"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 i=id(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Xa(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,sd(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(i=>i.destroy()),this.unload(),(e=this.indexBuffer)==null||e.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const rd=new Float32Array(1),od=new Uint32Array(1);class ad extends nd{constructor(){const e=new Ms({data:rd,label:"attribute-batch-buffer",usage:Pt.VERTEX|Pt.COPY_DST,shrinkToFit:!1}),i=new Ms({data:od,label:"index-batch-buffer",usage:Pt.INDEX|Pt.COPY_DST,shrinkToFit:!1}),n=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:n,offset:0},aUV:{buffer:e,format:"float32x2",stride:n,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:n,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:n,offset:5*4}},indexBuffer:i})}}function $r(s,t,e){if(s)for(const i in s){const n=i.toLocaleLowerCase(),r=t[n];if(r){let o=s[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&r.push(`//----${e}----//`),r.push(o)}else at(`${i} placement hook does not exist in shader`)}}const ld=/\{\{(.*?)\}\}/g;function Yr(s){var i;const t={};return(((i=s.match(ld))==null?void 0:i.map(n=>n.replace(/[{()}]/g,"")))??[]).forEach(n=>{t[n]=[]}),t}function Xr(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function jr(s,t,e=!1){const i=[];
vendor: 6,886 bytes, lines 26-210
26Xr(t,i),s.forEach(a=>{a.header&&Xr(a.header,i)});const n=i;e&&n.sort();const r=n.map((a,l)=>` @location(${l}) ${a},`).join(` 27`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",` 28${r} 29`),o}function qr(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function hd(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function cd(s){const t=/@.*?\s+/g;return s.replace(t,"")}function ud(s,t){const e=[];qr(t,e),s.forEach(l=>{l.header&&qr(l.header,e)});let i=0;const n=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, 30`),r=e.sort().map(l=>` var ${cd(l)};`).join(` 31`),o=`return VSOutput( 32 ${e.sort().map(l=>` ${hd(l)}`).join(`, 33`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` 34${n} 35`),a=a.replace("{{start}}",` 36${r} 37`),a=a.replace("{{return}}",` 38${o} 39`),a}function Kr(s,t){let e=s;for(const i in t){const n=t[i];n.join(` 40`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// 41${n.join(` 42`)} 43//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const he=Object.create(null),ji=new Map;let dd=0;function fd({template:s,bits:t}){const e=ja(s,t);if(he[e])return he[e];const{vertex:i,fragment:n}=gd(s,t);return he[e]=qa(i,n,t),he[e]}function pd({template:s,bits:t}){const e=ja(s,t);return he[e]||(he[e]=qa(s.vertex,s.fragment,t)),he[e]}function gd(s,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let n=jr(e,s.vertex,!0);n=ud(e,n);const r=jr(i,s.fragment,!0);return{vertex:n,fragment:r}}function ja(s,t){return t.map(e=>(ji.has(e)||ji.set(e,dd++),ji.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function qa(s,t,e){const i=Yr(s),n=Yr(t);return e.forEach(r=>{$r(r.vertex,i,r.name),$r(r.fragment,n,r.name)}),{vertex:Kr(s,i),fragment:Kr(t,n)}}const md=` 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`,yd=` 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`,xd=` 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)).xy, 0.0, 1.0); 141 142 vColor *= uWorldColorAlpha; 143 144 {{end}} 145 } 146`,_d=` 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`,bd={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 `}},wd={name:"global-uniforms-bit",vertex:{header:` 177 uniform mat3 uProjectionMatrix; 178 uniform mat3 uWorldTransformMatrix; 179 uniform vec4 uWorldColorAlpha; 180 uniform vec2 uResolution; 181 `}};function vd({bits:s,name:t}){const e=fd({template:{fragment:yd,vertex:md},bits:[bd,...s]});return Ze.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Sd({bits:s,name:t}){return new mi({name:t,...pd({template:{vertex:xd,fragment:_d},bits:[wd,...s]})})}const Ad={name:"color-bit",vertex:{header:` 182 @in aColor: vec4<f32>; 183 `,main:` 184 vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a); 185 `}},Cd={name:"color-bit",vertex:{header:` 186 in vec4 aColor; 187 `,main:` 188 vColor *= vec4(aColor.rgb * aColor.a, aColor.a); 189 `}},qi={};function Md(s){const t=[];if(s===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<s;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` 190`)}function Td(s){const t=[];if(s===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<s;e++)e===s-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 kd(s){return qi[s]||(qi[s]={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 ${Md(s)} 205 `,main:` 206 var uvDx = dpdx(vUV); 207 var uvDy = dpdy(vUV); 208 209 ${Td(s)} 210 `}}),qi[s]}const Ki={};function Pd(s){const t=[];for(let e=0;e<s;e++)e>0&&t.push("else"),e<s-1&&t.push(`if(vTextureId < ${e}
210.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(` 211`)}function Id(s){return Ki[s]||(Ki[s]={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[${s}]; 226 227 `,main:` 228 229 ${Pd(s)} 230 `}}),Ki[s]}const Rd={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 `}},Ed={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 `}},Zr={};function Ld(s){let t=Zr[s];if(t)return t;const e=new Int32Array(s);for(let i=0;i<s;i++)e[i]=i;return t=Zr[s]=new Ca({uTextures:{value:e,type:"i32",size:s}},{isStatic:!0}),t}class Qr extends yi{constructor(t){const e=Sd({name:"batch",bits:[Cd,Id(t),Ed]}),i=vd({name:"batch",bits:[Ad,kd(t),Rd]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Ld(t)}}),this.maxTextures=t}}let cs=null;const Ka=class Za extends ed{constructor(t){super(t),this.geometry=new ad,this.name=Za.extension.name,this.vertexSize=6,cs??(cs=new Qr(t.maxTextures)),this.shader=cs}packAttributes(t,e,i,n,r){const o=r<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,{positions:p,uvs:g}=t,m=t.color,y=t.attributeOffset,x=y+t.attributeSize;for(let _=y;_<x;_++){const b=_*2,S=p[b],w=p[b+1];e[n++]=l*S+c*w+f,e[n++]=u*w+h*S+d,e[n++]=g[b],e[n++]=g[b+1],i[n++]=m,i[n++]=o}}packQuadAttributes(t,e,i,n,r){const o=t.texture,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,p=t.bounds,g=p.maxX,m=p.minX,y=p.maxY,x=p.minY,_=o.uvs,b=t.color,S=r<<16|t.roundPixels&65535;e[n+0]=l*m+c*x+f,e[n+1]=u*x+h*m+d,e[n+2]=_.x0,e[n+3]=_.y0,i[n+4]=b,i[n+5]=S,e[n+6]=l*g+c*x+f,e[n+7]=u*x+h*g+d,e[n+8]=_.x1,e[n+9]=_.y1,i[n+10]=b,i[n+11]=S,e[n+12]=l*g+c*y+f,e[n+13]=u*y+h*g+d,e[n+14]=_.x2,e[n+15]=_.y2,i[n+16]=b,i[n+17]=S,e[n+18]=l*m+c*y+f,e[n+19]=u*y+h*m+d,e[n+20]=_.x3,e[n+21]=_.y3,i[n+22]=b,i[n+23]=S}_updateMaxTextures(t){this.shader.maxTextures!==t&&(cs=new Qr(t),this.shader=cs)}destroy(){this.shader=null,super.destroy()}};Ka.extension={type:[G.Batcher],name:"default"};let Fd=Ka;class Is{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:n,priority:r,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,r??0),this._onUnload=n,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){var n;if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&((n=this._onUnload)==null||n.call(this,t,...e),i.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 Bd(s,t,e,i,n,r,o,a=null){let l=0;e*=t,n*=r;const h=a.a,c=a.b,u=a.c,f=a.d,d=a.tx,p=a.ty;for(;l<o;){const g=s[e],m=s[e+1];i[n]=h*g+u*m+d,i[n+1]=c*g+f*m+p,n+=r,e+=t,l++}}function Gd(s,t,e,i){let n=0;for(t*=e;n<i;)s[t]=0,s[t+1]=0,t+=e,n++}function Qa(s,t,e,i,n){const r=t.a,o=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),n||(n=s.length/i-e);let u=e*i;for(let f=0;f<n;f++){const d=s[u],p=s[u+1];s[u]=r*d+a*p+h,s[u+1]=o*d+l*p+c,u+=i}}const Dd=new j;class Xn{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,i=this.renderable;return i?sa(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||Dd}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 Ts={extension:{type:G.ShapeBuilder,name:"circle"},build(s,t){let e,i,n,r,o,a;if(s.type==="circle"){const b=s;if(o=a=b.radius,o<=0)return!1;e=b.x,i=b.y,n=r=0}else if(s.type==="ellipse"){const b=s;if(o=b.halfWidth,a=b.halfHeight,o<=0||a<=0)return!1;e=b.x,i=b.y,n=r=0}else{const b=s,S=b.width/2,w=b.height/2;e=b.x+S,i=b.y+w,o=a=Math.max(0,Math.min(b.radius,Math.min(S,w))),n=S-o,r=w-a}if(n<0||r<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(n?4:0)+(r?4:0);if(h===0)return!1;if(l===0)return t[0]=t[6]=e+n,t[1]=t[3]=i+r,t[2]=t[4]=e-n,t[5]=t[7]=i-r,!0;let c=0,u=l*4+(n?2:0)+2,f=u,d=h,p=n+o,g=r,m=e+p,y=e-p,x=i+g;if(t[c++]=m,t[c++]=x,t[--u]=x,t[--u]=y,r){const b=i-g;t[f++]=y,t[f++]=b,t[--d]=b,t[--d]=m}for(let b=1;b<l;b++){const S=Math.PI/2*(b/l),w=n+Math.cos(S)*o,v=r+Math.sin(S)*a,L=e+w,R=e-w,C=i+v,k=i-v;t[c++]=L,t[c++]=C,t[--u]=C,t[--u]=R,t[f++]=R,t[f++]=k,t[--d]=k,t[--d]=L}p=n,g=r+a,m=e+p,y=e-p,x=i+g;const _=i-g;return t[c++]=m,t[c++]=x,t[--d]=_,t[--d]=m,n&&(t[c++]=y,t[c++]=x,t[--d]=_,t[--d]=y),!0},triangulate(s,t,e,i,n,r){if(s.length===0)return;let o=0,a=0;for(let c=0;c<s.length;c+=2)o+=s[c],a+=s[c+1];o/=s.length/2,a/=s.length/2;let l=i;t[l*e]=o,t[l*e+1]=a;const h=l++;for(let c=0;c<s.length;c+=2)t[l*e]=s[c],t[l*e+1]=s[c+1],c>0&&(n[r++]=l,n[r++]=h,n[r++]=l-1),l++;n[r++]=h+1,n[r++]=h,n[r++]=l-1}},Od={...Ts,extension:{...Ts.extension,name:"ellipse"}},Nd={...Ts,extension:{...Ts.extension,name:"roundedRectangle"}},Ja=1e-4,Jr=1e-4;function Ud(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,n=s[t-2],r=s[t-1];i<t;i+=2){const o=s[i],a=s[i+1];e+=(o-n)*(a+r),n=o,r=a}return e<0?-1:1}function to(s,t,e,i,n,r,o,a){const l=s-e*n,h=t-i*n,c=s+e*r,u=t+i*r;let f,d;o?(f=i,d=-e):(f=-i,d=e);const p=l+f,g=h+d,m=c+f,y=u+d;return a.push(p,g),a.push(m,y),2}function pe(s,t,e,i,n,r,o,a){const l=e-s,h=i-t;
vendor: 5,134 bytes, line 240
240let c=Math.atan2(l,h),u=Math.atan2(n-s,r-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,p=Math.abs(d),g=Math.sqrt(l*l+h*h),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,y=d/m;if(f+=y,a){o.push(s,t),o.push(e,i);for(let x=1,_=f;x<m;x++,_+=y)o.push(s,t),o.push(s+Math.sin(_)*g,t+Math.cos(_)*g);o.push(s,t),o.push(n,r)}else{o.push(e,i),o.push(s,t);for(let x=1,_=f;x<m;x++,_+=y)o.push(s+Math.sin(_)*g,t+Math.cos(_)*g),o.push(s,t);o.push(n,r),o.push(s,t)}return m*2}function Wd(s,t,e,i,n,r){const o=Ja;if(s.length===0)return;const a=t;let l=a.alignment;if(t.alignment!==.5){let D=Ud(s);l=(l-.5)*D+.5}const h=new Mt(s[0],s[1]),c=new Mt(s[s.length-2],s[s.length-1]),u=i,f=Math.abs(h.x-c.x)<o&&Math.abs(h.y-c.y)<o;if(u){s=s.slice(),f&&(s.pop(),s.pop(),c.set(s[s.length-2],s[s.length-1]));const D=(h.x+c.x)*.5,Y=(c.y+h.y)*.5;s.unshift(D,Y),s.push(D,Y)}const d=n,p=s.length/2;let g=s.length;const m=d.length/2,y=a.width/2,x=y*y,_=a.miterLimit*a.miterLimit;let b=s[0],S=s[1],w=s[2],v=s[3],L=0,R=0,C=-(S-v),k=b-w,E=0,A=0,P=Math.sqrt(C*C+k*k);C/=P,k/=P,C*=y,k*=y;const z=l,M=(1-z)*2,F=z*2;u||(a.cap==="round"?g+=pe(b-C*(M-F)*.5,S-k*(M-F)*.5,b-C*M,S-k*M,b+C*F,S+k*F,d,!0)+2:a.cap==="square"&&(g+=to(b,S,C,k,M,F,!0,d))),d.push(b-C*M,S-k*M),d.push(b+C*F,S+k*F);for(let D=1;D<p-1;++D){b=s[(D-1)*2],S=s[(D-1)*2+1],w=s[D*2],v=s[D*2+1],L=s[(D+1)*2],R=s[(D+1)*2+1],C=-(S-v),k=b-w,P=Math.sqrt(C*C+k*k),C/=P,k/=P,C*=y,k*=y,E=-(v-R),A=w-L,P=Math.sqrt(E*E+A*A),E/=P,A/=P,E*=y,A*=y;const Y=w-b,tt=S-v,U=w-L,ht=R-v,mt=Y*U+tt*ht,W=tt*U-ht*Y,nt=W<0;if(Math.abs(W)<.001*Math.abs(mt)){d.push(w-C*M,v-k*M),d.push(w+C*F,v+k*F),mt>=0&&(a.join==="round"?g+=pe(w,v,w-C*M,v-k*M,w-E*M,v-A*M,d,!1)+4:g+=2,d.push(w-E*F,v-A*F),d.push(w+E*M,v+A*M));continue}const Nt=(-C+b)*(-k+v)-(-C+w)*(-k+S),Zt=(-E+L)*(-A+v)-(-E+w)*(-A+R),yt=(Y*Zt-U*Nt)/W,Me=(ht*Nt-tt*Zt)/W,Te=(yt-w)*(yt-w)+(Me-v)*(Me-v),Qt=w+(yt-w)*M,Ut=v+(Me-v)*M,Jt=w-(yt-w)*F,Yt=v-(Me-v)*F,vi=Math.min(Y*Y+tt*tt,U*U+ht*ht),Rs=nt?M:F,Si=vi+Rs*Rs*x;Te<=Si?a.join==="bevel"||Te/x>_?(nt?(d.push(Qt,Ut),d.push(w+C*F,v+k*F),d.push(Qt,Ut),d.push(w+E*F,v+A*F)):(d.push(w-C*M,v-k*M),d.push(Jt,Yt),d.push(w-E*M,v-A*M),d.push(Jt,Yt)),g+=2):a.join==="round"?nt?(d.push(Qt,Ut),d.push(w+C*F,v+k*F),g+=pe(w,v,w+C*F,v+k*F,w+E*F,v+A*F,d,!0)+4,d.push(Qt,Ut),d.push(w+E*F,v+A*F)):(d.push(w-C*M,v-k*M),d.push(Jt,Yt),g+=pe(w,v,w-C*M,v-k*M,w-E*M,v-A*M,d,!1)+4,d.push(w-E*M,v-A*M),d.push(Jt,Yt)):(d.push(Qt,Ut),d.push(Jt,Yt)):(d.push(w-C*M,v-k*M),d.push(w+C*F,v+k*F),a.join==="round"?nt?g+=pe(w,v,w+C*F,v+k*F,w+E*F,v+A*F,d,!0)+2:g+=pe(w,v,w-C*M,v-k*M,w-E*M,v-A*M,d,!1)+2:a.join==="miter"&&Te/x<=_&&(nt?(d.push(Jt,Yt),d.push(Jt,Yt)):(d.push(Qt,Ut),d.push(Qt,Ut)),g+=2),d.push(w-E*M,v-A*M),d.push(w+E*F,v+A*F),g+=2)}b=s[(p-2)*2],S=s[(p-2)*2+1],w=s[(p-1)*2],v=s[(p-1)*2+1],C=-(S-v),k=b-w,P=Math.sqrt(C*C+k*k),C/=P,k/=P,C*=y,k*=y,d.push(w-C*M,v-k*M),d.push(w+C*F,v+k*F),u||(a.cap==="round"?g+=pe(w-C*(M-F)*.5,v-k*(M-F)*.5,w-C*M,v-k*M,w+C*F,v+k*F,d,!1)+2:a.cap==="square"&&(g+=to(w,v,C,k,M,F,!1,d)));const J=Jr*Jr;for(let D=m;D<g+m-2;++D)b=d[D*2],S=d[D*2+1],w=d[(D+1)*2],v=d[(D+1)*2+1],L=d[(D+2)*2],R=d[(D+2)*2+1],!(Math.abs(b*(v-R)+w*(R-S)+L*(S-v))<J)&&r.push(D,D+1,D+2)}function zd(s,t,e,i){const n=Ja;if(s.length===0)return;const r=s[0],o=s[1],a=s[s.length-2],l=s[s.length-1],h=t||Math.abs(r-a)<n&&Math.abs(o-l)<n,c=e,u=s.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(s[d*2]),c.push(s[d*2+1]);for(let d=0;d<u-1;d++)i.push(f+d,f+d+1);h&&i.push(f+u-1,f)}function tl(s,t,e,i,n,r,o){const a=iu(s,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)r[o++]=a[h]+n,r[o++]=a[h+1]+n,r[o++]=a[h+2]+n;let l=n*i;for(let h=0;h<s.length;h+=2)e[l]=s[h],e[l+1]=s[h+1],l+=i}const Hd=[],Vd={extension:{type:G.ShapeBuilder,name:"polygon"},build(s,t){for(let e=0;e<s.points.length;e++)t[e]=s.points[e];return!0},triangulate(s,t,e,i,n,r){tl(s,Hd,t,e,i,n,r)}},$d={extension:{type:G.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,i=e.x,n=e.y,r=e.width,o=e.height;return r>0&&o>0?(t[0]=i,t[1]=n,t[2]=i+r,t[3]=n,t[4]=i+r,t[5]=n+o,t[6]=i,t[7]=n+o,!0):!1},triangulate(s,t,e,i,n,r){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[6],t[i+o+1]=s[7],o+=e,t[i+o]=s[4],t[i+o+1]=s[5],o+=e;const a=i/e;n[r++]=a,n[r++]=a+1,n[r++]=a+2,n[r++]=a+1,n[r++]=a+3,n[r++]=a+2}},Yd={extension:{type:G.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,i,n,r){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[4],t[i+o+1]=s[5];const a=i/e;n[r++]=a,n[r++]=a+1,n[r++]=a+2}},eo=[{offset:0,color:"white"},{offset:1,color:"black"}],jn=class wn{constructor(...t){this.uid=pt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=Xd(t);e={...e.type==="radial"?wn.defaultRadialOptions:wn.defaultLinearOptions,...$o(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(n=>{this.addColorStop(n.offset,n.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:lt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:n}=this.end,r=i-t,o=n-e;const a=r<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(r<0){const m=t;t=i,i=m,r*=-1}if(o<0){const m=e;e=n,n=m,o*=-1}}const l=this.colorStops.length?this.colorStops:eo,h=this._textureSize,{canvas:c,context:u}=io(h,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);so(f,l),u.fillStyle=f,u.fillRect(0,0,h,1),this.texture=new et({source:new Ye({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(r*r+o*o),p=Math.atan2(o,r),g=new j;g.scale(d/h,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(h,h),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:eo,e=this._textureSize,{canvas:i,context:n}=io(e,e),{x:r,y:o}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,f=l-c,d=e/(c*2),p=(r-u)*d,g=(o-f)*d,m=n.createRadialGradient(p,g,h*d,(a-u)*d,(l-f)*d,c*d);so(m,t),n.fillStyle=t[t.length-1].color,n.fillRect(0,0,e,e),n.fillStyle=m,n.translate(p,g),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-p,-g),n.fillRect(0,0,e,e),this.texture=new et({source:new Ye({resource:i,addressMode:this._wrapMode})});const y=new j;this.textureSpace==="local"?y.scale(2*c,2*c):y.scale(1/d,1/d),y.translate(u,f),this.transform=y}destroy(){var t;(t=this.texture)==null||t.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}`}};jn.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};jn.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 oe=jn;function so(s,t){for(let e=0;e<t.length;e++){const i=t[e];s.addColorStop(i.offset,i.color)}}function io(s,t){const e=K.get().createCanvas(s,t),i=e.getContext("2d");return{canvas:e,context:i}}function Xd(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(q("8.5.2","use options object instead"),t={type:"linear",start:{x:s[0],y:s[1]},end:{x:s[2],y:s[3]},textureSpace:s[4],textureSize:s[5]??oe.defaultLinearOptions.textureSize}),t}const jd=new j,qd=new gt;function Kd(s,t,e,i){const n=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(qd);t.width&&o.pad(t.width);const{x:a,y:l}=o,h=1/o.width,c=1/o.height,u=-a*h,f=-l*c,d=n.a,p=n.b,g=n.c,m=n.d;n.a*=h,n.b*=h,n.c*=c,n.d*=c,n.tx=u*d+f*g+n.tx,n.ty=u*p+f*m+n.ty}else n.translate(t.texture.frame.x,t.texture.frame.y),n.scale(1/t.texture.source.width,1/t.texture.source.height);const r=t.texture.source.style;return!(t.fill instanceof oe)&&r.addressMode==="clamp-to-edge"&&(r.addressMode="repeat",r.update()),i&&n.append(jd.copyFrom(i).invert()),n}const _i={};it.handleByMap(G.ShapeBuilder,_i);it.add($d,Vd,Yd,Ts,Od,Nd);const Zd=new gt,Qd=new j;function Jd(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let n=0;n<s.instructions.length;n++){const r=s.instructions[n];if(r.action==="texture")tf(r.data,i,e);else if(r.action==="fill"||r.action==="stroke"){const o=r.action==="stroke",a=r.data.path.shapePath,l=r.data.style,h=r.data.hole;o&&h&&no(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),no(a,l,o,i,e)}}}function tf(s,t,e){const i=[],n=_i.rectangle,r=Zd;r.x=s.dx,r.y=s.dy,r.width=s.dw,r.height=s.dh;const o=s.transform;if(!n.build(r,i))return;const{vertices:a,uvs:l,indices:h}=e,c=h.length,u=a.length/2;o&&Qa(i,o),n.triangulate(i,a,2,u,h,c);const f=s.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const p=It.get(Xn);p.indexOffset=c,p.indexSize=h.length-c,p.attributeOffset=u,p.attributeSize=a.length/2-u,p.baseColor=s.style,p.alpha=s.alpha,p.texture=f,p.geometryData=e,t.push(p)}function no(s,t,e,i,n){const{vertices:r,uvs:o,indices:a}=n;
240s.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{const u=[],f=_i[l.type];if(!f.build(l,u))return;const d=a.length,p=r.length/2;let g="triangle-list";if(h&&Qa(u,h),e){const _=l.closePath??!0,b=t;b.pixelLine?(zd(u,_,r,a),g="line-list"):Wd(u,b,!1,_,r,a)}else if(c){const _=[],b=u.slice();ef(c).forEach(w=>{_.push(b.length/2),b.push(...w)}),tl(b,_,r,2,p,a,d)}else f.triangulate(u,r,2,p,a,d);const m=o.length/2,y=t.texture;if(y!==et.WHITE){const _=Kd(Qd,t,l,h);Bd(r,2,p,o,m,2,r.length/2-p,_)}else Gd(o,m,2,r.length/2-p);const x=It.get(Xn);x.indexOffset=d,x.indexSize=a.length-d,x.attributeOffset=p,x.attributeSize=r.length/2-p,x.baseColor=t.color,x.alpha=t.alpha,x.texture=y,x.geometryData=n,x.topology=g,i.push(x)})}function ef(s){const t=[];for(let e=0;e<s.length;e++){const i=s[e].shape,n=[];_i[i.type].build(i,n)&&t.push(n)}return t}class sf{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{It.return(t)}),this.graphicsData&&It.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 nf{constructor(){this.instructions=new Wn}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Fd({maxTextures:e}),this.instructions.reset()}get geometry(){return q(Mh,"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 qn=class vn{constructor(t){this._renderer=t,this._managedContexts=new Is({renderer:t,type:"resource",name:"graphicsContext"})}init(t){vn.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??vn.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),Jd(t,i);const n=t.batchMode;t.customShader||n==="no-batch"?i.isBatchable=!1:n==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=It.get(nf,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:n,geometryData:r}=i;i.graphicsData=e;const o=r.vertices.length,a=r.indices.length;for(let u=0;u<n.length;u++)n[u].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let u=0;u<n.length;u++){const f=n[u];l.add(f)}l.finish(e.instructions);const h=l.geometry;h.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),h.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const c=l.batches;for(let u=0;u<c.length;u++){const f=c[u];f.bindGroup=$u(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new sf;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};qn.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"graphicsContext"};qn.defaultOptions={bezierSmoothness:.5};let Kn=qn;const rf=8,Vs=11920929e-14,of=1;function el(s,t,e,i,n,r,o,a,l,h){const u=Math.min(.99,Math.max(0,h??Kn.defaultOptions.bezierSmoothness));let f=(of-u)/1;return f*=f,af(t,e,i,n,r,o,a,l,s,f),s}function af(s,t,e,i,n,r,o,a,l,h){Sn(s,t,e,i,n,r,o,a,l,h,0),l.push(o,a)}function Sn(s,t,e,i,n,r,o,a,l,h,c){if(c>rf)return;const u=(s+e)/2,f=(t+i)/2,d=(e+n)/2,p=(i+r)/2,g=(n+o)/2,m=(r+a)/2,y=(u+d)/2,x=(f+p)/2,_=(d+g)/2,b=(p+m)/2,S=(y+_)/2,w=(x+b)/2;if(c>0){let v=o-s,L=a-t;const R=Math.abs((e-o)*L-(i-a)*v),C=Math.abs((n-o)*L-(r-a)*v);if(R>Vs&&C>Vs){if((R+C)*(R+C)<=h*(v*v+L*L)){l.push(S,w);return}}else if(R>Vs){if(R*R<=h*(v*v+L*L)){l.push(S,w);return}}else if(C>Vs){if(C*C<=h*(v*v+L*L)){l.push(S,w);return}}else if(v=S-(s+o)/2,L=w-(t+a)/2,v*v+L*L<=h){l.push(S,w);return}}Sn(s,t,u,f,y,x,S,w,l,h,c+1),Sn(S,w,_,b,g,m,o,a,l,h,c+1)}const lf=8,hf=11920929e-14,cf=1;function uf(s,t,e,i,n,r,o,a){const h=Math.min(.99,Math.max(0,a??Kn.defaultOptions.bezierSmoothness));let c=(cf-h)/1;return c*=c,df(t,e,i,n,r,o,s,c),s}function df(s,t,e,i,n,r,o,a){An(o,s,t,e,i,n,r,a,0),o.push(n,r)}function An(s,t,e,i,n,r,o,a,l){if(l>lf)return;const h=(t+i)/2,c=(e+n)/2,u=(i+r)/2,f=(n+o)/2,d=(h+u)/2,p=(c+f)/2;let g=r-t,m=o-e;const y=Math.abs((i-r)*m-(n-o)*g);if(y>hf){if(y*y<=a*(g*g+m*m)){s.push(d,p);return}}else if(g=d-(t+r)/2,m=p-(e+o)/2,g*g+m*m<=a){s.push(d,p);return}An(s,t,e,h,c,d,p,a,l+1),An(s,d,p,u,f,r,o,a,l+1)}function sl(s,t,e,i,n,r,o,a){let l=Math.abs(n-r);(!o&&n>r||o&&r>n)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=n;h*=o?-1:1;for(let u=0;u<a+1;u++){const f=Math.cos(c),d=Math.sin(c),p=t+f*i,g=e+d*i;s.push(p,g),c+=h}}function ff(s,t,e,i,n,r){const o=s[s.length-2],l=s[s.length-1]-e,h=o-t,c=n-e,u=i-t,f=Math.abs(l*u-h*c);if(f<1e-8||r===0){(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e);return}const d=l*l+h*h,p=c*c+u*u,g=l*c+h*u,m=r*Math.sqrt(d)/f,y=r*Math.sqrt(p)/f,x=m*g/d,_=y*g/p,b=m*u+y*h,S=m*c+y*l,w=h*(y+x),v=l*(y+x),L=u*(m+_),R=c*(m+_),C=Math.atan2(v-S,w-b),k=Math.atan2(R-S,L-b);sl(s,b+t,S+e,r,C,k,h*c>u*l)}const ws=Math.PI*2,Zi={centerX:0,centerY:0,ang1:0,ang2:0},Qi=({x:s,y:t},e,i,n,r,o,a,l)=>{s*=e,t*=i;const h=n*s-r*t,c=r*s+n*t;return l.x=h+o,l.y=c+a,l};function pf(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,n=Math.cos(s),r=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:n-r*i,y:r+n*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const ro=(s,t,e,i)=>{const n=s*i-t*e<0?-1:1;let r=s*e+t*i;return r>1&&(r=1),r<-1&&(r=-1),n*Math.acos(r)},gf=(s,t,e,i,n,r,o,a,l,h,c,u,f)=>{const d=Math.pow(n,2),p=Math.pow(r,2),g=Math.pow(c,2),m=Math.pow(u,2);let y=d*p-d*m-p*g;y<0&&(y=0),y/=d*m+p*g,y=Math.sqrt(y)*(o===a?-1:1);const x=y*n/r*u,_=y*-r/n*c,b=h*x-l*_+(s+e)/2,S=l*x+h*_+(t+i)/2,w=(c-x)/n,v=(u-_)/r,L=(-c-x)/n,R=(-u-_)/r,C=ro(1,0,w,v);let k=ro(w,v,L,R);a===0&&k>0&&(k-=ws),a===1&&k<0&&(k+=ws),f.centerX=b,f.centerY=S,f.ang1=C,f.ang2=k};function mf(s,t,e,i,n,r,o,a=0,l=0,h=0){if(r===0||o===0)return;const c=Math.sin(a*ws/360),u=Math.cos(a*ws/360),f=u*(t-i)/2+c*(e-n)/2,d=-c*(t-i)/2+u*(e-n)/2;if(f===0&&d===0)return;r=Math.abs(r),o=Math.abs(o);const p=Math.pow(f,2)/Math.pow(r,2)+Math.pow(d,2)/Math.pow(o,2);p>1&&(r*=Math.sqrt(p),o*=Math.sqrt(p)),gf(t,e,i,n,r,o,l,h,c,u,f,d,Zi);let{ang1:g,ang2:m}=Zi;const{centerX:y,centerY:x}=Zi;let _=Math.abs(m)/(ws/4);Math.abs(1-_)<1e-7&&(_=1);const b=Math.max(Math.ceil(_),1);m/=b;let S=s[s.length-2],w=s[s.length-1];const v={x:0,y:0};for(let L=0;L<b;L++){const R=pf(g,m),{x:C,y:k}=Qi(R[0],r,o,u,c,y,x,v),{x:E,y:A}=Qi(R[1],r,o,u,c,y,x,v),{x:P,y:z}=Qi(R[2],r,o,u,c,y,x,v);el(s,S,w,C,k,E,A,P,z),S=P,w=z,g+=m}}function yf(s,t,e){const i=(o,a)=>{const l=a.x-o.x,h=a.y-o.y,c=Math.sqrt(l*l+h*h),u=l/c,f=h/c;return{len:c,nx:u,ny:f}},n=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.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],l=a.radius??e;if(l<=0){n(o,a),r=a;continue}const h=t[(o+1)%t.length],c=i(a,r),u=i(a,h);if(c.len<1e-4||u.len<1e-4){n(o,a),r=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=!0):f>0&&(d=-1,p=!0);const g=f/2;let m,y=Math.abs(Math.cos(g)*l/Math.sin(g));y>Math.min(c.len/2,u.len/2)?(y=Math.min(c.len/2,u.len/2),m=Math.abs(y*Math.sin(g)/Math.cos(g))):m=l;const x=a.x+u.nx*y+-u.ny*m*d,_=a.y+u.ny*y+u.nx*m*d,b=Math.atan2(c.ny,c.nx)+Math.PI/2*d,S=Math.atan2(u.ny,u.nx
240)-Math.PI/2*d;o===0&&s.moveTo(x+Math.cos(b)*m,_+Math.sin(b)*m),s.arc(x,_,m,b,S,p),r=a}}function xf(s,t,e,i){const n=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),r=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),o=t.length;for(let a=0;a<o;a++){const l=t[(a+1)%o],h=l.radius??e;if(h<=0){a===0?s.moveTo(l.x,l.y):s.lineTo(l.x,l.y);continue}const c=t[a],u=t[(a+2)%o],f=n(c,l);let d;if(f<1e-4)d=l;else{const m=Math.min(f/2,h);d=r(l,c,m/f)}const p=n(u,l);let g;if(p<1e-4)g=l;else{const m=Math.min(p/2,h);g=r(l,u,m/p)}a===0?s.moveTo(d.x,d.y):s.lineTo(d.x,d.y),s.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}const _f=new gt;class bf{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Dt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,n=i[i.length-2],r=i[i.length-1];return(n!==t||r!==e)&&i.push(t,e),this}arc(t,e,i,n,r,o){this._ensurePoly(!1);const a=this._currentPoly.points;return sl(a,t,e,i,n,r,o),this}arcTo(t,e,i,n,r){this._ensurePoly();const o=this._currentPoly.points;return ff(o,t,e,i,n,r),this}arcToSvg(t,e,i,n,r,o,a){const l=this._currentPoly.points;return mf(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,i,n,r),this}bezierCurveTo(t,e,i,n,r,o,a){this._ensurePoly();const l=this._currentPoly;return el(this._currentPoly.points,l.lastX,l.lastY,t,e,i,n,r,o,a),this}quadraticCurveTo(t,e,i,n,r){this._ensurePoly();const o=this._currentPoly;return uf(this._currentPoly.points,o.lastX,o.lastY,t,e,i,n,r),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const i=this.shapePrimitives,n=i.length;for(let r=0;r<t.instructions.length;r++){const o=t.instructions[r];this[o.action](...o.data)}if(t.checkForHoles&&i.length-n>1){let r=null;for(let o=n;o<i.length;o++){const a=i[o];if(a.shape.type==="polygon"){const l=a.shape,h=r==null?void 0:r.shape;h&&h.containsPolygon(l)?(r.holes||(r.holes=[]),r.holes.push(a),i.copyWithin(o,o+1),i.length--,o--):r=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,n,r){return this.drawShape(new gt(t,e,i,n),r),this}circle(t,e,i,n){return this.drawShape(new Oe(t,e,i),n),this}poly(t,e,i){const n=new _s(t);return n.closePath=e,this.drawShape(n,i),this}regularPoly(t,e,i,n,r=0,o){n=Math.max(n|0,3);const a=-1*Math.PI/2+r,l=Math.PI*2/n,h=[];for(let c=0;c<n;c++){const u=a-c*l;h.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(h,!0,o),this}
vendor: 4,522 bytes, line 240
240roundPoly(t,e,i,n,r,o=0,a){if(n=Math.max(n|0,3),r<=0)return this.regularPoly(t,e,i,n,o);const l=i*Math.sin(Math.PI/n)-.001;r=Math.min(r,l);const h=-1*Math.PI/2+o,c=Math.PI*2/n,u=(n-2)*Math.PI/n/2;for(let f=0;f<n;f++){const d=f*c+h,p=t+i*Math.cos(d),g=e+i*Math.sin(d),m=d+Math.PI+u,y=d-Math.PI-u,x=p+r*Math.cos(m),_=g+r*Math.sin(m),b=p+r*Math.cos(y),S=g+r*Math.sin(y);f===0?this.moveTo(x,_):this.lineTo(x,_),this.quadraticCurveTo(p,g,b,S,a)}return this.closePath()}roundShape(t,e,i=!1,n){return t.length<3?this:(i?xf(this,t,e,n):yf(this,t,e),this.closePath())}filletRect(t,e,i,n,r){if(r===0)return this.rect(t,e,i,n);const o=Math.min(i,n)/2,a=Math.min(o,Math.max(-o,r)),l=t+i,h=e+n,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+i-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,i,n,r,o){if(r<=0)return this.rect(t,e,i,n);const a=Math.min(r,Math.min(i,n)/2),l=t+i,h=e+n,c=[t+a,e,l-a,e,l,e+a,l,h-a,l-a,h,t+a,h,t,h-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,n,r){return this.drawShape(new $n(t,e,i,n),r),this}roundRect(t,e,i,n,r,o){return this.drawShape(new Yn(t,e,i,n,r),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new _s,i.points.push(t,e),this._currentPoly=i,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 _s,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,n=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const r=e.transform,o=i;i=r.a*i+r.c*n+r.tx,n=r.b*o+r.d*n+r.ty}this._currentPoly.points.push(i,n)}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 i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const n=e[i],r=n.shape.getBounds(_f);n.transform?t.addRect(r,n.transform):t.addRect(r)}return t}}class ne{constructor(t,e=!1){this.instructions=[],this.uid=pt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Wu(t,this):this.instructions=(t==null?void 0:t.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new bf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,n,r){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(Mt.shared);let l=0,h=0;if(!o||o.action!=="bezierCurveTo")l=a.x,h=a.y;else{l=o.data[2],h=o.data[3];const c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,n,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,i){const n=this.instructions[this.instructions.length-1],r=this.getLastPoint(Mt.shared);let o=0,a=0;if(!n||n.action!=="quadraticCurveTo")o=r.x,a=r.y;else{o=n.data[0],a=n.data[1];const l=r.x,h=r.y;o=l+(l-o),a=h+(h-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,n,r){return this.instructions.push({action:"rect",data:[t,e,i,n,r]}),this._dirty=!0,this}circle(t,e,i,n){return this.instructions.push({action:"circle",data:[t,e,i,n]}),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,i,n,r,o,a){r||(r=n/2);const l=-1*Math.PI/2+o,h=i*2,c=Math.PI*2/h,u=[];for(let f=0;f<h;f++){const d=f%2?r:n,p=f*c+l;u.push(t+d*Math.cos(p),e+d*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){const e=new ne;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const n=this.instructions[i];e.instructions.push({action:n.action,data:n.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,i=t.b,n=t.c,r=t.d,o=t.tx,a=t.ty;let l=0,h=0,c=0,u=0,f=0,d=0,p=0,g=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":l=x[0],h=x[1],x[0]=e*l+n*h+o,x[1]=i*l+r*h+a;break;case"bezierCurveTo":c=x[0],u=x[1],f=x[2],d=x[3],l=x[4],h=x[5],x[0]=e*c+n*u+o,x[1]=i*c+r*u+a,x[2]=e*f+n*d+o,x[3]=i*f+r*d+a,x[4]=e*l+n*h+o,x[5]=i*l+r*h+a;break;case"quadraticCurveTo":c=x[0],u=x[1],l=x[2],h=x[3],x[0]=e*c+n*u+o,x[1]=i*c+r*u+a,x[2]=e*l+n*h+o,x[3]=i*l+r*h+a;break;case"arcToSvg":l=x[5],h=x[6],p=x[0],g=x[1],x[0]=e*p+n*g,x[1]=i*p+r*g,x[5]=e*l+n*h+o,x[6]=i*l+r*h+a;break;case"circle":x[4]=Ie(x[3],t);break;case"rect":x[4]=Ie(x[4],t);break;case"ellipse":x[8]=Ie(x[8],t);break;case"roundRect":x[5]=Ie(x[5],t);break;case"addPath":x[0].transform(t);break;case"poly":x[2]=Ie(x[2],t);break;case"regularPoly":case"chamferRect":x[5]=Ie(x[5],t);break;case"closePath":break;default:at("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,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}function Ie(s,t){return s?s.prepend(t):t.clone()}function dt(s,t,e){const i=s.getAttribute(t);return i?Number(i):e}function wf(s,t){const e=s.querySelectorAll("defs");for(let i=0;i<e.length;i++){const n=e[i];for(let r=0;r<n.children.length;r++){const o=n.children[r];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=vf(o);break;case"radialgradient":t.defs[o.id]=Sf();break}}}}function vf(s){const t=dt(s,"x1",0),e=dt(s,"y1",0),i=dt(s,"x2",1),n=dt(s,"y2",0),r=s.getAttribute("gradientUnits")||"objectBoundingBox",o=new oe(t,e,i,n,r==="objectBoundingBox"?"local":"global");for(let a=0;a<s.children.length;a++){const l=s.children[a],h=dt(l,"offset",0),c=lt.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(h,c)}return o}function Sf(s){return at("[SVG Parser] Radial gradients are not yet supported"),new oe(0,0,1,0)}function oo(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const ao={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 il(s,t){const e=s.getAttribute("style"),i={},n={}
240,r={strokeStyle:i,fillStyle:n,useFill:!1,useStroke:!1};for(const o in ao){const a=s.getAttribute(o);a&&lo(t,r,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const l=o[a].trim(),[h,c]=l.split(":");ao[h]&&lo(t,r,h,c.trim())}}return{strokeStyle:r.useStroke?i:null,fillStyle:r.useFill?n:null,useFill:r.useFill,useStroke:r.useStroke}}function lo(s,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){const n=oo(i);t.strokeStyle.fill=s.defs[n]}else t.strokeStyle.color=lt.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){const n=oo(i);t.fillStyle.fill=s.defs[n]}else t.fillStyle.color=lt.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}function Af(s){if(s.length<=2)return!0;const t=s.map(a=>a.area).sort((a,l)=>l-a),[e,i]=t,n=t[t.length-1],r=e/i,o=i/n;return!(r>3&&o<2)}function Cf(s){return s.split(/(?=[Mm])/).filter(i=>i.trim().length>0)}function Mf(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],n=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(i.push(e[c]),n.push(e[c+1]));if(i.length===0||n.length===0)return 0;const r=Math.min(...i),o=Math.max(...i),a=Math.min(...n),l=Math.max(...n);return(o-r)*(l-a)}function ho(s,t){const e=new ne(s,!1);for(const i of e.instructions)t.instructions.push(i)}function Tf(s,t){if(typeof s=="string"){const o=document.createElement("div");o.innerHTML=s.trim(),s=o.querySelector("svg")}const e={context:t,defs:{},path:new ne};wf(s,e);const i=s.children,{fillStyle:n,strokeStyle:r}=il(s,e);for(let o=0;o<i.length;o++){const a=i[o];a.nodeName.toLowerCase()!=="defs"&&nl(a,e,n,r)}return t}function nl(s,t,e,i){const n=s.children,{fillStyle:r,strokeStyle:o}=il(s,t);r&&e?e={...e,...r}:r&&(e=r),o&&i?i={...i,...o}:o&&(i=o);const a=!e&&!i;a&&(e={color:0});let l,h,c,u,f,d,p,g,m,y,x,_,b,S,w,v,L;switch(s.nodeName.toLowerCase()){case"path":{S=s.getAttribute("d");const R=s.getAttribute("fill-rule"),C=Cf(S),k=R==="evenodd",E=C.length>1;if(k&&E){const P=C.map(M=>({path:M,area:Mf(M)}));if(P.sort((M,F)=>F.area-M.area),C.length>3||!Af(P))for(let M=0;M<P.length;M++){const F=P[M],J=M===0;t.context.beginPath();const D=new ne(void 0,!0);ho(F.path,D),t.context.path(D),J?(e&&t.context.fill(e),i&&t.context.stroke(i)):t.context.cut()}else for(let M=0;M<P.length;M++){const F=P[M],J=M%2===1;t.context.beginPath();const D=new ne(void 0,!0);ho(F.path,D),t.context.path(D),J?t.context.cut():(e&&t.context.fill(e),i&&t.context.stroke(i))}}else{const P=R?R==="evenodd":!0;w=new ne(S,P),t.context.path(w),e&&t.context.fill(e),i&&t.context.stroke(i)}break}case"circle":p=dt(s,"cx",0),g=dt(s,"cy",0),m=dt(s,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=dt(s,"x",0),h=dt(s,"y",0),v=dt(s,"width",0),L=dt(s,"height",0),y=dt(s,"rx",0),x=dt(s,"ry",0),y||x?t.context.roundRect(l,h,v,L,y||x):t.context.rect(l,h,v,L),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=dt(s,"cx",0),g=dt(s,"cy",0),y=dt(s,"rx",0),x=dt(s,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,y,x),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=dt(s,"x1",0),u=dt(s,"y1",0),f=dt(s,"x2",0),d=dt(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case"polygon":b=s.getAttribute("points"),_=b.match(/-?\d+/g).map(R=>parseInt(R,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":b=s.getAttribute("points"),_=b.match(/-?\d+/g).map(R=>parseInt(R,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{at(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<n.length;R++)nl(n[R],t,e,i)}function kf(s){return s.texture!==void 0}const co={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 bi{constructor(t,e){this.uid=pt("fillPattern"),this._tick=0,this.transform=new j;const i=kf(t)?t:{texture:t,repetition:e};
240this.texture=i.texture,this.textureSpace=i.textureSpace??"global";const n=i.repetition;n&&(this.texture.source.style.addressModeU=co[n].addressModeU,this.texture.source.style.addressModeV=co[n].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 Pf(s){return lt.isColorLike(s)}function uo(s){return s instanceof bi}function fo(s){return s instanceof oe}function If(s){return s instanceof et}function Rf(s,t,e){const i=lt.shared.setValue(t??0);return s.color=i.toNumber(),s.alpha=i.alpha===1?e.alpha:i.alpha,s.texture=et.WHITE,{...e,...s}}function Ef(s,t,e){return s.texture=t,{...e,...s}}function po(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function go(s,t,e){return t.buildGradient(),s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Lf(s,t){const e={...t,...s},i=lt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function Se(s,t){if(s==null)return null;const e={},i=s;return Pf(s)?Rf(e,s,t):If(s)?Ef(e,s,t):uo(s)?po(e,s,t):fo(s)?go(e,s,t):i.fill&&uo(i.fill)?po(i,i.fill,t):i.fill&&fo(i.fill)?go(i,i.fill,t):Lf(i,t)}function ai(s,t){const{width:e,alignment:i,miterLimit:n,cap:r,join:o,pixelLine:a,...l}=t,h=Se(s,l);return h?{width:e,alignment:i,miterLimit:n,cap:r,join:o,pixelLine:a,...h}:null}function Ff(s,t){let e=1;const i=s.shapePath.shapePrimitives;for(let n=0;n<i.length;n++){const r=i[n].shape;if(r.type!=="polygon")continue;const o=r.points,a=o.length;if(a<6)continue;const l=r.closePath;for(let h=0;h<a;h+=2){if(!l&&(h===0||h===a-2))continue;const c=(h-2+a)%a,u=(h+2)%a,f=o[c],d=o[c+1],p=o[h],g=o[h+1],m=o[u],y=o[u+1],x=f-p,_=d-g,b=m-p,S=y-g,w=x*x+_*_,v=b*b+S*S;if(w<1e-12||v<1e-12)continue;let C=(x*b+_*S)/Math.sqrt(w*v);C<-1?C=-1:C>1&&(C=1);const k=Math.sqrt((1-C)*.5);if(k<1e-6)continue;const E=Math.min(1/k,t);E>e&&(e=E)}}return e}const Bf=new Mt,mo=new j,Zn=class jt extends Kt{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=pt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new ne,this._transform=new j,this._fillStyle={...jt.defaultFillStyle},this._strokeStyle={...jt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Dt,this._boundsDirty=!0}clone(){const t=new jt;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=Se(t,jt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ai(t,jt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Se(t,jt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Se(t,jt.defaultStrokeStyle),this}texture(t,e,i,n,r,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:n||0,dw:r||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?lt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ne,this}fill(t,e){let i;const n=this.instructions[this.instructions.length-1];return this._tick===0&&(n==null?void 0:n.action)==="stroke"?i=n.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(q(ft,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Se(t,jt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(Mt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ai(t,jt.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],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,n,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,i,n,r,o),this}arcTo(t,e,i,n,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*i+o.c*n+o.tx,o.b*i+o.d*n+o.ty,r),this}arcToSvg(t,e,i,n,r,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,i,n,r,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,i,n,r,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*n+l.tx,l.b*i+l.d*n+l.ty,l.a*r+l.c*o+l.tx,l.b*r+l.d*o+l.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,n){return this._tick++,this._activePath.ellipse(t,e,i,n,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,n=this._activePath.instructions,r=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=r,n[0].data[1]=o,this):(this._activePath.moveTo(r,o),this)}quadraticCurveTo(t,e,i,n,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*i+o.c*n+o.tx,o.b*i+o.d*n+o.ty,r),this}rect(t,e,i,n){return this._tick++,this._activePath.rect(t,e,i,n,this._transform.clone()),this}
240roundRect(t,e,i,n,r){return this._tick++,this._activePath.roundRect(t,e,i,n,r,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,n,r=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,n,r,o),this}roundPoly(t,e,i,n,r,o){return this._tick++,this._activePath.roundPoly(t,e,i,n,r,o),this}roundShape(t,e,i,n){return this._tick++,this._activePath.roundShape(t,e,i,n),this}filletRect(t,e,i,n,r){return this._tick++,this._activePath.filletRect(t,e,i,n,r),this}chamferRect(t,e,i,n,r,o){return this._tick++,this._activePath.chamferRect(t,e,i,n,r,o),this}star(t,e,i,n,r=0,o=0){return this._tick++,this._activePath.star(t,e,i,n,r,o,this._transform.clone()),this}svg(t){return this._tick++,Tf(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,i,n,r,o){return t instanceof j?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,n,r,o),this)}transform(t,e,i,n,r,o){return t instanceof j?(this._transform.append(t),this):(mo.set(t,e,i,n,r,o),this._transform.append(mo),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 i=this.instructions[e],n=i.action;if(n==="fill"){const r=i.data;t.addBounds(r.path.bounds)}else if(n==="texture"){const r=i.data;t.addFrame(r.dx,r.dy,r.dx+r.dw,r.dy+r.dh,r.transform)}if(n==="stroke"){const r=i.data,o=r.style.alignment;let a=r.style.width*(1-o);r.style.join==="miter"&&(a*=Ff(r.path,r.style.miterLimit));const l=r.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var n;if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let r=0;r<e.length;r++){const o=e[r],a=o.data,l=a.path;if(!o.action||!l)continue;const h=a.style,c=l.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){const f=c[u].shape;if(!h||!f)continue;const d=c[u].transform,p=d?d.applyInverse(t,Bf):t;if(o.action==="fill")i=f.contains(p.x,p.y);else{const m=h;i=f.strokeContains(p.x,p.y,m.width,m.alignment)}const g=a.hole;if(g){const m=(n=g.shapePath)==null?void 0:n.shapePrimitives;if(m)for(let y=0;y<m.length;y++)m[y].shape.contains(p.x,p.y)&&(i=!1)}if(i)return!0}}return i}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||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==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(i)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(i))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Zn.defaultFillStyle={color:16777215,alpha:1,texture:et.WHITE,matrix:null,fill:null,textureSpace:"local"};Zn.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:et.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Ft=Zn;function Qn(s,t=1){var i;const e=(i=Ke.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}function Jn(s,t,e){s.label=e,s._sourceOrigin=e;const i=new et({source:s,label:e}),n=()=>{delete t.promiseCache[e],vt.has(e)&&vt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(at("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),n())}),i.once("destroy",()=>{s.destroyed||(at("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),i}const Gf=".svg",Df="image/svg+xml",Of={extension:{type:G.LoadParser,priority:ue.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return Qe(s,Df)||Je(s,Gf)},async load(s,t,e){var i;return((i=t.data)==null?void 0:i.parseAsGraphicsContext)??this.config.parseAsGraphicsContext?Uf(s):Nf(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function Nf(s,t,e,i){var m,y,x;const n=await K.get().fetch(s),r=K.get().createImage();r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await n.text())}`,r.crossOrigin=i,await r.decode();const o=((m=t.data)==null?void 0:m.width)??r.width,a=((y=t.data)==null?void 0:y.height)??r.he
240ight,l=((x=t.data)==null?void 0:x.resolution)||Qn(s),h=Math.ceil(o*l),c=Math.ceil(a*l),u=K.get().createCanvas(h,c),f=u.getContext("2d");f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(r,0,0,o*l,a*l);const{parseAsGraphicsContext:d,...p}=t.data??{},g=new Ye({resource:u,alphaMode:"premultiply-alpha-on-upload",resolution:l,...p});return Jn(g,e,s)}async function Uf(s){const e=await(await K.get().fetch(s)).text(),i=new Ft;return i.svg(e),i}const Wf=`(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 Ne=null,Cn=class{constructor(){Ne||(Ne=URL.createObjectURL(new Blob([Wf],{type:"application/javascript"}))),this.worker=new Worker(Ne)}};Cn.revokeObjectURL=function(){Ne&&(URL.revokeObjectURL(Ne),Ne=null)};const zf=`(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 Ue=null;class rl{constructor(){Ue||(Ue=URL.createObjectURL(new Blob([zf],{type:"application/javascript"}))),this.worker=new Worker(Ue)}}rl.revokeObjectURL=function(){Ue&&(URL.revokeObjectURL(Ue),Ue=null)};let yo=0,Ji;class Hf{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 Cn;e.addEventListener("message",i=>{e.terminate(),Cn.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Ji===void 0&&(Ji=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Ji&&(this._createdWorkers++,t=new rl().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 i=new Promise((n,r)=>{this._queue.push({id:t,arguments:e,resolve:n,reject:r})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[yo]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:yo++,id:i})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>
289{t==null||t(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}}const xo=new Hf,Vf=[".jpeg",".jpg",".png",".webp",".avif"],$f=["image/jpeg","image/png","image/webp","image/avif"];async function Yf(s,t){var n;const e=await K.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return((n=t==null?void 0:t.data)==null?void 0:n.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const ol={name:"loadTextures",id:"texture",extension:{type:G.LoadParser,priority:ue.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Qe(s,$f)||Je(s,Vf)},async load(s,t,e){var r;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await xo.isImageBitmapSupported()?i=await xo.loadImageBitmap(s,t):i=await Yf(s,t):i=await new Promise((o,a)=>{i=K.get().createImage(),i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=a)});const n=new Ye({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((r=t.data)==null?void 0:r.resolution)||Qn(s),...t.data});return Jn(n,e,s)},unload(s){s.destroy(!0)}},Xf=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let tn,en;function jf(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=Kf(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function qf(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",n),s.load();function i(){r(),t()}function n(o){r(),e(o)}function r(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",n)}})}function Kf(s,t=globalThis.location){if(s.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Zf(){const s=[],t=[];for(const e of Xf){const i=xs.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;xi(i)&&(s.push(e),t.includes(i)||t.push(i))}return{validVideoExtensions:s,validVideoMime:t}}const Qf={name:"loadVideo",id:"video",extension:{type:G.LoadParser,name:"loadVideo"},test(s){if(!tn||!en){const{validVideoExtensions:i,validVideoMime:n}=Zf();tn=i,en=n}const t=Qe(s,en),e=Je(s,tn);return t||e},async load(s,t,e){var l,h;const i={...xs.defaultOptions,resolution:((l=t.data)==null?void 0:l.resolution)||Qn(s),alphaMode:((h=t.data)==null?void 0:h.alphaMode)||await pa(),...t.data},n=document.createElement("video"),r={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(r).forEach(c=>{const u=r[c];u!==void 0&&n.setAttribute(c,u)}),i.muted===!0&&(n.muted=!0),jf(n,s,i.crossorigin);const o=document.createElement("source");let a;if(i.mime)a=i.mime;else if(s.startsWith("data:"))a=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const c=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();a=xs.MIME_TYPES[c]||`video/${c}`}return o.src=s,a&&(o.type=a),new Promise((c,u)=>{i.preload&&!i.autoPlay&&n.load(),n.addEventListener("canplay",f),n.addEventListener("error",d),o.addEventListener("error",d),n.appendChild(o);async function f(){const g=new xs({...i,resource:n});p(),t.data.preload&&await qf(n),c(Jn(g,e,s))}function d(g){p(),u(g)}function p(){n.removeEventListener("canplay",f),n.removeEventListener("error",d),o.removeEventListener("error",d)}})},unload(s){s.destroy(!0)}},al={extension:{type:G.ResolveParser,name:"resolveTexture"},test:ol.test,parse:s=>{var t;return{resolution:parseFloat(((t=Ke.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:s.split(".").pop(),src:s}}},Jf={extension:{type:G.ResolveParser,priority:-2,name:"resolveJson"},test:s=>Ke.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:al.parse};class tp{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new vu,this.cache=vt,this._backgroundLoader=new fu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var r,o;
289if(this._initialized){at("[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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((r=t.texturePreference)==null?void 0:r.resolution)??1,i=typeof e=="number"?[e]:e,n=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:i}}),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 i=ri(t),n=Vt(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),r=this.resolver.resolve(n),o=await this._mapLoadToResolve(r,e);return i?o[n[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const n=this.resolver.resolveBundle(t),r={},o=Object.keys(n);let a=0;const l=[],h=()=>{e==null||e(l.reduce((u,f)=>u+f,0)/a)},c=o.map((u,f)=>{const d=n[u],p=Object.values(d),m=[...new Set(p.flat())].reduce((y,x)=>y+(x.progressSize||1),0);return l.push(0),a+=m,this._mapLoadToResolve(d,y=>{l[f]=y*m,h()}).then(y=>{r[u]=y})});return await Promise.all(c),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return vt.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=vt.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const r={};return i.forEach(o=>{const a=n[o.src],l=[o.src];o.alias&&l.push(...o.alias),l.forEach(h=>{r[h]=a}),vt.set(l,a)}),r}async unload(t){this._initialized||await this.init();const e=Vt(t).map(n=>typeof n!="string"?n.src:n),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Vt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(n=>this._unloadFromResolved(e[n]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{vt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,n)=>e.indexOf(i)===n),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const ms=new tp;it.handleByList(G.LoadParser,ms.loader.parsers).handleByList(G.ResolveParser,ms.resolver.parsers).handleByList(G.CacheParser,ms.cache.parsers).handleByList(G.DetectionParser,ms.detections);it.add(pu,mu,gu,wu,xu,_u,bu,Cu,ku,Gu,Of,ol,Qf,du,uu,al,Jf);const _o={loader:G.LoadParser,resolver:G.ResolveParser,cache:G.CacheParser,detection:G.DetectionParser};it.handle(G.Asset,s=>{const t=s.ref;Object.entries(_o).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(_o).filter(e=>
289!!t[e]).forEach(e=>it.remove(t[e]))});let Re;function bo(s){const t=K.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=s,e.fillRect(0,0,6,1),t}function ep(){if(Re!==void 0)return Re;try{const s=bo("#ff00ff"),t=bo("#ffff00"),i=K.get().createCanvas(6,1).getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(s,0,0),i.drawImage(t,2,0);const n=i.getImageData(2,0,1,1);if(!n)Re=!1;else{const r=n.data;Re=r[0]===255&&r[1]===0&&r[2]===0}}catch{Re=!1}return Re}const rt={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:ep(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const t=s.source,e=t==null?void 0:t.resource;if(!e)return null;const i=t.alphaMode==="premultiplied-alpha",n=t.resourceWidth??t.pixelWidth,r=t.resourceHeight??t.pixelHeight,o=n!==t.pixelWidth||r!==t.pixelHeight;if(i){if((e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)&&!o)return e;const a=rt._unpremultipliedCache.get(t);if((a==null?void 0: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=rt._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const l=K.get().createCanvas(t.pixelWidth,t.pixelHeight),h=l.getContext("2d"),c=h.createImageData(t.pixelWidth,t.pixelHeight),u=c.data,f=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.format==="bgra8unorm")for(let d=0;d<u.length&&d+3<f.length;d+=4)u[d]=f[d+2],u[d+1]=f[d+1],u[d+2]=f[d],u[d+3]=f[d+3];else u.set(f.subarray(0,u.length));return h.putImageData(c,0,0),rt._canvasSourceCache.set(t,{canvas:l,resourceId:t._resourceId}),l}if(i){const a=K.get().createCanvas(t.pixelWidth,t.pixelHeight),l=a.getContext("2d",{willReadFrequently:!0});a.width=t.pixelWidth,a.height=t.pixelHeight,l.drawImage(e,0,0);const h=l.getImageData(0,0,a.width,a.height),c=h.data;for(let u=0;u<c.length;u+=4){const f=c[u+3];if(f>0){const d=255/f;c[u]=Math.min(255,c[u]*d+.5),c[u+1]=Math.min(255,c[u+1]*d+.5),c[u+2]=Math.min(255,c[u+2]*d+.5)}}return l.putImageData(h,0,0),rt._unpremultipliedCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(o){const a=rt._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const l=K.get().createCanvas(t.pixelWidth,t.pixelHeight),h=l.getContext("2d");return l.width=t.pixelWidth,l.height=t.pixelHeight,h.drawImage(e,0,0),rt._canvasSourceCache.set(t,{canvas:l,resourceId:t._resourceId}),l}return e},getTintedCanvas:(s,t)=>{const e=s.texture,i=lt.shared.setValue(t).toHex(),n=e.tintCache||(e.tintCache={}),r=n[i],o=e.source._resourceId;if((r==null?void 0:r.tintId)===o)return r;const a=r&&"getContext"in r?r:K.get().createCanvas();return rt.tintMethod(e,t,a),a.tintId=o,n[i]=a,n[i]},getTintedPattern:(s,t)=>{const e=lt.shared.setValue(t).toHex(),i=s.patternCache||(s.patternCache={}),n=s.source._resourceId;let r=i[e];return(r==null?void 0:r.tintId)===n||(rt.canvas||(rt.canvas=K.get().createCanvas()),rt.tintMethod(s,t,rt.canvas),r=rt.canvas.getContext("2d").createPattern(rt.canvas,"repeat"),r.tintId=n,i[e]=r),r},applyPatternTransform:(s,t,e=!0)=>{if(!t)return;const i=s;
289if(!i.setTransform)return;const n=globalThis.DOMMatrix;if(!n)return;const r=new n([t.a,t.b,t.c,t.d,t.tx,t.ty]);i.setTransform(e?r.inverse():r)},tintWithMultiply:(s,t,e)=>{const i=e.getContext("2d"),n=s.frame.clone(),r=s.source._resolution??s.source.resolution??1,o=s.rotate;n.x*=r,n.y*=r,n.width*=r,n.height*=r;const a=X.isVertical(o),l=a?n.height:n.width,h=a?n.width:n.height;e.width=Math.ceil(l),e.height=Math.ceil(h),i.save(),i.fillStyle=lt.shared.setValue(t).toHex(),i.fillRect(0,0,l,h),i.globalCompositeOperation="multiply";const c=rt.getCanvasSource(s);if(!c){i.restore();return}o&&rt._applyInverseRotation(i,o,n.width,n.height),i.drawImage(c,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(c,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithOverlay:(s,t,e)=>{const i=e.getContext("2d"),n=s.frame.clone(),r=s.source._resolution??s.source.resolution??1,o=s.rotate;n.x*=r,n.y*=r,n.width*=r,n.height*=r;const a=X.isVertical(o),l=a?n.height:n.width,h=a?n.width:n.height;e.width=Math.ceil(l),e.height=Math.ceil(h),i.save(),i.globalCompositeOperation="copy",i.fillStyle=lt.shared.setValue(t).toHex(),i.fillRect(0,0,l,h),i.globalCompositeOperation="destination-atop";const c=rt.getCanvasSource(s);if(!c){i.restore();return}o&&rt._applyInverseRotation(i,o,n.width,n.height),i.drawImage(c,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithPerPixel:(s,t,e)=>{const i=e.getContext("2d"),n=s.frame.clone(),r=s.source._resolution??s.source.resolution??1,o=s.rotate;n.x*=r,n.y*=r,n.width*=r,n.height*=r;const a=X.isVertical(o),l=a?n.height:n.width,h=a?n.width:n.height;e.width=Math.ceil(l),e.height=Math.ceil(h),i.save(),i.globalCompositeOperation="copy";const c=rt.getCanvasSource(s);if(!c){i.restore();return}o&&rt._applyInverseRotation(i,o,n.width,n.height),i.drawImage(c,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();const u=t>>16&255,f=t>>8&255,d=t&255,p=i.getImageData(0,0,l,h),g=p.data;for(let m=0;m<g.length;m+=4)g[m]=g[m]*u/255,g[m+1]=g[m+1]*f/255,g[m+2]=g[m+2]*d/255;i.putImageData(p,0,0)},_applyInverseRotation:(s,t,e,i)=>{const n=X.inv(t),r=X.uX(n),o=X.uY(n),a=X.vX(n),l=X.vY(n),h=-Math.min(0,r*e,a*i,r*e+a*i),c=-Math.min(0,o*e,l*i,o*e+l*i);s.transform(r,o,a,l,h,c)}};rt.tintMethod=rt.canUseMultiply?rt.tintWithMultiply:rt.tintWithPerPixel;class sp{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=K.get().createCanvas();i.width=t,i.height=e;const n=i.getContext("2d");return{canvas:i,context:n}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ze(t),e=ze(e);const n=(t<<17)+(e<<1);this._canvasPool[n]||(this._canvasPool[n]=[]);let r=this._canvasPool[n].pop();return r||(r=this._createCanvasAndContext(t,e)),r}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:n}=e,r=(i<<17)+(n<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,n),this._canvasPool[r].push(t)}clear(){this._canvasPool={}}}const Mn=new sp;Ps.register(Mn);const ip=new Dt;function np(s,t,e,i,n=!1){const r=ip;r.minX=0,r.minY=0,r.maxX=s.width/i|0,r.maxY=s.height/i|0;const o=pi.getOptimalTexture(r.width,r.height,i,!1,n);return o.source.uploadMethodId="image",o.source.resource=s,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}class rp{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class op{constructor(){this.instructions=new Wn}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const tr=class Tn{constructor(t){this._renderer=t,this._managedContexts=new Is({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Tn.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??Tn.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,i=!!e[this._renderer.uid],n=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!i)&&(i&&n.reset(),n.isBatchable=!1,t.dirty=!1),n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}
289_initContextRenderData(t){const e=new op,i=this.getGpuContext(t);return i.graphicsData=e,e.init(),e}_initContext(t){const e=new rp;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};tr.extension={type:[G.CanvasSystem],name:"graphicsContext"};tr.defaultOptions={bezierSmoothness:.5};let ap=tr;class ll{constructor(t,e){this.state=Vn.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Is({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}}ll.extension={type:[G.CanvasPipes],name:"graphics"};function lp(s,t,e){const i=(s>>24&255)/255;t[e++]=(s&255)/255*i,t[e++]=(s>>8&255)/255*i,t[e++]=(s>>16&255)/255*i,t[e++]=i}class hp{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{It.return(t)}),this.batches.length=0}}class hl{constructor(t,e){this.state=Vn.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Is({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,i=!!t._gpuData,r=this.renderer.graphicsContext.updateGpuContext(e);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(t,e){const n=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),n.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const i=this._getGpuDataForRenderable(t).batches;for(let n=0;n<i.length;n++){const r=i[n];r._batcher.updateElement(r)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const r=i.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,lp(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),n=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),n.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(t).batches;for(let r=0;r<n.length;r++){const o=n[r];i.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new hp;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const i=t.context,r=this.renderer.graphicsContext.getGpuContext(i),o=this.renderer._roundPixels|t._roundPixels;e.batches=r.batches.map(a=>{const l=It.get(Xn);return a.copyTo(l),l.renderable=t,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.de
289stroy(),this._adaptor=null,this.state=null}}hl.extension={type:[G.WebGLPipes,G.WebGPUPipes],name:"graphics"};it.add(ll);it.add(hl);it.add(ap);it.add(Kn);class xt extends zn{constructor(t){t instanceof Ft&&(t={context:t});const{context:e,roundPixels:i,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new Ft,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!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==null?void 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 xt(this._context.clone()):(this._ownedContext=null,new xt(this._context))}lineStyle(t,e,i){q(ft,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const n={};return t&&(n.width=t),e&&(n.color=e),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(t,e){q(ft,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){q(ft,"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!==Ft.defaultStrokeStyle.width||t.color!==Ft.defaultStrokeStyle.color||t.alpha!==Ft.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return q(ft,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return q(ft,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return q(ft,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return q(ft,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return q(ft,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return q(ft,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}class cp extends zn{constructor(t,e){const{text:i,resolution:n,style:r,anchor:o,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=r,this.resolution=n??null,this.allowChildren=!1,this._anchor=new St({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}
289set 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){var e;t||(t={}),(e=this._style)==null||e.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,i=this.bounds.height,n=-e*this.anchor.x;let r=0;return t.x>=n&&t.x<=n+e&&(r=-i*this.anchor.y,t.y>=r&&t.y<=r+i)}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!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function up(s,t){let e=s[0]??{};return(typeof e=="string"||s[1])&&(q(ft,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:s[1]}),e}let ge=null,se=null;function dp(s,t){ge||(ge=K.get().createCanvas(256,128),se=ge.getContext("2d",{willReadFrequently:!0}),se.globalCompositeOperation="copy",se.globalAlpha=1),(ge.width<s||ge.height<t)&&(ge.width=ze(s),ge.height=ze(t))}function wo(s,t,e){for(let i=0,n=4*e*t;i<t;++i,n+=4)if(s[n+3]!==0)return!1;return!0}function vo(s,t,e,i,n){const r=4*t;for(let o=i,a=i*r+4*e;o<=n;++o,a+=r)if(s[a+3]!==0)return!1;return!0}function fp(...s){let t=s[0];t.canvas||(t={canvas:s[0],resolution:s[1]});const{canvas:e}=t,i=Math.min(t.resolution??1,1),n=t.width??e.width,r=t.height??e.height;let o=t.output;if(dp(n,r),!se)throw new TypeError("Failed to get canvas 2D context");se.drawImage(e,0,0,n,r,0,0,n*i,r*i);const l=se.getImageData(0,0,n,r).data;let h=0,c=0,u=n-1,f=r-1;for(;c<r&&wo(l,n,c);)++c;if(c===r)return gt.EMPTY;for(;wo(l,n,f);)--f;for(;vo(l,n,h,c,f);)++h;for(;vo(l,n,u,c,f);)--u;return++u,++f,se.globalCompositeOperation="source-over",se.strokeRect(h,c,u-h,f-c),se.globalCompositeOperation="copy",o??(o=new gt),o.set(h/i,c/i,(u-h)/i,(f-c)/i),o}/** 290 * tiny-lru 291 * 292 * @copyright 2026 Jason Mulligan <[email protected]> 293 * @license BSD-3-Clause 294 * @version 11.4.7 295 */class pp{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,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 i=0;i<t.length;i++){const n=t[i];e[i]=[n,this.get(n)]}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,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let n=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(n={...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 n}set(t,e,i=!1,n=this.resetTtl){let r=this.items[t];return i||r!==void 0?(r.value=e,i===!1&&n&&(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 i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function gp(s=1e3,t=0,e=!1){if(isNaN(s)||s<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 pp(s,t,e)}function cl(s){return!!s.tagStyles&&Object.keys(s.tagStyles).length>0}function ul(s){return s.includes("<")}function mp(s,t){return s.clone().assign(t)}function yp(s,t){const e=[],i=t.tagStyles;if(!cl(t)||!ul(s))return e.push({text:s,style:t}),e;const n=[t],r=[];let o="",a=0;for(;a<s.length;){const l=s[a];if(l==="<"){const h=s.indexOf(">",a);if(h===-1){o+=l,a++;continue}const c=s.indexOf("<",a+1);if(c!==-1&&c<h){o+=l,a++;continue}const u=s.slice(a+1,h);if(u.startsWith("/")){const f=u.slice(1).trim();if(r.length>0&&r[r.length-1]===f){o.length>0&&(e.push({text:o,style:n[n.length-1]}),o=""),n.pop(),r.pop(),a=h+1;continue}else{o+=s.slice(a,h+1),a=h+1;continue}}else{const f=u.trim();if(i[f]){o.length>0&&(e.push({text:o,style:n[n.length-1]}),o="");const d=n[n.length-1],p=mp(d,i[f]);n.push(p),r.push(f),a=h+1;continue}else{o+=s.slice(a,h+1),a=h+1;continue}}}else o+=l,a++}return o.length>0&&e.push({text:o,style:n[n.length-1]}),e}const xp=[10,13],_p=new Set(xp),bp=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],wp=new Set(bp),vp=[9,32],Sp=new Set(vp),Ap=[45,8208,8211,8212,173],Cp=new Set(Ap),Mp=/(\r\n|\r|\n)/,Tp=/(?:\r\n|\r|\n)/;
295function li(s){return typeof s!="string"?!1:_p.has(s.charCodeAt(0))}function Gt(s,t){return typeof s!="string"?!1:wp.has(s.charCodeAt(0))}function sx(s){return typeof s!="string"?!1:Sp.has(s.charCodeAt(0))}function kp(s){return typeof s!="string"?!1:Cp.has(s.charCodeAt(0))}function dl(s){return s==="normal"||s==="pre-line"}function fl(s){return s==="normal"}function ee(s){if(typeof s!="string")return"";let t=s.length-1;for(;t>=0&&Gt(s[t]);)t--;return t<s.length-1?s.slice(0,t+1):s}function pl(s){const t=[],e=[];if(typeof s!="string")return t;for(let i=0;i<s.length;i++){const n=s[i],r=s[i+1];if(Gt(n)||li(n)){e.length>0&&(t.push(e.join("")),e.length=0),n==="\r"&&r===` 296`?(t.push(`\r 297`),i++):t.push(n);continue}e.push(n),kp(n)&&r&&!Gt(r)&&!li(r)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function gl(s,t,e,i){const n=e(s),r=[];for(let o=0;o<n.length;o++){let a=n[o],l=a,h=1;for(;n[o+h];){const c=n[o+h];if(!i(l,c,s,o,t))a+=c,l=c,h++;else break}o+=h-1,r.push(a)}return r}const Pp=/\r\n|\r|\n/g;function Ip(s,t,e,i,n,r,o,a,l){var P,z;const h=yp(s,t);if(fl(t.whiteSpace))for(let M=0;M<h.length;M++){const F=h[M];h[M]={text:F.text.replace(Pp," "),style:F.style}}const u=[];let f=[];for(const M of h){const F=M.text.split(Mp);for(let J=0;J<F.length;J++){const D=F[J];D===`\r 298`||D==="\r"||D===`
299`?(u.push(f),f=[]):D.length>0&&f.push({text:D,style:M.style})}}(f.length>0||u.length===0)&&u.push(f);const d=e?Rp(u,t,i,r,a,l):u,p=[],g=[],m=[],y=[],x=[];let _=0;const b=t._fontString,S=o(b);S.fontSize===0&&(S.fontSize=t.fontSize,S.ascent=t.fontSize);let w="",v=!!t.dropShadow,L=((P=t._stroke)==null?void 0:P.width)||0;for(const M of d){let F=0,J=S.ascent,D=S.descent,Y="";for(const U of M){const ht=U.style._fontString,mt=o(ht);ht!==w&&(i.font=ht,w=ht);const W=n(U.text,U.style.letterSpacing,i);F+=W,J=Math.max(J,mt.ascent),D=Math.max(D,mt.descent),Y+=U.text;const nt=((z=U.style._stroke)==null?void 0:z.width)||0;nt>L&&(L=nt),!v&&U.style.dropShadow&&(v=!0)}M.length===0&&(J=S.ascent,D=S.descent),p.push(F),g.push(J),m.push(D),x.push(Y);const tt=t.lineHeight||J+D;y.push(tt+t.leading),_=Math.max(_,F)}const R=L,C=_+R+(t.dropShadow?t.dropShadow.distance:0);let k=0;for(let M=0;M<y.length;M++)k+=y[M];k=Math.max(k,y[0]+R);const E=k+(t.dropShadow?t.dropShadow.distance:0),A=t.lineHeight||S.fontSize;return{width:C,height:E,lines:x,lineWidths:p,lineHeight:A+t.leading,maxLineWidth:_,fontProperties:S,runsByLine:d,lineAscents:g,lineDescents:m,lineHeights:y,hasDropShadow:v}}function Rp(s,t,e,i,n,r){var m;const{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:h}=t,c=dl(a),u=l+o,f={};let d="";const p=(y,x)=>{const _=`${y}|${x.styleKey}`;let b=f[_];if(b===void 0){const S=x._fontString;S!==d&&(e.font=S,d=S),b=i(y,x.letterSpacing,e)+x.letterSpacing,f[_]=b}return b},g=[];for(const y of s){const x=Ep(y),_=g.length,b=E=>{let A=0,P=E;do{const{token:z,style:M}=x[P];A+=p(z,M),P++}while(P<x.length&&x[P].continuesFromPrevious);return A},S=E=>{const A=[];let P=E;do A.push({token:x[P].token,style:x[P].style}),P++;while(P<x.length&&x[P].continuesFromPrevious);return A};let w=[],v=0,L=!c,R=null;const C=()=>{R&&R.text.length>0&&w.push(R),R=null},k=()=>{if(C(),w.length>0){const E=w[w.length-1];E.text=ee(E.text),E.text.length===0&&w.pop()}g.push(w),w=[],v=0,L=!1};for(let E=0;E<x.length;E++){const{token:A,style:P,continuesFromPrevious:z}=x[E],M=p(A,P);if(c){const D=Gt(A),Y=(R==null?void 0:R.text[R.text.length-1])??((m=w[w.length-1])==null?void 0:m.text.slice(-1))??"",tt=Y?Gt(Y):!1;if(D&&tt)continue}const F=!z,J=F?b(E):M;if(J>u&&F)if(v>0&&k(),h){const D=S(E);for(let Y=0;Y<D.length;Y++){const tt=D[Y].token,U=D[Y].style,ht=gl(tt,h,r,n);for(const mt of ht){const W=p(mt,U);W+v>u&&k(),!R||R.style!==U?(C(),R={text:mt,style:U}):R.text+=mt,v+=W}}E+=D.length-1}else{const D=S(E);C(),g.push(D.map(Y=>({text:Y.token,style:Y.style}))),L=!1,E+=D.length-1}else if(J+v>u&&F){if(Gt(A)){L=!1;continue}k(),R={text:A,style:P},v=M}else if(z&&!h)!R||R.style!==P?(C(),R={text:A,style:P}):R.text+=A,v+=M;else{const D=Gt(A);if(v===0&&D&&!L)continue;!R||R.style!==P?(C(),R={text:A,style:P}):R.text+=A,v+=M}}if(C(),w.length>0){const E=w[w.length-1];E.text=ee(E.text),E.text.length===0&&w.pop()}(w.length>0||g.length===_)&&g.push(w)}return g}function Ep(s){const t=[];let e=!1;for(const i of s){const n=pl(i.text);let r=!0;for(const o of n){const a=Gt(o)||li(o),l=r&&e&&!a;t.push({token:o,style:i.style,continuesFromPrevious:l}),e=!a,r=!1}}return t}const Lp={willReadFrequently:!0};function So(s,t,e,i,n){let r=e[s];return typeof r!="number"&&(r=n(s,t,i)+t,e[s]=r),r}function Fp(s,t,e,i,n,r,o){const a=e.getContext("2d",Lp);a.font=t._fontString;let l=0,h="";const c=[],u=Object.create(null),{letterSpacing:f,whiteSpace:d}=t,p=dl(d),g=fl(d);let m=!p;const y=t.wordWrapWidth+f,x=pl(s);for(let b=0;b<x.length;b++){let S=x[b];if(li(S)){if(!g){c.push(ee(h)),m=!p,h="",l=0;continue}S=" "}if(p){const v=Gt(S),L=Gt(h[h.length-1]);if(v&&L)continue}const w=So(S,f,u,a,i);if(w>y)if(h!==""&&(c.push(ee(h)),h="",l=0),n(S,t.breakWords)){const v=gl(S,t.breakWords,o,r);for(const L of v){const R=So(L,f,u,a,i);R+l>y&&(c.push(ee(h)),m=!1,h="",l=0),h+=L,l+=R}}else h.length>0&&(c.push(ee(h)),h="",l=0),c.push(ee(S)),m=!1,h="",l=0;else w+l>y&&(m=!1,c.push(ee(h)),h="",l=0),(h.length>0||!Gt(S)||m)&&(h+=S,l+=w)}const _=ee(h);return _.length>0&&c.push(_),c.join(` 300`)}const Ao={willReadFrequently:!0},ae=class N{static get experimentalLetterSpacingSupported(){let t=N._experimentalLetterSpacingSupported;if(t===void 0){const e=K.get().getCanvasRenderingContext2D().prototype;t=N._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,n,r,o,a,l,h,c){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h,c&&(this.runsByLine
300=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,i=N._canvas,n=e.wordWrap){var b;const r=`${t}-${e.styleKey}-wordWrap-${n}`;if(N._measurementCache.has(r))return N._measurementCache.get(r);if(cl(e)&&ul(t)){const S=Ip(t,e,n,N._context,N._measureText,N._measureTextAdvance,N.measureFont,N.canBreakChars,N.wordWrapSplit),w=new N(t,e,S.width,S.height,S.lines,S.lineWidths,S.lineHeight,S.maxLineWidth,S.fontProperties,{runsByLine:S.runsByLine,lineAscents:S.lineAscents,lineDescents:S.lineDescents,lineHeights:S.lineHeights,hasDropShadow:S.hasDropShadow});return N._measurementCache.set(r,w),w}const a=e._fontString,l=N.measureFont(a);l.fontSize===0&&(l.fontSize=e.fontSize,l.ascent=e.fontSize,l.descent=0);const h=N._context;h.font=a;const u=(n?N._wordWrap(t,e,i):t).split(Tp),f=new Array(u.length);let d=0;for(let S=0;S<u.length;S++){const w=N._measureText(u[S],e.letterSpacing,h);f[S]=w,d=Math.max(d,w)}const p=((b=e._stroke)==null?void 0:b.width)??0,g=e.lineHeight||l.fontSize,m=N._adju
300stWidthForStyle(d,e),y=Math.max(g,l.fontSize+p)+(u.length-1)*(g+e.leading),x=N._adjustHeightForStyle(y,e),_=new N(t,e,m,x,u,f,g+e.leading,d,l);return N._measurementCache.set(r,_),_}static _adjustWidthForStyle(t,e){var r;const i=((r=e._stroke)==null?void 0:r.width)||0;let n=t+i;return e.dropShadow&&(n+=e.dropShadow.distance),n}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _measureText(t,e,i){const{metricWidth:n,metrics:r,letterSpacingVal:o}=N._measureTextCore(t,e,i),a=-(r.actualBoundingBoxLeft??0);let h=(r.actualBoundingBoxRight??0)-a;return r.width>0&&(h+=o),Math.max(n,h)}static _measureTextAdvance(t,e,i){return N._measureTextCore(t,e,i).metricWidth}static _measureTextCore(t,e,i){let n=!1;N.experimentalLetterSpacingSupported&&(N.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,n=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const r=i.measureText(t);let o=r.width,a=0;return o>0&&(n?a=-e:a=(N.graphemeSegmenter(t).length-1)*e,o+=a),{metricWidth:o,metrics:r,letterSpacingVal:a}}static _wordWrap(t,e,i=N._canvas){return Fp(t,e,i,N._measureTextAdvance,N.canBreakWords,N.canBreakChars,N.wordWrapSplit)}static isBreakingSpace(t,e){return Gt(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,n,r){return!0}static wordWrapSplit(t){return N.graphemeSegmenter(t)}static measureFont(t){if(N._fonts[t])return N._fonts[t];const e=N._context;e.font=t;const i=e.measureText(N.METRICS_STRING+N.BASELINE_SYMBOL),n=i.actualBoundingBoxAscent??0,r=i.actualBoundingBoxDescent??0,o={ascent:n,descent:r,fontSize:n+r};return N._fonts[t]=o,o}static clearMetrics(t=""){t?delete N._fonts[t]:N._fonts={}}static get _canvas(){if(!N.__canvas){let t;try{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",Ao);if(i!=null&&i.measureText)return N.__canvas=e,e;t=K.get().createCanvas()}catch{t=K.get().createCanvas()}t.width=t.height=10,N.__canvas=t}return N.__canvas}static get _context(){return N.__context||(N.__context=N._canvas.getContext("2d",Ao)),N.__context}};ae.METRICS_STRING="|ÃqÃ
";ae.BASELINE_SYMBOL="M";ae.BASELINE_MULTIPLIER=1.4;ae.HEIGHT_MULTIPLIER=2;ae.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>{const e=s.segment(t),i=[];let n=0;for(const r of e)i[n++]=r.segment;return i}}return s=>[...s]})();ae.experimentalLetterSpacing=!1;ae._fonts={};ae._measurementCache=gp(1e3);let le=ae;const Bp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function kn(s){const t=typeof s.fontSize=="number"?`${s.fontSize}px`:s.fontSize;let e=s.fontFamily;Array.isArray(s.fontFamily)||(e=s.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let n=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Bp.includes(n)&&(n=`"${n}"`),e[i]=n}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const Co=1e5;function $s(s,t,e,i=0,n=0,r=0){if(s.texture===et.WHITE&&!s.fill)return lt.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof bi){const o=s.fill,a=t.createPattern(o.texture.source.resource,"repeat");return rt.applyPatternTransform(a,o.transform,!1),a}else if(s.fill instanceof oe){const o=s.fill,a=o.type==="linear",l=o.textureSpace==="local";let h=1,c=1;l&&e&&(h=e.width+i,c=e.height+i);let u,f=!1;if(a){const{start:d,end:p}=o;u=t.createLinearGradient(d.x*h+n,d.y*c+r,p.x*h+n,p.y*c+r),f=Math.abs(p.x-d.x)<Math.abs((p.y-d.y)*.1)}else{const{center:d,innerRadius:p,outerCenter:g,outerRadius:m}=o;u=t.createRadialGradient(d.x*h+n,d.y*c+r,p*h,g.x*h+n,g.y*c+r,m*h)}if(f&&l&&e){const d=e.lineHeight/c;for(let p=0;p<e.lines.length;p++){const g=(p*e.lineHeight+i/2)/c;o.colorStops.forEach(m=>{let y=g+m.offset*d;y=Math.max(0,Math.min(1,y)),u.addColorStop(Math.floor(y*Co)/Co,lt.shared.setValue(m.color).toHex())})}}else o.colorStops.forEach(d=>{u.addColorStop(d.offset,lt.shared.setValue(d.color).toHex())});return u}}else{const o=t.createPattern(s.texture.source.resource,"repeat"),a=s.matrix.copyTo(j.shared);return a.scale(s.texture.source.pixelWidth,s.texture.source.pixelHeight),o.setTransform(a),o}return at("FillStyle not recognised",s),"red"}const Mo=new gt;function Ee(s){let t=0;for(let e=0;e<s.length;e++)s.charCodeAt(e)===32&&t++;return t}class Gp{getCanvasAndContext(t){const{text:e,style:i,resolution:n=1}=t,r=i._getFinalPadding(),o=le.measureText(e||" ",i),a=Math.ceil(Math.ceil(Math.max(1,o.width)+r*2)*n),l=Math.ceil(Math.ceil(Math.max(1,o.height)+r*2)*n),h=Mn.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(i,r,n,h,o);const c=i.trim?fp({canvas:h.canvas,width:a,height:l,resolution:1,output:Mo}):Mo.set(0,0,a,l);return{canvasAndContext:h,frame:c}}returnCanvasAndContext(t){Mn.returnCanvasAndContext(t)}
300_renderTextToCanvas(t,e,i,n,r){var S,w,v;if(r.runsByLine&&r.runsByLine.length>0){this._renderTaggedTextToCanvas(r,t,e,i,n);return}const{canvas:o,context:a}=n,l=kn(t),h=r.lines,c=r.lineHeight,u=r.lineWidths,f=r.maxLineWidth,d=r.fontProperties,p=o.height;if(a.resetTransform(),a.scale(i,i),a.textBaseline=t.textBaseline,(S=t._stroke)!=null&&S.width){const L=t._stroke;a.lineWidth=L.width,a.miterLimit=L.miterLimit,a.lineJoin=L.join,a.lineCap=L.cap}a.font=l;let g,m;const y=t.dropShadow?2:1,_=(((w=t._stroke)==null?void 0:w.width)??0)/2;let b=(c-d.fontSize)/2;c-d.fontSize<0&&(b=0);for(let L=0;L<y;++L){const R=t.dropShadow&&L===0,C=R?Math.ceil(Math.max(1,p)+e*2):0,k=C*i;if(R)this._setupDropShadow(a,t,i,k);else{const E=t._gradientBounds,A=t._gradientOffset;if(E){const P={width:E.width,height:E.height,lineHeight:E.height,lines:r.lines};this._setFillAndStrokeStyles(a,t,P,e,_,(A==null?void 0:A.x)??0,(A==null?void 0:A.y)??0)}else A?this._setFillAndStrokeStyles(a,t,r,e,_,A.x,A.y):this._setFillAndStrokeStyles(a,t,r,e,_);a.shadowColor="rgba(0,0,0,0)"}for(let E=0;E<h.length;E++){g=_,m=_+E*c+d.ascent+b,g+=this._getAlignmentOffset(u[E],f,t.align);let A=0;if(t.align==="justify"&&t.wordWrap&&E<h.length-1){const P=Ee(h[E]);P>0&&(A=(f-u[E])/P)}(v=t._stroke)!=null&&v.width&&this._drawLetterSpacing(h[E],t,n,g+e,m+e-C,!0,A),t._fill!==void 0&&this._drawLetterSpacing(h[E],t,n,g+e,m+e-C,!1,A)}}}_renderTaggedTextToCanvas(t,e,i,n,r){var _,b,S;const{canvas:o,context:a}=r,{runsByLine:l,lineWidths:h,maxLineWidth:c,lineAscents:u,lineHeights:f,hasDropShadow:d}=t,p=o.height;a.resetTransform(),a.scale(n,n),a.textBaseline=e.textBaseline;const g=d?2:1;let m=((_=e._stroke)==null?void 0:_.width)??0;for(const w of l)for(const v of w){const L=((b=v.style._stroke)==null?void 0:b.width)??0;L>m&&(m=L)}const y=m/2,x=[];for(let w=0;w<l.length;w++){const v=l[w],L=[];for(const R of v){const C=kn(R.style);a.font=C,L.push({width:le._measureText(R.text,R.style.letterSpacing,a),font:C})}x.push(L)}for(let w=0;w<g;++w){const v=d&&w===0,L=v?Math.ceil(Math.max(1,p)+i*2):0,R=L*n;v||(a.shadowColor="rgba(0,0,0,0)");let C=y;for(let k=0;k<l.length;k++){const E=l[k],A=h[k],P=u[k],z=f[k],M=x[k];let F=y;F+=this._getAlignmentOffset(A,c,e.align);let J=0;if(e.align==="justify"&&e.wordWrap&&k<l.length-1){let tt=0;for(const U of E)tt+=Ee(U.text);tt>0&&(J=(c-A)/tt)}const D=C+P;let Y=F+i;for(let tt=0;tt<E.length;tt++){const U=E[tt],{width:ht,font:mt}=M[tt];if(a.font=mt,a.textBaseline=U.style.textBaseline,(S=U.style._stroke)!=null&&S.width){const nt=U.style._stroke;if(a.lineWidth=nt.width,a.miterLimit=nt.miterLimit,a.lineJoin=nt.join,a.lineCap=nt.cap,v)if(U.style.dropShadow)this._setupDropShadow(a,U.style,n,R);else{const Nt=Ee(U.text);Y+=ht+Nt*J;continue}else{const Nt=le.measureFont(mt),Zt=U.style.lineHeight||Nt.fontSize,yt={width:ht,height:Zt,lineHeight:Zt,lines:[U.text]};a.strokeStyle=$s(nt,a,yt,i*2,Y-i,C)}this._drawLetterSpacing(U.text,U.style,r,Y,D+i-L,!0,J)}const W=Ee(U.text);Y+=ht+W*J}Y=F+i;for(let tt=0;tt<E.length;tt++){const U=E[tt],{width:ht,font:mt}=M[tt];if(a.font=mt,a.textBaseline=U.style.textBaseline,U.style._fill!==void 0){if(v)if(U.style.dropShadow)this._setupDropShadow(a,U.style,n,R);else{const nt=Ee(U.text);Y+=ht+nt*J;continue}else{const nt=le.measureFont(mt),Nt=U.style.lineHeight||nt.fontSize,Zt={width:ht,height:Nt,lineHeight:Nt,lines:[U.text]};a.fillStyle=$s(U.style._fill,a,Zt,i*2,Y-i,C)}this._drawLetterSpacing(U.text,U.style,r,Y,D+i-L,!1,J)}const W=Ee(U.text);Y+=ht+W*J}C+=z}}}_setFillAndStrokeStyles(t,e,i,n,r,o=0,a=0){var l;if(t.fillStyle=e._fill?$s(e._fill,t,i,n*2,o,a):null,(l=e._stroke)!=null&&l.width){const h=r+n*2;t.strokeStyle=$s(e._stroke,t,i,h,o,a)}}_setupDropShadow(t,e,i,n){t.fillStyle="black",t.strokeStyle="black";const r=e.dropShadow,o=r.color,a=r.alpha;t.shadowColor=lt.shared.setValue(o).setAlpha(a).toRgbaString();const l=r.blur*i,h=r.distance*i;t.shadowBlur=l,t.shadowOffsetX=Math.cos(r.angle)*h,t.shadowOffsetY=Math.sin(r.angle)*h+n}_getAlignmentOffset(t,e,i){return i==="right"?e-t:i==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,i,n,r,o=!1,a=0){const{context:l}=i,h=e.letterSpacing;let c=!1;if(le.experimentalLetterSpacingSupported&&(le.experimentalLetterSpacing?(l.letterSpacing=`${h}px`,l.textLetterSpacing=`${h}px`,c=!0):(l.letterSpacing="0px",l.textLetterSpacing="0px")),(h===0||c)&&a===0){o?l.strokeText(t,n,r):l.fillText(t,n,r);return}if(a!==0&&(h===0||c)){const g=t.split(" ");let m=n;const y=l.measureText(" ").width;for(let x=0;x<g.length;
300x++)o?l.strokeText(g[x],m,r):l.fillText(g[x],m,r),m+=l.measureText(g[x]).width+y+a;return}let u=n;const f=le.graphemeSegmenter(t);let d=l.measureText(t).width,p=0;for(let g=0;g<f.length;++g){const m=f[g];o?l.strokeText(m,u,r):l.fillText(m,u,r);let y="";for(let x=g+1;x<f.length;++x)y+=f[x];p=l.measureText(y).width,u+=d-p+h,m===" "&&(u+=a),d=p}}}const Ge=new Gp,er=class ve extends Kt{constructor(t={}){super(),this.uid=pt("textStyle"),this._tick=0,this._cachedFontString=null,Dp(t),t instanceof ve&&(t=t._toObject());const n={...ve.defaultTextStyle,...t};for(const r in n){const o=r;this[o]=n[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({...ve.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ve.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({...Ft.defaultFillStyle,...t},()=>{this._fill=Se({...this._originalFill},Ft.defaultFillStyle)})),this._fill=Se(t===0?"black":t,Ft.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ft.defaultStrokeStyle,...t},()=>{this._stroke=ai({...this._originalStroke},Ft.defaultStrokeStyle)})),this._stroke=ai(t,Ft.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=ve.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const i=e;this[i]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=kn(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new ve(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){var i,n,r,o;
300if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const a=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(i=this._fill)!=null&&i.texture&&this._fill.texture.destroy(a),(n=this._originalFill)!=null&&n.texture&&this._originalFill.texture.destroy(a),(r=this._stroke)!=null&&r.texture&&this._stroke.texture.destroy(a),(o=this._originalStroke)!=null&&o.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,n,r)=>(i[n]===r||(i[n]=r,e==null||e(n,r),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(lt.isColorLike(t)||t instanceof oe||t instanceof bi)}};er.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};er.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 hi=er;function Dp(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=hi.defaultDropShadow;s.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){q(ft,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(lt.isColorLike(e))i.color=e;else if(e instanceof oe||e instanceof bi)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(q(ft,"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&&at("The number of fill colors must match the number of fill gradient stops.");const e=new oe({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),i=t.fillGradientStops.slice(),n=t.fill.map(r=>lt.shared.setValue(r).toNumber());i.forEach((r,o)=>{e.addColorStop(r,n[o])}),s.fill={fill:e}}}function Op(s,t){const{texture:e,bounds:i}=s,n=t._style._getFinalPadding();Ko(i,t._anchor,e);const r=t._anchor._x*n*2,o=t._anchor._y*n*2;i.minX-=n-r,i.minY-=n-o,i.maxX-=n-r,i.maxY-=n-o}class Np{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 Up extends Np{}class ml{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Is({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!=null&&e._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i?!0:t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const n=t._autoResolution?this._renderer.resolution:t.resolution;(i.currentKey!==t.styleKey||t._resolution!==n)&&this._updateGpuText(t),t._didTextUpdate=!1,Op(i,t)}this._renderer.renderPipes.batch.addToBatch(i,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 Up;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:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}ml.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"text"};class yl{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,n){typeof t=="string"&&(q("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof hi||(t.style=new hi(t.style)),t.textureStyle instanceof He||(t.textureStyle=new He(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:r,style:o,textureStyle:a,autoGenerateMipmaps:l}=t,h=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:u}=Ge.getCanvasAndContext({text:r,style:o,resolution:h}),f=np(u.canvas,c.width,c.height,h,l);
300if(a&&(f.source.style=a),o.trim&&(c.pad(o.padding),f.frame.copyFrom(c),f.frame.scale(1/h),f.updateUvs()),o.filters){const d=this._applyFilters(f,o.filters);return this.returnTexture(f),Ge.returnCanvasAndContext(u),d}return this._renderer.texture.initSource(f._source),this._retainCanvasContext||Ge.returnCanvasAndContext(u),f}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&(i!=null&&i.getContext)){const n=i.getContext("2d");n&&Ge.returnCanvasAndContext({canvas:i,context:n})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",pi.returnTexture(t,!0)}renderTextToCanvas(){q("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 i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){var e;return((e=this._activeTextures[t])==null?void 0:e.usageCount)??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),n}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class xl extends yl{constructor(t){super(t,!0)}}xl.extension={type:[G.CanvasSystem],name:"canvasText"};class _l extends yl{constructor(t){super(t,!1)}}_l.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"canvasText"};it.add(xl);it.add(_l);it.add(ml);class To extends cp{constructor(...t){const e=up(t,"Text");super(e,hi),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof He?e.textureStyle:new He(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??Ot.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,n=0;if(this._style.trim){const{frame:r,canvasAndContext:o}=Ge.getCanvasAndContext({text:this.text,style:this._style,resolution:1});Ge.returnCanvasAndContext(o),i=r.width,n=r.height}else{const r=le.measureText(this._text,this._style);i=r.width,n=r.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}it.add(yh,xh);var Wp=`in vec2 aPosition; 301out vec2 vTextureCoord; 302 303uniform vec4 uInputSize; 304uniform vec4 uOutputFrame; 305uniform vec4 uOutputTexture; 306 307vec4 filterVertexPosition( void ) 308{ 309 vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; 310 311 position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; 312 position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; 313 314 return vec4(position, 0.0, 1.0); 315} 316 317vec2 filterTextureCoord( void ) 318{ 319 return aPosition * (uOutputFrame.zw * uInputSize.zw); 320} 321 322void main(void) 323{ 324 gl_Position = filterVertexPosition(); 325 vTextureCoord = filterTextureCoord(); 326} 327`,zp=`struct GlobalFilterUniforms { 328 uInputSize:vec4<f32>, 329 uInputPixel:vec4<f32>, 330 uInputClamp:vec4<f32>, 331 uOutputFrame:vec4<f32>, 332 uGlobalFrame:vec4<f32>, 333 uOutputTexture:vec4<f32>, 334}; 335 336@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms; 337 338struct VSOutput { 339 @builtin(position) position: vec4<f32>, 340 @location(0) uv : vec2<f32> 341 }; 342 343fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32> 344{ 345 var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; 346 347 position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; 348 position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; 349 350 return vec4(position, 0.0, 1.0); 351} 352 353fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32> 354{ 355 return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); 356} 357 358fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32> 359{ 360 return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); 361} 362 363fn getSize() -> vec2<f32> 364{ 365 return gfu.uGlobalFrame.zw; 366} 367 368@vertex 369fn mainVertex( 370 @location(0) aPosition : vec2<f32>, 371) -> VSOutput { 372 return VSOutput( 373 filterVertexPosition(aPosition), 374 filterTextureCoord(aPosition) 375 ); 376}`,Hp=`precision highp float; 377in vec2 vTextureCoord; 378out vec4 finalColor; 379 380uniform sampler2D uTexture; 381uniform vec2 uStrength; 382uniform vec3 uColor; 383uniform float uKnockout; 384uniform float uAlpha; 385 386uniform vec4 uInputSize; 387uniform vec4 uInputClamp; 388 389const float PI = 3.14159265358979323846264; 390 391// Hard-assignment of DIST and ANGLE_STEP_SIZE instead of using uDistance and uQuality to allow them to be use on GLSL loop conditions 392const float DIST = __DIST__; 393const float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.); 394const float ANGLE_STEP_NUM = ceil(PI * 2. / ANGLE_STEP_SIZE); 395const float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.) / 2.; 396 397void main(void) { 398 vec2 px = vec2(1.) / uInputSize.xy; 399 400 float totalAlpha = 0.; 401 402 vec2 direction; 403 vec2 displaced; 404 vec4 curColor; 405 406 for (float angle = 0.; angle < PI * 2.; angle += ANGLE_STEP_SIZE) { 407 direction = vec2(cos(angle), sin(angle)) * px; 408 409 for (float curDistance = 0.; curDistance < DIST; curDistance++) { 410 displaced = clamp(vTextureCoord + direction * (curDistance + 1.), uInputClamp.xy, uInputClamp.zw); 411 curColor = texture(uTexture, displaced); 412 totalAlpha += (DIST - curDistance) * curColor.a; 413 } 414 } 415 416 curColor = texture(uTexture, vTextureCoord); 417
418 vec4 glowColor = vec4(uColor, uAlpha); 419 bool knockout = uKnockout > .5; 420 float innerStrength = uStrength[0]; 421 float outerStrength = uStrength[1]; 422 423 float alphaRatio = totalAlpha / MAX_TOTAL_ALPHA; 424 float innerGlowAlpha = (1. - alphaRatio) * innerStrength * curColor.a * uAlpha; 425 float innerGlowStrength = min(1., innerGlowAlpha); 426 427 vec4 innerColor = mix(curColor, glowColor, innerGlowStrength); 428 float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a) * uAlpha; 429 float outerGlowStrength = min(1. - innerColor.a, outerGlowAlpha); 430 vec4 outerGlowColor = outerGlowStrength * glowColor.rgba; 431 432 if (knockout) { 433 float resultAlpha = outerGlowAlpha + innerGlowAlpha; 434 finalColor = vec4(glowColor.rgb * resultAlpha, resultAlpha); 435 } 436 else { 437 finalColor = innerColor + outerGlowColor; 438 } 439} 440`,Vp=`struct GlowUniforms { 441 uDistance: f32, 442 uStrength: vec2<f32>, 443 uColor: vec3<f32>, 444 uAlpha: f32, 445 uQuality: f32, 446 uKnockout: f32, 447}; 448 449struct GlobalFilterUniforms { 450 uInputSize:vec4<f32>, 451 uInputPixel:vec4<f32>, 452 uInputClamp:vec4<f32>, 453 uOutputFrame:vec4<f32>, 454 uGlobalFrame:vec4<f32>, 455 uOutputTexture:vec4<f32>, 456}; 457 458@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms; 459 460@group(0) @binding(1) var uTexture: texture_2d<f32>; 461@group(0) @binding(2) var uSampler: sampler; 462@group(1) @binding(0) var<uniform> glowUniforms : GlowUniforms; 463 464@fragment 465fn mainFragment( 466 @builtin(position) position: vec4<f32>, 467 @location(0) uv : vec2<f32> 468) -> @location(0) vec4<f32> { 469 let quality = glowUniforms.uQuality; 470 let distance = glowUniforms.uDistance; 471 472 let dist: f32 = glowUniforms.uDistance; 473 let angleStepSize: f32 = min(1. / quality / distance, PI * 2.0); 474 let angleStepNum: f32 = ceil(PI * 2.0 / angleStepSize); 475 476 let px: vec2<f32> = vec2<f32>(1.0 / gfu.uInputSize.xy); 477 478 var totalAlpha: f32 = 0.0; 479 480 var direction: vec2<f32>; 481 var displaced: vec2<f32>; 482 var curColor: vec4<f32>; 483 484 for (var angle = 0.0; angle < PI * 2.0; angle += angleStepSize) { 485 direction = vec2<f32>(cos(angle), sin(angle)) * px; 486 for (var curDistance = 0.0; curDistance < dist; curDistance+=1) { 487 displaced = vec2<f32>(clamp(uv + direction * (curDistance + 1.0), gfu.uInputClamp.xy, gfu.uInputClamp.zw)); 488 curColor = textureSample(uTexture, uSampler, displaced); 489 totalAlpha += (dist - curDistance) * curColor.a; 490 } 491 } 492 493 curColor = textureSample(uTexture, uSampler, uv); 494 495 let glowColorRGB = glowUniforms.uColor; 496 let glowAlpha = glowUniforms.uAlpha; 497 let glowColor = vec4<f32>(glowColorRGB, glowAlpha); 498 let knockout: bool = glowUniforms.uKnockout > 0.5; 499 let innerStrength = glowUniforms.uStrength[0]; 500 let outerStrength = glowUniforms.uStrength[1]; 501 502 let alphaRatio: f32 = (totalAlpha / (angleStepNum * dist * (dist + 1.0) / 2.0)); 503 let innerGlowAlpha: f32 = (1.0 - alphaRatio) * innerStrength * curColor.a * glowAlpha; 504 let innerGlowStrength: f32 = min(1.0, innerGlowAlpha); 505 506 let innerColor: vec4<f32> = mix(curColor, glowColor, innerGlowStrength); 507 let outerGlowAlpha: f32 = alphaRatio * outerStrength * (1. - curColor.a) * glowAlpha; 508 let outerGlowStrength: f32 = min(1.0 - innerColor.a, outerGlowAlpha); 509 let outerGlowColor: vec4<f32> = outerGlowStrength * glowColor.rgba; 510 511 if (knockout) { 512 let resultAlpha: f32 = outerGlowAlpha + innerGlowAlpha; 513 return vec4<f32>(glowColor.rgb * resultAlpha, resultAlpha); 514 } 515 else { 516 return innerColor + outerGlowColor; 517 } 518} 519 520const PI: f32 = 3.14159265358979323846264;`,$p=Object.defineProperty,Yp=(s,t,e)=>t in s?$p(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Pn=(s,t,e)=>(Yp(s,typeof t!="symbol"?t+"":t,e),e);const bl=class wl extends Oc{constructor(t){t={...wl.DEFAULT_OPTIONS,...t};const e=t.distance??10,i=t.quality??.1,n=Ze.from({vertex:{source:zp,entryPoint:"mainVertex"},fragment:{source:Vp,entryPoint:"mainFragment"}}),r=mi.from({vertex:Wp,fragment:Hp.replace(/__ANGLE_STEP_SIZE__/gi,`${(1/i/e).toFixed(7)}`).replace(/__DIST__/gi,`${e.toFixed(0)}.0`),name:"glow-filter"});super({gpuProgram:n,glProgram:r,resources:{glowUniforms:{uDistance:{value:e,type:"f32"}
520,uStrength:{value:[t.innerStrength,t.outerStrength],type:"vec2<f32>"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uAlpha:{value:t.alpha,type:"f32"},uQuality:{value:i,type:"f32"},uKnockout:{value:(t==null?void 0:t.knockout)??!1?1:0,type:"f32"}}},padding:e}),Pn(this,"uniforms"),Pn(this,"_color"),this.uniforms=this.resources.glowUniforms.uniforms,this._color=new lt,this.color=t.color??16777215}get distance(){return this.uniforms.uDistance}set distance(t){this.uniforms.uDistance=this.padding=t}get innerStrength(){return this.uniforms.uStrength[0]}set innerStrength(t){this.uniforms.uStrength[0]=t}get outerStrength(){return this.uniforms.uStrength[1]}set outerStrength(t){this.uniforms.uStrength[1]=t}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,i,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=i,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get quality(){return this.uniforms.uQuality}set quality(t){this.uniforms.uQuality=t}get knockout(){return this.uniforms.uKnockout===1}set knockout(t){this.uniforms.uKnockout=t?1:0}};Pn(bl,"DEFAULT_OPTIONS",{distance:10,outerStrength:4,innerStrength:0,color:16777215,alpha:1,quality:.1,knockout:!1});let Xp=bl;const sr=3*24*60*60*1e3,jp=50;function je(s){return Math.max(0,Math.min(1,s))}function qp(s,t){return s==null?0:s<=0?1:Math.exp(-Math.LN2*s/t)}function vs(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0)%1e6/1e6}function Kp(s,t,e=sr){if(!s)return 0;const i=s.lastVisitMs??s.visitTimeMs??s.createdAtMs??null;return i==null||!Number.isFinite(i)?0:qp(t-i,e)}function Zp(s){const t=typeof s=="number"&&Number.isFinite(s)?Math.max(0,s):0;return je(Math.log(t+1)/Math.log(jp+1))}function si(s,t,e){const i=je(e),n=s>>16&255,r=s>>8&255,o=s&255,a=t>>16&255,l=t>>8&255,h=t&255,c=Math.round(n+(a-n)*i),u=Math.round(r+(l-r)*i),f=Math.round(o+(h-o)*i);return c<<16|u<<8|f}function Qp(s,t){return si(t.cool,t.warm,s)}function Jp(s){return .35+.65*je(s)}function tg(s,t,e){return t+(e-t)*je(s)}function vl(s,t,e,i){const n=vs(i)*Math.PI*2;let r;if(s!=null&&s.length&&(t!=null&&t.length)){const l=Uo(s,t);r=je(1-l)}else r=.35+vs(`${i}:r`)*.5;const o=(vs(`${i}:j`)-.5)*.12,a=je(r+o)*e.radius*.92;return{x:e.cx+Math.cos(n)*a,y:e.cy+Math.sin(n)*a}}function Sl(s){return fh([...s].sort().join(","))}function ko(s,t,e){return typeof s.color=="number"?s.color:e.length?e[(t%e.length+e.length)%e.length]:8947848}const eg={minNodeR:5,maxNodeR:16},Ys=.03,Xs=10,Po=4,sg=.0015,ig=.6,ng=3,rg=1.35,og=1.5,ag=600,lg=18,Al="__collections__",Io=16765286,hg=1.25,Ro=1;function cg(s,t){return s.length>t?`${s.slice(0,t-1).trimEnd()}â¦`:s}function ug(s,t,e,i,n){const r=[];for(let h=0;h<e;h++){const c=i+h/e*Math.PI*2;r.push({x:Math.cos(c)*t,y:Math.sin(c)*t})}const o=(h,c,u)=>{const f=c.x-h.x,d=c.y-h.y,p=Math.hypot(f,d)||1,g=Math.min(u,p*.5)/p;return{x:h.x+f*g,y:h.y+d*g}},a=r.map((h,c)=>o(h,r[(c-1+e)%e],n)),l=r.map((h,c)=>o(h,r[(c+1)%e],n));s.moveTo(l[0].x,l[0].y);for(let h=1;h<=e;h++){const c=h%e;s.lineTo(a[c].x,a[c].y),s.quadraticCurveTo(r[c].x,r[c].y,l[c].x,l[c].y)}s.closePath()}function me(s,t,e){t?ug(s,e,4,0,e*.16):s.circle(0,0,e)}function Le(s){const t=s.cartography,e=(t==null?void 0:t.track)??s.freshRamp.warm,i=(t==null?void 0:t.ink)??s.text.region;return{paper:(t==null?void 0:t.paper)??s.background,ink:i,track:e,trackGlow:(t==null?void 0:t.trackGlow)??e,trackWidth:(t==null?void 0:t.trackWidth)??2,gridNodeRing:(t==null?void 0:t.gridNodeRing)??s.node.stroke??s.text.node,boundary:(t==null?void 0:t.boundary)??i,hub:(t==null?void 0:t.hub)??e,vignette:t==null?void 0:t.vignette}}class dg{constructor(t,e,i={}){Q(this,"app",new Wa);Q(this,"world",new At);Q(this,"washLayer",new xt);Q(this,"boundaryLayer",new xt);Q(this,"tracksLayer",new At);Q(this,"tracksGfx",new xt);Q(this,"glyphLayer",new At);Q(this,"itemLabelLayer",new At);Q(this,"drillHubLayer",new At);Q(this,"drillLabelLayer",new At);Q(this,"model",null);Q(this,"theme");Q(this,"options",eg);Q(this,"trackGlowFilter",null);Q(this,"trackGlowColor",null);Q(this,"selectedId",null);Q(this,"highlightKey",null);Q(this,"initialized",!1);Q(this,"destroyed",!1);Q(this,"focusPath",[]);Q(this,"dragging",!1);Q(this,"dragMoved",!1);Q(this,"dragStart",{x:0,y:0});Q(this,"lastPointer",{x:0,y:0});Q(this,"wheelHandler",null);Q(this,"activePointers",new Map);Q(this,"pinch",null);Q(this,"anim",null);Q(this,"tappedTarget",!1);Q(this,"tick",()=>{if(!this.anim)return;const t=this.anim;t.elapsed+=this.app.ticker.deltaMS;const e=Math.min(1,t.elapsed/t.dur),i=e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;this.world.scale.set(t.fromS+(t.toS-t.fromS)*i),this.world.position.set(t.fromX+(t.toX-t.fromX)*i,t.fromY+(t.toY-t.fromY)*i),this.updateZoomDependent(),e>=1&&(this.anim=null)});this.host=t,this.callbacks=i,this.theme=e}
520async init(){const t=Math.max(320,this.host.clientWidth),e=Math.max(320,this.host.clientHeight);if(await this.app.init({width:t,height:e,antialias:!0,autoDensity:!0,resolution:Math.min(window.devicePixelRatio||1,2),background:Le(this.theme).paper}),this.destroyed){this.app.destroy(!0,{children:!0});return}this.host.appendChild(this.app.canvas),this.app.canvas.style.display="block",this.tracksLayer.addChild(this.tracksGfx),this.world.addChild(this.washLayer),this.world.addChild(this.boundaryLayer),this.world.addChild(this.tracksLayer),this.world.addChild(this.glyphLayer),this.world.addChild(this.itemLabelLayer),this.world.addChild(this.drillHubLayer),this.world.addChild(this.drillLabelLayer),this.app.stage.addChild(this.world);for(const i of[this.washLayer,this.boundaryLayer,this.tracksLayer,this.itemLabelLayer])i.eventMode="none";this.setupCamera(),this.app.ticker.add(this.tick),this.initialized=!0,this.redraw(),this.snapToCurrent(!1),this.emitNav()}nodeById(t){return!t||!this.model?null:this.model.nodes.find(e=>e.id===t)??null}childrenOf(t){return this.model?this.model.nodes.filter(e=>e.parentId===(t??null)):[]}focusedNode(){return this.nodeById(this.focusPath[this.focusPath.length-1]??null)}focusedLeafId(){const t=this.focusedNode();return t!=null&&t.isLeaf?t.id:null}ancestorPath(t){var r;const e=[];let i=t;const n=new Set;for(;i&&!n.has(i);)n.add(i),e.unshift(i),i=((r=this.nodeById(i))==null?void 0:r.parentId)??null;return e}boundsTarget(t,e,i,n,r){const o=Math.max(1,i*2*r),a=Math.max(1,n*2*r),l=this.app.screen.width,h=this.app.screen.height,c=Math.max(Ys,Math.min(Xs,Math.min(l/o,h/a)));return{scale:c,x:l/2-t*c,y:h/2-e*c}}targetForCurrent(){var e;const t=this.focusedNode();if(!t)return this.computeFit();if(t.isLeaf){const i=this.selectedId?(e=this.model)==null?void 0:e.glyphs.find(n=>n.nodeId===this.selectedId&&n.regionId===t.id):null;return this.boundsTarget((i==null?void 0:i.x)??t.cx,(i==null?void 0:i.y)??t.cy,t.layoutRadius,t.layoutRadius,Ro)}return this.boundsTarget(t.cx,t.cy,t.radius,t.radius,hg)}snapToCurrent(t=!0){const e=this.targetForCurrent();e&&(this.syncDrillTargets(),this.syncLeafLabels(),this.applyLOD(),t?this.tweenTo(e.scale,e.x,e.y):(this.anim=null,this.world.scale.set(e.scale),this.world.position.set(e.x,e.y),this.updateZoomDependent()))}emitNav(){var e,i;const t=[{id:null,label:"Overview",isLeaf:!1}];for(const n of this.focusPath){const r=this.nodeById(n);t.push({id:n,label:(r==null?void 0:r.label)??"â¦",isLeaf:!!(r!=null&&r.isLeaf)})}(i=(e=this.callbacks).onNavChange)==null||i.call(e,t)}focusNode(t){this.focusPath=this.ancestorPath(t.id),this.snapToCurrent(),this.emitNav()}popLevel(){this.focusPath.length&&(this.focusPath.pop(),this.snapToCurrent(),this.emitNav())}jumpToLevel(t){t<0||(this.focusPath=this.focusPath.slice(0,t),this.snapToCurrent(),this.emitNav())}resetView(){this.focusPath=[],this.snapToCurrent(),this.emitNav()}revealTarget(t,e={}){var n,r;if(!this.model||!this.initialized||this.destroyed)return!1;if(t.kind==="item"){const o=this.model.glyphs.find(l=>l.nodeId===t.id);if(!o)return!1;const a=this.nodeById(o.regionId);return a?(this.setSelected(t.id),this.focusNode(a),e.open&&((r=(n=this.callbacks).onLeafSelect)==null||r.call(n,o)),!0):!1}const i=this.nodeById(t.id);return i?(this.selectedId&&this.setSelected(null),this.focusNode(i),!0):!1}setWorld(t,e,i){this.model=t,e&&(this.theme=e),i&&(this.options={...this.options,...i}),!(!this.initialized||this.destroyed)&&(this.app.renderer.background.color=Le(this.theme).paper,this.focusPath=[],this.redraw(),this.snapToCurrent(!1),this.emitNav())}setTheme(t){this.theme=t,!(!this.initialized||this.destroyed)&&(this.app.renderer.background.color=Le(t).paper,this.redraw())}setSelected(t){this.selectedId=t,this.initialized&&!this.destroyed&&this.redraw()}setHighlight(t){this.highlightKey=t||null,this.initialized&&!this.destroyed&&this.redraw()}matchesHighlight(t){return this.highlightKey?this.highlightKey===Al?t.isCollection:(t.subType??"")===this.highlightKey:!1}resize(t,e){!this.initialized||this.destroyed||(this.app.renderer.resize(Math.max(320,Math.floor(t)),Math.max(320,Math.floor(e))),this.app.stage.hitArea=this.app.screen,this.snapToCurrent(!1))}destroy(){var t;if(this.destroyed=!0,this.wheelHandler&&this.app.canvas&&(this.app.canvas.removeEventListener("wheel",this.wheelHandler),this.wheelHandler=null),(t=this.trackGlowFilter)==null||t.destroy(),this.trackGlowFilter=null,this.initialized)try{this.app.destroy(!0,{children:!0})}catch{}}clearLayer(t){for(const e of t.removeChildren())e.destroy({children:!0})}redraw(){var i;this.washLayer.clear(),this.boundaryLayer.clear(),this.tracksGfx.clear();for(const n of[this.glyphLayer,this.itemLabelLayer,this.drillHubLayer,this.drillLabelLayer])this.clearLayer(n);if(!this.model)return;const t=Le(this.theme),e=this.theme.regionPalette;for(const n of this.model.nodes){const r=ko(n,n.paletteIndex,e);if(n.isLeaf){const o=n.layoutRadius;this.washLayer.circle(n.cx,n.cy,o).fill({color:r,alpha:.05}),this.washLayer.circle(n.cx,n.cy,o*.58).fill({color:r,alpha:.05}),this.boundaryLayer.circle(n.cx,n.cy,o).stroke({color:t.boundary,width:2.4,alpha:.5}),this.boundaryLayer.circle(n.cx,n.cy,o-4).stroke({color:t.boundary,width:1,alpha:.28})}else this.washLayer.circle(n.cx,n.cy,n.radius).fill({color:r,alpha:.04}),this.boundaryLayer.circle(n.cx,n.cy,n.radius).stroke({color:t.boundary,width:1.5,alpha:.22})}for(const n of this.model.tracks)this.strokeTrack(this.tracksGfx,n,t.track,t.trackWidth,.16,.64);(!this.trackGlowFilter||this.trackGlowColor!==t.trackGlow)&&((i=this.trackGlowFilter)==null||i.destroy(),this.trackGlowFilter=new Xp({distance:12,outerStrength:2,innerStrength:0,color:t.trackGlow,quality:.3}),this.trackGlowColor=t.trackGlow,this.tracksLayer.filters=[this.trackGlowFilter]);for(const n of this.model.glyphs)this.glyphLayer.addChild(this.buildGlyph(n,t));this.syncDrillTargets(),this.syncLeafLabels(),this.applyLOD(),this.updateZoomDependent()}syncDrillTargets(){if(this.clearLayer(this.drillHubLayer),this.clearLayer(this.drillLabelLayer),!this.model)return;const t=this.focusedNode();if(t!=null&&t.isLeaf)return;const e=Le(this.theme),i=this.theme.regionPalette;for(const n of this.childrenOf((t==null?void 0:t.id)??null))this.drillHubLayer.addChild(this.buildNodeHub(n,e,i)),this.drillLabelLayer.addChild(this.buildNodeLabel(n,e))}syncLeafLabels(){var r;if(this.clearLayer(this.itemLabelLayer),!this.model)return;const t=this.focusedLeafId();if(!t)return;const e=Le(this.theme),i=((r=this.targetForCurrent())==null?void 0:r.scale)??this.world.scale.x??1;let n=0;for(const o of this.model.glyphs){if(o.regionId!==t)continue;const a=!!o.imageUrl||!!o.secureFileId;if(a&&this.itemLabelLayer.addChild(this.buildLeafThumb(o,e)),this.itemLabelLayer.addChild(this.buildLeafName(o,e,i,a)),++n>=ag)break}}strokeTrack(t,e,i,n,r,o){const a=e.points;if(!(a.length<4)){t.moveTo(a[0],a[1]);for(let l=2;l<a.length;
520l+=2)t.lineTo(a[l],a[l+1]);t.stroke({width:n,color:i,alpha:r+o*e.recency})}}nodeRadius(t){const e=tg(t.frequency,this.options.minNodeR,this.options.maxNodeR);return t.isCollection?e*1.3:e}buildGlyph(t,e){const i=this.nodeRadius(t),n=t.isCollection,r=this.selectedId===t.nodeId,o=this.highlightKey!=null,a=this.matchesHighlight(t),l=o&&!a,h=new At;h.position.set(t.x,t.y);let c=Qp(t.recency,this.theme.freshRamp),u=Jp(t.recency);if(t.isGate&&(c=si(e.paper,0,.45),u=.6),l&&(u*=.16),typeof this.theme.node.shadow=="number"){const y=new xt;me(y,n,i+1.2),y.fill({color:this.theme.node.shadow,alpha:l?.08:.28}),h.addChild(y)}if(a){const y=new xt;y.circle(0,0,i*2.4).fill({color:Io,alpha:.22}),y.blendMode="add",h.addChild(y)}else if(!t.isGate&&!l&&t.recency>.5){const y=new xt;y.circle(0,0,i*2.3).fill({color:c,alpha:.16}),y.blendMode="add",h.addChild(y)}const f=new xt;me(f,n,i),f.fill({color:c,alpha:u}),h.addChild(f);const d=a?Io:e.gridNodeRing,p=a?2.4:1.4,g=l?.25:t.isGate?.45:a?1:.85,m=new xt;if(me(m,n,i),m.stroke({color:d,width:p,alpha:g}),h.addChild(m),!t.isGate&&!l&&t.recency>.35){const y=new xt;y.circle(0,0,Math.max(1.4,i*.28)).fill({color:16777215,alpha:.5*t.recency}),h.addChild(y)}if(r){const y=new xt;me(y,n,i+4),y.stroke({color:16777215,width:2,alpha:.95}),h.addChild(y)}return h.eventMode="static",h.cursor="pointer",h.hitArea=new Oe(0,0,Math.max(i,6)+5),h.on("pointerover",()=>{var y,x;return(x=(y=this.callbacks).onPeek)==null?void 0:x.call(y,t)}),h.on("pointerout",()=>{var y,x;return(x=(y=this.callbacks).onPeek)==null?void 0:x.call(y,null)}),h.on("pointertap",()=>{if(this.tappedTarget=!0,this.dragMoved)return;const y=this.focusedLeafId()===t.regionId;this.revealTarget({kind:"item",id:t.nodeId},{open:y})}),h}medallionRadius(t){return this.nodeRadius(t)+3}buildLeafName(t,e,i,n){const r=this.nodeRadius(t),o=new To({text:cg(t.label,lg),style:{fill:e.ink,fontSize:11,fontFamily:this.theme.text.font||"inherit",align:"center"}});o.anchor.set(.5,0);const a=n?this.medallionRadius(t):r;return o.position.set(t.x,t.y+a+6/(i||1)),o.alpha=t.isGate?.5:.9,o}async resolveThumbSource(t){if(t.imageUrl)return t.imageUrl;if(t.secureFileId&&this.callbacks.resolveSecureImage)try{return await this.callbacks.resolveSecureImage(t.secureFileId)}catch{return null}return null}buildLeafThumb(t,e){const i=this.medallionRadius(t),n=t.isCollection,r=new At;r._kmWorld=!0,r.position.set(t.x,t.y),r.visible=!1;const o=new xt;me(o,n,i),o.fill({color:e.paper,alpha:1});const a=new $e;a.anchor.set(.5,.5);const l=new xt;me(l,n,i),l.fill({color:16777215}),a.mask=l;const h=new xt;return me(h,n,i),h.stroke({color:e.gridNodeRing,width:1.4,alpha:.9}),r.addChild(o,l,a,h),this.resolveThumbSource(t).then(c=>!c||this.destroyed||r.destroyed?(r.destroyed||r.destroy({children:!0}),null):ms.load(c)).then(c=>{!c||this.destroyed||r.destroyed||a.destroyed||!(c!=null&&c.width)||(a.texture=c,a.scale.set(i*2/Math.min(c.width,c.height)),r.visible=!0)}).catch(()=>{r.destroyed||r.destroy({children:!0})}),r}buildNodeHub(t,e,i){const n=ko(t,t.paletteIndex,i),r=new At;if(r.position.set(t.cx,t.cy),t.isLeaf){const c=si(n,16777215,.25*t.meanRecency),u=new xt;return u.circle(0,0,9).fill({color:c,alpha:.95}),u.circle(0,0,9).stroke({color:e.boundary,width:1.6,alpha:.85}),r.addChild(u),this.makeFocusable(r,new Oe(0,0,22),()=>this.focusNode(t)),r}const o=si(n,16777215,.3*t.meanRecency),a=new xt;a.circle(0,0,30).fill({color:e.hub,alpha:.1+.2*t.meanRecency}),a.blendMode="add",r.addChild(a);const l=new xt;l.circle(0,0,17).fill({color:o,alpha:.96}),l.circle(0,0,17).stroke({color:e.boundary,width:2.4,alpha:.95}),r.addChild(l);const h=new xt;return h.circle(0,0,5).fill({color:16777215,alpha:.35+.5*t.meanRecency}),r.addChild(h),this.makeFocusable(r,new Oe(0,0,34),()=>this.focusNode(t)),r}buildNodeLabel(t,e){const i=!t.isLeaf,n=new To({text:t.label,style:{fill:e.ink,fontSize:i?19:13,fontWeight:i?"700":"600",fontFamily:this.theme.text.font||"inherit",letterSpacing:i?1:0}});return n.anchor.set(.5,1),n.position.set(t.cx,i?t.cy-26:t.cy-t.layoutRadius-6),this.makeFocusable(n,null,()=>this.focusNode(t)),n}makeFocusable(t,e,i){t.eventMode="static",t.cursor="zoom-in",e&&(t.hitArea=e),t.on("pointertap",()=>{this.tappedTarget=!0,this.dragMoved||i()})}applyLOD(){var i;const t=this.focusPath.length===0,e=!!((i=this.focusedNode())!=null&&i.isLeaf);this.washLayer.visible=!0,this.boundaryLayer.visible=!0,this.drillHubLayer.visible=!0,this.drillLabelLayer.visible=!0,this.glyphLayer.visible=!t,this.tracksLayer.visible=!t,this.itemLabelLayer.visible=e}applyScaleLOD(){var e,i;if(!this.model)return;const t=this.world.scale.x||1;if(this.focusPath.length===0){const n=this.computeFit();if(!n)return;const r=t>n.scale*og;this.glyphLayer.visible=r,this.tracksLayer.visible=r;return}if((e=this.focusedNode())!=null&&e.isLeaf){const n=((i=this.targetForCurrent())==null?void 0:i.scale)??t;this.itemLabelLayer.visible=t>n*.55}}updateZoomDependent(){const t=1/(this.world.scale.x||1);for(const e of[this.itemLabelLayer,this.drillHubLayer,this.drillLabelLayer])for(const i of e.children)i._kmWorld||i.scale.set(t);this.applyScaleLOD()}setupCamera(){const t=this.app.stage;t.eventMode="static",t.hitArea=this.app.screen,this.app.canvas.style.touchAction="none",t.on("pointerdown",i=>{if(this.activePointers.set(i.pointerId,{x:i.global.x,y:i.global.y}),this.activePointers.size===2){this.dragging=!1,this.dragMoved=!0,this.pinch=this.pinchState();return}this.dragging=!0,this.dragMoved=!1,this.tappedTarget=!1,this.dragStart={x:i.global.x,y:i.global.y},this.lastPointer={x:i.global.x,y:i.global.y}}),t.on("pointertap",()=>{this.dragMoved||this.tappedTarget||(this.zoomedFarFromRest()?this.snapToCurrent():this.popLevel())}),t.on("pointermove",i=>{const n=this.activePointers.get(i.pointerId);if(n&&(n.x=i.global.x,n.y=i.global.y),this.pinch&&this.activePointers.size>=2){const a=this.pinchState();if(!a)return;this.world.position.x+=a.midX-this.pinch.midX,this.world.position.y+=a.midY-this.pinch.midY,this.pinch.dist>0?this.zoomAt(a.midX,a.midY,a.dist/this.pinch.dist):this.clampPan(),this.pinch=a;return}if(!this.dragging)return;const r=i.global.x-this.dragStart.x,o=i.global.y-this.dragStart.y;(Math.abs(r)>Po||Math.abs(o)>Po)&&(this.dragMoved=!0),this.dragMoved&&!this.anim&&(this.world.position.x+=i.global.x-this.lastPointer.x,this.world.position.y+=i.global.y-this.lastPointer.y,this.clampPan()),this.lastPointer={x:i.global.x,y:i.global.y}});const e=i=>{this.activePointers.delete(i.pointerId),this.activePointers.size<2&&(this.pinch=null),this.dragging=!1};t.on("pointerup",e),t.on("pointerupoutside",e),t.on("pointercancel",e),this.wheelHandler=i=>{i.preventDefault();const n=i.deltaMode===1?16:i.deltaMode===2?120:1;this.zoomAt(i.offsetX,i.offsetY,Math.exp(-i.deltaY*n*sg))},this.app.canvas.addEventListener("wheel",this.wheelHandler,{passive:!1})}pinchState(){const t=[...this.activePointers.values()];if(t.length<2)return null;const[e,i]=t;return{dist:Math.hypot(i.x-e.x,i.y-e.y),midX:(e.x+i.x)/2,midY:(e.y+i.y)/2}}zoomBounds(){var o;const t=this.computeFit();if(!t)return{min:Ys,max:Xs};const e=Math.min(this.app.screen.width,this.app.screen.height);let i=0;for(const a of((o=this.model)==null?void 0:o.nodes)??[]){if(!a.isLeaf)continue;const l=e/Math.max(1,a.layoutRadius*2*Ro);l>i&&(i=l)}const n=Math.max(Ys,t.scale*ig),r=Math.min(Xs,Math.max(n*4,(i||t.scale*8)*ng));return{min:n,max:r}}zoomAt(t,e,i){const{min:n,max:r}=this.zoomBounds(),o=this.world.scale.x||1,a=Math.min(r,Math.max(n,o*i));if(a===o){this.clampPan();return}const l=(t-this.world.position.x)/o,h=(e-this.world.position.y)/o;this.anim=null,this.world.scale.set(a),this.world.position.set(t-l*a,e-h*a),this.clampPan(),this.updateZoomDependent()}zoomedFarFromRest(){var i;const t=(i=this.targetForCurrent())==null?void 0:i.scale;if(!t)return!1;const e=this.world.scale.x||1;return Math.abs(Math.log(e/t))>Math.log(rg)}clampPan(){if(!this.model)return;const{minX:t,minY:e,maxX:i,maxY:n}=this.model.bbox,r=(t+i)/2,o=(e+n)/2,a=Math.max(1,(i-t)/2)*1.05,l=Math.max(1,(n-e)/2)*1.05,h=this.world.scale.x||1,c=(u,f,d,p)=>{const g=f/2-(d+p)*h,m=f/2-(d-p)*h;return g>m?f/2-d*h:Math.min(m,Math.max(g,u))};this.world.position.x=c(this.world.position.x,this.app.screen.width,r,a),this.world.position.y=c(this.world.position.y,this.app.screen.height,o,l)}computeFit(){if(!this.model)return null;const{minX:t,minY:e,maxX:i,maxY:n}
520=this.model.bbox,r=Math.max(1,i-t),o=Math.max(1,n-e),a=this.app.screen.width,l=this.app.screen.height,h=Math.max(Ys,Math.min(Xs,Math.min(a/r,l/o)*.9)),c=(t+i)/2,u=(e+n)/2;return{scale:h,x:a/2-c*h,y:l/2-u*h}}tweenTo(t,e,i,n=520){this.anim={fromS:this.world.scale.x,toS:t,fromX:this.world.position.x,toX:e,fromY:this.world.position.y,toY:i,elapsed:0,dur:n}}}const In=[{id:"atlas",label:"Atlas",background:15524815,regionPalette:[10135659,8231798,11573854,8822952,11569770,9408430],freshRamp:{warm:12938046,cool:13616811},node:{stroke:7035452,strokeWidth:1.4,shadow:13483933,shape:"circle"},text:{region:5917230,node:4865064,font:'Georgia, "Times New Roman", serif'},cartography:{paper:15524815,ink:7035452,track:12088378,trackGlow:14722922,trackWidth:2,gridNodeRing:7035452,boundary:9075282,hub:10903854,vignette:3813148}},{id:"night-sky",label:"Night Sky",background:725024,regionPalette:[3886458,4876943,5918586,6978127,8015706,5208682],freshRamp:{warm:16765567,cool:2832999},node:{stroke:1779015,strokeWidth:1,shadow:329487,shape:"circle"},text:{region:10466264,node:14673915}},{id:"parchment",label:"Parchment",background:15985362,regionPalette:[10257494,9071931,11040063,7305807,10115644,6257258],freshRamp:{warm:11887901,cool:13418403},node:{stroke:14207395,strokeWidth:1,shadow:14207395,shape:"circle"},text:{region:5982770,node:4865064}},{id:"minimal",label:"Minimal",background:16250872,regionPalette:[5213439,7107965,2139038,10185983,14711391,5873999],freshRamp:{warm:5213439,cool:13685978},node:{stroke:14869994,strokeWidth:1,shape:"circle"},text:{region:7041664,node:3621201}},{id:"synthwave",label:"Synthwave",background:1706798,regionPalette:[16723897,58879,10309341,16740039,3602934,16196997],freshRamp:{warm:16723897,cool:3811947},node:{stroke:58879,strokeWidth:1.5,shadow:656416,shape:"circle"},text:{region:58879,node:16766709,font:"monospace"},cartography:{paper:1706798,ink:58879,track:16723897,trackGlow:58879,trackWidth:2,gridNodeRing:58879,boundary:7158686,hub:16740039,vignette:327951},fx:{glow:!0,gridHorizon:!0,gridColor:16723897}},{id:"arcade-8bit",label:"Arcade 8-bit",background:24,regionPalette:[14942296,43008,30968,16300032,16544864,12122136],freshRamp:{warm:16300032,cool:3170464},node:{stroke:0,strokeWidth:1,shape:"square"},text:{region:16579836,node:12369084,font:"monospace"},fx:{pixelated:!0,gridHorizon:!0,gridColor:30968}}],Cl="atlas";function fg(s){return In.find(e=>e.id===s)??In[0]}const pg=1500,Eo=[{id:"my-library",label:"My Library",categorySetId:"general",defaultMode:"live",sources:["personal"],layoutRadius:520,regionRadius:190,minNodeR:3,maxNodeR:14,recencyHalfLifeMs:sr,maxItems:pg,defaultThemeId:Cl}],gg="my-library";function mg(s){return Eo.find(t=>t.id===s)??Eo[0]}function yg(s){return We.find(t=>t.id===s.categorySetId)??We[0]}const Rn="unsorted";function xg(s,t){const e=s.categoryIds;if(!(e!=null&&e.length))return"";const i=new Set(e);for(const n of t)if(i.has(n.id))return n.id;return""}function _g(s,t){const e=(s.tags??[]).map(r=>r.toLowerCase());if(!e.length)return"";let i="",n=0;for(const r of t){const a=(r.tags??[]).map(l=>l.toLowerCase()).filter(l=>e.includes(l)).length;a>n&&(n=a,i=r.id)}return i}function bg(s,t,e){var r;if(!((r=s.embedding)!=null&&r.length))return"";let i="",n=-1/0;for(const o of t){const a=e.get(o.id);if(!(a!=null&&a.length))continue;const l=Uo(s.embedding,a);l>n&&(n=l,i=o.id)}return i}function wg(s,t,e,i="embeddings"){if(i==="embeddings"){const n=bg(s,t,e);if(n)return n}return xg(s,t)||_g(s,t)||Rn}function vg(s){const{entities:t,groups:e,regions:i,regionNodes:n,centroidById:r,config:o,nowMs:a,sourceIds:l}=s,h=s.placement??"embeddings";let c=0,u=0;for(const b of i)c=Math.max(c,b.cy+b.radius),u+=b.cx;const f={id:Rn,label:"Unsorted",cx:i.length?u/i.length:0,cy:i.length?c+o.regionRadius*2.5:0,radius:o.regionRadius},d=new Map(i.map(b=>[b.id,b])),p=new Set,g=t.filter(b=>p.has(b.id)?!1:(p.add(b.id),!0)),m=[],y={};let x=!1;for(const b of g){const S=wg(b,n,r,h),w=d.get(S)??f;w.id===Rn&&(x=!0);const v=r.get(w.id)??null,L=vl(b.embedding??null,v,w,b.id);m.push({id:b.id,label:b.label,x:L.x,y:L.y,regionId:w.id,sourceRef:b.sourceRef,subType:b.subType??null,imageUrl:b.imageUrl??null,secureFileId:b.secureFileId??null,isCollection:b.isCollection??!1}),b.overlay&&(y[b.id]=b.overlay)}return{document:{schemaVersion:1,mode:"live",meta:{title:o.label,sources:l,builtAt:a,fingerprint:Sl(g.map(b=>b.id)),themeId:o.defaultThemeId},groups:e,regions:x?[...i,f]:i,nodes:m},overlay:y}}function Sg(s,t){return{...s,mode:"constructed",meta:{...s.meta,title:t??s.meta.title}}}const Ag=Math.PI*(3-Math.sqrt(5));function ir(s){var t;return!((t=s.children)!=null&&t.length)}function nr(s){const t=[],e=i=>{for(const n of i)ir(n)?t.push(n):e(n.children)};return e(s),t}function Cg(s,t){const e=[],i=(n,r)=>{for(const o of n)r>=t||ir(o)?e.push(o):i(o.children,r+1)};return i(s,0),e}function Mg(s,t,e,i,n){if(!s.length)return{x:0,y:0};for(let r=1;r<6e3;r++){const o=e*.5*Math.sqrt(r),a=r*Ag+n,l=Math.cos(a)*o,h=Math.sin(a)*o;if(s.every(c=>Math.hypot(c.x-l,c.y-h)>=c.radius+t+i))return{x:l,y:h}}return{x:e*.5*Math.sqrt(6e3),y:0}}function Ml(s,t,e){const i=new Map;if(s.length===0)return{offsets:i,enclosingRadius:0};if(s.length===1)return i.set(s[0].id,{x:0,y:0}),{offsets:i,enclosingRadius:s[0].radius+t*.5};const n=vs(e)*Math.PI*2,o=s.reduce((h,c)=>Math.max(h,c.radius),0)*2+t,a=[];for(const h of[...s].sort((c,u)=>
520u.radius-c.radius||(c.id<u.id?-1:1))){const c=Mg(a,h.radius,o,t,n);a.push({x:c.x,y:c.y,radius:h.radius}),i.set(h.id,c)}let l=0;for(const h of a)l=Math.max(l,Math.hypot(h.x,h.y)+h.radius);return{offsets:i,enclosingRadius:l+t*.5}}function Tl(s,t,e,i,n){if(ir(s))return{flat:[{id:s.id,label:s.label,parentId:e,depth:t,isLeaf:!0,cx:0,cy:0,radius:i}],radius:i};const r=s.children,o=r.map(u=>Tl(u,t+1,s.id,i,n)),{offsets:a,enclosingRadius:l}=Ml(r.map((u,f)=>({id:u.id,radius:o[f].radius})),n,s.id),c=[{id:s.id,label:s.label,parentId:e,depth:t,isLeaf:!1,cx:0,cy:0,radius:l}];return r.forEach((u,f)=>{const d=a.get(u.id)??{x:0,y:0};for(const p of o[f].flat)c.push({...p,cx:p.cx+d.x,cy:p.cy+d.y})}),{flat:c,radius:l}}function Tg(s,t,e=0){const i=t.regionRadius,n=t.regionRadius*.7,r=Cg(s.nodes,e),o=r.map(c=>Tl(c,0,null,i,n)),{offsets:a}=Ml(r.map((c,u)=>({id:c.id,radius:o[u].radius})),n,"kindredly-topic-roots"),l=[],h=[];return r.forEach((c,u)=>{const f=a.get(c.id)??{x:0,y:0};for(const d of o[u].flat){const p=d.cx+f.x,g=d.cy+f.y;d.isLeaf?h.push({id:d.id,label:d.label,cx:p,cy:g,radius:i,parentGroupId:d.parentId??void 0}):l.push({id:d.id,label:d.label,parentId:d.parentId,cx:p,cy:g,radius:d.radius})}}),{groups:l,regions:h,regionNodes:nr(s.nodes)}}const kg=5e3;async function js(s,t,e,i={}){const n=e.onProgress??(()=>{}),r=s.find(d=>d.kind==="constructed");if(r)return n({label:"Loading mapâ¦"}),{document:await r.load(e),overlay:{}};n({label:"Preparing the worldâ¦"});const o=yg(t),{groups:a,regions:l,regionNodes:h}=Tg(o,t,i.rootDepth??0),c=i.placement??"embeddings",u=new Map;if(c==="embeddings"){let d=0;n({label:"Learning your topicsâ¦",current:0,total:h.length});const p=Promise.all(h.map(async g=>{try{const m=await gh.instance.getCategoryEmbedding(g);m!=null&&m.length&&u.set(g.id,m)}catch{}finally{d+=1,n({label:"Learning your topicsâ¦",current:d,total:h.length})}}));await Promise.race([p,new Promise(g=>setTimeout(g,kg))])}const f=[];for(const d of s){if(d.kind!=="live")continue;const p=await d.load(e);Array.isArray(p)&&f.push(...p)}return n({label:`Placing ${f.length} item${f.length===1?"":"s"}â¦`}),vg({entities:f,groups:a,regions:l,regionNodes:h,centroidById:u,config:t,nowMs:Date.now(),sourceIds:s.map(d=>d.id),placement:c})}function Pg(s,t){const e=new Map,i=[];for(const n of s){const r=t.continentOf(n);e.has(r)||(e.set(r,[]),i.push(r)),e.get(r).push(n)}return i.map(n=>({id:n,label:t.labelOf(n),regionIds:e.get(n)}))}const kl=Math.PI*(3-Math.sqrt(5));function Ig(s,t,e){const i=t*Math.sqrt(s),n=s*kl+e;return{x:Math.cos(n)*i,y:Math.sin(n)*i}}function Rg(s,t,e,i){if(!s.length)return{x:0,y:0};for(let n=1;n<6e3;n++){const r=e*.5*Math.sqrt(n),o=n*kl,a=Math.cos(o)*r,l=Math.sin(o)*r;if(s.every(h=>Math.hypot(h.cx-a,h.cy-l)>=h.radius+t+i))return{x:a,y:l}}return{x:e*.5*Math.sqrt(6e3),y:0}}function Eg(s,t){const e=t.regionSpacing??430,i=t.pack??.92,n=e*.85,o=Pg(s,t.mapping).map((d,p)=>{const g=vs(d.id)*Math.PI*2,m=d.regionIds.map((x,_)=>({rid:x,...Ig(_,e*i,g)})),y=m.reduce((x,_)=>Math.max(x,Math.hypot(_.x,_.y)),0);return{group:d,idx:p,offsets:m,radius:y+e*.55}}),a=o.reduce((d,p)=>Math.max(d,p.radius),0)*2+n,l=[],h=new Map;for(const d of[...o].sort((p,g)=>g.radius-p.radius||(p.group.id<g.group.id?-1:1))){const p=Rg(l,d.radius,a,n);l.push({cx:p.x,cy:p.y,radius:d.radius}),h.set(d.group.id,p)}const c=new Map,u=new Map,f=o.map(d=>{const p=h.get(d.group.id)??{x:0,y:0};for(const g of d.offsets)c.set(g.rid,{x:p.x+g.x,y:p.y+g.y}),u.set(g.rid,d.group.id);return{id:d.group.id,label:d.group.label,cx:p.x,cy:p.y,radius:d.radius,regionIds:d.group.regionIds,paletteIndex:d.idx}});return{regionPos:c,continents:f,continentOf:u}}const Lo="col:unsorted",qs="cont:unsorted",Ks="Uncategorized",Lg="cont:";function Fg(s){var k,E;const{entities:t,relations:e,config:i,nowMs:n,sourceIds:r}=s,o=new Map(t.map(A=>[A.id,A])),a=A=>{var P;return!!((P=o.get(A))!=null&&P.isCollection)},l=[...e].sort((A,P)=>A.collectionId<P.collectionId?-1:A.collectionId>P.collectionId?1:A.itemId<P.itemId?-1:A.itemId>P.itemId?1:0),h=new Map,c=new Map;for(const A of l)A.itemType==="col"||a(A.itemId)?h.has(A.itemId)||h.set(A.itemId,A.collectionId):c.has(A.itemId)||c.set(A.itemId,A.collectionId);const u=new Map,f=A=>{const P=u.get(A);if(P)return P;const z=new Set;let M=A;for(;h.has(M)&&!z.has(M);)z.add(M),M=h.get(M);return u.set(A,M),M},d=t.filter(A=>!A.isCollection),p=A=>{const P=c.get(A.id);return P&&o.has(P)?P:Lo},g=new Map,m=new Map,y=new Map,x=[];for(const A of d){const P=p(A);if(!g.has(P))if(x.push(P),P===Lo)g.set(P,qs),m.set(qs,Ks),y.set(P,Ks);else{const z=f(P),M=Lg+z;g.set(P,M),m.set(M,((k=o.get(z))==null?void 0:k.label)??"Collection"),y.set(P,((E=o.get(P))==null?void 0:E.label)??"Collection")}}const _={continentOf:A=>g.get(A)??qs,labelOf:A=>m.get(A)??Ks},b=Eg(x,{regionSpacing:i.regionRadius*2.3,mapping:_}),S=x.map(A=>{const P=b.regionPos.get(A)??{x:0,y:0},z=g.get(A)??qs;return{id:A,label:y.get(A)??"Collection",cx:P.x,cy:P.y,radius:i.regionRadius,continentId:z,continentLabel:m.get(z)??Ks}}),w=new Map(S.map(A=>[A.id,A])),v=[],L={},R=new Set;for(const A of d){if(R.has(A.id))continue;R.add(A.id);const P=w.get(p(A));if(!P)continue;const z=vl(null,null,P,A.id);v.push({id:A.id,label:A.label,x:z.x,y:z.y,regionId:P.id,sourceRef:A.sourceRef,subType:A.subType??null,imageUrl:A.imageUrl??null,secureFileId:A.secureFileId??null,isCollection:!1}),A.overlay&&(L[A.id]=A.overlay)}return{document:{schemaVersion:1,mode:"live",meta:{title:"My Library",sources:r,builtAt:n,fingerprint:Sl(v.map(A=>A.id)),themeId:i.defaultThemeId},regions:S,nodes:v},overlay:L}}function kt(s){return typeof s=="string"?s.trim():""}function ii(s){if(typeof s=="number")return Number.isFinite(s)?s:null;if(typeof s=="string"&&s){const t=Date.parse(s);return Number.isFinite(t)?t:null}if(s instanceof Date){const t=s.getTime();return Number.isFinite(t)?t:null}return null}const Fo="personal";function sn(s){return!!s&&(s.startsWith("uf_")||s.includes("/image/get/uf_"))}function Bg(s){const t=rn(s);if(t&&!sn(t))return t;const e=kt(s.imageUrl)||kt(s.defaultImage);if(!e||sn(e))return null;if(/^(https?:|data:)/i.test(e))return e;const i=rn({imageFilename:e});return i&&!sn(i)?i:null}const Gg=new Set(["defaultQuickbar","defaultSharedCollection","defaultShowcaseCollection","pub_col","shared_col","pub_col_slink"]);function Dg(s,t){return s.startsWith("col_")||kt(t.type)==="col"?!0:Gg.has(kt(t.subType))}function Og(s){var e;const t=[kt(s.imageFilename),kt(s.defaultImage),kt(s.imageUrl),kt((e=s.meta)==null?void 0:e.bannerImagePath)];for(const i of t)if(i.startsWith("uf_"))return i.slice(3);return null}const Ng=5*6e4;let us=null;async function Ug(s){var n;const t=!s.forceFresh&&us&&us.userId===s.userId&&Date.now()-us.atMs<Ng?us:null;if(t)return t.items;const e=await Lt("/item/query",{userId:s.userId,mode:"standard",includes:{feedback:!0},pagination:{limit:s.maxItems}}),i=((n=e==null?void 0:e.result)==null?void 0:n.items)??[];return us={userId:s.userId,items:i,atMs:Date.now()},i}const En={id:Fo,kind:"live",async load(s){var n,r,o,a;if(!s.userId)return[];(n=s.onProgress)==null||n.call(s,{label:"Loading your libraryâ¦"});const t=await Ug(s),e=[],i=[];for(const l of t)try{const h=l.details||{};
520if(h.archived===!0)continue;const c=kt(l.itemId)||kt(h._id),u=mh({name:h.name,meta:h.meta,info:h.info});if(!c||!u)continue;const f=l.feedback||{},d=Array.isArray(h.tags)?h.tags:null,p=Bg(h);e.push({id:c,label:u,tags:d,embedding:null,subType:kt(h.subType)||null,imageUrl:p,secureFileId:p?null:Og(h),isCollection:Dg(c,h),sourceRef:{source:Fo,refId:c},overlay:{lastVisitMs:ii(f.lastVisit),visitTimeMs:ii(f.visitTime),visitCount:typeof f.visitCount=="number"?f.visitCount:null,createdAtMs:ii(h.createdAt)}});const g=Wo({name:h.name,meta:h.meta,info:h.info,description:h.description,tags:d});g.trim().length>0&&i.push({itemId:c,text:g})}catch{}if(!s.skipEmbeddings&&i.length)try{(r=s.onProgress)==null||r.call(s,{label:"Mapping item meaningsâ¦",current:0,total:i.length});const l=await Lt("/itemEmbedding/getMany",{items:i}),h=new Map(e.map(u=>[u.id,u]));let c=0;for(const{itemId:u,embedding:f}of((o=l==null?void 0:l.result)==null?void 0:o.results)??[]){const d=h.get(u);d&&(f!=null&&f.length)&&(d.embedding=f,c+=1)}(a=s.onProgress)==null||a.call(s,{label:"Mapping item meaningsâ¦",current:c,total:i.length})}catch{}return e}},Pl="published";function Wg(){const s=We.find(t=>t.id==="general")??We[0];return new Map(nr(s.nodes).map(t=>[t.id,t.label]))}function zg(s){const t=kt(s._id),e=kt(s.name);if(!t||!e)return null;const i=Array.isArray(s.categories)?s.categories.filter(n=>typeof n=="string"&&n.length>0):null;return{id:t,label:e,tags:null,categoryIds:i!=null&&i.length?i:null,embedding:null,subType:kt(s.subType)||null,imageUrl:rn(s),secureFileId:null,isCollection:kt(s.type)==="col",sourceRef:{source:Pl,refId:t},overlay:{createdAtMs:ii(s.createdAt),visitCount:typeof s.statSubCount=="number"?s.statSubCount:null}}}const Hg={id:Pl,kind:"live",async load(s){var o,a,l,h,c;(o=s.onProgress)==null||o.call(s,{label:"Loading published catalogâ¦"});const t=await Lt("/published/listForMap",{limit:s.maxItems}),e=((a=t==null?void 0:t.result)==null?void 0:a.rows)??[],i=Wg(),n=[],r=[];for(const u of e){const f=zg(u);if(!f)continue;n.push(f);const d=Wo({name:u.name,description:u.description,tags:(f.categoryIds??[]).map(p=>i.get(p)).filter(p=>!!p)});d.trim().length>0&&r.push({itemId:f.id,text:d})}if(!s.skipEmbeddings&&r.length)try{(l=s.onProgress)==null||l.call(s,{label:"Mapping item meaningsâ¦",current:0,total:r.length});const u=await Lt("/itemEmbedding/getMany",{items:r}),f=new Map(n.map(p=>[p.id,p]));let d=0;for(const{itemId:p,embedding:g}of((h=u==null?void 0:u.result)==null?void 0:h.results)??[]){const m=f.get(p);m&&(g!=null&&g.length)&&(m.embedding=g,d+=1)}(c=s.onProgress)==null||c.call(s,{label:"Mapping item meaningsâ¦",current:d,total:r.length})}catch{}return n}};function Vg(s,t="constructed"){return{id:t,kind:"constructed",async load(e){return{...s,mode:"constructed"}}}}function $g(s){let t=1779033703^s.length;for(let e=0;e<s.length;e++)t=Math.imul(t^s.charCodeAt(e),3432918353),t=t<<13|t>>>19;return()=>(t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,t>>>0)}function Yg(s){let t=s>>>0;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Il(s){const t=$g(s);return Yg(t())}const Xg="kindredly-sample-v2",jg=16,qg=24*60*60*1e3;function Kg(){const s=We.find(n=>n.id==="general")??We[0],t=Il(Xg),e=Date.now(),i=[];for(const n of nr(s.nodes)){const r=n.tags??[],o=Math.floor(t()**1.6*jg);for(let a=0;a<o;a++){const l=`sample:${n.id}:${a}`,h=r.length?r[Math.floor(t()*r.length)]:void 0,c=t()>.3,u=t()**2*75;i.push({id:l,label:`${n.label} · ${a+1}`,tags:h?[h]:[],sourceRef:{source:"sample",refId:l},overlay:c?{lastVisitMs:e-u*qg,visitCount:1+Math.floor(t()*45)}:{}})}}return i}const Zg={id:"sample",kind:"live",async load(s){return Kg()}},Ln="apps.knowledgeMap.v1.theme",Fn="apps.knowledgeMap.v1.selection",Bn="apps.knowledgeMap.v1.grouping",Gn="apps.knowledgeMap.v1.placement",de=rh.clientKv("knowledgeMapV1"),Rl="theme.v1",El="selection.v1",Ll="grouping.v1",Fl="placement.v1",Bl=s=>`knowledgeMap.pinned.v1.${s||"guest"}`;function ce(s){return typeof s=="string"&&s.length>0?s:null}async function Qg(s){var t;if(s){const e=await Lt("/user/prefs/get",{userId:s,keys:[Ln]});return ce((t=e==null?void 0:e.result)==null?void 0:t[Ln])}return ce(await de.getRaw(Rl))}async function Jg(s,t){s?await Lt("/user/prefs/update",{userId:s,updates:{[Ln]:t}}
520):await de.setRaw(Rl,t)}async function tm(s){var e;let t;if(s){const i=await Lt("/user/prefs/get",{userId:s,keys:[Fn]});t=ce((e=i==null?void 0:i.result)==null?void 0:e[Fn])}else t=ce(await de.getRaw(El));return t==="sample"||t==="pinned"||t==="live"||t==="collections"||t==="published"?t:null}async function em(s,t){s?await Lt("/user/prefs/update",{userId:s,updates:{[Fn]:t}}):await de.setRaw(El,t)}async function sm(s){var e;let t;if(s){const i=await Lt("/user/prefs/get",{userId:s,keys:[Bn]});t=ce((e=i==null?void 0:i.result)==null?void 0:e[Bn])}else t=ce(await de.getRaw(Ll));return t==="flat"}async function im(s,t){const e=t?"flat":"grouped";s?await Lt("/user/prefs/update",{userId:s,updates:{[Bn]:e}}):await de.setRaw(Ll,e)}async function nm(s){var e;let t;if(s){const i=await Lt("/user/prefs/get",{userId:s,keys:[Gn]});t=ce((e=i==null?void 0:i.result)==null?void 0:e[Gn])}else t=ce(await de.getRaw(Fl));return t==="tags"||t==="embeddings"?t:null}async function rm(s,t){s?await Lt("/user/prefs/update",{userId:s,updates:{[Gn]:t}}):await de.setRaw(Fl,t)}async function Gl(s){const t=await oh(Bl(s));return t&&typeof t=="object"&&Array.isArray(t.nodes)?t:null}async function om(s,t){await nh(Bl(s),t)}const Bo=18,am=84,lm=5,Go=.6,hm=.9,Do=.42;function cm(s){return s===0?1:lm*s}function um(s,t,e,i,n){let r=n-i;for(;r>Math.PI;)r-=Math.PI*2;for(;r<-Math.PI;)r+=Math.PI*2;const o=[];for(let a=0;a<=Bo;a++){const l=i+r*a/Bo;o.push(s+Math.cos(l)*e,t+Math.sin(l)*e)}return o}function dm(s,t,e,i){return[s,t,e,i]}function fm(s,t,e,i){const n=[...s].sort((f,d)=>{const p=(f.x-t.cx)**2+(f.y-t.cy)**2,g=(d.x-t.cx)**2+(d.y-t.cy)**2;return p-g||(f.id<d.id?-1:f.id>d.id?1:0)}),r=[];let o=0;for(const f of n)r[o]||(r[o]=[]),r[o].length>=cm(o)&&(o+=1,r[o]=[]),r[o].push(f);const a=r.length-1,l=a>0?Math.min(am,e/(a+Go)):0,h=i()*Math.PI*2,c=[];r.forEach((f,d)=>{const p=f.length,g=d*l,m=d%2===1&&p>0?Math.PI/p:0;f.forEach((y,x)=>{if(d===0){c.push({id:y.id,ring:d,slot:x,angle:0,x:t.cx,y:t.cy});return}const _=h+m+Math.PI*2*x/p;c.push({id:y.id,ring:d,slot:x,angle:_,x:t.cx+Math.cos(_)*g,y:t.cy+Math.sin(_)*g})})});const u=a>0?l*(a+Go):Math.min(e,t.radius*.32);return{placed:c,outerRadius:u,ringGap:l,maxRing:a}}function pm(s,t,e,i){const n=[],r=new Map;for(const h of s){const c=r.get(h.ring)??[];c.push(h),r.set(h.ring,c)}for(const h of r.values())h.sort((c,u)=>c.angle-u.angle);const o=h=>i.get(h)??0,a=(h,c,u)=>n.push({fromId:h.id,toId:c.id,points:u,recency:(o(h.id)+o(c.id))/2}),l=Math.max(0,...s.map(h=>h.ring));for(let h=1;h<=l;h++){const c=r.get(h)??[],u=h*e;if(c.length>=2)for(let d=0;d<c.length;d++){const p=c[d],g=c[(d+1)%c.length];if(c.length===2&&d===1)break;a(p,g,um(t.cx,t.cy,u,p.angle,g.angle))}const f=r.get(h-1)??[];if(f.length)for(const d of c){let p=f[0],g=1/0;for(const m of f){let y=Math.abs((d.angle-m.angle+Math.PI)%(Math.PI*2)-Math.PI);h-1===0&&(y=0),y<g&&(g=y,p=m)}a(d,p,dm(d.x,d.y,p.x,p.y))}}return n}function gm(s,t,e,i){const n=new Map,r=new Map,o=new Map,a=[],l=new Map;for(const u of s){const f=l.get(u.regionId)??[];f.push(u),l.set(u.regionId,f)}const h=new Map;for(const u of t){let f=1/0;for(const d of t)u.id!==d.id&&(f=Math.min(f,Math.hypot(u.cx-d.cx,u.cy-d.cy)));h.set(u.id,f)}const c=[...t].sort((u,f)=>u.id<f.id?-1:u.id>f.id?1:0);for(const u of c){const f=l.get(u.id)??[],d=f.length>0?f.reduce((_,b)=>_+(e.get(b.id)??0),0)/f.length:0;o.set(u.id,d);const p=h.get(u.id)??1/0;if(f.length===0){r.set(u.id,Math.min(u.radius*.3,p*Do));continue}const g=Math.min(u.radius*hm,p*Do),{placed:m,outerRadius:y,ringGap:x}=fm(f,u,g,i);for(const _ of m)n.set(_.id,{x:_.x,y:_.y});r.set(u.id,y);for(const _ of pm(m,u,x,e))a.push(_)}return{positions:n,regionRadii:r,regionMeanRecency:o,tracks:a}}const mm=.25,Zs=80;function ym(s,t){let e=1/0,i=1/0,n=-1/0,r=-1/0;const o=(a,l)=>{e=Math.min(e,a),i=Math.min(i,l),n=Math.max(n,a),r=Math.max(r,l)};for(const a of s){const l=Math.max(a.layoutRadius,a.radius);o(a.cx-l,a.cy-l),o(a.cx+l,a.cy+l)}for(const a of t)o(a.x,a.y);return Number.isFinite(e)?{minX:e-Zs,minY:i-Zs,maxX:n+Zs,maxY:r+Zs}:{minX:-200,minY:-200,maxX:200,maxY:200}}function xm(s){const t=[];if(s.groups){for(const r of s.groups)t.push({id:r.id,label:r.label,parentId:r.parentId,cx:r.cx,cy:r.cy,radius:r.radius,isLeaf:!1});for(const r of s.regions)t.push({id:r.id,label:r.label,parentId:r.parentGroupId??null,cx:r.cx,cy:r.cy,radius:r.radius,isLeaf:!0});return t}const e=new Map,i=[],n=[];for(const r of s.regions){const o=r.continentId;if(!o){n.push(r);continue}
520e.has(o)||(e.set(o,[]),i.push(o)),e.get(o).push(r)}for(const r of i){const o=e.get(r),a=o.reduce((c,u)=>c+u.cx,0)/o.length,l=o.reduce((c,u)=>c+u.cy,0)/o.length,h=o.reduce((c,u)=>Math.max(c,Math.hypot(u.cx-a,u.cy-l)+u.radius),0);t.push({id:r,label:o[0].continentLabel??r,parentId:null,cx:a,cy:l,radius:h,isLeaf:!1});for(const c of o)t.push({id:c.id,label:c.label,parentId:r,cx:c.cx,cy:c.cy,radius:c.radius,isLeaf:!0})}for(const r of n)t.push({id:r.id,label:r.label,parentId:null,cx:r.cx,cy:r.cy,radius:r.radius,isLeaf:!0});return t}function Oo(s,t){var r;let e=0,i=s;const n=new Set([s]);for(;;){const o=((r=t.get(i))==null?void 0:r.parentId)??null;if(o==null||!t.has(o)||n.has(o))break;n.add(o),i=o,e++}return{depth:e,root:i}}function _m(s,t,e){const i=xm(s),n=new Map(i.map(h=>[h.id,h])),r=new Map;for(const h of s.nodes)r.set(h.regionId,(r.get(h.regionId)??0)+1);const o=new Map;for(const h of i){const{root:c}=Oo(h.id,n);o.has(c)||o.set(c,o.size)}const a=new Map,l=new Map;for(const h of i){if(!h.isLeaf)continue;const c=r.get(h.id)??0,u=e.get(h.id)??0;let f=h.id;const d=new Set;for(;f!=null&&n.has(f)&&!d.has(f);)d.add(f),a.set(f,(a.get(f)??0)+c),l.set(f,(l.get(f)??0)+u*c),f=n.get(f).parentId}return i.map(h=>{const{depth:c,root:u}=Oo(h.id,n),f=a.get(h.id)??0,d=f>0?(l.get(h.id)??0)/f:0;return{id:h.id,label:h.label,parentId:h.parentId,depth:c,isLeaf:h.isLeaf,cx:h.cx,cy:h.cy,radius:h.radius,layoutRadius:h.isLeaf?t.get(h.id)??h.radius*.32:h.radius,meanRecency:d,nodeCount:f,paletteIndex:o.get(u)??0}})}function bm(s,t,e,i,n=sr){const r=Il(e),o=s.nodes.map(p=>{const g=t[p.id]??null;return{nodeId:p.id,label:p.label,x:p.x,y:p.y,regionId:p.regionId,recency:Kp(g,i,n),frequency:Zp(g==null?void 0:g.visitCount),isGate:!1,subType:p.subType??null,imageUrl:p.imageUrl??null,secureFileId:p.secureFileId??null,isCollection:p.isCollection??!1}}),a=new Map(o.map(p=>[p.nodeId,p.recency])),l=s.nodes.map(p=>({id:p.id,x:p.x,y:p.y,regionId:p.regionId})),h=s.regions.map(p=>({id:p.id,cx:p.cx,cy:p.cy,radius:p.radius})),c=gm(l,h,a,r);for(const p of o){const g=c.positions.get(p.nodeId);g&&(p.x=g.x,p.y=g.y)}const u=_m(s,c.regionRadii,c.regionMeanRecency),f=c.tracks,d=new Map;for(const p of f)d.set(p.fromId,(d.get(p.fromId)??0)+1),d.set(p.toId,(d.get(p.toId)??0)+1);for(const p of o)p.isGate=(d.get(p.nodeId)??0)<=1&&p.recency<mm;return{seed:e,bbox:ym(u,o),nodes:u,glyphs:o,tracks:f}}const re=ot(null),ci=ot({}),ui=ot(null),wi=ot(Cl),$t=ot("live"),ks=ot(!1),Ae=ot("embeddings"),Dl=ot(null),Dn=ot(!1),di=ot(null),qe=ot(""),rr=ot(!1),qt=Ht(()=>{var s;return((s=On.currentUser)==null?void 0:s._id)||null}),wm=Ht(()=>On.loadingUser),fi=Ht(()=>mg(gg)),vm=Ht(()=>fg(wi.value)),Sm=Ht(()=>{var s;return((s=re.value)==null?void 0:s.nodes.length)??0});async function Am(s){const t=fi.value,e={userId:qt.value,maxItems:t.maxItems,forceFresh:s,onProgress:n=>{di.value=n},skipEmbeddings:Ae.value==="tags"},i={rootDepth:ks.value?1:0,placement:Ae.value};if($t.value==="collections")return Mm(t,e);if($t.value==="sample")return js([Zg],t,e,{placement:Ae.value});if($t.value==="pinned"){const n=await Gl(qt.value);if(n)return js([Vg(n,"pinned")],t,e);$t.value="live"}return $t.value==="published"?js([Hg],t,e,i):js([En],t,e,i)}async function Cm(){var s;try{const t=await ah("/collection/structure",{});return(((s=t==null?void 0:t.result)==null?void 0:s.relations)??[]).map(i=>({collectionId:String(i.collectionId),itemId:String(i.itemId),itemType:String(i.itemType??"item")}))}catch{return[]}}async function Mm(s,t){var r,o,a;(r=t.onProgress)==null||r.call(t,{label:"Loading your libraryâ¦"});const e=await En.load({...t,skipEmbeddings:!0}),i=Array.isArray(e)?e:[];(o=t.onProgress)==null||o.call(t,{label:"Reading your collectionsâ¦"});const n=await Cm();return(a=t.onProgress)==null||a.call(t,{label:"Arranging collectionsâ¦"}),Fg({entities:i,relations:n,config:s,nowMs:Date.now(),sourceIds:[En.id]})}let ds=null,nn=!1,Qs=!1;async function No(s){Dn.value=!0,qe.value="",di.value=null;try{const t=await Am(s);re.value=t.document,ci.value=t.overlay,ui.value=bm(t.document,t.overlay,`knowledgeMap:${fi.value.id}`,Date.now(),fi.value.recencyHalfLifeMs)}catch(t){qe.value=(t==null?void 0:t.message)||"Could not build your map.",re.value=null,ci.value={},ui.value=null}finally{Dn.value=!1,di.value=null}}async function ts(s){return ds?(nn=!0,Qs=Qs||!!(s!=null&&s.forceFresh),ds):(ds=(async()=>{try{for(await No(!!(s!=null&&s.forceFresh));nn;){nn=!1;const t=Qs;Qs=!1,await No(t)}}finally{ds=null}})(),ds)}async function Tm(){await ts({forceFresh:!0})}async function km(){const s=qt.value;try{const[t,e,i,n,r]=await Promise.all([Qg(s),tm(s),Gl(s),sm(s),nm(s)]);t&&(wi.value=t),e&&($t.value=e),rr.value=!!i,ks.value=n,r&&(Ae.value=r)}catch{}if(!qt.value&&($t.value==="live"||$t.value==="collections")){re.value=null,ci.value={},ui.value=null,qe.value="";return}await ts()}async function Pm(s){wi.value=s;try{await Jg(qt.value,s)}catch(t){qe.value=(t==null?void 0:t.message)||"Could not save your theme."}}async function Im(s){if(ks.value!==s){ks.value=s;try{await im(qt.value,s)}catch{}await ts()}}async function Rm(s){if(Ae.value!==s){Ae.value=s;try{await rm(qt.value,s)}catch{}await ts()}}async function Ol(s){if($t.value!==s){$t.value=s;try{await em(qt.value,s)}catch{}await ts()}}
520async function Em(){if(!re.value)return;const s=Sg(re.value,re.value.meta.title);try{await om(qt.value,s),rr.value=!0,await Ol("pinned")}catch(t){qe.value=(t==null?void 0:t.message)||"Could not pin this map."}}function Lm(s){Dl.value=s}function Nl(s){var t,e;return((t=s.sourceRef)==null?void 0:t.source)==="published"?`/v/${s.sourceRef.refId}`:((e=s.sourceRef)==null?void 0:e.source)!=="personal"?null:s.isCollection?`/collection/${s.sourceRef.refId}`:`/item/${s.sourceRef.refId}`}function Fm(s){var e;const t=(e=re.value)==null?void 0:e.nodes.find(i=>i.id===s);return t?Nl(t):null}function Bm(){return{mapDocument:re,overlay:ci,nodeCount:Sm,selection:$t,topicFlattened:ks,placementMode:Ae,selectedNodeId:Dl,selectedThemeId:wi,selectedTheme:vm,themes:In,hasPinned:rr,currentUserId:qt,authLoading:wm,config:fi,hydrating:Dn,progress:di,errorMessage:qe,hydrate:km,rebuild:ts,refresh:Tm,setTheme:Pm,setSelection:Ol,setTopicFlattened:Im,setPlacementMode:Rm,pinCurrent:Em,selectNode:Lm,nodeOpenTarget:Nl,worldModel:ui,openTargetForNodeId:Fm}}function Gm(s){const t=s.now??Date.now;let e=null,i=0;return{notify(){const n=i?i+s.maxIntervalMs:0,r=Math.max(t()+s.quietMs,n);e&&clearTimeout(e),e=setTimeout(()=>{e=null,i=t(),s.run()},r-t())},cancel(){e&&clearTimeout(e),e=null}}}const Dm={class:"km-shell"},Om={key:0,class:"km-overlay km-loading text-muted text-center px-4"},Nm={key:1,class:"km-overlay text-muted px-4 text-center"},Um={key:2,class:"km-overlay text-muted text-center px-4"},Wm={key:3,class:"km-breadcrumb d-flex align-items-center flex-wrap gap-1","aria-label":"Map location"},zm=["disabled","onClick"],Hm={key:0,class:"km-crumb__sep","aria-hidden":"true"},Vm=["aria-label"],$m={class:"km-controls d-flex gap-1"},Ym=["aria-label"],Xm={key:4,class:"km-settings rounded-3 p-3"},jm={class:"d-flex align-items-center mb-2"},qm=["value"],Km={key:0,value:"pinned"},Zm={key:0,class:"form-check form-switch mb-3"},Qm=["checked"],Jm=["value"],ty=["value"],ey=["value"],sy=["value"],iy=["value"],ny=["disabled"],ry=["disabled"],oy={class:"small text-muted mt-2"},ay={key:5,class:"km-search rounded-3 p-2"},ly={key:0,class:"km-search__results list-unstyled mb-0 mt-2"},hy=["onClick"],cy={class:"km-search__label text-truncate"},uy={key:0,class:"km-search__sub text-muted text-truncate"},dy={key:1,class:"text-muted small mt-2 px-1"},fy={key:6,class:"km-refining d-flex align-items-center gap-2"},py={class:"small text-truncate"},gy={key:7,class:"km-peek rounded-3 p-2"},my={class:"d-flex align-items-start gap-2"},yy=["src"],xy={class:"km-peek__body"},_y={class:"fw-semibold text-truncate"},by={key:0,class:"small text-muted text-truncate"},wy={class:"km-modal__card rounded-3 p-3",role:"dialog","aria-modal":"true"},vy={class:"d-flex align-items-start gap-3 mb-3"},Sy=["src"],Ay={class:"flex-grow-1 min-w-0"},Cy={class:"fw-semibold km-clamp-2"},My={key:0,class:"small text-muted text-truncate"},Ty={class:"km-modal__stats small mb-3"},ky={class:"d-flex justify-content-between gap-3 py-1"},Py={class:"mb-0 text-end text-truncate min-w-0"},Iy={class:"d-flex justify-content-between gap-3 py-1 border-top"},Ry={class:"mb-0 text-end text-truncate min-w-0"},Ey={class:"d-flex justify-content-between gap-3 py-1 border-top"},Ly={class:"mb-0 text-end text-truncate min-w-0"},Fy={class:"km-modal__card rounded-3 p-3",role:"dialog","aria-modal":"true"},By={class:"d-flex align-items-start gap-2 mb-3"},Gy={class:"flex-grow-1 min-w-0"},Dy={class:"small text-uppercase fw-semibold km-eyebrow"},Oy={class:"fw-semibold km-clamp-2"},Ny={class:"km-modal__stats small mb-0"},Uy={class:"text-muted fw-normal flex-shrink-0"},Wy={class:"mb-0 text-end text-truncate min-w-0"},zy="/kindredapp/#",Hy=ql({__name:"StandaloneKnowledgeMapApp",setup(s){const t=Bm(),e=ph(),i=Gm({quietMs:2500,maxIntervalMs:2e4,run:()=>void t.rebuild()});function n(){t.placementMode.value==="embeddings"&&i.notify()}const{mapDocument:r,worldModel:o,nodeCount:a,selection:l,topicFlattened:h,placementMode:c,selectedThemeId:u,selectedTheme:f,themes:d,hasPinned:p,hydrating:g,progress:m,errorMessage:y,config:x,currentUserId:_}=t,b=Ht(()=>{const T=m.value;return T?T.total&&T.current!=null?`${T.label} ${T.current}/${T.total}`:T.label:"Building your mapâ¦"}),S=Ht(()=>t.authLoading.value&&!_.value),w=ot(null),v=ot(null),L=ot(null),R=ot(!1),C=ot([]),k=ot(!1),E=ot(!1),A=ot(!1),P=ot(""),z=ot(!1),M=ot(""),F=ot(null),J=Kl(),D=Zl();let Y=null;const tt=Ht(()=>{const T=M.value.trim().toLowerCase(),I=o.value;if(!T||!I)return[];const Z=[],O=new Map(I.nodes.map(H=>[H.id,H]));for(const H of I.nodes){if(!H.label.toLowerCase().includes(T))continue;const _t=H.parentId?O.get(H.parentId):null,Ct=H.isLeaf?"Section":"Landmass";Z.push({kind:"node",id:H.id,label:H.label,sub:_t?`${Ct} · ${_t.label}`:Ct})}for(const H of I.glyphs){if(Z.length>=24)break;if(H.label.toLowerCase().includes(T)){const _t=O.get(H.regionId);Z.push({kind:"item",id:H.nodeId,label:H.label,sub:_t==null?void 0:_t.label})}}return Z.slice(0,20)});function U(T){const I=T.replace(/_/g," ").trim();return I.charAt(0).toUpperCase()+I.slice(1)}const ht=Ht(()=>{var H;const T=[{key:"",label:"None"}],I=o.value;if(!I)return T;let Z=0;const O=new Map;for(const _t of I.glyphs){_t.isCollection&&(Z+=1);const Ct=(H=_t.subType)==null?void 0:H.trim();Ct&&O.set(Ct,(O.get(Ct)??0)+1)}Z&&T.push({key:Al,label:`Collections (${Z})`});for(const[_t,Ct]of[...O.entries()].sort((Ci,es)=>es[1]-Ci[1]))T.push({key:_t,label:`${U(_t)} (${Ct})`});return T}),mt=Ht(()=>{const T=o.value,I=C.value[C.value.length-1];if(!T||!I)return null;const Z=[];if(!I.id){const Ct=T.nodes.filter(es=>es.parentId===null).length,Ci=T.nodes.filter(es=>es.isLeaf).length;return Z.push(["Top categories",String(Ct)],["Sections",String(Ci)],["Items",String(T.glyphs.length)]),{kindLabel:"Overview",title:"Overview",rows:Z}}const O=T.nodes.find(Ct=>Ct.id===I.id)??null;if(!O)return null;const H=O.parentId?T.nodes.find(Ct=>Ct.id===O.parentId)??null:null;if(H&&Z.push(["In",H.label]),O.isLeaf)return Z.push(["Items",String(O.nodeCount)]),{kindLabel:"Section",title:O.label,rows:Z};const _t=T.nodes.filter(Ct=>Ct.parentId===O.id).length;
520return Z.push(["Within",String(_t)],["Items",String(O.nodeCount)]),{kindLabel:"Landmass",title:O.label,rows:Z}});let W=null,nt=null;function Nt(T){return T>=.66?"Fresh":T>=.33?"Recent":T>0?"Cooling":"Dormant"}function Zt(T){return T>=.66?"Deep":T>=.33?"Moderate":T>0?"Light":"New"}const yt=Ht(()=>{const T=L.value,I=o.value;if(!T||!I)return null;const Z=I.nodes.find(_t=>_t.id===T.regionId)??null,O=Z!=null&&Z.parentId?I.nodes.find(_t=>_t.id===Z.parentId)??null:null,H=[O==null?void 0:O.label,Z==null?void 0:Z.label].filter(Boolean).join(" ⺠")||"Unsorted";return{title:T.label,subType:T.subType,imageUrl:T.imageUrl,section:H,isCollection:T.isCollection,freshness:T.isGate?"Frontier":Nt(T.recency),engagement:Zt(T.frequency),openTarget:t.openTargetForNodeId(T.nodeId)}});function Me(){const T=x.value;return{minNodeR:T.minNodeR,maxNodeR:T.maxNodeR}}function Te(){W==null||W.setWorld(o.value,f.value,Me())}function Qt(T){W==null||W.jumpToLevel(T)}function Ut(){L.value=null}function Jt(){var I;const T=(I=yt.value)==null?void 0:I.openTarget;T&&window.open(`${zy}${T}`,"_blank","noopener"),Ut()}function Yt(){A.value=!!document.fullscreenElement}function vi(){var I;const T=w.value;T&&(document.fullscreenElement?document.exitFullscreen():(I=T.requestFullscreen)==null||I.call(T))}function Rs(T){t.setSelection(T.target.value)}function Si(T){t.setTheme(T.target.value)}function or(T){t.setTopicFlattened(T.target.checked)}function Ul(T){t.setPlacementMode(T.target.value)}function Wl(){t.pinCurrent()}function zl(){t.refresh()}function Hl(T){P.value=T.target.value,W==null||W.setHighlight(P.value||null)}function Vl(){z.value=!z.value,z.value&&(E.value=!1,ih(()=>{var T;return(T=F.value)==null?void 0:T.focus()}))}function $l(T){Y=T;const I={...J.query};T?I.item=T:delete I.item,D.replace({query:I})}function ar(T){const I=W==null?void 0:W.revealTarget({kind:T.kind,id:T.id},{open:T.kind==="item"});z.value=!1,M.value="",I&&$l(T.kind==="item"?T.id:null)}function Yl(){tt.value.length&&ar(tt.value[0])}function Ai(){const T=String(J.query.item||"").trim();!T||T===Y||!o.value||!W||W.revealTarget({kind:"item",id:T},{open:!0})&&(Y=T)}return Ql(async()=>{!_.value&&!On.loadingUser&&lh("startup-cache-first"),w.value&&(W=new dg(w.value,f.value,{onPeek:T=>{v.value=T},onLeafSelect:T=>{k.value=!1,R.value=!1,L.value=T},onNavChange:T=>{C.value=T},resolveSecureImage:async T=>{var I;try{const Z=await hh(T);if(typeof Z=="string"&&Z)return Z;const O=await Lt("/userfile/getById",{fileId:T,previewId:"0"},{defaultPrefix:"image/jpeg"}),H=(I=O==null?void 0:O.result)==null?void 0:I.data;return typeof H=="string"&&H?(ch(T,H),H):null}catch{return null}}}),await W.init(),Te(),Ai(),document.addEventListener("fullscreenchange",Yt),nt=new ResizeObserver(()=>{w.value&&W&&W.resize(w.value.clientWidth,w.value.clientHeight)}),nt.observe(w.value),e.on("item-embeddings-updated",n))}),Jl(()=>{document.removeEventListener("fullscreenchange",Yt),i.cancel(),nt==null||nt.disconnect(),nt=null,W==null||W.destroy(),W=null}),fe(o,()=>{L.value=null,k.value=!1}),fe(C,()=>{k.value=!1}),fe(ht,T=>{P.value&&!T.some(I=>I.key===P.value)&&(P.value="",W==null||W.setHighlight(null))}),fe(o,()=>{Te(),Ai()}),fe(()=>J.query.item,()=>Ai()),fe(f,T=>W==null?void 0:W.setTheme(T)),fe(_,()=>{t.hydrate()},{immediate:!0}),(T,I)=>{const Z=th("b-spinner");return $(),V("div",Dm,[B("div",{ref_key:"mapHost",ref:w,class:"km-canvas","aria-label":"Knowledge map"},[(st(g)||S.value)&&!st(a)?($(),V("div",Om,[lr(Z,{small:"",class:"mb-2"}),B("div",null,ct(b.value),1),I[8]||(I[8]=B("div",{class:"km-loading__bar mt-2","aria-hidden":"true"},[B("span")],-1))])):st(y)?($(),V("div",Nm,ct(st(y)),1)):st(a)?bt("",!0):($(),V("div",Um,[(st(l)==="live"||st(l)==="collections")&&!st(_)?($(),V(Wt,{key:0},[ss(" Sign in to map your library. ")],64)):st(l)==="live"?($(),V(Wt,{key:1},[ss(" Your library is empty here â add items, or pick âSample mapâ to explore an example. ")],64)):st(l)==="published"?($(),V(Wt,{key:2},[ss("No published content available yet.")],64)):($(),V(Wt,{key:3},[ss("Nothing to map yet â add items to your library and they'll appear here.")],64))])),C.value.length?($(),V("nav",Wm,[($(!0),V(Wt,null,is(C.value,(O,H)=>($(),V(Wt,{key:H},[B("button",{type:"button",class:ns(["km-crumb",{"km-crumb--current":H===C.value.length-1}]),disabled:H===C.value.length-1,onClick:_t=>Qt(H)},ct(O.label),11,zm),H<C.value.length-1?($(),V("span",Hm,"âº")):bt("",!0)],64))),128)),B("button",{type:"button",class:"km-crumb-info","aria-label":`Info on ${C.value[C.value.length-1].label}`,onClick:I[0]||(I[0]=O=>{L.value=null,k.value=!0})},[...I[9]||(I[9]=[B("i",{class:"bi bi-info-circle","aria-hidden":"true"},null,-1)])],8,Vm)])):bt("",!0),B("div",$m,[B("button",{type:"button",class:ns(["km-tool-btn btn btn-sm",{"km-tool-btn--active":z.value}]),"aria-label":"Search",onClick:Vl},[...I[10]||(I[10]=[B("i",{class:"bi bi-search","aria-hidden":"true"},null,-1)])],2),B("button",{type:"button",class:ns(["km-tool-btn btn btn-sm",{"km-tool-btn--active":E.value}
520]),"aria-label":"Settings",onClick:I[1]||(I[1]=O=>{E.value=!E.value,z.value=!1})},[...I[11]||(I[11]=[B("i",{class:"bi bi-gear","aria-hidden":"true"},null,-1)])],2),B("button",{type:"button",class:"km-tool-btn btn btn-sm","aria-label":A.value?"Exit fullscreen":"Enter fullscreen",onClick:vi},[B("i",{class:ns(A.value?"bi bi-fullscreen-exit":"bi bi-arrows-fullscreen"),"aria-hidden":"true"},null,2)],8,Ym)]),E.value?($(),V("div",Xm,[B("div",jm,[I[12]||(I[12]=B("div",{class:"small text-uppercase fw-semibold km-eyebrow me-auto"},"Settings",-1)),B("button",{type:"button",class:"btn-close btn-sm","aria-label":"Close",onClick:I[2]||(I[2]=O=>E.value=!1)})]),I[21]||(I[21]=B("label",{class:"form-label small mb-1",for:"km-map"},"Map",-1)),B("select",{id:"km-map",class:"form-select form-select-sm mb-3",value:st(l),onChange:Rs},[I[13]||(I[13]=B("option",{value:"live"},"My Library (topics)",-1)),I[14]||(I[14]=B("option",{value:"collections"},"My Library (collections)",-1)),I[15]||(I[15]=B("option",{value:"published"},"Published",-1)),I[16]||(I[16]=B("option",{value:"sample"},"Sample map",-1)),st(p)?($(),V("option",Km,"Pinned")):bt("",!0)],40,qm),st(l)==="live"||st(l)==="published"?($(),V("div",Zm,[B("input",{id:"km-flatten",class:"form-check-input",type:"checkbox",role:"switch",checked:st(h),onChange:or},null,40,Qm),I[17]||(I[17]=B("label",{class:"form-check-label small",for:"km-flatten"},"Flatten top level",-1))])):bt("",!0),st(l)!=="collections"&&st(l)!=="pinned"?($(),V(Wt,{key:1},[I[19]||(I[19]=B("label",{class:"form-label small mb-1",for:"km-placement"},"Placement",-1)),B("select",{id:"km-placement",class:"form-select form-select-sm mb-3",value:st(c),onChange:Ul},[...I[18]||(I[18]=[B("option",{value:"embeddings"},"By meaning (AI)",-1),B("option",{value:"tags"},"By topic tags (fast)",-1)])],40,Jm)],64)):bt("",!0),I[22]||(I[22]=B("label",{class:"form-label small mb-1",for:"km-theme"},"Theme",-1)),B("select",{id:"km-theme",class:"form-select form-select-sm mb-3",value:st(u),onChange:Si},[($(!0),V(Wt,null,is(st(d),O=>($(),V("option",{key:O.id,value:O.id},ct(O.label),9,ey))),128))],40,ty),I[23]||(I[23]=B("label",{class:"form-label small mb-1",for:"km-highlight"},"Highlight",-1)),B("select",{id:"km-highlight",class:"form-select form-select-sm mb-3",value:P.value,onChange:Hl},[($(!0),V(Wt,null,is(ht.value,O=>($(),V("option",{key:O.key,value:O.key},ct(O.label),9,iy))),128))],40,sy),B("button",{type:"button",class:"btn btn-sm btn-outline-secondary w-100",disabled:st(g)||st(l)==="pinned",onClick:zl},[I[20]||(I[20]=B("i",{class:"bi bi-arrow-clockwise me-1","aria-hidden":"true"},null,-1)),ss(" "+ct(st(g)?"Refreshingâ¦":"Refresh map"),1)],8,ny),B("button",{type:"button",class:"btn btn-sm btn-outline-secondary w-100 mt-2",disabled:!st(r),onClick:Wl}," Pin this map ",8,ry),B("div",oy,ct(st(a))+" item"+ct(st(a)===1?"":"s")+" mapped",1)])):bt("",!0),z.value?($(),V("div",ay,[eh(B("input",{ref_key:"searchInput",ref:F,"onUpdate:modelValue":I[3]||(I[3]=O=>M.value=O),type:"search",class:"form-control form-control-sm",placeholder:"Search items, sectionsâ¦",onKeydown:[hr(Yl,["enter"]),I[4]||(I[4]=hr(O=>z.value=!1,["esc"]))]},null,544),[[sh,M.value]]),tt.value.length?($(),V("ul",ly,[($(!0),V(Wt,null,is(tt.value,O=>($(),V("li",{key:`${O.kind}:${O.id}`},[B("button",{type:"button",class:"km-search__item w-100 text-start",onClick:H=>ar(O)},[B("span",cy,ct(O.label),1),O.sub?($(),V("span",uy,ct(O.sub),1)):bt("",!0)],8,hy)]))),128))])):M.value.trim()?($(),V("div",dy,"No matches")):bt("",!0)])):bt("",!0),st(g)&&st(a)?($(),V("div",fy,[lr(Z,{small:""}),B("span",py,ct(b.value),1)])):bt("",!0),v.value&&!yt.value?($(),V("div",gy,[B("div",my,[v.value.imageUrl?($(),V("img",{key:0,src:v.value.imageUrl,alt:"",class:"km-peek__thumb rounded-2"},null,8,yy)):bt("",!0),B("div",xy,[B("div",_y,ct(v.value.label),1),v.value.subType?($(),V("div",by,ct(v.value.subType),1)):bt("",!0)])])])):bt("",!0),yt.value?($(),V("div",{key:8,class:"km-modal",onClick:cr(Ut,["self"])},[B("div",wy,[B("div",vy,[yt.value.imageUrl&&!R.value?($(),V("img",{key:0,src:yt.value.imageUrl,alt:"",class:"km-modal__thumb rounded-2",onError:I[5]||(I[5]=O=>R.value=!0)},null,40,Sy)):bt("",!0),B("div",Ay,[B("div",Cy,ct(yt.value.title),
5201),yt.value.subType?($(),V("div",My,ct(yt.value.subType),1)):bt("",!0)]),B("button",{type:"button",class:"btn-close flex-shrink-0","aria-label":"Close",onClick:Ut})]),B("dl",Ty,[B("div",ky,[I[24]||(I[24]=B("dt",{class:"text-muted fw-normal flex-shrink-0"},"Section",-1)),B("dd",Py,ct(yt.value.section),1)]),B("div",Iy,[I[25]||(I[25]=B("dt",{class:"text-muted fw-normal flex-shrink-0"},"Freshness",-1)),B("dd",Ry,ct(yt.value.freshness),1)]),B("div",Ey,[I[26]||(I[26]=B("dt",{class:"text-muted fw-normal flex-shrink-0"},"Engagement",-1)),B("dd",Ly,ct(yt.value.engagement),1)])]),yt.value.openTarget?($(),V("button",{key:0,type:"button",class:"btn btn-sm btn-primary",onClick:Jt},ct(yt.value.isCollection?"Open collection":"Open item"),1)):bt("",!0)])])):bt("",!0),k.value&&mt.value?($(),V("div",{key:9,class:"km-modal",onClick:I[7]||(I[7]=cr(O=>k.value=!1,["self"]))},[B("div",Fy,[B("div",By,[B("div",Gy,[B("div",Dy,ct(mt.value.kindLabel),1),B("div",Oy,ct(mt.value.title),1)]),B("button",{type:"button",class:"btn-close flex-shrink-0","aria-label":"Close",onClick:I[6]||(I[6]=O=>k.value=!1)})]),B("dl",Ny,[($(!0),V(Wt,null,is(mt.value.rows,(O,H)=>($(),V("div",{key:H,class:ns(["d-flex justify-content-between gap-3 py-1",{"border-top":H>0}])},[B("dt",Uy,ct(O[0]),1),B("dd",Wy,ct(O[1]),1)],2))),128))])])])):bt("",!0)],512)])}}}),Vy=uh(Hy,[["__scopeId","data-v-330a363f"]]),ix=Object.freeze(Object.defineProperty({__proto__:null,default:Vy},Symbol.toStringTag,{value:"Module"}));export{Wr as $,Wd as A,Ms as B,le as C,ep as D,Kt as E,Kd as F,xt as G,oe as H,Ye as I,bi as J,da as K,K as L,j as M,Ba as N,pn as O,it as P,Be as Q,gt as R,ju as S,et as T,ni as U,Mt as V,zh as W,At as X,Vn as Y,$u as Z,Is as _,He as a,ti as a0,Hn as a1,Ea as a2,Ot as a3,Ca as a4,vd as a5,Ad as a6,kd as a7,Rd as a8,yi as a9,Cd as aA,Id as aB,Ed as aC,Ld as aD,np as aE,ix as aF,Oc as aa,kh as ab,Ze as ac,mi as ad,Fd as ae,It as af,ta as ag,Dt as ah,pi as ai,Ar as aj,$e as ak,Np as al,rc as am,Mr as an,Fi as ao,Tr as ap,ac as aq,ia as ar,lp as as,Ga as at,Ps as au,hu as av,nu as aw,nd as ax,Zu as ay,Sd as az,Mn as b,lt as c,q as d,hi as e,kn as f,$s as g,dl as h,fl as i,Gt as j,sx as k,kp as l,gp as m,vt as n,X as o,kc as p,Pt as q,pt as r,rt as s,Js as t,Uc as u,ft as v,at as w,sa as x,G as y,_i 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.