@agent-play/play-ui 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{browserAll-CxJ5n1KR.js → browserAll-Cqm89Ctx.js} +1 -1
- package/dist/assets/index-DKWpRUbE.js +298 -0
- package/dist/assets/{webworkerAll-C0uXnrAJ.js → webworkerAll-B678c6tn.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +4 -2
- package/dist/assets/index-BoW5G5Xq.js +0 -298
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-CxJ5n1KR.js","assets/webworkerAll-C0uXnrAJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var ol=Object.defineProperty;var al=(s,t,e)=>t in s?ol(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var z=(s,t,e)=>al(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();const ll="modulepreload",hl=function(s){return"/agent-play/"+s},Zr={},ko=function(t,e,i){let r=Promise.resolve();if(e&&e.length>0){let o=function(h){return Promise.all(h.map(c=>Promise.resolve(c).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=o(e.map(h=>{if(h=hl(h),h in Zr)return;Zr[h]=!0;const c=h.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":ll,c||(f.as="script"),f.crossOrigin="",f.href=h,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((d,p)=>{f.addEventListener("load",d),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return t().catch(n)})};var X=(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.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(X||{});const Ui=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},bs=(s,t)=>Ui(s).priority??t,kt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Ui).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(Ui).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,r=this._queue;i[e]?(o=i[e])==null||o.call(i,t):(r[e]=r[e]||[],(n=r[e])==null||n.push(t))})}),this},handle(s,t,e){var o;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((o=n[s])==null||o.forEach(a=>t(a)),delete n[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(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,o)=>bs(o.value,e)-bs(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>bs(n,e)-bs(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},cl={extension:{type:X.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await ko(()=>import("./browserAll-CxJ5n1KR.js"),__vite__mapDeps([0,1]))}},ul={extension:{type:X.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await ko(()=>import("./webworkerAll-C0uXnrAJ.js"),[])}};class ot{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new ot(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function Ao(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var oi={exports:{}},Qr;function dl(){return Qr||(Qr=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function n(l,h,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(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}a.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,b,_;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,b=new Array(y-1);_<y;_++)b[_-1]=arguments[_];m.fn.apply(m.context,b)}else{var w=m.length,T;for(_=0;_<w;_++)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(!b)for(T=1,b=new Array(y-1);T<y;T++)b[T-1]=arguments[T];m[_].fn.apply(m[_].context,b)}}return!0},a.prototype.on=function(h,c,u){return n(this,h,c,u,!1)},a.prototype.once=function(h,c,u){return n(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})(oi)),oi.exports}var fl=dl();const ee=Ao(fl),pl=Math.PI*2,ml=180/Math.PI,gl=Math.PI/180;class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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 ai.x=0,ai.y=0,ai}}const ai=new lt;class B{constructor(t=1,e=0,i=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,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 lt;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new lt;const i=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,h=1/(i*o+n*-r),c=t.x,u=t.y;return e.x=o*h*c+-n*h*u+(l*n-a*o)*h,e.y=i*h*u+-r*h*c+(-l*i+a*r)*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),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*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,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,r=t.b,n=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+r*u,this.b=i*c+r*f,this.c=n*h+o*u,this.d=n*c+o*f,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*f+e.ty,this}setTransform(t,e,i,r,n,o,a,l,h){return this.a=Math.cos(a+h)*n,this.b=Math.sin(a+h)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*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,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*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,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(pl-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(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new B;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 yl.identity()}static get shared(){return xl.identity()}}const xl=new B,yl=new B,ae=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],le=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],he=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ce=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],$i=[],So=[],ws=Math.sign;function _l(){for(let s=0;s<16;s++){const t=[];$i.push(t);for(let e=0;e<16;e++){const i=ws(ae[s]*ae[e]+he[s]*le[e]),r=ws(le[s]*ae[e]+ce[s]*le[e]),n=ws(ae[s]*he[e]+he[s]*ce[e]),o=ws(le[s]*he[e]+ce[s]*ce[e]);for(let a=0;a<16;a++)if(ae[a]===i&&le[a]===r&&he[a]===n&&ce[a]===o){t.push(a);break}}}for(let s=0;s<16;s++){const t=new B;t.set(ae[s],le[s],he[s],ce[s],0,0),So.push(t)}}_l();const H={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=>ae[s],uY:s=>le[s],vX:s=>he[s],vY:s=>ce[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>$i[s][t],sub:(s,t)=>$i[s][H.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?H.S:H.N:Math.abs(t)*2<=Math.abs(s)?s>0?H.E:H.W:t>0?s>0?H.SE:H.SW:s>0?H.NE:H.NW,matrixAppendRotationInv:(s,t,e=0,i=0,r=0,n=0)=>{const o=So[H.inv(t)],a=o.a,l=o.b,h=o.c,c=o.d,u=e-Math.min(0,a*r,h*n,a*r+h*n),f=i-Math.min(0,l*r,c*n,l*r+c*n),d=s.a,p=s.b,g=s.c,m=s.d;s.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:r,y:n,width:o,height:a}=s,{x:l,y:h,width:c,height:u}=t;return e===H.E?(i.set(r+l,n+h,o,a),i):e===H.S?i.set(c-n-a+l,r+h,a,o):e===H.W?i.set(c-r-o+l,u-n-a+h,o,a):e===H.N?i.set(n+l,u-r-o+h,a,o):i.set(r+l,n+h,o,a)}},ks=[new lt,new lt,new lt,new lt];class it{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}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 it(0,0,0,0)}clone(){return new it(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,r=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,l=this.y,h=i*(1-r),c=i-h,u=a-h,f=a+n+h,d=l-h,p=l+o+h,g=a+c,m=a+n-c,y=l+c,b=l+o-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>g&&t<m&&e>y&&e<b)}intersects(t,e){if(!e){const I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;const a=ks[0].set(t.left,t.top),l=ks[1].set(t.left,t.bottom),h=ks[2].set(t.right,t.top),c=ks[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)>=r||Math.max(a.y,l.y,h.y,c.y)<=n||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*n,g=f*r+d*n,m=f*i+d*o,y=f*r+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 b=u*(a.y-h.y),_=u*(h.x-a.x),w=b*i+_*n,T=b*r+_*n,k=b*i+_*o,A=b*r+_*o;return!(Math.max(w,T,k,A)<=b*a.x+_*a.y||Math.min(w,T,k,A)>=b*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),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=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=r-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),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t||(t=new it),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,r=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,i,r){return this.x=t,this.y=e,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const li={default:-1};function tt(s="default"){return li[s]===void 0&&(li[s]=-1),++li[s]}const Kr=new Set,at="8.0.0",bl="8.3.4",Ce={quiet:!1,noColor:!1},V=((s,t,e=3)=>{if(Ce.quiet||Kr.has(t))return;let i=new Error().stack;const r=`${t}
|
|
3
|
-
Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!Ce.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(`
|
|
4
|
-
`).splice(e).join(`
|
|
5
|
-
`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),Kr.add(t)});Object.defineProperties(V,{quiet:{get:()=>Ce.quiet,set:s=>{Ce.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>Ce.noColor,set:s=>{Ce.noColor=s},enumerable:!0,configurable:!1}});const To=()=>{};function Jr(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 tn(s){return!(s&s-1)&&!!s}function Co(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const en=Object.create(null);function wl(s){const t=en[s];return t===void 0&&(en[s]=tt("resource")),t}const Mo=class Po extends ee{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Po.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){V(at,"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=wl(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Mo.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let vo=Mo;const Eo=class Ro extends ee{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=tt("textureSource"),this._resourceType="textureSource",this._resourceId=tt("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._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Ro.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.alphaMode=t.alphaMode,this.style=new vo(Co(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}_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=tt("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 r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=tt("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=tn(this.pixelWidth)&&tn(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Eo.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 Dt=Eo;class hr extends Dt{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}}hr.extension=X.TextureSource;const sn=new B;class kl{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){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 r=0;r<t.length;r+=2){const n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*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,r=t.trim;r&&(sn.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(sn));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+l)/n.width,o[1]=(t.frame.y+a+l)/n.height,o[2]=(t.frame.x+t.frame.width-a+l)/n.width,o[3]=(t.frame.y+t.frame.height-a+l)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class Y extends ee{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=tt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new it,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(t==null?void 0:t.source)??new Dt,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=r||this.frame,this.trim=n,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("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new kl(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:r}=this._source,n=e.x/i,o=e.y/r,a=e.width/i,l=e.height/r;let h=this.rotate;if(h){const c=a/2,u=l/2,f=n+c,d=o+u;h=H.add(h,H.NW),t.x0=f+c*H.uX(h),t.y0=d+u*H.uY(h),h=H.add(h,2),t.x1=f+c*H.uX(h),t.y1=d+u*H.uY(h),h=H.add(h,2),t.x2=f+c*H.uX(h),t.y2=d+u*H.uY(h),h=H.add(h,2),t.x3=f+c*H.uX(h),t.y3=d+u*H.uY(h)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+l,t.x3=n,t.y3=o+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return V(at,"Texture.baseTexture is now Texture.source"),this._source}}Y.EMPTY=new Y({label:"EMPTY",source:new Dt({label:"EMPTY"})});Y.EMPTY.destroy=To;Y.WHITE=new Y({source:new hr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});Y.WHITE.destroy=To;function Al(s,t,e){const{width:i,height:r}=e.orig,n=e.trim;if(n){const o=n.width,a=n.height;s.minX=n.x-t._x*i,s.maxX=s.minX+o,s.minY=n.y-t._y*r,s.maxY=s.minY+a}else s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*r,s.maxY=s.minY+r}const rn=new B;class It{constructor(t=1/0,e=1/0,i=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=rn,this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new it);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=rn,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,h=n.d,c=n.tx,u=n.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*r+c,y=a*t+h*r+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=o*i+l*r+c,y=a*i+h*r+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,r=this.maxX,n=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*r+l*i+c,d=a*r+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*n+c,d=a*e+h*n+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*r+l*n+c,d=a*r+h*n+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,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>r&&(this.maxY=r),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 It(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,r){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;r||(r=this.matrix);const h=r.a,c=r.b,u=r.c,f=r.d,d=r.tx,p=r.ty;for(let g=e;g<i;g+=2){const m=t[g],y=t[g+1],b=h*m+u*y+d,_=c*m+f*y+p;n=b<n?b:n,o=_<o?_:o,a=b>a?b:a,l=_>l?_:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var Sl={grad:.9,turn:360,rad:360/(2*Math.PI)},Yt=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},st=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},St=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Io=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},nn=function(s){return{r:St(s.r,0,255),g:St(s.g,0,255),b:St(s.b,0,255),a:St(s.a)}},hi=function(s){return{r:st(s.r),g:st(s.g),b:st(s.b),a:st(s.a,3)}},Tl=/^#([0-9a-f]{3,8})$/i,As=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Do=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Lo=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),h=n%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:r}},on=function(s){return{h:Io(s.h),s:St(s.s,0,100),l:St(s.l,0,100),a:St(s.a)}},an=function(s){return{h:st(s.h),s:st(s.s),l:st(s.l),a:st(s.a,3)}},ln=function(s){return Lo((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},ts=function(s){return{h:(t=Do(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Cl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ml=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hi={string:[[function(s){var t=Tl.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?st(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?st(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Pl.exec(s)||vl.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:nn({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=Cl.exec(s)||Ml.exec(s);if(!t)return null;var e,i,r=on({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(Sl[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ln(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return Yt(t)&&Yt(e)&&Yt(i)?nn({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!Yt(t)||!Yt(e)||!Yt(i))return null;var o=on({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return ln(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!Yt(t)||!Yt(e)||!Yt(i))return null;var o=(function(a){return{h:Io(a.h),s:St(a.s,0,100),v:St(a.v,0,100),a:St(a.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Lo(o)},"hsv"]]},hn=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]},El=function(s){return typeof s=="string"?hn(s.trim(),Hi.string):typeof s=="object"&&s!==null?hn(s,Hi.object):[null,void 0]},ci=function(s,t){var e=ts(s);return{h:e.h,s:St(e.s+100*t,0,100),l:e.l,a:e.a}},ui=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},cn=function(s,t){var e=ts(s);return{h:e.h,s:e.s,l:St(e.l+100*t,0,100),a:e.a}},Yi=(function(){function s(t){this.parsed=El(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 st(ui(this.rgba),2)},s.prototype.isDark=function(){return ui(this.rgba)<.5},s.prototype.isLight=function(){return ui(this.rgba)>=.5},s.prototype.toHex=function(){return t=hi(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?As(st(255*n)):"","#"+As(e)+As(i)+As(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return hi(this.rgba)},s.prototype.toRgbString=function(){return t=hi(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return an(ts(this.rgba))},s.prototype.toHslString=function(){return t=an(ts(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Do(this.rgba),{h:st(t.h),s:st(t.s),v:st(t.v),a:st(t.a,3)};var t},s.prototype.invert=function(){return Ft({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),Ft(ci(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ft(ci(this.rgba,-t))},s.prototype.grayscale=function(){return Ft(ci(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Ft(cn(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Ft(cn(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"?Ft({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):st(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=ts(this.rgba);return typeof t=="number"?Ft({h:t,s:e.s,l:e.l,a:e.a}):st(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Ft(t).toHex()},s})(),Ft=function(s){return s instanceof Yi?s:new Yi(s)},un=[],Rl=function(s){s.forEach(function(t){un.indexOf(t)<0&&(t(Yi,Hi),un.push(t))})};function Il(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 r in e)i[e[r]]=r;var n={};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(!n.length)for(var d in e)n[d]=new s(e[d]).toRgb();for(var p in e){var g=(a=c,l=n[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"])}Rl([Il]);const Me=class je{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 je)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((n,o)=>n===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}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,r]=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(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,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,r,n]=je._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}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,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=je.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ft(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,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((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof je||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}};Me.shared=new Me;Me._temp=new Me;Me.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let qt=Me;const Dl={cullArea:null,cullable:!1,cullableChildren:!0};let di=0;const dn=500;function wt(...s){di!==dn&&(di++,di===dn?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const cr={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},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 Ll{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 Bl{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 Ll(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 yt=new Bl;cr.register(yt);const Gl={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){V("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function Fl(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}const Ol={allowChildren:!0,removeChildren(s=0,t){var n;const e=t??this.children.length,i=e-s,r=[];if(i>0&&i<=e){for(let a=e-1;a>=s;a--){const l=this.children[a];l&&(r.push(l),l.parent=null)}Fl(this.children,s,e);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(r);for(let a=0;a<r.length;++a){const l=r[a];(n=l.parentRenderLayer)==null||n.detach(l),this.emit("childRemoved",l,this,a),r[a].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}else if(i===0&&this.children.length===0)return r;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||V(at,"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 n=s.parent.children.indexOf(s);if(i){if(n===t)return s;s.parent.children.splice(n,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 r=this.renderGroup||this.parentRenderGroup;return r&&r.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 r=this.renderGroup||this.parentRenderGroup;r&&(r.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)}},Nl={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,r=i.length;for(let n=0;n<r;n++)i[n].collectRenderables(s,t,e)},collectRenderablesWithEffects(s,t,e){const{renderPipes:i}=t;for(let r=0;r<this.effects.length;r++){const n=this.effects[r];i[n.pipe].push(n,this,s)}this.collectRenderablesSimple(s,t,e);for(let r=this.effects.length-1;r>=0;r--){const n=this.effects[r];i[n.pipe].pop(n,this,s)}}};class fn{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 zl{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 yt.get(i.maskClass,t)}return t}returnMaskEffect(t){yt.return(t)}}const Xi=new zl;kt.handleByList(X.MaskEffect,Xi._effectClasses);const Ul={_maskEffect:null,_maskOptions:{inverse:!1},_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),Xi.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=Xi.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 n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new fn);s=s;const e=(s==null?void 0:s.length)>0,i=((n=t.filters)==null?void 0:n.length)>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(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 fn),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},$l={label:null,get name(){return V(at,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){V(at,"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 r=e[i];if(r.label===s||s instanceof RegExp&&s.test(r.label))return r}if(t)for(let i=0;i<e.length;i++){const n=e[i].getChildByLabel(s,!0);if(n)return n}return null},getChildrenByLabel(s,t=!1,e=[]){const i=this.children;for(let r=0;r<i.length;r++){const n=i[r];(n.label===s||s instanceof RegExp&&s.test(n.label))&&e.push(n)}if(t)for(let r=0;r<i.length;r++)i[r].getChildrenByLabel(s,!0,e);return e}},ut=yt.getPool(B),Wt=yt.getPool(It),Hl=new B,Yl={getFastGlobalBounds(s,t){t||(t=new It),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 r=!!this.effects.length;if((this.renderGroup||r)&&(i=Wt.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 n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(s,i,e)}if(r){let n=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,i.applyMatrix(o.worldTransform)),this.effects[a].addBounds(i,!0));n&&i.applyMatrix(o.worldTransform.copyTo(Hl).invert()),t.addBounds(i),Wt.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Wt.return(i))}};function Bo(s,t,e){e.clear();let i,r;return s.parent?t?i=s.parent.worldTransform:(r=ut.get().identity(),i=ur(s,r)):i=B.IDENTITY,Go(s,e,i,t),r&&ut.return(r),e.isValid||e.set(0,0,0,0),e}function Go(s,t,e,i){var a,l;if(!s.visible||!s.measurable)return;let r;i?r=s.worldTransform:(s.updateLocalTransform(),r=ut.get(),r.appendFrom(s.localTransform,e));const n=t,o=!!s.effects.length;if(o&&(t=Wt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,r);else{const h=s.bounds;h&&!h.isEmpty()&&(t.matrix=r,t.addBounds(h));for(let c=0;c<s.children.length;c++)Go(s.children[c],t,r,i)}if(o){for(let h=0;h<s.effects.length;h++)(l=(a=s.effects[h]).addBounds)==null||l.call(a,t);n.addBounds(t,B.IDENTITY),Wt.return(t)}i||ut.return(r)}function ur(s,t){const e=s.parent;return e&&(ur(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Fo(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;const e=s>>16&255,i=s>>8&255,r=s&255,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255|0,h=i*o/255|0,c=r*a/255|0;return(l<<16)+(h<<8)+c}const pn=16777215;function mn(s,t){return s===pn?t:t===pn?s:Fo(s,t)}function Gs(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const Xl={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 B,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=ur(this,ut.get().identity());return s.appendFrom(this.localTransform,e),ut.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?Gs(this.renderGroup.worldColor):this.parentRenderGroup?Gs(mn(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=mn(t,e.localColor),e=e.parent;return Gs(t)}};function Oo(s,t,e){return t.clear(),e||(e=B.IDENTITY),No(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function No(s,t,e,i,r){var l,h;let n;if(r)n=ut.get(),n=e.copyTo(n);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const c=s.localTransform;n=ut.get(),n.appendFrom(c,e)}const o=t,a=!!s.effects.length;if(a&&(t=Wt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{s.renderPipeId&&(t.matrix=n,t.addBounds(s.bounds));const c=s.children;for(let u=0;u<c.length;u++)No(c[u],t,n,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,B.IDENTITY),Wt.return(t)}ut.return(n)}function zo(s,t){const e=s.children;for(let i=0;i<e.length;i++){const r=e[i],n=r.uid,o=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,r.children.length&&zo(r,t)}return t.didChange}const Wl=new B,Vl={_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 It});const s=this._localBoundsCacheData;return s.index=1,s.didChange=!1,s.data[0]!==this._didViewChangeTick&&(s.didChange=!0,s.data[0]=this._didViewChangeTick),zo(this,s),s.didChange&&Oo(this,s.localBounds,Wl),s.localBounds},getBounds(s,t){return Bo(this,s,t||new It)}},ql={_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}},jl={_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(Zl))}};function Zl(s,t){return s._zIndex-t._zIndex}const Ql={getGlobalPosition(s=new lt,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(ut.get(),e);return t=i.apply(s,t),ut.return(i),t},toLocal(s,t,e,i){t&&(s=t.toGlobal(s,e,i));const r=this.getGlobalTransform(ut.get(),i);return e=r.applyInverse(s,e),ut.return(r),e}};class dr{constructor(){this.uid=tt("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 Kl=0;class Jl{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new vo(this.textureOptions)}createTexture(t,e,i,r){const n=new Dt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new Y({source:n,label:`texturePool_${Kl++}`})}getOptimalTexture(t,e,i=1,r,n=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=Jr(o),a=Jr(a);const l=r?1:0,h=n?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,r,n)),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 r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}}const Uo=new Jl;cr.register(Uo);class th{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new dr,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 r=e[i];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Uo.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 r=0;r<i.length;r++)this._getChildren(i[r],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function eh(s,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(s[i]=t[i])}const fi=new ot(null),Ss=new ot(null),pi=new ot(null,1,1),Ts=new ot(null),gn=1,sh=2,mi=4;class se extends ee{constructor(t={}){var e,i;super(),this.uid=tt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ot(this,0,0),this._scale=pi,this._pivot=Ss,this._origin=Ts,this._skew=fi,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],eh(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(r=>this.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){V("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),kt.mixin(se,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||V(at,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r<t.length;r++)this.addChild(t[r]);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 r=0;r<t.length;r++)this.removeChild(t[r]);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=yt.get(th,this),this.groupTransform=B.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),yt.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 B),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*ml}set angle(t){this.rotation=t*gl}get pivot(){return this._pivot===Ss&&(this._pivot=new ot(this,0,0)),this._pivot}set pivot(t){this._pivot===Ss&&(this._pivot=new ot(this,0,0),this._origin!==Ts&&wt("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===fi&&(this._skew=new ot(this,0,0)),this._skew}set skew(t){this._skew===fi&&(this._skew=new ot(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===pi&&(this._scale=new ot(this,1,1)),this._scale}set scale(t){this._scale===pi&&(this._scale=new ot(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===Ts&&(this._origin=new ot(this,0,0)),this._origin}set origin(t){this._origin===Ts&&(this._origin=new ot(this,0,0),this._pivot!==Ss&&wt("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const 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||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this.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,r=this._pivot,n=this._origin,o=this._position,a=i._x,l=i._y,h=r._x,c=r._y,u=-n._x,f=-n._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*l,e.d=this._sy*l,e.tx=o._x-(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|=gn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=qt.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=gn,this._onUpdate())}get tint(){return Gs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=sh,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|=mi,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|=mi,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|=mi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;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 n=0;n<e.length;++n)e[n].destroy(t);(r=this.renderGroup)==null||r.destroy(),this.renderGroup=null}}kt.mixin(se,Ol,Yl,Ql,ql,Vl,Ul,$l,jl,Dl,Gl,Xl,Nl);class $o extends se{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 It(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:r}=t;return i>=e.minX&&i<=e.maxX&&r>=e.minY&&r<=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;this.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:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const o=r[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);r.blendMode.popBlendMode(t)}}class ns extends $o{constructor(t=Y.EMPTY){t instanceof Y&&(t={texture:t});const{texture:e=Y.EMPTY,anchor:i,roundPixels:r,width:n,height:o,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof Y?new ns(t):new ns(Y.from(t,e))}set texture(t){t||(t=Y.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 Al(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return V("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:r,height:n}=e.orig;i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*n,i.maxY=i.minY+n}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 ih=new It;function Ho(s,t,e){const i=ih;s.measurable=!0,Bo(s,e,i),t.addBoundsMask(i),s.measurable=!1}function Yo(s,t,e){const i=Wt.get();s.measurable=!0;const r=ut.get().identity(),n=Xo(s,e,r);Oo(s,i,n),s.measurable=!1,t.addBoundsMask(i),ut.return(r),Wt.return(i)}function Xo(s,t,e){return s?(s!==t&&(Xo(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(wt("Mask bounds, renderable is not inside the root container"),e)}class Wo{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof ns),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||Ho(this.mask,t,e)}addLocalBounds(t,e){Yo(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof ns}}Wo.extension=X.MaskEffect;class Vo{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"}}Vo.extension=X.MaskEffect;class qo{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){Ho(this.mask,t,e)}addLocalBounds(t,e){Yo(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof se}}qo.extension=X.MaskEffect;const rh={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=>new DOMParser().parseFromString(s,"text/xml")};let xn=rh;const ds={get(){return xn},set(s){xn=s}};class jo extends Dt{constructor(t){t.resource||(t.resource=ds.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 r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}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"))}}jo.extension=X.TextureSource;class zs extends Dt{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}}zs.extension=X.TextureSource;var Wi=(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))(Wi||{});class gi{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}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 Zo=class _t{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 gi(null,null,1/0),this.deltaMS=1/_t.targetFPMS,this.elapsedMS=1/_t.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=Wi.NORMAL){return this._addListener(new gi(t,e,i))}addOnce(t,e,i=Wi.NORMAL){return this._addListener(new gi(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 n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*_t.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.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,_t.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(!_t._shared){const t=_t._shared=new _t;t.autoStart=!0,t._protected=!0}return _t._shared}static get system(){if(!_t._system){const t=_t._system=new _t;t.autoStart=!0,t._protected=!0}return _t._system}};Zo.targetFPMS=.06;let Cs=Zo,xi;async function nh(){return xi??(xi=(async()=>{var o;const t=ds.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 r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),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 n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),(o=t.getExtension("WEBGL_lose_context"))==null||o.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),xi}const Ws=class Qo extends Dt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Qo.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=Cs.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.alphaMode=await nh(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){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._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("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&&(Cs.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||(Cs.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Cs.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ws.extension=X.TextureSource;Ws.defaultOptions={...Dt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ws.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let oh=Ws;const Se=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class ah{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||wt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Se(t);let r;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.test(e)){r=h.getCacheableAssets(i,e);break}}const n=new Map(Object.entries(r||{}));r||i.forEach(l=>{n.set(l,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const h=r?r[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&wt("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t)){wt(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const Te=new ah,Vi=[];kt.handleByList(X.TextureSource,Vi);function Ko(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r<Vi.length;r++){const n=Vi[r];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function lh(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,r=e?s:{resource:s};if(!t&&Te.has(i))return Te.get(i);const n=new Y({source:Ko(r)});return n.on("destroy",()=>{Te.has(i)&&Te.remove(i)}),t||Te.set(i,n),n}function hh(s,t=!1){return typeof s=="string"?Te.get(s):s instanceof Dt?new Y({source:s}):lh(s,t)}Y.from=hh;Dt.from=Ko;kt.add(Wo,Vo,qo,oh,zs,jo,hr);var Jo=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Jo||{});function vt(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Be(s){return s.split("?")[0].split("#")[0]}function ch(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uh(s,t,e){return s.replace(new RegExp(ch(t),"g"),e)}function dh(s,t){let e="",i=0,r=-1,n=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(!(r===a-1||n===1))if(r!==a-1&&n===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("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=a,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,a)}`:e=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const os={toPosix(s){return uh(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){vt(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(vt(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Be(this.toPosix(t??ds.get().getBaseUrl())),r=Be(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?os.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(vt(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=dh(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return vt(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(vt(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(vt(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),o=s;s=s.slice(n.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!r){i=a;break}}else r=!1;return i===-1?e?"/":this.isUrl(o)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){vt(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){vt(s),t&&vt(t),s=Be(this.toPosix(s));let e=0,i=-1,r=!0,n;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(n=s.length-1;n>=0;--n){const l=s.charCodeAt(n);if(l===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){vt(s),s=Be(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){vt(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Be(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,o=0,a=-1,l=!0,h=s.length-1,c=0;for(;h>=r;--h){if(e=s.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?n===-1?n=h:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===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,n),t.base=s.slice(1,a)):(t.name=s.slice(o,n),t.base=s.slice(o,a)),t.ext=s.slice(n,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function ta(s,t,e,i,r){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?ta(s.replace(i[e],a),t,e+1,i,r):r.push(s.replace(i[e],a))}}function fh(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),ta(s,r,0,e,i)}else i.push(s);return i}const yn=s=>!Array.isArray(s);class ea{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 Se(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>(o==null?void 0:o.src)??o):n!=null&&n.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&wt("[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 r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.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({...n,alias:l,src:o})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&wt(`[Resolver] already has key: ${n} overwriting`)},Se(e).forEach(n=>{const{src:o}=n;let{data:a,format:l,loadParser:h,parser:c}=n;const u=Se(o).map(g=>typeof g=="string"?fh(g):Array.isArray(g)?g:[g]),f=this.getAlias(n);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:n.progressSize}),d.push(y)})}),f.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=yn(t);t=Se(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(r,l)]=h}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=yn(t);t=Se(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const h=n.filter(c=>c[a]?c[a]===l:!1);h.length&&(n=h)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),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],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}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:r,loadParser:n,parser:o,format:a,progressSize:l}=e;return(this._basePath||this._rootPath)&&(t.src=os.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??ph(t.src),l!==void 0&&(t.progressSize=l),t}}ea.RETINA_PREFIX=/@([0-9\.]+)x/;function ph(s){return s.split(".").pop().split("?").shift().split("#").shift()}const _n=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},sa=class Ze{constructor(t,e){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof Dt&&(i={texture:t,data:e});const{texture:r,data:n,cachePrefix:o=""}=i;this.cachePrefix=o,this._texture=r instanceof Y?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,r.source.resolution=this.resolution):this.resolution=r.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<=Ze.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 r=e?1/0:Ze.BATCH_SIZE;for(;i-t<r&&i<this._frameKeys.length;){const n=this._frameKeys[i],o=this._frames[n],a=o.frame;if(a){let l=null,h=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new it(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?l=new it(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 it(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 it(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new Y({source:this.textureSource,frame:l,orig:u,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:n.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 r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ze.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ze.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=[]}};sa.BATCH_SIZE=1e3;let bn=sa;const mh=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function ia(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=os.dirname(s[0]);t.linkedSheets.forEach((n,o)=>{const a=ia([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const gh={extension:X.Asset,cache:{test:s=>s instanceof bn,getCacheableAssets:(s,t)=>ia(s,t,!1)},resolver:{extension:{type:X.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&mh.includes(r)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ea.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:X.LoadParser,priority:Jo.Normal,name:"spritesheetLoader"},async testParse(s,t){return os.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var u,f;const{texture:i,imageFilename:r,textureOptions:n,cachePrefix:o}=(t==null?void 0:t.data)??{};let a=os.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(i instanceof Y)l=i;else{const d=_n(a+(r??s.meta.image),t.src);l=(await e.load([{src:d,data:n}]))[d]}const h=new bn({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=_n(m,t.src),d.push(e.load({src:m,data:{textureOptions:n,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)}}};kt.add(gh);const yi=Object.create(null),wn=Object.create(null);function fr(s,t){let e=wn[s];return e===void 0&&(yi[t]===void 0&&(yi[t]=1),wn[s]=e=yi[t]++),e}let ke;function ra(){return(!ke||ke!=null&&ke.isContextLost())&&(ke=ds.get().createCanvas().getContext("webgl",{})),ke}let Ms;function xh(){if(!Ms){Ms="mediump";const s=ra();s&&s.getShaderPrecisionFormat&&(Ms=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return Ms}function yh(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 _h(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float;
|
|
21
|
-
${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function bh(s,t){return t?`#version 300 es
|
|
22
|
-
${s}`:s}const wh={},kh={};function Ah(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?wh:kh;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 Sh(s,t){return t?s.replace("#version 300 es",""):s}const _i={stripVersion:Sh,ensurePrecision:_h,addProgramDefines:yh,setProgramName:Ah,insertVersion:bh},Ge=Object.create(null),na=class qi{constructor(t){t={...qi.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:xh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(_i).forEach(o=>{const a=i[o];r=_i[o](r,a,!0),n=_i[o](n,a,!1)}),this.fragment=r,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=fr(`${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,Ge[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Ge[e]||(Ge[e]=new qi(t),Ge[e]._cacheKey=e),Ge[e]}};na.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let oa=na;const kn={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 Th(s){return kn[s]??kn.float32}const Ch={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"},An=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Sn(s,t){let e;for(;(e=An.exec(s))!==null;){const i=Ch[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:i,stride:Th(i).stride,offset:0,instance:!1,start:0}}An.lastIndex=0}function Mh(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Ph({source:s,entryPoint:t}){const e={},i=Mh(s),r=i.indexOf(`fn ${t}(`);if(r===-1)return e;const n=i.indexOf("->",r);if(n===-1)return e;const o=i.substring(r,n);if(Sn(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&&Sn(c[1],e)}}return e}function bi(s){var u,f;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\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(r)[2],isUniform:d.match(r)[1]==="<uniform>",type:d.match(n)[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[b,_]=y.split(":");return m[b.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 ue=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(ue||{});function vh({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:ue.VERTEX|ue.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:ue.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:ue.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:ue.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:ue.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Eh({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 Rh(s,t){const e=new Set,i=new Set,r=[...s.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...s.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:r,groups:n}}const Fe=Object.create(null);class Vs{constructor(t){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=i,e.source===i.source){const h=bi(e.source);this.structsAndGroups=h}else{const h=bi(i.source),c=bi(e.source);this.structsAndGroups=Rh(h,c)}this.layout=r??Eh(this.structsAndGroups),this.gpuLayout=n??vh(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=fr(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ph(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Fe[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Fe[e]||(Fe[e]=new Vs(t),Fe[e]._cacheKey=e),Fe[e]}}const aa=["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>"],Ih=aa.reduce((s,t)=>(s[t]=!0,s),{});function Dh(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 la=class ha{constructor(t,e){this._touched=0,this.uid=tt("uniform"),this._resourceType="uniformGroup",this._resourceId=tt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...ha.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!Ih[n.type]){const o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${aa.join(", ")}`)}n.value??(n.value=Dh(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=fr(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};la.defaultOptions={ubo:!1,isStatic:!1};let ca=la;class Fs{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,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 r,n;const i=this.resources[e];t!==i&&((r=i==null?void 0:i.off)==null||r.call(i,"change",this.onResourceChange,this),(n=t.on)==null||n.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 r in i)i[r]._gcLastUsed=t,i[r]._touched=e}destroy(){var e;const t=this.resources;for(const i in t){const r=t[i];(e=r==null?void 0:r.off)==null||e.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var ji=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(ji||{});class pr extends ee{constructor(t){super(),this.uid=tt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=ji.WEBGPU),i&&(o|=ji.WEBGL)),this.compatibleRenderers=o;const l={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&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&&r&&!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(n){r={},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 n)l[c]||(r[99]||(r[99]=new Fs,this._ownedBindGroups.push(r[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(const c in n){const u=c;let f=n[c];!f.source&&!f._resourceType&&(f=new ca(f));const d=l[u];d&&(r[d.group]||(r[d.group]=new Fs,this._ownedBindGroups.push(r[d.group])),r[d.group].setResource(f,d.binding))}}this.groups=r,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(r,l)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Fs,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.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(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...r}=t;let n,o;return e&&(n=Vs.from(e)),i&&(o=oa.from(i)),new pr({gpuProgram:n,glProgram:o,...r})}}const Lh={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},wi=0,ki=1,Ai=2,Si=3,Ti=4,Ci=5,Zi=class ua{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<wi)}set blend(t){!!(this.data&1<<wi)!==t&&(this.data^=1<<wi)}get offsets(){return!!(this.data&1<<ki)}set offsets(t){!!(this.data&1<<ki)!==t&&(this.data^=1<<ki)}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<<Ai)}set culling(t){!!(this.data&1<<Ai)!==t&&(this.data^=1<<Ai)}get depthTest(){return!!(this.data&1<<Si)}set depthTest(t){!!(this.data&1<<Si)!==t&&(this.data^=1<<Si)}get depthMask(){return!!(this.data&1<<Ci)}set depthMask(t){!!(this.data&1<<Ci)!==t&&(this.data^=1<<Ci)}get clockwiseFrontFace(){return!!(this.data&1<<Ti)}set clockwiseFrontFace(t){!!(this.data&1<<Ti)!==t&&(this.data^=1<<Ti)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Lh[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 ua;return t.depthTest=!1,t.blend=!0,t}};Zi.default2d=Zi.for2d();let da=Zi;function Tn(s,t,e=2){const i=t&&t.length,r=i?t[0]*e:s.length;let n=fa(s,0,r,e,!0);const o=[];if(!n||n.next===n.prev)return o;let a,l,h;if(i&&(n=Nh(s,t,n,e)),s.length>80*e){a=s[0],l=s[1];let c=a,u=l;for(let f=e;f<r;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 as(n,o,e,a,l,h,0),o}function fa(s,t,e,i,r){let n;if(r===Zh(s,t,e,i)>0)for(let o=t;o<e;o+=i)n=Cn(o/i|0,s[o],s[o+1],n);else for(let o=e-i;o>=t;o-=i)n=Cn(o/i|0,s[o],s[o+1],n);return n&&Pe(n,n.next)&&(hs(n),n=n.next),n}function fe(s,t){if(!s)return s;t||(t=s);let e=s,i;do if(i=!1,!e.steiner&&(Pe(e,e.next)||Q(e.prev,e,e.next)===0)){if(hs(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function as(s,t,e,i,r,n,o){if(!s)return;!o&&n&&Yh(s,i,r,n);let a=s;for(;s.prev!==s.next;){const l=s.prev,h=s.next;if(n?Gh(s,i,r,n):Bh(s)){t.push(l.i,s.i,h.i),hs(s),s=h.next,a=h.next;continue}if(s=h,s===a){o?o===1?(s=Fh(fe(s),t),as(s,t,e,i,r,n,2)):o===2&&Oh(s,t,e,i,r,n):as(fe(s),t,e,i,r,n,1);break}}}function Bh(s){const t=s.prev,e=s,i=s.next;if(Q(t,e,i)>=0)return!1;const r=t.x,n=e.x,o=i.x,a=t.y,l=e.y,h=i.y,c=Math.min(r,n,o),u=Math.min(a,l,h),f=Math.max(r,n,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&&Qe(r,a,n,l,o,h,p.x,p.y)&&Q(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Gh(s,t,e,i){const r=s.prev,n=s,o=s.next;if(Q(r,n,o)>=0)return!1;const a=r.x,l=n.x,h=o.x,c=r.y,u=n.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=Qi(d,p,t,e,i),b=Qi(g,m,t,e,i);let _=s.prevZ,w=s.nextZ;for(;_&&_.z>=y&&w&&w.z<=b;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Qe(a,c,l,u,h,f,_.x,_.y)&&Q(_.prev,_,_.next)>=0||(_=_.prevZ,w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==r&&w!==o&&Qe(a,c,l,u,h,f,w.x,w.y)&&Q(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Qe(a,c,l,u,h,f,_.x,_.y)&&Q(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;w&&w.z<=b;){if(w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==r&&w!==o&&Qe(a,c,l,u,h,f,w.x,w.y)&&Q(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Fh(s,t){let e=s;do{const i=e.prev,r=e.next.next;!Pe(i,r)&&ma(i,e,e.next,r)&&ls(i,r)&&ls(r,i)&&(t.push(i.i,e.i,r.i),hs(e),hs(e.next),e=s=r),e=e.next}while(e!==s);return fe(e)}function Oh(s,t,e,i,r,n){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Vh(o,a)){let l=ga(o,a);o=fe(o,o.next),l=fe(l,l.next),as(o,t,e,i,r,n,0),as(l,t,e,i,r,n,0);return}a=a.next}o=o.next}while(o!==s)}function Nh(s,t,e,i){const r=[];for(let n=0,o=t.length;n<o;n++){const a=t[n]*i,l=n<o-1?t[n+1]*i:s.length,h=fa(s,a,l,i,!1);h===h.next&&(h.steiner=!0),r.push(Wh(h))}r.sort(zh);for(let n=0;n<r.length;n++)e=Uh(r[n],e);return e}function zh(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),r=(t.next.y-t.y)/(t.next.x-t.x);e=i-r}return e}function Uh(s,t){const e=$h(s,t);if(!e)return t;const i=ga(e,s);return fe(i,i.next),fe(e,e.next)}function $h(s,t){let e=t;const i=s.x,r=s.y;let n=-1/0,o;if(Pe(s,e))return e;do{if(Pe(s,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const u=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=i&&u>n&&(n=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(r<h?i:n,r,l,h,r<h?n:i,r,e.x,e.y)){const u=Math.abs(r-e.y)/(i-e.x);ls(e,s)&&(u<c||u===c&&(e.x>o.x||e.x===o.x&&Hh(o,e)))&&(o=e,c=u)}e=e.next}while(e!==a);return o}function Hh(s,t){return Q(s.prev,s,t.prev)<0&&Q(t.next,s,s.next)<0}function Yh(s,t,e,i){let r=s;do r.z===0&&(r.z=Qi(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,Xh(r)}function Xh(s){let t,e=1;do{let i=s,r;s=null;let n=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)?(r=i,i=i.nextZ,a--):(r=o,o=o.nextZ,l--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;i=o}n.nextZ=null,e*=2}while(t>1);return s}function Qi(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|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 Wh(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,r,n,o,a){return(r-o)*(t-a)>=(s-o)*(n-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(i-a)}function Qe(s,t,e,i,r,n,o,a){return!(s===o&&t===a)&&pa(s,t,e,i,r,n,o,a)}function Vh(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!qh(s,t)&&(ls(s,t)&&ls(t,s)&&jh(s,t)&&(Q(s.prev,s,t.prev)||Q(s,t.prev,t))||Pe(s,t)&&Q(s.prev,s,s.next)>0&&Q(t.prev,t,t.next)>0)}function Q(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Pe(s,t){return s.x===t.x&&s.y===t.y}function ma(s,t,e,i){const r=vs(Q(s,t,e)),n=vs(Q(s,t,i)),o=vs(Q(e,i,s)),a=vs(Q(e,i,t));return!!(r!==n&&o!==a||r===0&&Ps(s,e,t)||n===0&&Ps(s,i,t)||o===0&&Ps(e,s,i)||a===0&&Ps(e,t,i))}function Ps(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 vs(s){return s>0?1:s<0?-1:0}function qh(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&&ma(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function ls(s,t){return Q(s.prev,s,s.next)<0?Q(s,t,s.next)>=0&&Q(s,s.prev,t)>=0:Q(s,t,s.prev)<0||Q(s,s.next,t)<0}function jh(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function ga(s,t){const e=Ki(s.i,s.x,s.y),i=Ki(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Cn(s,t,e,i){const r=Ki(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function hs(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 Ki(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Zh(s,t,e,i){let r=0;for(let n=t,o=e-i;n<e;n+=i)r+=(s[o]-s[n])*(s[n+1]+s[o+1]),o=n;return r}const Qh=Tn.default||Tn;var Mi,Mn;function Kh(){if(Mn)return Mi;Mn=1,Mi=e;var s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function e(n){var o=[];return n.replace(t,function(a,l,h){var c=l.toLowerCase();for(h=r(h),c=="m"&&h.length>2&&(o.push([l].concat(h.splice(0,2))),c="l",l=l=="m"?"l":"L");;){if(h.length==s[c])return h.unshift(l),o.push(h);if(h.length<s[c])throw new Error("malformed path data");o.push([l].concat(h.splice(0,s[c])))}}),o}var i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function r(n){var o=n.match(i);return o?o.map(Number):[]}return Mi}var Jh=Kh();const tc=Ao(Jh);function ec(s,t){const e=tc(s),i=[];let r=null,n=0,o=0;for(let a=0;a<e.length;a++){const l=e[a],h=l[0],c=l;switch(h){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),i.length>0&&(r=i.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:wt(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&r===null&&(r={startX:n,startY:o},i.push(r))}return t}class mr{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new mr(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i,r=.5){if(this.radius===0)return!1;const n=this.x-t,o=this.y-e,a=this.radius,l=(1-r)*i,h=Math.sqrt(n*n+o*o);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new it),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class gr{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new gr(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,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i,r=.5){const{halfWidth:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;const a=i*(1-r),l=i-a,h=n-l,c=o-l,u=n+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 it),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function sc(s,t,e,i,r,n){const o=s-e,a=t-i,l=r-e,h=n-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=r,p=n):(d=e+f*l,p=i+f*h);const g=s-d,m=t-p;return g*g+m*m}let ic,rc;class es{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let r=0;r<i;r+=2){const n=e[r],o=e[r+1],a=e[(r+2)%i],l=e[(r+3)%i];t+=(a-n)*(l+o)}return t<0}containsPolygon(t){const e=this.getBounds(ic),i=t.getBounds(rc);if(!e.containsRect(i))return!1;const r=t.points;for(let n=0;n<r.length;n+=2){const o=r[n],a=r[n+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new es(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[n*2],l=this.points[n*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,r=.5){const n=i*i,o=n*(1-r),a=n-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=sc(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 it);const e=this.points;let i=1/0,r=-1/0,n=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,r=h>r?h:r,n=c<n?c:n,o=c>o?c:o}return t.x=i,t.width=r-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return V("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return V("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 Es=(s,t,e,i,r,n,o)=>{const a=s-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=r-n&&h<=r+o};class xr{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}getBounds(t){return t||(t=new it),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new xr(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 r=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(r*r+n*n<=o||(r=t-(this.x+this.width-i),r*r+n*n<=o)||(n=e-(this.y+this.height-i),r*r+n*n<=o)||(r=t-(this.x+i),r*r+n*n<=o))return!0}return!1}strokeContains(t,e,i,r=.5){const{x:n,y:o,width:a,height:l,radius:h}=this,c=i*(1-r),u=i-c,f=n+h,d=o+h,p=a-h*2,g=l-h*2,m=n+a,y=o+l;return(t>=n-c&&t<=n+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&&Es(t,e,f,d,h,u,c)||t>m-h&&e<d&&Es(t,e,m-h,d,h,u,c)||t>m-h&&e>y-h&&Es(t,e,m-h,y-h,h,u,c)||t<f&&e>y-h&&Es(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 xa={};function nc(s,t,e){let i=2166136261;for(let r=0;r<t;r++)i^=s[r].uid,i=Math.imul(i,16777619),i>>>=0;return xa[i]||oc(s,t,i,e)}function oc(s,t,e,i){const r={};let n=0;for(let a=0;a<i;a++){const l=a<t?s[a]:Y.EMPTY.source;r[n++]=l.source,r[n++]=l.style}const o=new Fs(r);return xa[e]=o,o}class Pn{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 vn(s,t,e,i){if(e??(e=0),i??(i=Math.min(s.byteLength-e,t.byteLength)),!(e&7)&&!(i&7)){const r=i/8;new Float64Array(t,0,r).set(new Float64Array(s,e,r))}else if(!(e&3)&&!(i&3)){const r=i/4;new Float32Array(t,0,r).set(new Float32Array(s,e,r))}else new Uint8Array(t).set(new Uint8Array(s,e,i))}const ac={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function En(s,t){return t.alphaMode==="no-premultiply-alpha"&&ac[s]||s}const lc=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
-
`);function hc(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=`
|
|
25
|
-
else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function cc(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=lc.replace(/%forloop%/gi,hc(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 Ae=null;function uc(){var t;if(Ae)return Ae;const s=ra();return Ae=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),Ae=cc(Ae,s),(t=s.getExtension("WEBGL_lose_context"))==null||t.loseContext(),Ae}class dc{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 fc{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new dc,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 ss=[];let Us=0;cr.register({clear:()=>{if(ss.length>0)for(const s of ss)s&&s.destroy();ss.length=0,Us=0}});function Rn(){return Us>0?ss[--Us]:new fc}function In(s){s.elements=null,ss[Us++]=s}let Oe=0;const ya=class _a{constructor(t){this.uid=tt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={..._a.defaultOptions,...t},t.maxTextures||(V("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=uc());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new Pn(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)In(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=Rn(),r=i.textures;r.clear();const n=e[this.elementStart];let o=En(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);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,w=En(y.blendMode,_),T=o!==w||a!==y.topology;if(_._batchTick===Oe&&!T){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=Oe,(r.count>=g||T)&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),d="renderBatch",f=u,o=w,a=y.topology,i=Rn(),r=i.textures,r.clear(),p=[],++Oe),y._textureId=_._textureBindLocation=r.count,r.ids[_.uid]=r.count,r.textures[r.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))}r.count>0&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),f=u,++Oe),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,i,r,n,o,a,l,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=r,t.blendMode=n,t.topology=o,t.start=e,t.size=i,t.elements=h,++Oe,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 Pn(e);vn(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 r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)r[n]=e[n];else vn(e.buffer,r.buffer);this.indexBuffer=r}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,r){const n=t.indices,o=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<o;h++)e[i++]=r+n[h+a]-l}destroy(t={}){var e;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)In(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}}};ya.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let pc=ya;var xt=(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))(xt||{});class cs extends ee{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=tt("buffer"),this._resourceType="buffer",this._resourceId=tt("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:r,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&xt.STATIC)}set static(t){t?this.descriptor.usage|=xt.STATIC:this.descriptor.usage&=~xt.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,this._dataInt32=null,!r||r.length!==t.length){!this.shrinkToFit&&r&&t.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=tt("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 ba(s,t){if(!(s instanceof cs)){let e=t?xt.INDEX:xt.VERTEX;s instanceof Array&&(t?(s=new Uint32Array(s),e=xt.INDEX|xt.COPY_DST):(s=new Float32Array(s),e=xt.VERTEX|xt.COPY_DST)),s=new cs({data:s,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return s}function mc(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 r=i.buffer.data;let n=1/0,o=1/0,a=-1/0,l=-1/0;const h=r.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||8)/h;for(let f=c;f<r.length;f+=u){const d=r[f],p=r[f+1];d>a&&(a=d),p>l&&(l=p),d<n&&(n=d),p<o&&(o=p)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=l,e}function gc(s){return(s instanceof cs||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=ba(s.buffer,!1),s}class xc extends ee{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=tt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new It,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:r}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=r||"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=gc(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=ba(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,mc(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 yc=new Float32Array(1),_c=new Uint32Array(1);class bc extends xc{constructor(){const e=new cs({data:yc,label:"attribute-batch-buffer",usage:xt.VERTEX|xt.COPY_DST,shrinkToFit:!1}),i=new cs({data:_c,label:"index-batch-buffer",usage:xt.INDEX|xt.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:20}},indexBuffer:i})}}function Dn(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let o=s[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else wt(`${i} placement hook does not exist in shader`)}}const wc=/\{\{(.*?)\}\}/g;function Ln(s){var i;const t={};return(((i=s.match(wc))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function Bn(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function Gn(s,t,e=!1){const i=[];Bn(t,i),s.forEach(a=>{a.header&&Bn(a.header,i)});const r=i;e&&r.sort();const n=r.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
26
|
-
`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
27
|
-
${n}
|
|
28
|
-
`),o}function Fn(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function kc(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function Ac(s){const t=/@.*?\s+/g;return s.replace(t,"")}function Sc(s,t){const e=[];Fn(t,e),s.forEach(l=>{l.header&&Fn(l.header,e)});let i=0;const r=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
|
|
29
|
-
`),n=e.sort().map(l=>` var ${Ac(l)};`).join(`
|
|
30
|
-
`),o=`return VSOutput(
|
|
31
|
-
${e.sort().map(l=>` ${kc(l)}`).join(`,
|
|
32
|
-
`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
33
|
-
${r}
|
|
34
|
-
`),a=a.replace("{{start}}",`
|
|
35
|
-
${n}
|
|
36
|
-
`),a=a.replace("{{return}}",`
|
|
37
|
-
${o}
|
|
38
|
-
`),a}function On(s,t){let e=s;for(const i in t){const r=t[i];r.join(`
|
|
39
|
-
`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
|
|
40
|
-
${r.join(`
|
|
41
|
-
`)}
|
|
42
|
-
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const te=Object.create(null),Pi=new Map;let Tc=0;function Cc({template:s,bits:t}){const e=wa(s,t);if(te[e])return te[e];const{vertex:i,fragment:r}=Pc(s,t);return te[e]=ka(i,r,t),te[e]}function Mc({template:s,bits:t}){const e=wa(s,t);return te[e]||(te[e]=ka(s.vertex,s.fragment,t)),te[e]}function Pc(s,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let r=Gn(e,s.vertex,!0);r=Sc(e,r);const n=Gn(i,s.fragment,!0);return{vertex:r,fragment:n}}function wa(s,t){return t.map(e=>(Pi.has(e)||Pi.set(e,Tc++),Pi.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function ka(s,t,e){const i=Ln(s),r=Ln(t);return e.forEach(n=>{Dn(n.vertex,i,n.name),Dn(n.fragment,r,n.name)}),{vertex:On(s,i),fragment:On(t,r)}}const vc=`
|
|
43
|
-
@in aPosition: vec2<f32>;
|
|
44
|
-
@in aUV: vec2<f32>;
|
|
45
|
-
|
|
46
|
-
@out @builtin(position) vPosition: vec4<f32>;
|
|
47
|
-
@out vUV : vec2<f32>;
|
|
48
|
-
@out vColor : vec4<f32>;
|
|
49
|
-
|
|
50
|
-
{{header}}
|
|
51
|
-
|
|
52
|
-
struct VSOutput {
|
|
53
|
-
{{struct}}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
@vertex
|
|
57
|
-
fn main( {{in}} ) -> VSOutput {
|
|
58
|
-
|
|
59
|
-
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
60
|
-
var modelMatrix = mat3x3<f32>(
|
|
61
|
-
1.0, 0.0, 0.0,
|
|
62
|
-
0.0, 1.0, 0.0,
|
|
63
|
-
0.0, 0.0, 1.0
|
|
64
|
-
);
|
|
65
|
-
var position = aPosition;
|
|
66
|
-
var uv = aUV;
|
|
67
|
-
|
|
68
|
-
{{start}}
|
|
69
|
-
|
|
70
|
-
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
71
|
-
|
|
72
|
-
{{main}}
|
|
73
|
-
|
|
74
|
-
vUV = uv;
|
|
75
|
-
|
|
76
|
-
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
77
|
-
|
|
78
|
-
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
79
|
-
|
|
80
|
-
vColor *= globalUniforms.uWorldColorAlpha;
|
|
81
|
-
|
|
82
|
-
{{end}}
|
|
83
|
-
|
|
84
|
-
{{return}}
|
|
85
|
-
};
|
|
86
|
-
`,Ec=`
|
|
87
|
-
@in vUV : vec2<f32>;
|
|
88
|
-
@in vColor : vec4<f32>;
|
|
89
|
-
|
|
90
|
-
{{header}}
|
|
91
|
-
|
|
92
|
-
@fragment
|
|
93
|
-
fn main(
|
|
94
|
-
{{in}}
|
|
95
|
-
) -> @location(0) vec4<f32> {
|
|
96
|
-
|
|
97
|
-
{{start}}
|
|
98
|
-
|
|
99
|
-
var outColor:vec4<f32>;
|
|
100
|
-
|
|
101
|
-
{{main}}
|
|
102
|
-
|
|
103
|
-
var finalColor:vec4<f32> = outColor * vColor;
|
|
104
|
-
|
|
105
|
-
{{end}}
|
|
106
|
-
|
|
107
|
-
return finalColor;
|
|
108
|
-
};
|
|
109
|
-
`,Rc=`
|
|
110
|
-
in vec2 aPosition;
|
|
111
|
-
in vec2 aUV;
|
|
112
|
-
|
|
113
|
-
out vec4 vColor;
|
|
114
|
-
out vec2 vUV;
|
|
115
|
-
|
|
116
|
-
{{header}}
|
|
117
|
-
|
|
118
|
-
void main(void){
|
|
119
|
-
|
|
120
|
-
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
121
|
-
mat3 modelMatrix = mat3(
|
|
122
|
-
1.0, 0.0, 0.0,
|
|
123
|
-
0.0, 1.0, 0.0,
|
|
124
|
-
0.0, 0.0, 1.0
|
|
125
|
-
);
|
|
126
|
-
vec2 position = aPosition;
|
|
127
|
-
vec2 uv = aUV;
|
|
128
|
-
|
|
129
|
-
{{start}}
|
|
130
|
-
|
|
131
|
-
vColor = vec4(1.);
|
|
132
|
-
|
|
133
|
-
{{main}}
|
|
134
|
-
|
|
135
|
-
vUV = uv;
|
|
136
|
-
|
|
137
|
-
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
138
|
-
|
|
139
|
-
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
140
|
-
|
|
141
|
-
vColor *= uWorldColorAlpha;
|
|
142
|
-
|
|
143
|
-
{{end}}
|
|
144
|
-
}
|
|
145
|
-
`,Ic=`
|
|
146
|
-
|
|
147
|
-
in vec4 vColor;
|
|
148
|
-
in vec2 vUV;
|
|
149
|
-
|
|
150
|
-
out vec4 finalColor;
|
|
151
|
-
|
|
152
|
-
{{header}}
|
|
153
|
-
|
|
154
|
-
void main(void) {
|
|
155
|
-
|
|
156
|
-
{{start}}
|
|
157
|
-
|
|
158
|
-
vec4 outColor;
|
|
159
|
-
|
|
160
|
-
{{main}}
|
|
161
|
-
|
|
162
|
-
finalColor = outColor * vColor;
|
|
163
|
-
|
|
164
|
-
{{end}}
|
|
165
|
-
}
|
|
166
|
-
`,Dc={name:"global-uniforms-bit",vertex:{header:`
|
|
167
|
-
struct GlobalUniforms {
|
|
168
|
-
uProjectionMatrix:mat3x3<f32>,
|
|
169
|
-
uWorldTransformMatrix:mat3x3<f32>,
|
|
170
|
-
uWorldColorAlpha: vec4<f32>,
|
|
171
|
-
uResolution: vec2<f32>,
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
175
|
-
`}},Lc={name:"global-uniforms-bit",vertex:{header:`
|
|
176
|
-
uniform mat3 uProjectionMatrix;
|
|
177
|
-
uniform mat3 uWorldTransformMatrix;
|
|
178
|
-
uniform vec4 uWorldColorAlpha;
|
|
179
|
-
uniform vec2 uResolution;
|
|
180
|
-
`}};function Bc({bits:s,name:t}){const e=Cc({template:{fragment:Ec,vertex:vc},bits:[Dc,...s]});return Vs.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Gc({bits:s,name:t}){return new oa({name:t,...Mc({template:{vertex:Rc,fragment:Ic},bits:[Lc,...s]})})}const Fc={name:"color-bit",vertex:{header:`
|
|
181
|
-
@in aColor: vec4<f32>;
|
|
182
|
-
`,main:`
|
|
183
|
-
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
184
|
-
`}},Oc={name:"color-bit",vertex:{header:`
|
|
185
|
-
in vec4 aColor;
|
|
186
|
-
`,main:`
|
|
187
|
-
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
188
|
-
`}},vi={};function Nc(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(`
|
|
189
|
-
`)}function zc(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(`
|
|
190
|
-
`)}function Uc(s){return vi[s]||(vi[s]={name:"texture-batch-bit",vertex:{header:`
|
|
191
|
-
@in aTextureIdAndRound: vec2<u32>;
|
|
192
|
-
@out @interpolate(flat) vTextureId : u32;
|
|
193
|
-
`,main:`
|
|
194
|
-
vTextureId = aTextureIdAndRound.y;
|
|
195
|
-
`,end:`
|
|
196
|
-
if(aTextureIdAndRound.x == 1)
|
|
197
|
-
{
|
|
198
|
-
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
199
|
-
}
|
|
200
|
-
`},fragment:{header:`
|
|
201
|
-
@in @interpolate(flat) vTextureId: u32;
|
|
202
|
-
|
|
203
|
-
${Nc(s)}
|
|
204
|
-
`,main:`
|
|
205
|
-
var uvDx = dpdx(vUV);
|
|
206
|
-
var uvDy = dpdy(vUV);
|
|
207
|
-
|
|
208
|
-
${zc(s)}
|
|
209
|
-
`}}),vi[s]}const Ei={};function $c(s){const t=[];for(let e=0;e<s;e++)e>0&&t.push("else"),e<s-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
210
|
-
`)}function Hc(s){return Ei[s]||(Ei[s]={name:"texture-batch-bit",vertex:{header:`
|
|
211
|
-
in vec2 aTextureIdAndRound;
|
|
212
|
-
out float vTextureId;
|
|
213
|
-
|
|
214
|
-
`,main:`
|
|
215
|
-
vTextureId = aTextureIdAndRound.y;
|
|
216
|
-
`,end:`
|
|
217
|
-
if(aTextureIdAndRound.x == 1.)
|
|
218
|
-
{
|
|
219
|
-
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
220
|
-
}
|
|
221
|
-
`},fragment:{header:`
|
|
222
|
-
in float vTextureId;
|
|
223
|
-
|
|
224
|
-
uniform sampler2D uTextures[${s}];
|
|
225
|
-
|
|
226
|
-
`,main:`
|
|
227
|
-
|
|
228
|
-
${$c(s)}
|
|
229
|
-
`}}),Ei[s]}const Yc={name:"round-pixels-bit",vertex:{header:`
|
|
230
|
-
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
231
|
-
{
|
|
232
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
233
|
-
}
|
|
234
|
-
`}},Xc={name:"round-pixels-bit",vertex:{header:`
|
|
235
|
-
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
236
|
-
{
|
|
237
|
-
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
238
|
-
}
|
|
239
|
-
`}},Nn={};function Wc(s){let t=Nn[s];if(t)return t;const e=new Int32Array(s);for(let i=0;i<s;i++)e[i]=i;return t=Nn[s]=new ca({uTextures:{value:e,type:"i32",size:s}},{isStatic:!0}),t}class zn extends pr{constructor(t){const e=Gc({name:"batch",bits:[Oc,Hc(t),Xc]}),i=Bc({name:"batch",bits:[Fc,Uc(t),Yc]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Wc(t)}}),this.maxTextures=t}}let Ne=null;const Aa=class Sa extends pc{constructor(t){super(t),this.geometry=new bc,this.name=Sa.extension.name,this.vertexSize=6,Ne??(Ne=new zn(t.maxTextures)),this.shader=Ne}packAttributes(t,e,i,r,n){const o=n<<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,b=y+t.attributeSize;for(let _=y;_<b;_++){const w=_*2,T=p[w],k=p[w+1];e[r++]=l*T+c*k+f,e[r++]=u*k+h*T+d,e[r++]=g[w],e[r++]=g[w+1],i[r++]=m,i[r++]=o}}packQuadAttributes(t,e,i,r,n){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,b=p.minY,_=o.uvs,w=t.color,T=n<<16|t.roundPixels&65535;e[r+0]=l*m+c*b+f,e[r+1]=u*b+h*m+d,e[r+2]=_.x0,e[r+3]=_.y0,i[r+4]=w,i[r+5]=T,e[r+6]=l*g+c*b+f,e[r+7]=u*b+h*g+d,e[r+8]=_.x1,e[r+9]=_.y1,i[r+10]=w,i[r+11]=T,e[r+12]=l*g+c*y+f,e[r+13]=u*y+h*g+d,e[r+14]=_.x2,e[r+15]=_.y2,i[r+16]=w,i[r+17]=T,e[r+18]=l*m+c*y+f,e[r+19]=u*y+h*m+d,e[r+20]=_.x3,e[r+21]=_.y3,i[r+22]=w,i[r+23]=T}_updateMaxTextures(t){this.shader.maxTextures!==t&&(Ne=new zn(t),this.shader=Ne)}destroy(){this.shader=null,super.destroy()}};Aa.extension={type:[X.Batcher],name:"default"};let Vc=Aa;class qs{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:r,priority:n,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,n??0),this._onUnload=r,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 r;if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&((r=this._onUnload)==null||r.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 qc(s,t,e,i,r,n,o,a=null){let l=0;e*=t,r*=n;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[r]=h*g+u*m+d,i[r+1]=c*g+f*m+p,r+=n,e+=t,l++}}function jc(s,t,e,i){let r=0;for(t*=e;r<i;)s[t]=0,s[t+1]=0,t+=e,r++}function Ta(s,t,e,i,r){const n=t.a,o=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),r||(r=s.length/i-e);let u=e*i;for(let f=0;f<r;f++){const d=s[u],p=s[u+1];s[u]=n*d+a*p+h,s[u+1]=o*d+l*p+c,u+=i}}const Zc=new B;class yr{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?Fo(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)||Zc}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 us={extension:{type:X.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,o,a;if(s.type==="circle"){const w=s;if(o=a=w.radius,o<=0)return!1;e=w.x,i=w.y,r=n=0}else if(s.type==="ellipse"){const w=s;if(o=w.halfWidth,a=w.halfHeight,o<=0||a<=0)return!1;e=w.x,i=w.y,r=n=0}else{const w=s,T=w.width/2,k=w.height/2;e=w.x+T,i=w.y+k,o=a=Math.max(0,Math.min(w.radius,Math.min(T,k))),r=T-o,n=k-a}if(r<0||n<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(r?4:0)+(n?4:0);if(h===0)return!1;if(l===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,!0;let c=0,u=l*4+(r?2:0)+2,f=u,d=h,p=r+o,g=n,m=e+p,y=e-p,b=i+g;if(t[c++]=m,t[c++]=b,t[--u]=b,t[--u]=y,n){const w=i-g;t[f++]=y,t[f++]=w,t[--d]=w,t[--d]=m}for(let w=1;w<l;w++){const T=Math.PI/2*(w/l),k=r+Math.cos(T)*o,A=n+Math.sin(T)*a,I=e+k,D=e-k,M=i+A,C=i-A;t[c++]=I,t[c++]=M,t[--u]=M,t[--u]=D,t[f++]=D,t[f++]=C,t[--d]=C,t[--d]=I}p=r,g=n+a,m=e+p,y=e-p,b=i+g;const _=i-g;return t[c++]=m,t[c++]=b,t[--d]=_,t[--d]=m,r&&(t[c++]=y,t[c++]=b,t[--d]=_,t[--d]=y),!0},triangulate(s,t,e,i,r,n){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&&(r[n++]=l,r[n++]=h,r[n++]=l-1),l++;r[n++]=h+1,r[n++]=h,r[n++]=l-1}},Qc={...us,extension:{...us.extension,name:"ellipse"}},Kc={...us,extension:{...us.extension,name:"roundedRectangle"}},Ca=1e-4,Un=1e-4;function Jc(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];i<t;i+=2){const o=s[i],a=s[i+1];e+=(o-r)*(a+n),r=o,n=a}return e<0?-1:1}function $n(s,t,e,i,r,n,o,a){const l=s-e*r,h=t-i*r,c=s+e*n,u=t+i*n;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 oe(s,t,e,i,r,n,o,a){const l=e-s,h=i-t;let c=Math.atan2(l,h),u=Math.atan2(r-s,n-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 b=1,_=f;b<m;b++,_+=y)o.push(s,t),o.push(s+Math.sin(_)*g,t+Math.cos(_)*g);o.push(s,t),o.push(r,n)}else{o.push(e,i),o.push(s,t);for(let b=1,_=f;b<m;b++,_+=y)o.push(s+Math.sin(_)*g,t+Math.cos(_)*g),o.push(s,t);o.push(r,n),o.push(s,t)}return m*2}function tu(s,t,e,i,r,n){const o=Ca;if(s.length===0)return;const a=t;let l=a.alignment;if(t.alignment!==.5){let F=Jc(s);l=(l-.5)*F+.5}const h=new lt(s[0],s[1]),c=new lt(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 F=(h.x+c.x)*.5,Ct=(c.y+h.y)*.5;s.unshift(F,Ct),s.push(F,Ct)}const d=r,p=s.length/2;let g=s.length;const m=d.length/2,y=a.width/2,b=y*y,_=a.miterLimit*a.miterLimit;let w=s[0],T=s[1],k=s[2],A=s[3],I=0,D=0,M=-(T-A),C=w-k,O=0,U=0,$=Math.sqrt(M*M+C*C);M/=$,C/=$,M*=y,C*=y;const jt=l,P=(1-jt)*2,R=jt*2;u||(a.cap==="round"?g+=oe(w-M*(P-R)*.5,T-C*(P-R)*.5,w-M*P,T-C*P,w+M*R,T+C*R,d,!0)+2:a.cap==="square"&&(g+=$n(w,T,M,C,P,R,!0,d))),d.push(w-M*P,T-C*P),d.push(w+M*R,T+C*R);for(let F=1;F<p-1;++F){w=s[(F-1)*2],T=s[(F-1)*2+1],k=s[F*2],A=s[F*2+1],I=s[(F+1)*2],D=s[(F+1)*2+1],M=-(T-A),C=w-k,$=Math.sqrt(M*M+C*C),M/=$,C/=$,M*=y,C*=y,O=-(A-D),U=k-I,$=Math.sqrt(O*O+U*U),O/=$,U/=$,O*=y,U*=y;const Ct=k-w,q=T-A,Qt=k-I,Z=D-A,Ee=Ct*Qt+q*Z,W=q*Qt-Z*Ct,Mt=W<0;if(Math.abs(W)<.001*Math.abs(Ee)){d.push(k-M*P,A-C*P),d.push(k+M*R,A+C*R),Ee>=0&&(a.join==="round"?g+=oe(k,A,k-M*P,A-C*P,k-O*P,A-U*P,d,!1)+4:g+=2,d.push(k-O*R,A-U*R),d.push(k+O*P,A+U*P));continue}const ie=(-M+w)*(-C+A)-(-M+k)*(-C+T),Pt=(-O+I)*(-U+A)-(-O+k)*(-U+D),re=(Ct*Pt-Qt*ie)/W,Kt=(Z*ie-q*Pt)/W,ge=(re-k)*(re-k)+(Kt-A)*(Kt-A),Lt=k+(re-k)*P,mt=A+(Kt-A)*P,At=k-(re-k)*R,ht=A-(Kt-A)*R,Re=Math.min(Ct*Ct+q*q,Qt*Qt+Z*Z),xe=Mt?P:R,Jt=Re+xe*xe*b;ge<=Jt?a.join==="bevel"||ge/b>_?(Mt?(d.push(Lt,mt),d.push(k+M*R,A+C*R),d.push(Lt,mt),d.push(k+O*R,A+U*R)):(d.push(k-M*P,A-C*P),d.push(At,ht),d.push(k-O*P,A-U*P),d.push(At,ht)),g+=2):a.join==="round"?Mt?(d.push(Lt,mt),d.push(k+M*R,A+C*R),g+=oe(k,A,k+M*R,A+C*R,k+O*R,A+U*R,d,!0)+4,d.push(Lt,mt),d.push(k+O*R,A+U*R)):(d.push(k-M*P,A-C*P),d.push(At,ht),g+=oe(k,A,k-M*P,A-C*P,k-O*P,A-U*P,d,!1)+4,d.push(k-O*P,A-U*P),d.push(At,ht)):(d.push(Lt,mt),d.push(At,ht)):(d.push(k-M*P,A-C*P),d.push(k+M*R,A+C*R),a.join==="round"?Mt?g+=oe(k,A,k+M*R,A+C*R,k+O*R,A+U*R,d,!0)+2:g+=oe(k,A,k-M*P,A-C*P,k-O*P,A-U*P,d,!1)+2:a.join==="miter"&&ge/b<=_&&(Mt?(d.push(At,ht),d.push(At,ht)):(d.push(Lt,mt),d.push(Lt,mt)),g+=2),d.push(k-O*P,A-U*P),d.push(k+O*R,A+U*R),g+=2)}w=s[(p-2)*2],T=s[(p-2)*2+1],k=s[(p-1)*2],A=s[(p-1)*2+1],M=-(T-A),C=w-k,$=Math.sqrt(M*M+C*C),M/=$,C/=$,M*=y,C*=y,d.push(k-M*P,A-C*P),d.push(k+M*R,A+C*R),u||(a.cap==="round"?g+=oe(k-M*(P-R)*.5,A-C*(P-R)*.5,k-M*P,A-C*P,k+M*R,A+C*R,d,!1)+2:a.cap==="square"&&(g+=$n(k,A,M,C,P,R,!1,d)));const Zt=Un*Un;for(let F=m;F<g+m-2;++F)w=d[F*2],T=d[F*2+1],k=d[(F+1)*2],A=d[(F+1)*2+1],I=d[(F+2)*2],D=d[(F+2)*2+1],!(Math.abs(w*(A-D)+k*(D-T)+I*(T-A))<Zt)&&n.push(F,F+1,F+2)}function eu(s,t,e,i){const r=Ca;if(s.length===0)return;const n=s[0],o=s[1],a=s[s.length-2],l=s[s.length-1],h=t||Math.abs(n-a)<r&&Math.abs(o-l)<r,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 Ma(s,t,e,i,r,n,o){const a=Qh(s,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)n[o++]=a[h]+r,n[o++]=a[h+1]+r,n[o++]=a[h+2]+r;let l=r*i;for(let h=0;h<s.length;h+=2)e[l]=s[h],e[l+1]=s[h+1],l+=i}const su=[],iu={extension:{type:X.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,r,n){Ma(s,su,t,e,i,r,n)}},ru={extension:{type:X.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,i=e.x,r=e.y,n=e.width,o=e.height;return n>0&&o>0?(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+o,t[6]=i,t[7]=r+o,!0):!1},triangulate(s,t,e,i,r,n){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;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2}},nu={extension:{type:X.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,r,n){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;r[n++]=a,r[n++]=a+1,r[n++]=a+2}},Hn=[{offset:0,color:"white"},{offset:1,color:"black"}],_r=class Ji{constructor(...t){this.uid=tt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=ou(t);e={...e.type==="radial"?Ji.defaultRadialOptions:Ji.defaultLinearOptions,...Co(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(r=>{this.addColorStop(r.offset,r.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:qt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:r}=this.end,n=i-t,o=r-e;const a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const m=t;t=i,i=m,n*=-1}if(o<0){const m=e;e=r,r=m,o*=-1}}const l=this.colorStops.length?this.colorStops:Hn,h=this._textureSize,{canvas:c,context:u}=Xn(h,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Yn(f,l),u.fillStyle=f,u.fillRect(0,0,h,1),this.texture=new Y({source:new zs({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(n*n+o*o),p=Math.atan2(o,n),g=new B;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:Hn,e=this._textureSize,{canvas:i,context:r}=Xn(e,e),{x:n,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=(n-u)*d,g=(o-f)*d,m=r.createRadialGradient(p,g,h*d,(a-u)*d,(l-f)*d,c*d);Yn(m,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=m,r.translate(p,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-p,-g),r.fillRect(0,0,e,e),this.texture=new Y({source:new zs({resource:i,addressMode:this._wrapMode})});const y=new B;y.scale(1/d,1/d),y.translate(u,f),this.textureSpace==="local"&&y.scale(e,e),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}`}};_r.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};_r.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let fs=_r;function Yn(s,t){for(let e=0;e<t.length;e++){const i=t[e];s.addColorStop(i.offset,i.color)}}function Xn(s,t){const e=ds.get().createCanvas(s,t),i=e.getContext("2d");return{canvas:e,context:i}}function ou(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(V("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]??fs.defaultLinearOptions.textureSize}),t}const au=new B,lu=new it;function hu(s,t,e,i){const r=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(lu);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=r.a,p=r.b,g=r.c,m=r.d;r.a*=h,r.b*=h,r.c*=c,r.d*=c,r.tx=u*d+f*g+r.tx,r.ty=u*p+f*m+r.ty}else r.translate(t.texture.frame.x,t.texture.frame.y),r.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof fs)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),i&&r.append(au.copyFrom(i).invert()),r}const js={};kt.handleByMap(X.ShapeBuilder,js);kt.add(ru,iu,nu,us,Qc,Kc);const cu=new it,uu=new B;function du(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 r=0;r<s.instructions.length;r++){const n=s.instructions[r];if(n.action==="texture")fu(n.data,i,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,l=n.data.style,h=n.data.hole;o&&h&&Wn(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),Wn(a,l,o,i,e)}}}function fu(s,t,e){const i=[],r=js.rectangle,n=cu;n.x=s.dx,n.y=s.dy,n.width=s.dw,n.height=s.dh;const o=s.transform;if(!r.build(n,i))return;const{vertices:a,uvs:l,indices:h}=e,c=h.length,u=a.length/2;o&&Ta(i,o),r.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=yt.get(yr);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 Wn(s,t,e,i,r){const{vertices:n,uvs:o,indices:a}=r;s.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{const u=[],f=js[l.type];if(!f.build(l,u))return;const d=a.length,p=n.length/2;let g="triangle-list";if(h&&Ta(u,h),e){const _=l.closePath??!0,w=t;w.pixelLine?(eu(u,_,n,a),g="line-list"):tu(u,w,!1,_,n,a)}else if(c){const _=[],w=u.slice();pu(c).forEach(k=>{_.push(w.length/2),w.push(...k)}),Ma(w,_,n,2,p,a,d)}else f.triangulate(u,n,2,p,a,d);const m=o.length/2,y=t.texture;if(y!==Y.WHITE){const _=hu(uu,t,l,h);qc(n,2,p,o,m,2,n.length/2-p,_)}else jc(o,m,2,n.length/2-p);const b=yt.get(yr);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=p,b.attributeSize=n.length/2-p,b.baseColor=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=r,b.topology=g,i.push(b)})}function pu(s){const t=[];for(let e=0;e<s.length;e++){const i=s[e].shape,r=[];js[i.type].build(i,r)&&t.push(r)}return t}class mu{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{yt.return(t)}),this.graphicsData&&yt.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 gu{constructor(){this.instructions=new dr}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Vc({maxTextures:e}),this.instructions.reset()}get geometry(){return V(bl,"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 br=class tr{constructor(t){this._renderer=t,this._managedContexts=new qs({renderer:t,type:"resource",name:"graphicsContext"})}init(t){tr.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??tr.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(),du(t,i);const r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="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=yt.get(gu,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:r,geometryData:n}=i;i.graphicsData=e;const o=n.vertices.length,a=n.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let u=0;u<r.length;u++){const f=r[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=nc(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new mu;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};br.extension={type:[X.WebGLSystem,X.WebGPUSystem],name:"graphicsContext"};br.defaultOptions={bezierSmoothness:.5};let wr=br;const xu=8,Rs=11920929e-14,yu=1;function Pa(s,t,e,i,r,n,o,a,l,h){const u=Math.min(.99,Math.max(0,h??wr.defaultOptions.bezierSmoothness));let f=(yu-u)/1;return f*=f,_u(t,e,i,r,n,o,a,l,s,f),s}function _u(s,t,e,i,r,n,o,a,l,h){er(s,t,e,i,r,n,o,a,l,h,0),l.push(o,a)}function er(s,t,e,i,r,n,o,a,l,h,c){if(c>xu)return;const u=(s+e)/2,f=(t+i)/2,d=(e+r)/2,p=(i+n)/2,g=(r+o)/2,m=(n+a)/2,y=(u+d)/2,b=(f+p)/2,_=(d+g)/2,w=(p+m)/2,T=(y+_)/2,k=(b+w)/2;if(c>0){let A=o-s,I=a-t;const D=Math.abs((e-o)*I-(i-a)*A),M=Math.abs((r-o)*I-(n-a)*A);if(D>Rs&&M>Rs){if((D+M)*(D+M)<=h*(A*A+I*I)){l.push(T,k);return}}else if(D>Rs){if(D*D<=h*(A*A+I*I)){l.push(T,k);return}}else if(M>Rs){if(M*M<=h*(A*A+I*I)){l.push(T,k);return}}else if(A=T-(s+o)/2,I=k-(t+a)/2,A*A+I*I<=h){l.push(T,k);return}}er(s,t,u,f,y,b,T,k,l,h,c+1),er(T,k,_,w,g,m,o,a,l,h,c+1)}const bu=8,wu=11920929e-14,ku=1;function Au(s,t,e,i,r,n,o,a){const h=Math.min(.99,Math.max(0,a??wr.defaultOptions.bezierSmoothness));let c=(ku-h)/1;return c*=c,Su(t,e,i,r,n,o,s,c),s}function Su(s,t,e,i,r,n,o,a){sr(o,s,t,e,i,r,n,a,0),o.push(r,n)}function sr(s,t,e,i,r,n,o,a,l){if(l>bu)return;const h=(t+i)/2,c=(e+r)/2,u=(i+n)/2,f=(r+o)/2,d=(h+u)/2,p=(c+f)/2;let g=n-t,m=o-e;const y=Math.abs((i-n)*m-(r-o)*g);if(y>wu){if(y*y<=a*(g*g+m*m)){s.push(d,p);return}}else if(g=d-(t+n)/2,m=p-(e+o)/2,g*g+m*m<=a){s.push(d,p);return}sr(s,t,e,h,c,d,p,a,l+1),sr(s,d,p,u,f,n,o,a,l+1)}function va(s,t,e,i,r,n,o,a){let l=Math.abs(r-n);(!o&&r>n||o&&n>r)&&(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=r;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 Tu(s,t,e,i,r,n){const o=s[s.length-2],l=s[s.length-1]-e,h=o-t,c=r-e,u=i-t,f=Math.abs(l*u-h*c);if(f<1e-8||n===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=n*Math.sqrt(d)/f,y=n*Math.sqrt(p)/f,b=m*g/d,_=y*g/p,w=m*u+y*h,T=m*c+y*l,k=h*(y+b),A=l*(y+b),I=u*(m+_),D=c*(m+_),M=Math.atan2(A-T,k-w),C=Math.atan2(D-T,I-w);va(s,w+t,T+e,n,M,C,h*c>u*l)}const is=Math.PI*2,Ri={centerX:0,centerY:0,ang1:0,ang2:0},Ii=({x:s,y:t},e,i,r,n,o,a,l)=>{s*=e,t*=i;const h=r*s-n*t,c=n*s+r*t;return l.x=h+o,l.y=c+a,l};function Cu(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const Vn=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},Mu=(s,t,e,i,r,n,o,a,l,h,c,u,f)=>{const d=Math.pow(r,2),p=Math.pow(n,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 b=y*r/n*u,_=y*-n/r*c,w=h*b-l*_+(s+e)/2,T=l*b+h*_+(t+i)/2,k=(c-b)/r,A=(u-_)/n,I=(-c-b)/r,D=(-u-_)/n,M=Vn(1,0,k,A);let C=Vn(k,A,I,D);a===0&&C>0&&(C-=is),a===1&&C<0&&(C+=is),f.centerX=w,f.centerY=T,f.ang1=M,f.ang2=C};function Pu(s,t,e,i,r,n,o,a=0,l=0,h=0){if(n===0||o===0)return;const c=Math.sin(a*is/360),u=Math.cos(a*is/360),f=u*(t-i)/2+c*(e-r)/2,d=-c*(t-i)/2+u*(e-r)/2;if(f===0&&d===0)return;n=Math.abs(n),o=Math.abs(o);const p=Math.pow(f,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);p>1&&(n*=Math.sqrt(p),o*=Math.sqrt(p)),Mu(t,e,i,r,n,o,l,h,c,u,f,d,Ri);let{ang1:g,ang2:m}=Ri;const{centerX:y,centerY:b}=Ri;let _=Math.abs(m)/(is/4);Math.abs(1-_)<1e-7&&(_=1);const w=Math.max(Math.ceil(_),1);m/=w;let T=s[s.length-2],k=s[s.length-1];const A={x:0,y:0};for(let I=0;I<w;I++){const D=Cu(g,m),{x:M,y:C}=Ii(D[0],n,o,u,c,y,b,A),{x:O,y:U}=Ii(D[1],n,o,u,c,y,b,A),{x:$,y:jt}=Ii(D[2],n,o,u,c,y,b,A);Pa(s,T,k,M,C,O,U,$,jt),T=$,k=jt,g+=m}}function vu(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}},r=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.lineTo(a.x,a.y)};let n=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){r(o,a),n=a;continue}const h=t[(o+1)%t.length],c=i(a,n),u=i(a,h);if(c.len<1e-4||u.len<1e-4){r(o,a),n=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 b=a.x+u.nx*y+-u.ny*m*d,_=a.y+u.ny*y+u.nx*m*d,w=Math.atan2(c.ny,c.nx)+Math.PI/2*d,T=Math.atan2(u.ny,u.nx)-Math.PI/2*d;o===0&&s.moveTo(b+Math.cos(w)*m,_+Math.sin(w)*m),s.arc(b,_,m,w,T,p),n=a}}function Eu(s,t,e,i){const r=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),n=(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=r(c,l);let d;if(f<1e-4)d=l;else{const m=Math.min(f/2,h);d=n(l,c,m/f)}const p=r(u,l);let g;if(p<1e-4)g=l;else{const m=Math.min(p/2,h);g=n(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 Ru=new it;class Iu{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new It,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,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,r,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return va(a,t,e,i,r,n,o),this}arcTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly.points;return Tu(o,t,e,i,r,n),this}arcToSvg(t,e,i,r,n,o,a){const l=this._currentPoly.points;return Pu(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,o,a){this._ensurePoly();const l=this._currentPoly;return Pa(this._currentPoly.points,l.lastX,l.lastY,t,e,i,r,n,o,a),this}quadraticCurveTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly;return Au(this._currentPoly.points,o.lastX,o.lastY,t,e,i,r,n),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,r=i.length;for(let n=0;n<t.instructions.length;n++){const o=t.instructions[n];this[o.action](...o.data)}if(t.checkForHoles&&i.length-r>1){let n=null;for(let o=r;o<i.length;o++){const a=i[o];if(a.shape.type==="polygon"){const l=a.shape,h=n==null?void 0:n.shape;h&&h.containsPolygon(l)?(n.holes||(n.holes=[]),n.holes.push(a),i.copyWithin(o,o+1),i.length--,o--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,r,n){return this.drawShape(new it(t,e,i,r),n),this}circle(t,e,i,r){return this.drawShape(new mr(t,e,i),r),this}poly(t,e,i){const r=new es(t);return r.closePath=e,this.drawShape(r,i),this}regularPoly(t,e,i,r,n=0,o){r=Math.max(r|0,3);const a=-1*Math.PI/2+n,l=Math.PI*2/r,h=[];for(let c=0;c<r;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}roundPoly(t,e,i,r,n,o=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(t,e,i,r,o);const l=i*Math.sin(Math.PI/r)-.001;n=Math.min(n,l);const h=-1*Math.PI/2+o,c=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let f=0;f<r;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,b=p+n*Math.cos(m),_=g+n*Math.sin(m),w=p+n*Math.cos(y),T=g+n*Math.sin(y);f===0?this.moveTo(b,_):this.lineTo(b,_),this.quadraticCurveTo(p,g,w,T,a)}return this.closePath()}roundShape(t,e,i=!1,r){return t.length<3?this:(i?Eu(this,t,e,r):vu(this,t,e),this.closePath())}filletRect(t,e,i,r,n){if(n===0)return this.rect(t,e,i,r);const o=Math.min(i,r)/2,a=Math.min(o,Math.max(-o,n)),l=t+i,h=e+r,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,r,n,o){if(n<=0)return this.rect(t,e,i,r);const a=Math.min(n,Math.min(i,r)/2),l=t+i,h=e+r,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,r,n){return this.drawShape(new gr(t,e,i,r),n),this}roundRect(t,e,i,r,n,o){return this.drawShape(new xr(t,e,i,r,n),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 es,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 es,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*r+n.tx,r=n.b*o+n.d*r+n.ty}this._currentPoly.points.push(i,r)}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 r=e[i],n=r.shape.getBounds(Ru);r.transform?t.addRect(n,r.transform):t.addRect(n)}return t}}class Vt{constructor(t,e=!1){this.instructions=[],this.uid=tt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?ec(t,this):this.instructions=(t==null?void 0:t.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new Iu(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,r,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(lt.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,r,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const r=this.instructions[this.instructions.length-1],n=this.getLastPoint(lt.shared);let o=0,a=0;if(!r||r.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=r.data[0],a=r.data[1];const l=n.x,h=n.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,r,n){return this.instructions.push({action:"rect",data:[t,e,i,r,n]}),this._dirty=!0,this}circle(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,r,n,o,a){n||(n=r/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?n:r,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 Vt;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const r=this.instructions[i];e.instructions.push({action:r.action,data:r.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,r=t.c,n=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],b=y.data;switch(y.action){case"moveTo":case"lineTo":l=b[0],h=b[1],b[0]=e*l+r*h+o,b[1]=i*l+n*h+a;break;case"bezierCurveTo":c=b[0],u=b[1],f=b[2],d=b[3],l=b[4],h=b[5],b[0]=e*c+r*u+o,b[1]=i*c+n*u+a,b[2]=e*f+r*d+o,b[3]=i*f+n*d+a,b[4]=e*l+r*h+o,b[5]=i*l+n*h+a;break;case"quadraticCurveTo":c=b[0],u=b[1],l=b[2],h=b[3],b[0]=e*c+r*u+o,b[1]=i*c+n*u+a,b[2]=e*l+r*h+o,b[3]=i*l+n*h+a;break;case"arcToSvg":l=b[5],h=b[6],p=b[0],g=b[1],b[0]=e*p+r*g,b[1]=i*p+n*g,b[5]=e*l+r*h+o,b[6]=i*l+n*h+a;break;case"circle":b[4]=ze(b[3],t);break;case"rect":b[4]=ze(b[4],t);break;case"ellipse":b[8]=ze(b[8],t);break;case"roundRect":b[5]=ze(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=ze(b[2],t);break;default:wt("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 ze(s,t){return s?s.prepend(t):t.clone()}function K(s,t,e){const i=s.getAttribute(t);return i?Number(i):e}function Du(s,t){const e=s.querySelectorAll("defs");for(let i=0;i<e.length;i++){const r=e[i];for(let n=0;n<r.children.length;n++){const o=r.children[n];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=Lu(o);break;case"radialgradient":t.defs[o.id]=Bu();break}}}}function Lu(s){const t=K(s,"x1",0),e=K(s,"y1",0),i=K(s,"x2",1),r=K(s,"y2",0),n=s.getAttribute("gradientUnits")||"objectBoundingBox",o=new fs(t,e,i,r,n==="objectBoundingBox"?"local":"global");for(let a=0;a<s.children.length;a++){const l=s.children[a],h=K(l,"offset",0),c=qt.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(h,c)}return o}function Bu(s){return wt("[SVG Parser] Radial gradients are not yet supported"),new fs(0,0,1,0)}function qn(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const jn={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 Ea(s,t){const e=s.getAttribute("style"),i={},r={},n={strokeStyle:i,fillStyle:r,useFill:!1,useStroke:!1};for(const o in jn){const a=s.getAttribute(o);a&&Zn(t,n,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(":");jn[h]&&Zn(t,n,h,c.trim())}}return{strokeStyle:n.useStroke?i:null,fillStyle:n.useFill?r:null,useFill:n.useFill,useStroke:n.useStroke}}function Zn(s,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){const r=qn(i);t.strokeStyle.fill=s.defs[r]}else t.strokeStyle.color=qt.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 r=qn(i);t.fillStyle.fill=s.defs[r]}else t.fillStyle.color=qt.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 Gu(s){if(s.length<=2)return!0;const t=s.map(a=>a.area).sort((a,l)=>l-a),[e,i]=t,r=t[t.length-1],n=e/i,o=i/r;return!(n>3&&o<2)}function Fu(s){return s.split(/(?=[Mm])/).filter(i=>i.trim().length>0)}function Ou(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],r=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(i.push(e[c]),r.push(e[c+1]));if(i.length===0||r.length===0)return 0;const n=Math.min(...i),o=Math.max(...i),a=Math.min(...r),l=Math.max(...r);return(o-n)*(l-a)}function Qn(s,t){const e=new Vt(s,!1);for(const i of e.instructions)t.instructions.push(i)}function Nu(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 Vt};Du(s,e);const i=s.children,{fillStyle:r,strokeStyle:n}=Ea(s,e);for(let o=0;o<i.length;o++){const a=i[o];a.nodeName.toLowerCase()!=="defs"&&Ra(a,e,r,n)}return t}function Ra(s,t,e,i){const r=s.children,{fillStyle:n,strokeStyle:o}=Ea(s,t);n&&e?e={...e,...n}:n&&(e=n),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,b,_,w,T,k,A,I;switch(s.nodeName.toLowerCase()){case"path":{T=s.getAttribute("d");const D=s.getAttribute("fill-rule"),M=Fu(T),C=D==="evenodd",O=M.length>1;if(C&&O){const $=M.map(P=>({path:P,area:Ou(P)}));if($.sort((P,R)=>R.area-P.area),M.length>3||!Gu($))for(let P=0;P<$.length;P++){const R=$[P],Zt=P===0;t.context.beginPath();const F=new Vt(void 0,!0);Qn(R.path,F),t.context.path(F),Zt?(e&&t.context.fill(e),i&&t.context.stroke(i)):t.context.cut()}else for(let P=0;P<$.length;P++){const R=$[P],Zt=P%2===1;t.context.beginPath();const F=new Vt(void 0,!0);Qn(R.path,F),t.context.path(F),Zt?t.context.cut():(e&&t.context.fill(e),i&&t.context.stroke(i))}}else{const $=D?D==="evenodd":!0;k=new Vt(T,$),t.context.path(k),e&&t.context.fill(e),i&&t.context.stroke(i)}break}case"circle":p=K(s,"cx",0),g=K(s,"cy",0),m=K(s,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=K(s,"x",0),h=K(s,"y",0),A=K(s,"width",0),I=K(s,"height",0),y=K(s,"rx",0),b=K(s,"ry",0),y||b?t.context.roundRect(l,h,A,I,y||b):t.context.rect(l,h,A,I),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=K(s,"cx",0),g=K(s,"cy",0),y=K(s,"rx",0),b=K(s,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,y,b),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=K(s,"x1",0),u=K(s,"y1",0),f=K(s,"x2",0),d=K(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case"polygon":w=s.getAttribute("points"),_=w.match(/-?\d+/g).map(D=>parseInt(D,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=s.getAttribute("points"),_=w.match(/-?\d+/g).map(D=>parseInt(D,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{wt(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let D=0;D<r.length;D++)Ra(r[D],t,e,i)}const Kn={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 zu{constructor(t,e){this.uid=tt("fillPattern"),this._tick=0,this.transform=new B,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Kn[e].addressModeU,t.source.style.addressModeV=Kn[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),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 Uu(s){return qt.isColorLike(s)}function Jn(s){return s instanceof zu}function to(s){return s instanceof fs}function $u(s){return s instanceof Y}function Hu(s,t,e){const i=qt.shared.setValue(t??0);return s.color=i.toNumber(),s.alpha=i.alpha===1?e.alpha:i.alpha,s.texture=Y.WHITE,{...e,...s}}function Yu(s,t,e){return s.texture=t,{...e,...s}}function eo(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,{...e,...s}}function so(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 Xu(s,t){const e={...t,...s},i=qt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function Ke(s,t){if(s==null)return null;const e={},i=s;return Uu(s)?Hu(e,s,t):$u(s)?Yu(e,s,t):Jn(s)?eo(e,s,t):to(s)?so(e,s,t):i.fill&&Jn(i.fill)?eo(i,i.fill,t):i.fill&&to(i.fill)?so(i,i.fill,t):Xu(i,t)}function io(s,t){const{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...l}=t,h=Ke(s,l);return h?{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...h}:null}function Wu(s,t){let e=1;const i=s.shapePath.shapePrimitives;for(let r=0;r<i.length;r++){const n=i[r].shape;if(n.type!=="polygon")continue;const o=n.points,a=o.length;if(a<6)continue;const l=n.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],b=f-p,_=d-g,w=m-p,T=y-g,k=b*b+_*_,A=w*w+T*T;if(k<1e-12||A<1e-12)continue;let M=(b*w+_*T)/Math.sqrt(k*A);M<-1?M=-1:M>1&&(M=1);const C=Math.sqrt((1-M)*.5);if(C<1e-6)continue;const O=Math.min(1/C,t);O>e&&(e=O)}}return e}const Vu=new lt,ro=new B,kr=class Ot extends ee{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=tt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new Vt,this._transform=new B,this._fillStyle={...Ot.defaultFillStyle},this._strokeStyle={...Ot.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new It,this._boundsDirty=!0}clone(){const t=new Ot;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=Ke(t,Ot.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=io(t,Ot.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ke(t,Ot.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ke(t,Ot.defaultStrokeStyle),this}texture(t,e,i,r,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:r||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?qt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Vt,this}fill(t,e){let i;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="stroke"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(V(at,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ke(t,Ot.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(lt.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=io(t,Ot.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,r,n,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,r,n,o),this}arcTo(t,e,i,r,n){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*r+o.tx,o.b*i+o.d*r+o.ty,n),this}arcToSvg(t,e,i,r,n,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,i,r,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,i,r,n,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*r+l.tx,l.b*i+l.d*r+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,r){return this._tick++,this._activePath.ellipse(t,e,i,r,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,r=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return r.length===1&&r[0].action==="moveTo"?(r[0].data[0]=n,r[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,i,r,n){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*r+o.tx,o.b*i+o.d*r+o.ty,n),this}rect(t,e,i,r){return this._tick++,this._activePath.rect(t,e,i,r,this._transform.clone()),this}roundRect(t,e,i,r,n){return this._tick++,this._activePath.roundRect(t,e,i,r,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,r,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,r,n,o),this}roundPoly(t,e,i,r,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,r,n,o),this}roundShape(t,e,i,r){return this._tick++,this._activePath.roundShape(t,e,i,r),this}filletRect(t,e,i,r,n){return this._tick++,this._activePath.filletRect(t,e,i,r,n),this}chamferRect(t,e,i,r,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,r,n,o),this}star(t,e,i,r,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,r,n,o,this._transform.clone()),this}svg(t){return this._tick++,Nu(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,r,n,o){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,r,n,o),this)}transform(t,e,i,r,n,o){return t instanceof B?(this._transform.append(t),this):(ro.set(t,e,i,r,n,o),this._transform.append(ro),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],r=i.action;if(r==="fill"){const n=i.data;t.addBounds(n.path.bounds)}else if(r==="texture"){const n=i.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(r==="stroke"){const n=i.data,o=n.style.alignment;let a=n.style.width*(1-o);n.style.join==="miter"&&(a*=Wu(n.path,n.style.miterLimit));const l=n.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var r;if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let n=0;n<e.length;n++){const o=e[n],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,Vu):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=(r=g.shapePath)==null?void 0:r.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}};kr.defaultFillStyle={color:16777215,alpha:1,texture:Y.WHITE,matrix:null,fill:null,textureSpace:"local"};kr.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Y.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Ue=kr;class qu{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class ju{constructor(){this.instructions=new dr}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Ar=class ir{constructor(t){this._renderer=t,this._managedContexts=new qs({renderer:t,type:"resource",name:"graphicsContext"})}init(t){ir.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??ir.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,i=!!e[this._renderer.uid],r=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!i)&&(i&&r.reset(),r.isBatchable=!1,t.dirty=!1),r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new ju,i=this.getGpuContext(t);return i.graphicsData=e,e.init(),e}_initContext(t){const e=new qu;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Ar.extension={type:[X.CanvasSystem],name:"graphicsContext"};Ar.defaultOptions={bezierSmoothness:.5};let Zu=Ar;class Ia{constructor(t,e){this.state=da.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new qs({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}}Ia.extension={type:[X.CanvasPipes],name:"graphics"};function Qu(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 Ku{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{yt.return(t)}),this.batches.length=0}}class Da{constructor(t,e){this.state=da.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new qs({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,i=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!!(n.isBatchable||i!==n.isBatchable)}addRenderable(t,e){const r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const i=this._getGpuDataForRenderable(t).batches;for(let r=0;r<i.length;r++){const n=i[r];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const n=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const o=n.resources.localUniforms.uniforms;o.uTransformMatrix=t.groupTransform,o.uRound=e._roundPixels|t._roundPixels,Qu(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,r=this._getGpuDataForRenderable(t).batches;for(let n=0;n<r.length;n++){const o=r[n];i.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new Ku;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const i=t.context,n=this.renderer.graphicsContext.getGpuContext(i),o=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map(a=>{const l=yt.get(yr);return a.copyTo(l),l.renderable=t,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Da.extension={type:[X.WebGLPipes,X.WebGPUPipes],name:"graphics"};kt.add(Ia);kt.add(Da);kt.add(Zu);kt.add(wr);class $s extends $o{constructor(t){t instanceof Ue&&(t={context:t});const{context:e,roundPixels:i,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new Ue,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 $s(this._context.clone()):(this._ownedContext=null,new $s(this._context))}lineStyle(t,e,i){V(at,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){V(at,"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(){V(at,"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!==Ue.defaultStrokeStyle.width||t.color!==Ue.defaultStrokeStyle.color||t.alpha!==Ue.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return V(at,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return V(at,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return V(at,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return V(at,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return V(at,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return V(at,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}kt.add(cl,ul);const Ju={background:"#1a1c2e",grid:"rgba(100, 118, 140, 0.15)",structureTool:"#3b82f6",structureHome:"#f59e0b",structureVendorAwning:"#f97316",structureVendorBody:"#9a3412",structureMcpFacade:"#1e3a5f",structureMcpAccent:"#7dd3fc",agent:"#22d3ee",calloutBg:"rgba(15, 23, 42, 0.88)",text:"#e2e8f0",textMuted:"#94a3b8",stroke:"#334155"};function td(s){return{...Ju,...s}}/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:La,setPrototypeOf:no,isFrozen:ed,getPrototypeOf:sd,getOwnPropertyDescriptor:id}=Object;let{freeze:ft,seal:Tt,create:Os}=Object,{apply:rr,construct:nr}=typeof Reflect<"u"&&Reflect;ft||(ft=function(t){return t});Tt||(Tt=function(t){return t});rr||(rr=function(t,e){for(var i=arguments.length,r=new Array(i>2?i-2:0),n=2;n<i;n++)r[n-2]=arguments[n];return t.apply(e,r)});nr||(nr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return new t(...i)});const Is=pt(Array.prototype.forEach),rd=pt(Array.prototype.lastIndexOf),oo=pt(Array.prototype.pop),$e=pt(Array.prototype.push),nd=pt(Array.prototype.splice),Ns=pt(String.prototype.toLowerCase),Di=pt(String.prototype.toString),Li=pt(String.prototype.match),He=pt(String.prototype.replace),od=pt(String.prototype.indexOf),ad=pt(String.prototype.trim),bt=pt(Object.prototype.hasOwnProperty),ct=pt(RegExp.prototype.test),Ye=ld(TypeError);function pt(s){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return rr(s,t,i)}}function ld(s){return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return nr(s,e)}}function L(s,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ns;no&&no(s,null);let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const n=e(r);n!==r&&(ed(t)||(t[i]=n),r=n)}s[r]=!0}return s}function hd(s){for(let t=0;t<s.length;t++)bt(s,t)||(s[t]=null);return s}function Nt(s){const t=Os(null);for(const[e,i]of La(s))bt(s,e)&&(Array.isArray(i)?t[e]=hd(i):i&&typeof i=="object"&&i.constructor===Object?t[e]=Nt(i):t[e]=i);return t}function Xe(s,t){for(;s!==null;){const i=id(s,t);if(i){if(i.get)return pt(i.get);if(typeof i.value=="function")return pt(i.value)}s=sd(s)}function e(){return null}return e}const ao=ft(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Bi=ft(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Gi=ft(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),cd=ft(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Fi=ft(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ud=ft(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),lo=ft(["#text"]),ho=ft(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Oi=ft(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),co=ft(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ds=ft(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dd=Tt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fd=Tt(/<%[\w\W]*|[\w\W]*%>/gm),pd=Tt(/\$\{[\w\W]*/gm),md=Tt(/^data-[\-\w.\u00B7-\uFFFF]+$/),gd=Tt(/^aria-[\-\w]+$/),Ba=Tt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xd=Tt(/^(?:\w+script|data):/i),yd=Tt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ga=Tt(/^html$/i),_d=Tt(/^[a-z][.\w]*(-[.\w]+)+$/i);var uo=Object.freeze({__proto__:null,ARIA_ATTR:gd,ATTR_WHITESPACE:yd,CUSTOM_ELEMENT:_d,DATA_ATTR:md,DOCTYPE_NAME:Ga,ERB_EXPR:fd,IS_ALLOWED_URI:Ba,IS_SCRIPT_OR_DATA:xd,MUSTACHE_EXPR:dd,TMPLIT_EXPR:pd});const We={element:1,text:3,progressingInstruction:7,comment:8,document:9},bd=function(){return typeof window>"u"?null:window},wd=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(i=e.getAttribute(r));const n="dompurify"+(i?"#"+i:"");try{return t.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},fo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Fa(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bd();const t=E=>Fa(E);if(t.version="3.3.3",t.removed=[],!s||!s.document||s.document.nodeType!==We.document||!s.Element)return t.isSupported=!1,t;let{document:e}=s;const i=e,r=i.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:h,NamedNodeMap:c=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:d}=s,p=l.prototype,g=Xe(p,"cloneNode"),m=Xe(p,"remove"),y=Xe(p,"nextSibling"),b=Xe(p,"childNodes"),_=Xe(p,"parentNode");if(typeof o=="function"){const E=e.createElement("template");E.content&&E.content.ownerDocument&&(e=E.content.ownerDocument)}let w,T="";const{implementation:k,createNodeIterator:A,createDocumentFragment:I,getElementsByTagName:D}=e,{importNode:M}=i;let C=fo();t.isSupported=typeof La=="function"&&typeof _=="function"&&k&&k.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:U,TMPLIT_EXPR:$,DATA_ATTR:jt,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:Zt,CUSTOM_ELEMENT:F}=uo;let{IS_ALLOWED_URI:Ct}=uo,q=null;const Qt=L({},[...ao,...Bi,...Gi,...Fi,...lo]);let Z=null;const Ee=L({},[...ho,...Oi,...co,...Ds]);let W=Object.seal(Os(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Mt=null,ie=null;const Pt=Object.seal(Os(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let re=!0,Kt=!0,ge=!1,Lt=!0,mt=!1,At=!0,ht=!1,Re=!1,xe=!1,Jt=!1,Ie=!1,ms=!1,Dr=!0,Lr=!1;const Ka="user-content-";let Ks=!0,De=!1,ye={},Bt=null;const Js=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Br=null;const Gr=L({},["audio","video","img","source","image","track"]);let ti=null;const Fr=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gs="http://www.w3.org/1998/Math/MathML",xs="http://www.w3.org/2000/svg",Ut="http://www.w3.org/1999/xhtml";let _e=Ut,ei=!1,si=null;const Ja=L({},[gs,xs,Ut],Di);let ys=L({},["mi","mo","mn","ms","mtext"]),_s=L({},["annotation-xml"]);const tl=L({},["title","style","font","a","script"]);let Le=null;const el=["application/xhtml+xml","text/html"],sl="text/html";let et=null,be=null;const il=e.createElement("form"),Or=function(x){return x instanceof RegExp||x instanceof Function},ii=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(be&&be===x)){if((!x||typeof x!="object")&&(x={}),x=Nt(x),Le=el.indexOf(x.PARSER_MEDIA_TYPE)===-1?sl:x.PARSER_MEDIA_TYPE,et=Le==="application/xhtml+xml"?Di:Ns,q=bt(x,"ALLOWED_TAGS")?L({},x.ALLOWED_TAGS,et):Qt,Z=bt(x,"ALLOWED_ATTR")?L({},x.ALLOWED_ATTR,et):Ee,si=bt(x,"ALLOWED_NAMESPACES")?L({},x.ALLOWED_NAMESPACES,Di):Ja,ti=bt(x,"ADD_URI_SAFE_ATTR")?L(Nt(Fr),x.ADD_URI_SAFE_ATTR,et):Fr,Br=bt(x,"ADD_DATA_URI_TAGS")?L(Nt(Gr),x.ADD_DATA_URI_TAGS,et):Gr,Bt=bt(x,"FORBID_CONTENTS")?L({},x.FORBID_CONTENTS,et):Js,Mt=bt(x,"FORBID_TAGS")?L({},x.FORBID_TAGS,et):Nt({}),ie=bt(x,"FORBID_ATTR")?L({},x.FORBID_ATTR,et):Nt({}),ye=bt(x,"USE_PROFILES")?x.USE_PROFILES:!1,re=x.ALLOW_ARIA_ATTR!==!1,Kt=x.ALLOW_DATA_ATTR!==!1,ge=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Lt=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,mt=x.SAFE_FOR_TEMPLATES||!1,At=x.SAFE_FOR_XML!==!1,ht=x.WHOLE_DOCUMENT||!1,Jt=x.RETURN_DOM||!1,Ie=x.RETURN_DOM_FRAGMENT||!1,ms=x.RETURN_TRUSTED_TYPE||!1,xe=x.FORCE_BODY||!1,Dr=x.SANITIZE_DOM!==!1,Lr=x.SANITIZE_NAMED_PROPS||!1,Ks=x.KEEP_CONTENT!==!1,De=x.IN_PLACE||!1,Ct=x.ALLOWED_URI_REGEXP||Ba,_e=x.NAMESPACE||Ut,ys=x.MATHML_TEXT_INTEGRATION_POINTS||ys,_s=x.HTML_INTEGRATION_POINTS||_s,W=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&Or(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&Or(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),mt&&(Kt=!1),Ie&&(Jt=!0),ye&&(q=L({},lo),Z=Os(null),ye.html===!0&&(L(q,ao),L(Z,ho)),ye.svg===!0&&(L(q,Bi),L(Z,Oi),L(Z,Ds)),ye.svgFilters===!0&&(L(q,Gi),L(Z,Oi),L(Z,Ds)),ye.mathMl===!0&&(L(q,Fi),L(Z,co),L(Z,Ds))),bt(x,"ADD_TAGS")||(Pt.tagCheck=null),bt(x,"ADD_ATTR")||(Pt.attributeCheck=null),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?Pt.tagCheck=x.ADD_TAGS:(q===Qt&&(q=Nt(q)),L(q,x.ADD_TAGS,et))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?Pt.attributeCheck=x.ADD_ATTR:(Z===Ee&&(Z=Nt(Z)),L(Z,x.ADD_ATTR,et))),x.ADD_URI_SAFE_ATTR&&L(ti,x.ADD_URI_SAFE_ATTR,et),x.FORBID_CONTENTS&&(Bt===Js&&(Bt=Nt(Bt)),L(Bt,x.FORBID_CONTENTS,et)),x.ADD_FORBID_CONTENTS&&(Bt===Js&&(Bt=Nt(Bt)),L(Bt,x.ADD_FORBID_CONTENTS,et)),Ks&&(q["#text"]=!0),ht&&L(q,["html","head","body"]),q.table&&(L(q,["tbody"]),delete Mt.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ye('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ye('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=x.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else w===void 0&&(w=wd(d,r)),w!==null&&typeof T=="string"&&(T=w.createHTML(""));ft&&ft(x),be=x}},Nr=L({},[...Bi,...Gi,...cd]),zr=L({},[...Fi,...ud]),rl=function(x){let S=_(x);(!S||!S.tagName)&&(S={namespaceURI:_e,tagName:"template"});const v=Ns(x.tagName),j=Ns(S.tagName);return si[x.namespaceURI]?x.namespaceURI===xs?S.namespaceURI===Ut?v==="svg":S.namespaceURI===gs?v==="svg"&&(j==="annotation-xml"||ys[j]):!!Nr[v]:x.namespaceURI===gs?S.namespaceURI===Ut?v==="math":S.namespaceURI===xs?v==="math"&&_s[j]:!!zr[v]:x.namespaceURI===Ut?S.namespaceURI===xs&&!_s[j]||S.namespaceURI===gs&&!ys[j]?!1:!zr[v]&&(tl[v]||!Nr[v]):!!(Le==="application/xhtml+xml"&&si[x.namespaceURI]):!1},Gt=function(x){$e(t.removed,{element:x});try{_(x).removeChild(x)}catch{m(x)}},ne=function(x,S){try{$e(t.removed,{attribute:S.getAttributeNode(x),from:S})}catch{$e(t.removed,{attribute:null,from:S})}if(S.removeAttribute(x),x==="is")if(Jt||Ie)try{Gt(S)}catch{}else try{S.setAttribute(x,"")}catch{}},Ur=function(x){let S=null,v=null;if(xe)x="<remove></remove>"+x;else{const J=Li(x,/^[\r\n\t ]+/);v=J&&J[0]}Le==="application/xhtml+xml"&&_e===Ut&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const j=w?w.createHTML(x):x;if(_e===Ut)try{S=new f().parseFromString(j,Le)}catch{}if(!S||!S.documentElement){S=k.createDocument(_e,"template",null);try{S.documentElement.innerHTML=ei?T:j}catch{}}const nt=S.body||S.documentElement;return x&&v&&nt.insertBefore(e.createTextNode(v),nt.childNodes[0]||null),_e===Ut?D.call(S,ht?"html":"body")[0]:ht?S.documentElement:nt},$r=function(x){return A.call(x.ownerDocument||x,x,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ri=function(x){return x instanceof u&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof c)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},Hr=function(x){return typeof a=="function"&&x instanceof a};function $t(E,x,S){Is(E,v=>{v.call(t,x,S,be)})}const Yr=function(x){let S=null;if($t(C.beforeSanitizeElements,x,null),ri(x))return Gt(x),!0;const v=et(x.nodeName);if($t(C.uponSanitizeElement,x,{tagName:v,allowedTags:q}),At&&x.hasChildNodes()&&!Hr(x.firstElementChild)&&ct(/<[/\w!]/g,x.innerHTML)&&ct(/<[/\w!]/g,x.textContent)||x.nodeType===We.progressingInstruction||At&&x.nodeType===We.comment&&ct(/<[/\w]/g,x.data))return Gt(x),!0;if(!(Pt.tagCheck instanceof Function&&Pt.tagCheck(v))&&(!q[v]||Mt[v])){if(!Mt[v]&&Wr(v)&&(W.tagNameCheck instanceof RegExp&&ct(W.tagNameCheck,v)||W.tagNameCheck instanceof Function&&W.tagNameCheck(v)))return!1;if(Ks&&!Bt[v]){const j=_(x)||x.parentNode,nt=b(x)||x.childNodes;if(nt&&j){const J=nt.length;for(let gt=J-1;gt>=0;--gt){const Ht=g(nt[gt],!0);Ht.__removalCount=(x.__removalCount||0)+1,j.insertBefore(Ht,y(x))}}}return Gt(x),!0}return x instanceof l&&!rl(x)||(v==="noscript"||v==="noembed"||v==="noframes")&&ct(/<\/no(script|embed|frames)/i,x.innerHTML)?(Gt(x),!0):(mt&&x.nodeType===We.text&&(S=x.textContent,Is([O,U,$],j=>{S=He(S,j," ")}),x.textContent!==S&&($e(t.removed,{element:x.cloneNode()}),x.textContent=S)),$t(C.afterSanitizeElements,x,null),!1)},Xr=function(x,S,v){if(ie[S]||Dr&&(S==="id"||S==="name")&&(v in e||v in il))return!1;if(!(Kt&&!ie[S]&&ct(jt,S))){if(!(re&&ct(P,S))){if(!(Pt.attributeCheck instanceof Function&&Pt.attributeCheck(S,x))){if(!Z[S]||ie[S]){if(!(Wr(x)&&(W.tagNameCheck instanceof RegExp&&ct(W.tagNameCheck,x)||W.tagNameCheck instanceof Function&&W.tagNameCheck(x))&&(W.attributeNameCheck instanceof RegExp&&ct(W.attributeNameCheck,S)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(S,x))||S==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&ct(W.tagNameCheck,v)||W.tagNameCheck instanceof Function&&W.tagNameCheck(v))))return!1}else if(!ti[S]){if(!ct(Ct,He(v,Zt,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&x!=="script"&&od(v,"data:")===0&&Br[x])){if(!(ge&&!ct(R,He(v,Zt,"")))){if(v)return!1}}}}}}}return!0},Wr=function(x){return x!=="annotation-xml"&&Li(x,F)},Vr=function(x){$t(C.beforeSanitizeAttributes,x,null);const{attributes:S}=x;if(!S||ri(x))return;const v={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let j=S.length;for(;j--;){const nt=S[j],{name:J,namespaceURI:gt,value:Ht}=nt,we=et(J),ni=Ht;let rt=J==="value"?ni:ad(ni);if(v.attrName=we,v.attrValue=rt,v.keepAttr=!0,v.forceKeepAttr=void 0,$t(C.uponSanitizeAttribute,x,v),rt=v.attrValue,Lr&&(we==="id"||we==="name")&&(ne(J,x),rt=Ka+rt),At&&ct(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,rt)){ne(J,x);continue}if(we==="attributename"&&Li(rt,"href")){ne(J,x);continue}if(v.forceKeepAttr)continue;if(!v.keepAttr){ne(J,x);continue}if(!Lt&&ct(/\/>/i,rt)){ne(J,x);continue}mt&&Is([O,U,$],jr=>{rt=He(rt,jr," ")});const qr=et(x.nodeName);if(!Xr(qr,we,rt)){ne(J,x);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!gt)switch(d.getAttributeType(qr,we)){case"TrustedHTML":{rt=w.createHTML(rt);break}case"TrustedScriptURL":{rt=w.createScriptURL(rt);break}}if(rt!==ni)try{gt?x.setAttributeNS(gt,J,rt):x.setAttribute(J,rt),ri(x)?Gt(x):oo(t.removed)}catch{ne(J,x)}}$t(C.afterSanitizeAttributes,x,null)},nl=function E(x){let S=null;const v=$r(x);for($t(C.beforeSanitizeShadowDOM,x,null);S=v.nextNode();)$t(C.uponSanitizeShadowNode,S,null),Yr(S),Vr(S),S.content instanceof n&&E(S.content);$t(C.afterSanitizeShadowDOM,x,null)};return t.sanitize=function(E){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,v=null,j=null,nt=null;if(ei=!E,ei&&(E="<!-->"),typeof E!="string"&&!Hr(E))if(typeof E.toString=="function"){if(E=E.toString(),typeof E!="string")throw Ye("dirty is not a string, aborting")}else throw Ye("toString is not a function");if(!t.isSupported)return E;if(Re||ii(x),t.removed=[],typeof E=="string"&&(De=!1),De){if(E.nodeName){const Ht=et(E.nodeName);if(!q[Ht]||Mt[Ht])throw Ye("root node is forbidden and cannot be sanitized in-place")}}else if(E instanceof a)S=Ur("<!---->"),v=S.ownerDocument.importNode(E,!0),v.nodeType===We.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?S=v:S.appendChild(v);else{if(!Jt&&!mt&&!ht&&E.indexOf("<")===-1)return w&&ms?w.createHTML(E):E;if(S=Ur(E),!S)return Jt?null:ms?T:""}S&&xe&&Gt(S.firstChild);const J=$r(De?E:S);for(;j=J.nextNode();)Yr(j),Vr(j),j.content instanceof n&&nl(j.content);if(De)return E;if(Jt){if(Ie)for(nt=I.call(S.ownerDocument);S.firstChild;)nt.appendChild(S.firstChild);else nt=S;return(Z.shadowroot||Z.shadowrootmode)&&(nt=M.call(i,nt,!0)),nt}let gt=ht?S.outerHTML:S.innerHTML;return ht&&q["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&ct(Ga,S.ownerDocument.doctype.name)&&(gt="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
240
|
-
`+gt),mt&&Is([O,U,$],Ht=>{gt=He(gt,Ht," ")}),w&&ms?w.createHTML(gt):gt},t.setConfig=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ii(E),Re=!0},t.clearConfig=function(){be=null,Re=!1},t.isValidAttribute=function(E,x,S){be||ii({});const v=et(E),j=et(x);return Xr(v,j,S)},t.addHook=function(E,x){typeof x=="function"&&$e(C[E],x)},t.removeHook=function(E,x){if(x!==void 0){const S=rd(C[E],x);return S===-1?void 0:nd(C[E],S,1)[0]}return oo(C[E])},t.removeHooks=function(E){C[E]=[]},t.removeAllHooks=function(){C=fo()},t}Fa();function Sr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var me=Sr();function Oa(s){me=s}var de={exec:()=>null};function G(s,t=""){let e=typeof s=="string"?s:s.source,i={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(dt.caret,"$1"),e=e.replace(r,o),i},getRegex:()=>new RegExp(e,t)};return i}var kd=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),dt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}>`)},Ad=/^(?:[ \t]*(?:\n|$))+/,Sd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Td=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ps=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Tr=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Na=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,za=G(Na).replace(/bull/g,Tr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Md=G(Na).replace(/bull/g,Tr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Cr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pd=/^[^\n]+/,Mr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vd=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ed=G(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Tr).getRegex(),Zs="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Pr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rd=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Pr).replace("tag",Zs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ua=G(Cr).replace("hr",ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zs).getRegex(),Id=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ua).getRegex(),vr={blockquote:Id,code:Sd,def:vd,fences:Td,heading:Cd,hr:ps,html:Rd,lheading:za,list:Ed,newline:Ad,paragraph:Ua,table:de,text:Pd},po=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zs).getRegex(),Dd={...vr,lheading:Md,table:po,paragraph:G(Cr).replace("hr",ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",po).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zs).getRegex()},Ld={...vr,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:de,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(Cr).replace("hr",ps).replace("heading",` *#{1,6} *[^
|
|
241
|
-
]`).replace("lheading",za).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Bd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Gd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$a=/^( {2,}|\\)\n(?!\s*$)/,Fd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ve=/[\p{P}\p{S}]/u,Qs=/[\s\p{P}\p{S}]/u,Er=/[^\s\p{P}\p{S}]/u,Od=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qs).getRegex(),Ha=/(?!~)[\p{P}\p{S}]/u,Nd=/(?!~)[\s\p{P}\p{S}]/u,zd=/(?:[^\s\p{P}\p{S}]|~)/u,Ud=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",kd?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ya=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,$d=G(Ya,"u").replace(/punct/g,ve).getRegex(),Hd=G(Ya,"u").replace(/punct/g,Ha).getRegex(),Xa="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Yd=G(Xa,"gu").replace(/notPunctSpace/g,Er).replace(/punctSpace/g,Qs).replace(/punct/g,ve).getRegex(),Xd=G(Xa,"gu").replace(/notPunctSpace/g,zd).replace(/punctSpace/g,Nd).replace(/punct/g,Ha).getRegex(),Wd=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Er).replace(/punctSpace/g,Qs).replace(/punct/g,ve).getRegex(),Vd=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ve).getRegex(),qd="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",jd=G(qd,"gu").replace(/notPunctSpace/g,Er).replace(/punctSpace/g,Qs).replace(/punct/g,ve).getRegex(),Zd=G(/\\(punct)/,"gu").replace(/punct/g,ve).getRegex(),Qd=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Kd=G(Pr).replace("(?:-->|$)","-->").getRegex(),Jd=G("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Kd).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,tf=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Hs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Wa=G(/^!?\[(label)\]\[(ref)\]/).replace("label",Hs).replace("ref",Mr).getRegex(),Va=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mr).getRegex(),ef=G("reflink|nolink(?!\\()","g").replace("reflink",Wa).replace("nolink",Va).getRegex(),mo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rr={_backpedal:de,anyPunctuation:Zd,autolink:Qd,blockSkip:Ud,br:$a,code:Gd,del:de,delLDelim:de,delRDelim:de,emStrongLDelim:$d,emStrongRDelimAst:Yd,emStrongRDelimUnd:Wd,escape:Bd,link:tf,nolink:Va,punctuation:Od,reflink:Wa,reflinkSearch:ef,tag:Jd,text:Fd,url:de},sf={...Rr,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",Hs).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hs).getRegex()},or={...Rr,emStrongRDelimAst:Xd,emStrongLDelim:Hd,delLDelim:Vd,delRDelim:jd,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",mo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",mo).getRegex()},rf={...or,br:G($a).replace("{2,}","*").getRegex(),text:G(or.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ls={normal:vr,gfm:Dd,pedantic:Ld},Ve={normal:Rr,gfm:or,breaks:rf,pedantic:sf},nf={"&":"&","<":"<",">":">",'"':""","'":"'"},go=s=>nf[s];function zt(s,t){if(t){if(dt.escapeTest.test(s))return s.replace(dt.escapeReplace,go)}else if(dt.escapeTestNoEncode.test(s))return s.replace(dt.escapeReplaceNoEncode,go);return s}function xo(s){try{s=encodeURI(s).replace(dt.percentDecode,"%")}catch{return null}return s}function yo(s,t){var n;let e=s.replace(dt.findPipe,(o,a,l)=>{let h=!1,c=a;for(;--c>=0&&l[c]==="\\";)h=!h;return h?"|":" |"}),i=e.split(dt.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!((n=i.at(-1))!=null&&n.trim())&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(dt.slashPipe,"|");return i}function qe(s,t,e){let i=s.length;if(i===0)return"";let r=0;for(;r<i&&s.charAt(i-r-1)===t;)r++;return s.slice(0,i-r)}function of(s,t){if(s.indexOf(t[1])===-1)return-1;let e=0;for(let i=0;i<s.length;i++)if(s[i]==="\\")i++;else if(s[i]===t[0])e++;else if(s[i]===t[1]&&(e--,e<0))return i;return e>0?-2:-1}function af(s,t=0){let e=t,i="";for(let r of s)if(r===" "){let n=4-e%4;i+=" ".repeat(n),e+=n}else i+=r,e++;return i}function _o(s,t,e,i,r){let n=t.href,o=t.title||null,a=s[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:s[0].charAt(0)==="!"?"image":"link",raw:e,href:n,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}function lf(s,t,e){let i=s.match(e.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
242
|
-
`).map(n=>{let o=n.match(e.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
|
|
243
|
-
`)}var Ys=class{constructor(s){z(this,"options");z(this,"rules");z(this,"lexer");this.options=s||me}space(s){let t=this.rules.block.newline.exec(s);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(s){let t=this.rules.block.code.exec(s);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:qe(e,`
|
|
244
|
-
`)}}}fences(s){let t=this.rules.block.fences.exec(s);if(t){let e=t[0],i=lf(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(s){let t=this.rules.block.heading.exec(s);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let i=qe(e,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(e=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(s){let t=this.rules.block.hr.exec(s);if(t)return{type:"hr",raw:qe(t[0],`
|
|
245
|
-
`)}}blockquote(s){let t=this.rules.block.blockquote.exec(s);if(t){let e=qe(t[0],`
|
|
246
|
-
`).split(`
|
|
247
|
-
`),i="",r="",n=[];for(;e.length>0;){let o=!1,a=[],l;for(l=0;l<e.length;l++)if(this.rules.other.blockquoteStart.test(e[l]))a.push(e[l]),o=!0;else if(!o)a.push(e[l]);else break;e=e.slice(l);let h=a.join(`
|
|
248
|
-
`),c=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
249
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
250
|
-
${h}`:h,r=r?`${r}
|
|
251
|
-
${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,n,!0),this.lexer.state.top=u,e.length===0)break;let f=n.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let d=f,p=d.raw+`
|
|
252
|
-
`+e.join(`
|
|
253
|
-
`),g=this.blockquote(p);n[n.length-1]=g,i=i.substring(0,i.length-d.raw.length)+g.raw,r=r.substring(0,r.length-d.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let d=f,p=d.raw+`
|
|
254
|
-
`+e.join(`
|
|
255
|
-
`),g=this.list(p);n[n.length-1]=g,i=i.substring(0,i.length-f.raw.length)+g.raw,r=r.substring(0,r.length-d.raw.length)+g.raw,e=p.substring(n.at(-1).raw.length).split(`
|
|
256
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:n,text:r}}}list(s){var e,i;let t=this.rules.block.list.exec(s);if(t){let r=t[1].trim(),n=r.length>1,o={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");let a=this.rules.other.listItemRegex(r),l=!1;for(;s;){let c=!1,u="",f="";if(!(t=a.exec(s))||this.rules.block.hr.test(s))break;u=t[0],s=s.substring(u.length);let d=af(t[2].split(`
|
|
257
|
-
`,1)[0],t[1].length),p=s.split(`
|
|
258
|
-
`,1)[0],g=!d.trim(),m=0;if(this.options.pedantic?(m=2,f=d.trimStart()):g?m=t[1].length+1:(m=d.search(this.rules.other.nonSpaceChar),m=m>4?1:m,f=d.slice(m),m+=t[1].length),g&&this.rules.other.blankLine.test(p)&&(u+=p+`
|
|
259
|
-
`,s=s.substring(p.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(m),b=this.rules.other.hrRegex(m),_=this.rules.other.fencesBeginRegex(m),w=this.rules.other.headingBeginRegex(m),T=this.rules.other.htmlBeginRegex(m),k=this.rules.other.blockquoteBeginRegex(m);for(;s;){let A=s.split(`
|
|
260
|
-
`,1)[0],I;if(p=A,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),I=p):I=p.replace(this.rules.other.tabCharGlobal," "),_.test(p)||w.test(p)||T.test(p)||k.test(p)||y.test(p)||b.test(p))break;if(I.search(this.rules.other.nonSpaceChar)>=m||!p.trim())f+=`
|
|
261
|
-
`+I.slice(m);else{if(g||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(d)||w.test(d)||b.test(d))break;f+=`
|
|
262
|
-
`+p}g=!p.trim(),u+=A+`
|
|
263
|
-
`,s=s.substring(A.length+1),d=I.slice(m)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(l=!0)),o.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),o.raw+=u}let h=o.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let c of o.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((e=c.tokens[0])==null?void 0:e.type)==="text"||((i=c.tokens[0])==null?void 0:i.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let f={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=f.checked,o.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}if(!o.loose){let u=c.tokens.filter(d=>d.type==="space"),f=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=f}}if(o.loose)for(let c of o.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return o}}html(s){let t=this.rules.block.html.exec(s);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(s){let t=this.rules.block.def.exec(s);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:r}}}table(s){var o;let t=this.rules.block.table.exec(s);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=yo(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
264
|
-
`):[],n={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?n.align.push("right"):this.rules.other.tableAlignCenter.test(a)?n.align.push("center"):this.rules.other.tableAlignLeft.test(a)?n.align.push("left"):n.align.push(null);for(let a=0;a<e.length;a++)n.header.push({text:e[a],tokens:this.lexer.inline(e[a]),header:!0,align:n.align[a]});for(let a of r)n.rows.push(yo(a,n.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:n.align[h]})));return n}}lheading(s){let t=this.rules.block.lheading.exec(s);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(s){let t=this.rules.block.paragraph.exec(s);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
265
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(s){let t=this.rules.block.text.exec(s);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(s){let t=this.rules.inline.escape.exec(s);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(s){let t=this.rules.inline.tag.exec(s);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(s){let t=this.rules.inline.link.exec(s);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let n=qe(e.slice(0,-1),"\\");if((e.length-n.length)%2===0)return}else{let n=of(t[2],"()");if(n===-2)return;if(n>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+n;t[2]=t[2].substring(0,n),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(i);n&&(i=n[1],r=n[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?i=i.slice(1):i=i.slice(1,-1)),_o(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(s,t){let e;if((e=this.rules.inline.reflink.exec(s))||(e=this.rules.inline.nolink.exec(s))){let i=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let n=e[0].charAt(0);return{type:"text",raw:n,text:n}}return _o(e,r,e[0],this.lexer,this.rules)}}emStrong(s,t,e=""){let i=this.rules.inline.emStrongLDelim.exec(s);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!e||this.rules.inline.punctuation.exec(e))){let r=[...i[0]].length-1,n,o,a=r,l=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*s.length+r);(i=h.exec(t))!==null;){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(o=[...n].length,i[3]||i[4]){a+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let c=[...i[0]][0].length,u=s.slice(0,r+i.index+c+o);if(Math.min(r,o)%2){let d=u.slice(1,-1);return{type:"em",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(s){let t=this.rules.inline.code.exec(s);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return i&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(s){let t=this.rules.inline.br.exec(s);if(t)return{type:"br",raw:t[0]}}del(s,t,e=""){let i=this.rules.inline.delLDelim.exec(s);if(i&&(!i[1]||!e||this.rules.inline.punctuation.exec(e))){let r=[...i[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*s.length+r);(i=l.exec(t))!==null;){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n||(o=[...n].length,o!==r))continue;if(i[3]||i[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let h=[...i[0]][0].length,c=s.slice(0,r+i.index+h+o),u=c.slice(r,-r);return{type:"del",raw:c,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(s){let t=this.rules.inline.autolink.exec(s);if(t){let e,i;return t[2]==="@"?(e=t[1],i="mailto:"+e):(e=t[1],i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(s){var e;let t;if(t=this.rules.inline.url.exec(s)){let i,r;if(t[2]==="@")i=t[0],r="mailto:"+i;else{let n;do n=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(n!==t[0]);i=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(s){let t=this.rules.inline.text.exec(s);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Et=class ar{constructor(t){z(this,"tokens");z(this,"options");z(this,"state");z(this,"inlineQueue");z(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||me,this.options.tokenizer=this.options.tokenizer||new Ys,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={other:dt,block:Ls.normal,inline:Ve.normal};this.options.pedantic?(e.block=Ls.pedantic,e.inline=Ve.pedantic):this.options.gfm&&(e.block=Ls.gfm,this.options.breaks?e.inline=Ve.breaks:e.inline=Ve.gfm),this.tokenizer.rules=e}static get rules(){return{block:Ls,inline:Ve}}static lex(t,e){return new ar(e).lex(t)}static lexInline(t,e){return new ar(e).inlineTokens(t)}lex(t){t=t.replace(dt.carriageReturn,`
|
|
266
|
-
`),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let i=this.inlineQueue[e];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],i=!1){var r,n,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(dt.tabCharGlobal," ").replace(dt.spaceLine,""));t;){let a;if((n=(r=this.options.extensions)==null?void 0:r.block)!=null&&n.some(h=>(a=h.call({lexer:this},t,e))?(t=t.substring(a.raw.length),e.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let h=e.at(-1);a.raw.length===1&&h!==void 0?h.raw+=`
|
|
267
|
-
`:e.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
268
|
-
`)?"":`
|
|
269
|
-
`)+a.raw,h.text+=`
|
|
270
|
-
`+a.text,this.inlineQueue.at(-1).src=h.text):e.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
271
|
-
`)?"":`
|
|
272
|
-
`)+a.raw,h.text+=`
|
|
273
|
-
`+a.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},e.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),e.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),e.push(a);continue}let l=t;if((o=this.options.extensions)!=null&&o.startBlock){let h=1/0,c=t.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),typeof u=="number"&&u>=0&&(h=Math.min(h,u))}),h<1/0&&h>=0&&(l=t.substring(0,h+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let h=e.at(-1);i&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
274
|
-
`)?"":`
|
|
275
|
-
`)+a.raw,h.text+=`
|
|
276
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):e.push(a),i=l.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
277
|
-
`)?"":`
|
|
278
|
-
`)+a.raw,h.text+=`
|
|
279
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):e.push(a);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){var l,h,c,u,f;this.tokenizer.lexer=this;let i=t,r=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)d.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)n=r[2]?r[2].length:0,i=i.slice(0,r.index+n)+"["+"a".repeat(r[0].length-n-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((h=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:h.call({lexer:this},i))??i;let o=!1,a="";for(;t;){o||(a=""),o=!1;let d;if((u=(c=this.options.extensions)==null?void 0:c.inline)!=null&&u.some(g=>(d=g.call({lexer:this},t,e))?(t=t.substring(d.raw.length),e.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=e.at(-1);d.type==="text"&&(g==null?void 0:g.type)==="text"?(g.raw+=d.raw,g.text+=d.text):e.push(d);continue}if(d=this.tokenizer.emStrong(t,i,a)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.del(t,i,a)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),e.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),e.push(d);continue}let p=t;if((f=this.options.extensions)!=null&&f.startInline){let g=1/0,m=t.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},m),typeof y=="number"&&y>=0&&(g=Math.min(g,y))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(a=d.raw.slice(-1)),o=!0;let g=e.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=d.raw,g.text+=d.text):e.push(d);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return e}},Xs=class{constructor(s){z(this,"options");z(this,"parser");this.options=s||me}space(s){return""}code({text:s,lang:t,escaped:e}){var n;let i=(n=(t||"").match(dt.notSpaceStart))==null?void 0:n[0],r=s.replace(dt.endingNewline,"")+`
|
|
280
|
-
`;return i?'<pre><code class="language-'+zt(i)+'">'+(e?r:zt(r,!0))+`</code></pre>
|
|
281
|
-
`:"<pre><code>"+(e?r:zt(r,!0))+`</code></pre>
|
|
282
|
-
`}blockquote({tokens:s}){return`<blockquote>
|
|
283
|
-
${this.parser.parse(s)}</blockquote>
|
|
284
|
-
`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:t}){return`<h${t}>${this.parser.parseInline(s)}</h${t}>
|
|
285
|
-
`}hr(s){return`<hr>
|
|
286
|
-
`}list(s){let t=s.ordered,e=s.start,i="";for(let o=0;o<s.items.length;o++){let a=s.items[o];i+=this.listitem(a)}let r=t?"ol":"ul",n=t&&e!==1?' start="'+e+'"':"";return"<"+r+n+`>
|
|
287
|
-
`+i+"</"+r+`>
|
|
288
|
-
`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
|
|
289
|
-
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
|
|
290
|
-
`}table(s){let t="",e="";for(let r=0;r<s.header.length;r++)e+=this.tablecell(s.header[r]);t+=this.tablerow({text:e});let i="";for(let r=0;r<s.rows.length;r++){let n=s.rows[r];e="";for(let o=0;o<n.length;o++)e+=this.tablecell(n[o]);i+=this.tablerow({text:e})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
291
|
-
<thead>
|
|
292
|
-
`+t+`</thead>
|
|
293
|
-
`+i+`</table>
|
|
294
|
-
`}tablerow({text:s}){return`<tr>
|
|
295
|
-
${s}</tr>
|
|
296
|
-
`}tablecell(s){let t=this.parser.parseInline(s.tokens),e=s.header?"th":"td";return(s.align?`<${e} align="${s.align}">`:`<${e}>`)+t+`</${e}>
|
|
297
|
-
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${zt(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:t,tokens:e}){let i=this.parser.parseInline(e),r=xo(s);if(r===null)return i;s=r;let n='<a href="'+s+'"';return t&&(n+=' title="'+zt(t)+'"'),n+=">"+i+"</a>",n}image({href:s,title:t,text:e,tokens:i}){i&&(e=this.parser.parseInline(i,this.parser.textRenderer));let r=xo(s);if(r===null)return zt(e);s=r;let n=`<img src="${s}" alt="${zt(e)}"`;return t&&(n+=` title="${zt(t)}"`),n+=">",n}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:zt(s.text)}},Ir=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},Rt=class lr{constructor(t){z(this,"options");z(this,"renderer");z(this,"textRenderer");this.options=t||me,this.options.renderer=this.options.renderer||new Xs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ir}static parse(t,e){return new lr(e).parse(t)}static parseInline(t,e){return new lr(e).parseInline(t)}parse(t){var i,r;this.renderer.parser=this;let e="";for(let n=0;n<t.length;n++){let o=t[n];if((r=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&r[o.type]){let l=o,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){e+=h||"";continue}}let a=o;switch(a.type){case"space":{e+=this.renderer.space(a);break}case"hr":{e+=this.renderer.hr(a);break}case"heading":{e+=this.renderer.heading(a);break}case"code":{e+=this.renderer.code(a);break}case"table":{e+=this.renderer.table(a);break}case"blockquote":{e+=this.renderer.blockquote(a);break}case"list":{e+=this.renderer.list(a);break}case"checkbox":{e+=this.renderer.checkbox(a);break}case"html":{e+=this.renderer.html(a);break}case"def":{e+=this.renderer.def(a);break}case"paragraph":{e+=this.renderer.paragraph(a);break}case"text":{e+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return e}parseInline(t,e=this.renderer){var r,n;this.renderer.parser=this;let i="";for(let o=0;o<t.length;o++){let a=t[o];if((n=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&n[a.type]){let h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=h||"";continue}}let l=a;switch(l.type){case"escape":{i+=e.text(l);break}case"html":{i+=e.html(l);break}case"link":{i+=e.link(l);break}case"image":{i+=e.image(l);break}case"checkbox":{i+=e.checkbox(l);break}case"strong":{i+=e.strong(l);break}case"em":{i+=e.em(l);break}case"codespan":{i+=e.codespan(l);break}case"br":{i+=e.br(l);break}case"del":{i+=e.del(l);break}case"text":{i+=e.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},Bs,Je=(Bs=class{constructor(s){z(this,"options");z(this,"block");this.options=s||me}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(s=this.block){return s?Et.lex:Et.lexInline}provideParser(s=this.block){return s?Rt.parse:Rt.parseInline}},z(Bs,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),z(Bs,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Bs),hf=class{constructor(...s){z(this,"defaults",Sr());z(this,"options",this.setOptions);z(this,"parse",this.parseMarkdown(!0));z(this,"parseInline",this.parseMarkdown(!1));z(this,"Parser",Rt);z(this,"Renderer",Xs);z(this,"TextRenderer",Ir);z(this,"Lexer",Et);z(this,"Tokenizer",Ys);z(this,"Hooks",Je);this.use(...s)}walkTokens(s,t){var i,r;let e=[];for(let n of s)switch(e=e.concat(t.call(this,n)),n.type){case"table":{let o=n;for(let a of o.header)e=e.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let l of a)e=e.concat(this.walkTokens(l.tokens,t));break}case"list":{let o=n;e=e.concat(this.walkTokens(o.items,t));break}default:{let o=n;(r=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&r[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);e=e.concat(this.walkTokens(l,t))}):o.tokens&&(e=e.concat(this.walkTokens(o.tokens,t)))}}return e}use(...s){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(e=>{let i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=t.renderers[r.name];n?t.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=t[r.level];n?n.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),e.renderer){let r=this.defaults.renderer||new Xs(this.defaults);for(let n in e.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=e.renderer[o],l=r[o];r[o]=(...h)=>{let c=a.apply(r,h);return c===!1&&(c=l.apply(r,h)),c||""}}i.renderer=r}if(e.tokenizer){let r=this.defaults.tokenizer||new Ys(this.defaults);for(let n in e.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=e.tokenizer[o],l=r[o];r[o]=(...h)=>{let c=a.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}i.tokenizer=r}if(e.hooks){let r=this.defaults.hooks||new Je;for(let n in e.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=e.hooks[o],l=r[o];Je.passThroughHooks.has(n)?r[o]=h=>{if(this.defaults.async&&Je.passThroughHooksRespectAsync.has(n))return(async()=>{let u=await a.call(r,h);return l.call(r,u)})();let c=a.call(r,h);return l.call(r,c)}:r[o]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await a.apply(r,h);return u===!1&&(u=await l.apply(r,h)),u})();let c=a.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}i.hooks=r}if(e.walkTokens){let r=this.defaults.walkTokens,n=e.walkTokens;i.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,t){return Et.lex(s,t??this.defaults)}parser(s,t){return Rt.parse(s,t??this.defaults)}parseMarkdown(s){return(t,e)=>{let i={...e},r={...this.defaults,...i},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=s),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(t):t,a=await(r.hooks?await r.hooks.provideLexer(s):s?Et.lex:Et.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(s):s?Rt.parse:Rt.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(n);try{r.hooks&&(t=r.hooks.preprocess(t));let o=(r.hooks?r.hooks.provideLexer(s):s?Et.lex:Et.lexInline)(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(s):s?Rt.parse:Rt.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(s,t){return e=>{if(e.message+=`
|
|
298
|
-
Please report this to https://github.com/markedjs/marked.`,s){let i="<p>An error occurred:</p><pre>"+zt(e.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(e);throw e}}},pe=new hf;function N(s,t){return pe.parse(s,t)}N.options=N.setOptions=function(s){return pe.setOptions(s),N.defaults=pe.defaults,Oa(N.defaults),N};N.getDefaults=Sr;N.defaults=me;N.use=function(...s){return pe.use(...s),N.defaults=pe.defaults,Oa(N.defaults),N};N.walkTokens=function(s,t){return pe.walkTokens(s,t)};N.parseInline=pe.parseInline;N.Parser=Rt;N.parser=Rt.parse;N.Renderer=Xs;N.TextRenderer=Ir;N.Lexer=Et;N.lexer=Et.lex;N.Tokenizer=Ys;N.Hooks=Je;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;Rt.parse;Et.lex;N.setOptions({gfm:!0,breaks:!0,async:!1});const cf="agent-play-preview-chat-display-v1",qa={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function Ni(s,t,e){return Math.min(e,Math.max(t,s))}function uf(s){if(s===null||s.length===0)return null;try{const t=JSON.parse(s);if(t===null||typeof t!="object")return null;const e=t,i={};return typeof e.fontSizePx=="number"&&Number.isFinite(e.fontSizePx)&&(i.fontSizePx=e.fontSizePx),typeof e.panelWidthPx=="number"&&Number.isFinite(e.panelWidthPx)&&(i.panelWidthPx=e.panelWidthPx),typeof e.scrollMaxHeightPx=="number"&&Number.isFinite(e.scrollMaxHeightPx)&&(i.scrollMaxHeightPx=e.scrollMaxHeightPx),Object.keys(i).length>0?i:null}catch{return null}}let bo={...qa};function df(s){return{fontSizePx:Ni(Math.round(s.fontSizePx),5,18),panelWidthPx:Ni(Math.round(s.panelWidthPx),100,400),scrollMaxHeightPx:Ni(Math.round(s.scrollMaxHeightPx),24,200)}}function ff(){const s=uf(typeof localStorage<"u"?localStorage.getItem(cf):null),t={...qa,...s};return bo=df(t),{...bo}}typeof localStorage<"u"&&ff();function pf(){return["park","new_york","tokyo"]}const mf="agent-play-preview-view-settings-v2";function gf(){if(typeof window>"u")return!1;const s=window.location.hostname;return s==="localhost"||s==="127.0.0.1"||s==="::1"||s==="[::1]"}function ja(s){return s==="default"||s==="ember"||s==="forest"}function Za(s){return s==="unspecified"||s==="feminine"||s==="masculine"||s==="neutral"}function rs(){return{themeId:"park",showChatUi:!0,debugMode:gf(),joystickEnabled:!0,profileAvatarPresetId:"default",profileGender:"unspecified"}}function Qa(s){return pf().includes(s)}function xf(s){if(s===null||s.length===0)return null;try{const t=JSON.parse(s);if(t===null||typeof t!="object")return null;const e=t,i={};return typeof e.themeId=="string"&&Qa(e.themeId)&&(i.themeId=e.themeId),typeof e.showChatUi=="boolean"&&(i.showChatUi=e.showChatUi),typeof e.debugMode=="boolean"&&(i.debugMode=e.debugMode),typeof e.joystickEnabled=="boolean"&&(i.joystickEnabled=e.joystickEnabled),typeof e.profileAvatarPresetId=="string"&&ja(e.profileAvatarPresetId)&&(i.profileAvatarPresetId=e.profileAvatarPresetId),typeof e.profileGender=="string"&&Za(e.profileGender)&&(i.profileGender=e.profileGender),Object.keys(i).length>0?i:null}catch{return null}}let wo=rs();function yf(s){const t=Qa(s.themeId)?s.themeId:rs().themeId,e=ja(s.profileAvatarPresetId)?s.profileAvatarPresetId:rs().profileAvatarPresetId,i=Za(s.profileGender)?s.profileGender:rs().profileGender;return{themeId:t,showChatUi:s.showChatUi,debugMode:s.debugMode,joystickEnabled:s.joystickEnabled,profileAvatarPresetId:e,profileGender:i}}function _f(){const s=xf(typeof localStorage<"u"?localStorage.getItem(mf):null),t={...rs(),...s};return wo=yf(t),{...wo}}typeof localStorage<"u"&&_f();const zi={};var Xt={};const bf=typeof process<"u"&&typeof(Xt==null?void 0:Xt.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?Xt.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(Xt==null?void 0:Xt.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&Xt.NEXT_PUBLIC_PLAY_API_BASE.length>0?Xt.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(zi==null?void 0:zi.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");td({});new se;new $s;new se;new se;export{Fs as B,se as C,X as E,Vs as G,B as M,lt as P,ji as R,pr as S,Cs as T,Wi as U,ee as a,da as b,oa as c,ca as d,kt as e,Uo as f,Y as g,xc as h,It as i,Fl as r,wt as w};
|