@agent-play/play-ui 3.8.0 → 3.8.1
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-
|
|
2
|
-
var em=Object.defineProperty;var Tc=t=>{throw TypeError(t)};var tm=(t,e,n)=>e in t?em(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ne=(t,e,n)=>tm(t,typeof e!="symbol"?e+"":e,n),Po=(t,e,n)=>e.has(t)||Tc("Cannot "+n);var z=(t,e,n)=>(Po(t,e,"read from private field"),n?n.call(t):e.get(t)),me=(t,e,n)=>e.has(t)?Tc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Q=(t,e,n,r)=>(Po(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ct=(t,e,n)=>(Po(t,e,"access private method"),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const nm="modulepreload",rm=function(t){return"/agent-play/"+t},Ac={},Xh=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};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"));s=o(n.map(c=>{if(c=rm(c),c in Ac)return;Ac[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":nm,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,m)=>{f.addEventListener("load",d),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};var ve=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.TextureUploaderWebGL="texture-uploader-webgl",t.TextureUploaderWebGPU="texture-uploader-webgpu",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(ve||{});const wa=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},ei=(t,e)=>wa(t).priority??e,yt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(wa).forEach(e=>{e.type.forEach(n=>{var r,s;return(s=(r=this._removeHandlers)[n])==null?void 0:s.call(r,e)})}),this},add(...t){return t.map(wa).forEach(e=>{e.type.forEach(n=>{var i,o;const r=this._addHandlers,s=this._queue;r[n]?(o=r[n])==null||o.call(r,e):(s[n]=s[n]||[],(i=s[n])==null||i.push(e))})}),this},handle(t,e,n){var o;const r=this._addHandlers,s=this._removeHandlers;if(r[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,s[t]=n;const i=this._queue;return i[t]&&((o=i[t])==null||o.forEach(a=>e(a)),delete i[t]),this},handleByMap(t,e){return this.handle(t,n=>{n.name&&(e[n.name]=n.ref)},n=>{n.name&&delete e[n.name]})},handleByNamedList(t,e,n=-1){return this.handle(t,r=>{e.findIndex(i=>i.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((i,o)=>ei(o.value,n)-ei(i.value,n)))},r=>{const s=e.findIndex(i=>i.name===r.name);s!==-1&&e.splice(s,1)})},handleByList(t,e,n=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((s,i)=>ei(i,n)-ei(s,n)))},r=>{const s=e.indexOf(r.ref);s!==-1&&e.splice(s,1)})},mixin(t,...e){for(const n of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(n))}},sm={extension:{type:ve.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Xh(()=>import("./browserAll-DetuhReB.js"),__vite__mapDeps([0,1]))}},im={extension:{type:ve.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Xh(()=>import("./webworkerAll-BedtDt2U.js"),[])}};class Ke{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Ke(e??this._observer,this._x,this._y)}set(e=0,n=e){return(this._x!==e||this._y!==n)&&(this._x=e,this._y=n,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.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(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function qh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Mo={exports:{}},Cc;function om(){return Cc||(Cc=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function i(l,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new s(u,h||l,f),m=n?n+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=n?n+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,d=h.length,m=new Array(d);f<d;f++)m[f]=h[f].fn;return m},a.prototype.listenerCount=function(c){var u=n?n+c:c,h=this._events[u];return h?h.fn?1:h.length:0},a.prototype.emit=function(c,u,h,f,d,m){var y=n?n+c:c;if(!this._events[y])return!1;var g=this._events[y],x=arguments.length,b,S;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),x){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,h),!0;case 4:return g.fn.call(g.context,u,h,f),!0;case 5:return g.fn.call(g.context,u,h,f,d),!0;case 6:return g.fn.call(g.context,u,h,f,d,m),!0}for(S=1,b=new Array(x-1);S<x;S++)b[S-1]=arguments[S];g.fn.apply(g.context,b)}else{var T=g.length,I;for(S=0;S<T;S++)switch(g[S].once&&this.removeListener(c,g[S].fn,void 0,!0),x){case 1:g[S].fn.call(g[S].context);break;case 2:g[S].fn.call(g[S].context,u);break;case 3:g[S].fn.call(g[S].context,u,h);break;case 4:g[S].fn.call(g[S].context,u,h,f);break;default:if(!b)for(I=1,b=new Array(x-1);I<x;I++)b[I-1]=arguments[I];g[S].fn.apply(g[S].context,b)}}return!0},a.prototype.on=function(c,u,h){return i(this,c,u,h,!1)},a.prototype.once=function(c,u,h){return i(this,c,u,h,!0)},a.prototype.removeListener=function(c,u,h,f){var d=n?n+c:c;if(!this._events[d])return this;if(!u)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===u&&(!f||m.once)&&(!h||m.context===h)&&o(this,d);else{for(var y=0,g=[],x=m.length;y<x;y++)(m[y].fn!==u||f&&!m[y].once||h&&m[y].context!==h)&&g.push(m[y]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=n?n+c:c,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a}(Mo)),Mo.exports}var am=om();const An=qh(am),lm=Math.PI*2,cm=180/Math.PI,um=Math.PI/180;class et{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new et(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,n=e){return this.x=e,this.y=n,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Ro.x=0,Ro.y=0,Ro}}const Ro=new et;class ae{constructor(e=1,n=0,r=0,s=1,i=0,o=0){this.array=null,this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,n,r,s,i,o){return this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o,this}toArray(e,n){this.array||(this.array=new Float32Array(9));const r=n||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,n){n=n||new et;const r=e.x,s=e.y;return n.x=this.a*r+this.c*s+this.tx,n.y=this.b*r+this.d*s+this.ty,n}applyInverse(e,n){n=n||new et;const r=this.a,s=this.b,i=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(r*o+i*-s),u=e.x,h=e.y;return n.x=o*c*u+-i*c*h+(l*i-a*o)*c,n.y=r*c*h+-s*c*u+(-l*r+a*s)*c,n}translate(e,n){return this.tx+=e,this.ty+=n,this}scale(e,n){return this.a*=e,this.d*=n,this.c*=e,this.b*=n,this.tx*=e,this.ty*=n,this}rotate(e){const n=Math.cos(e),r=Math.sin(e),s=this.a,i=this.c,o=this.tx;return this.a=s*n-this.b*r,this.b=s*r+this.b*n,this.c=i*n-this.d*r,this.d=i*r+this.d*n,this.tx=o*n-this.ty*r,this.ty=o*r+this.ty*n,this}append(e){const n=this.a,r=this.b,s=this.c,i=this.d;return this.a=e.a*n+e.b*s,this.b=e.a*r+e.b*i,this.c=e.c*n+e.d*s,this.d=e.c*r+e.d*i,this.tx=e.tx*n+e.ty*s+this.tx,this.ty=e.tx*r+e.ty*i+this.ty,this}appendFrom(e,n){const r=e.a,s=e.b,i=e.c,o=e.d,a=e.tx,l=e.ty,c=n.a,u=n.b,h=n.c,f=n.d;return this.a=r*c+s*h,this.b=r*u+s*f,this.c=i*c+o*h,this.d=i*u+o*f,this.tx=a*c+l*h+n.tx,this.ty=a*u+l*f+n.ty,this}setTransform(e,n,r,s,i,o,a,l,c){return this.a=Math.cos(a+c)*i,this.b=Math.sin(a+c)*i,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(r*this.a+s*this.c),this.ty=n-(r*this.b+s*this.d),this}prepend(e){const n=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,s=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=n*e.a+this.ty*e.c+e.tx,this.ty=n*e.b+this.ty*e.d+e.ty,this}decompose(e){const n=this.a,r=this.b,s=this.c,i=this.d,o=e.pivot,a=-Math.atan2(-s,i),l=Math.atan2(r,n),c=Math.abs(a+l);return c<1e-5||Math.abs(lm-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(n*n+r*r),e.scale.y=Math.sqrt(s*s+i*i),e.position.x=this.tx+(o.x*n+o.y*s),e.position.y=this.ty+(o.x*r+o.y*i),e}invert(){const e=this.a,n=this.b,r=this.c,s=this.d,i=this.tx,o=e*s-n*r;return this.a=s/o,this.b=-n/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-s*i)/o,this.ty=-(e*this.ty-n*i)/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 e=new ae;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.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 dm.identity()}static get shared(){return hm.identity()}}const hm=new ae,dm=new ae,Bn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Un=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Gn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ka=[],Jh=[],ti=Math.sign;function fm(){for(let t=0;t<16;t++){const e=[];ka.push(e);for(let n=0;n<16;n++){const r=ti(Bn[t]*Bn[n]+Gn[t]*Un[n]),s=ti(Un[t]*Bn[n]+Zn[t]*Un[n]),i=ti(Bn[t]*Gn[n]+Gn[t]*Zn[n]),o=ti(Un[t]*Gn[n]+Zn[t]*Zn[n]);for(let a=0;a<16;a++)if(Bn[a]===r&&Un[a]===s&&Gn[a]===i&&Zn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new ae;e.set(Bn[t],Un[t],Gn[t],Zn[t],0,0),Jh.push(e)}}fm();const xe={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:t=>Bn[t],uY:t=>Un[t],vX:t=>Gn[t],vY:t=>Zn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>ka[t][e],sub:(t,e)=>ka[t][xe.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?xe.S:xe.N:Math.abs(e)*2<=Math.abs(t)?t>0?xe.E:xe.W:e>0?t>0?xe.SE:xe.SW:t>0?xe.NE:xe.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=Jh[xe.inv(e)],a=o.a,l=o.b,c=o.c,u=o.d,h=n-Math.min(0,a*s,c*i,a*s+c*i),f=r-Math.min(0,l*s,u*i,l*s+u*i),d=t.a,m=t.b,y=t.c,g=t.d;t.a=a*d+l*y,t.b=a*m+l*g,t.c=c*d+u*y,t.d=c*m+u*g,t.tx=h*d+f*y+t.tx,t.ty=h*m+f*g+t.ty},transformRectCoords:(t,e,n,r)=>{const{x:s,y:i,width:o,height:a}=t,{x:l,y:c,width:u,height:h}=e;return n===xe.E?(r.set(s+l,i+c,o,a),r):n===xe.S?r.set(u-i-a+l,s+c,a,o):n===xe.W?r.set(u-s-o+l,h-i-a+c,o,a):n===xe.N?r.set(i+l,h-s-o+c,a,o):r.set(s+l,i+c,o,a)}},ni=[new et,new et,new et,new et];class Ve{constructor(e=0,n=0,r=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(n),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Ve(0,0,0,0)}clone(){return new Ve(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&n>=this.y&&n<this.y+this.height}strokeContains(e,n,r,s=.5){const{width:i,height:o}=this;if(i<=0||o<=0)return!1;const a=this.x,l=this.y,c=r*(1-s),u=r-c,h=a-c,f=a+i+c,d=l-c,m=l+o+c,y=a+u,g=a+i-u,x=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>y&&e<g&&n>x&&n<b)}intersects(e,n){if(!n){const Z=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=Z)return!1;const $=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>$}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=ni[0].set(e.left,e.top),l=ni[1].set(e.left,e.bottom),c=ni[2].set(e.right,e.top),u=ni[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(n.a*n.d-n.b*n.c);if(h===0||(n.apply(a,a),n.apply(l,l),n.apply(c,c),n.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=r||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=i||Math.min(a.y,l.y,c.y,u.y)>=o))return!1;const f=h*(l.y-a.y),d=h*(a.x-l.x),m=f*r+d*i,y=f*s+d*i,g=f*r+d*o,x=f*s+d*o;if(Math.max(m,y,g,x)<=f*a.x+d*a.y||Math.min(m,y,g,x)>=f*u.x+d*u.y)return!1;const b=h*(a.y-c.y),S=h*(c.x-a.x),T=b*r+S*i,I=b*s+S*i,A=b*r+S*o,E=b*s+S*o;return!(Math.max(T,I,A,E)<=b*a.x+S*a.y||Math.min(T,I,A,E)>=b*u.x+S*u.y)}pad(e=0,n=e){return this.x-=e,this.y-=n,this.width+=e*2,this.height+=n*2,this}fit(e){const n=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=n,this.width=Math.max(r-n,0),this.y=s,this.height=Math.max(i-s,0),this}ceil(e=1,n=.001){const r=Math.ceil((this.x+this.width-n)*e)/e,s=Math.ceil((this.y+this.height-n)*e)/e;return this.x=Math.floor((this.x+n)*e)/e,this.y=Math.floor((this.y+n)*e)/e,this.width=r-this.x,this.height=s-this.y,this}scale(e,n=e){return this.x*=e,this.y*=n,this.width*=e,this.height*=n,this}enlarge(e){const n=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=n,this.width=r-n,this.y=s,this.height=i-s,this}getBounds(e){return e||(e=new Ve),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const n=e.x,r=e.y,s=e.x+e.width,i=e.y+e.height;return n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(e,n,r,s){return this.x=e,this.y=n,this.width=r,this.height=s,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const zo={default:-1};function Fe(t="default"){return zo[t]===void 0&&(zo[t]=-1),++zo[t]}const Ec=new Set,Qe="8.0.0",pm="8.3.4",yr={quiet:!1,noColor:!1},Ae=(t,e,n=3)=>{if(yr.quiet||Ec.has(e))return;let r=new Error().stack;const s=`${e}
|
|
3
|
-
Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-DNCcfdGz.js","assets/webworkerAll-DzOmapgl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var im=Object.defineProperty;var Cc=t=>{throw TypeError(t)};var om=(t,e,n)=>e in t?im(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var re=(t,e,n)=>om(t,typeof e!="symbol"?e+"":e,n),Mo=(t,e,n)=>e.has(t)||Cc("Cannot "+n);var z=(t,e,n)=>(Mo(t,e,"read from private field"),n?n.call(t):e.get(t)),ge=(t,e,n)=>e.has(t)?Cc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),te=(t,e,n,r)=>(Mo(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Et=(t,e,n)=>(Mo(t,e,"access private method"),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const am="modulepreload",lm=function(t){return"/agent-play/"+t},Ec={},Qh=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};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"));s=o(n.map(c=>{if(c=lm(c),c in Ec)return;Ec[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":am,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,m)=>{f.addEventListener("load",d),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};var ve=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.TextureUploaderWebGL="texture-uploader-webgl",t.TextureUploaderWebGPU="texture-uploader-webgpu",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(ve||{});const Sa=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},ti=(t,e)=>Sa(t).priority??e,yt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Sa).forEach(e=>{e.type.forEach(n=>{var r,s;return(s=(r=this._removeHandlers)[n])==null?void 0:s.call(r,e)})}),this},add(...t){return t.map(Sa).forEach(e=>{e.type.forEach(n=>{var i,o;const r=this._addHandlers,s=this._queue;r[n]?(o=r[n])==null||o.call(r,e):(s[n]=s[n]||[],(i=s[n])==null||i.push(e))})}),this},handle(t,e,n){var o;const r=this._addHandlers,s=this._removeHandlers;if(r[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,s[t]=n;const i=this._queue;return i[t]&&((o=i[t])==null||o.forEach(a=>e(a)),delete i[t]),this},handleByMap(t,e){return this.handle(t,n=>{n.name&&(e[n.name]=n.ref)},n=>{n.name&&delete e[n.name]})},handleByNamedList(t,e,n=-1){return this.handle(t,r=>{e.findIndex(i=>i.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((i,o)=>ti(o.value,n)-ti(i.value,n)))},r=>{const s=e.findIndex(i=>i.name===r.name);s!==-1&&e.splice(s,1)})},handleByList(t,e,n=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((s,i)=>ti(i,n)-ti(s,n)))},r=>{const s=e.indexOf(r.ref);s!==-1&&e.splice(s,1)})},mixin(t,...e){for(const n of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(n))}},cm={extension:{type:ve.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Qh(()=>import("./browserAll-DNCcfdGz.js"),__vite__mapDeps([0,1]))}},um={extension:{type:ve.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Qh(()=>import("./webworkerAll-DzOmapgl.js"),[])}};class Ke{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Ke(e??this._observer,this._x,this._y)}set(e=0,n=e){return(this._x!==e||this._y!==n)&&(this._x=e,this._y=n,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.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(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function ed(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ro={exports:{}},Ic;function hm(){return Ic||(Ic=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function i(l,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new s(u,h||l,f),m=n?n+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=n?n+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,d=h.length,m=new Array(d);f<d;f++)m[f]=h[f].fn;return m},a.prototype.listenerCount=function(c){var u=n?n+c:c,h=this._events[u];return h?h.fn?1:h.length:0},a.prototype.emit=function(c,u,h,f,d,m){var y=n?n+c:c;if(!this._events[y])return!1;var g=this._events[y],x=arguments.length,b,S;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),x){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,h),!0;case 4:return g.fn.call(g.context,u,h,f),!0;case 5:return g.fn.call(g.context,u,h,f,d),!0;case 6:return g.fn.call(g.context,u,h,f,d,m),!0}for(S=1,b=new Array(x-1);S<x;S++)b[S-1]=arguments[S];g.fn.apply(g.context,b)}else{var T=g.length,I;for(S=0;S<T;S++)switch(g[S].once&&this.removeListener(c,g[S].fn,void 0,!0),x){case 1:g[S].fn.call(g[S].context);break;case 2:g[S].fn.call(g[S].context,u);break;case 3:g[S].fn.call(g[S].context,u,h);break;case 4:g[S].fn.call(g[S].context,u,h,f);break;default:if(!b)for(I=1,b=new Array(x-1);I<x;I++)b[I-1]=arguments[I];g[S].fn.apply(g[S].context,b)}}return!0},a.prototype.on=function(c,u,h){return i(this,c,u,h,!1)},a.prototype.once=function(c,u,h){return i(this,c,u,h,!0)},a.prototype.removeListener=function(c,u,h,f){var d=n?n+c:c;if(!this._events[d])return this;if(!u)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===u&&(!f||m.once)&&(!h||m.context===h)&&o(this,d);else{for(var y=0,g=[],x=m.length;y<x;y++)(m[y].fn!==u||f&&!m[y].once||h&&m[y].context!==h)&&g.push(m[y]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=n?n+c:c,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a}(Ro)),Ro.exports}var dm=hm();const Cn=ed(dm),fm=Math.PI*2,pm=180/Math.PI,mm=Math.PI/180;class et{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new et(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,n=e){return this.x=e,this.y=n,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return zo.x=0,zo.y=0,zo}}const zo=new et;class le{constructor(e=1,n=0,r=0,s=1,i=0,o=0){this.array=null,this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,n,r,s,i,o){return this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o,this}toArray(e,n){this.array||(this.array=new Float32Array(9));const r=n||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,n){n=n||new et;const r=e.x,s=e.y;return n.x=this.a*r+this.c*s+this.tx,n.y=this.b*r+this.d*s+this.ty,n}applyInverse(e,n){n=n||new et;const r=this.a,s=this.b,i=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(r*o+i*-s),u=e.x,h=e.y;return n.x=o*c*u+-i*c*h+(l*i-a*o)*c,n.y=r*c*h+-s*c*u+(-l*r+a*s)*c,n}translate(e,n){return this.tx+=e,this.ty+=n,this}scale(e,n){return this.a*=e,this.d*=n,this.c*=e,this.b*=n,this.tx*=e,this.ty*=n,this}rotate(e){const n=Math.cos(e),r=Math.sin(e),s=this.a,i=this.c,o=this.tx;return this.a=s*n-this.b*r,this.b=s*r+this.b*n,this.c=i*n-this.d*r,this.d=i*r+this.d*n,this.tx=o*n-this.ty*r,this.ty=o*r+this.ty*n,this}append(e){const n=this.a,r=this.b,s=this.c,i=this.d;return this.a=e.a*n+e.b*s,this.b=e.a*r+e.b*i,this.c=e.c*n+e.d*s,this.d=e.c*r+e.d*i,this.tx=e.tx*n+e.ty*s+this.tx,this.ty=e.tx*r+e.ty*i+this.ty,this}appendFrom(e,n){const r=e.a,s=e.b,i=e.c,o=e.d,a=e.tx,l=e.ty,c=n.a,u=n.b,h=n.c,f=n.d;return this.a=r*c+s*h,this.b=r*u+s*f,this.c=i*c+o*h,this.d=i*u+o*f,this.tx=a*c+l*h+n.tx,this.ty=a*u+l*f+n.ty,this}setTransform(e,n,r,s,i,o,a,l,c){return this.a=Math.cos(a+c)*i,this.b=Math.sin(a+c)*i,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(r*this.a+s*this.c),this.ty=n-(r*this.b+s*this.d),this}prepend(e){const n=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,s=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=n*e.a+this.ty*e.c+e.tx,this.ty=n*e.b+this.ty*e.d+e.ty,this}decompose(e){const n=this.a,r=this.b,s=this.c,i=this.d,o=e.pivot,a=-Math.atan2(-s,i),l=Math.atan2(r,n),c=Math.abs(a+l);return c<1e-5||Math.abs(fm-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(n*n+r*r),e.scale.y=Math.sqrt(s*s+i*i),e.position.x=this.tx+(o.x*n+o.y*s),e.position.y=this.ty+(o.x*r+o.y*i),e}invert(){const e=this.a,n=this.b,r=this.c,s=this.d,i=this.tx,o=e*s-n*r;return this.a=s/o,this.b=-n/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-s*i)/o,this.ty=-(e*this.ty-n*i)/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 e=new le;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.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 _m.identity()}static get shared(){return gm.identity()}}const gm=new le,_m=new le,Un=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Gn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],jn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ta=[],td=[],ni=Math.sign;function ym(){for(let t=0;t<16;t++){const e=[];Ta.push(e);for(let n=0;n<16;n++){const r=ni(Un[t]*Un[n]+Zn[t]*Gn[n]),s=ni(Gn[t]*Un[n]+jn[t]*Gn[n]),i=ni(Un[t]*Zn[n]+Zn[t]*jn[n]),o=ni(Gn[t]*Zn[n]+jn[t]*jn[n]);for(let a=0;a<16;a++)if(Un[a]===r&&Gn[a]===s&&Zn[a]===i&&jn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new le;e.set(Un[t],Gn[t],Zn[t],jn[t],0,0),td.push(e)}}ym();const xe={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:t=>Un[t],uY:t=>Gn[t],vX:t=>Zn[t],vY:t=>jn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Ta[t][e],sub:(t,e)=>Ta[t][xe.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?xe.S:xe.N:Math.abs(e)*2<=Math.abs(t)?t>0?xe.E:xe.W:e>0?t>0?xe.SE:xe.SW:t>0?xe.NE:xe.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=td[xe.inv(e)],a=o.a,l=o.b,c=o.c,u=o.d,h=n-Math.min(0,a*s,c*i,a*s+c*i),f=r-Math.min(0,l*s,u*i,l*s+u*i),d=t.a,m=t.b,y=t.c,g=t.d;t.a=a*d+l*y,t.b=a*m+l*g,t.c=c*d+u*y,t.d=c*m+u*g,t.tx=h*d+f*y+t.tx,t.ty=h*m+f*g+t.ty},transformRectCoords:(t,e,n,r)=>{const{x:s,y:i,width:o,height:a}=t,{x:l,y:c,width:u,height:h}=e;return n===xe.E?(r.set(s+l,i+c,o,a),r):n===xe.S?r.set(u-i-a+l,s+c,a,o):n===xe.W?r.set(u-s-o+l,h-i-a+c,o,a):n===xe.N?r.set(i+l,h-s-o+c,a,o):r.set(s+l,i+c,o,a)}},ri=[new et,new et,new et,new et];class Ve{constructor(e=0,n=0,r=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(n),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Ve(0,0,0,0)}clone(){return new Ve(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&n>=this.y&&n<this.y+this.height}strokeContains(e,n,r,s=.5){const{width:i,height:o}=this;if(i<=0||o<=0)return!1;const a=this.x,l=this.y,c=r*(1-s),u=r-c,h=a-c,f=a+i+c,d=l-c,m=l+o+c,y=a+u,g=a+i-u,x=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>y&&e<g&&n>x&&n<b)}intersects(e,n){if(!n){const V=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=V)return!1;const $=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>$}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=ri[0].set(e.left,e.top),l=ri[1].set(e.left,e.bottom),c=ri[2].set(e.right,e.top),u=ri[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(n.a*n.d-n.b*n.c);if(h===0||(n.apply(a,a),n.apply(l,l),n.apply(c,c),n.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=r||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=i||Math.min(a.y,l.y,c.y,u.y)>=o))return!1;const f=h*(l.y-a.y),d=h*(a.x-l.x),m=f*r+d*i,y=f*s+d*i,g=f*r+d*o,x=f*s+d*o;if(Math.max(m,y,g,x)<=f*a.x+d*a.y||Math.min(m,y,g,x)>=f*u.x+d*u.y)return!1;const b=h*(a.y-c.y),S=h*(c.x-a.x),T=b*r+S*i,I=b*s+S*i,A=b*r+S*o,E=b*s+S*o;return!(Math.max(T,I,A,E)<=b*a.x+S*a.y||Math.min(T,I,A,E)>=b*u.x+S*u.y)}pad(e=0,n=e){return this.x-=e,this.y-=n,this.width+=e*2,this.height+=n*2,this}fit(e){const n=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=n,this.width=Math.max(r-n,0),this.y=s,this.height=Math.max(i-s,0),this}ceil(e=1,n=.001){const r=Math.ceil((this.x+this.width-n)*e)/e,s=Math.ceil((this.y+this.height-n)*e)/e;return this.x=Math.floor((this.x+n)*e)/e,this.y=Math.floor((this.y+n)*e)/e,this.width=r-this.x,this.height=s-this.y,this}scale(e,n=e){return this.x*=e,this.y*=n,this.width*=e,this.height*=n,this}enlarge(e){const n=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=n,this.width=r-n,this.y=s,this.height=i-s,this}getBounds(e){return e||(e=new Ve),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const n=e.x,r=e.y,s=e.x+e.width,i=e.y+e.height;return n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(e,n,r,s){return this.x=e,this.y=n,this.width=r,this.height=s,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Oo={default:-1};function Fe(t="default"){return Oo[t]===void 0&&(Oo[t]=-1),++Oo[t]}const Pc=new Set,Qe="8.0.0",xm="8.3.4",xr={quiet:!1,noColor:!1},Ae=(t,e,n=3)=>{if(xr.quiet||Pc.has(e))return;let r=new Error().stack;const s=`${e}
|
|
3
|
+
Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!xr.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split(`
|
|
4
4
|
`).splice(n).join(`
|
|
5
|
-
`),i?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),Ec.add(e)};Object.defineProperties(Ae,{quiet:{get:()=>yr.quiet,set:t=>{yr.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>yr.noColor,set:t=>{yr.noColor=t},enumerable:!0,configurable:!1}});const Kh=()=>{};function Ic(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Pc(t){return!(t&t-1)&&!!t}function Qh(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Mc=Object.create(null);function mm(t){const e=Mc[t];return e===void 0&&(Mc[t]=Fe("resource")),e}const ed=class td extends An{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...td.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){Ae(Qe,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=mm(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};ed.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let nd=ed;const rd=class sd extends An{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Fe("textureSource"),this._resourceType="textureSource",this._resourceId=Fe("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...sd.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.transient=e.transient??!1,this.alphaMode=e.alphaMode,this.style=new nd(Qh(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){var n,r;this.style!==e&&((n=this._style)==null||n.off("change",this._onStyleChange,this),this._style=e,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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 e,n;this._resourceId=Fe("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(n=(e=this._gpuData[r])==null?void 0:e.destroy)==null||n.call(e);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,n,r){r||(r=this._resolution),e||(e=this.width),n||(n=this.height);const s=Math.round(e*r),i=Math.round(n*r);return this.width=s/r,this.height=i/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===i?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=i,this.emit("resize",this),this._resourceId=Fe("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Pc(this.pixelWidth)&&Pc(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};rd.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 $t=rd;class pl extends $t{constructor(e){const n=e.resource||new Float32Array(e.width*e.height*4);let r=e.format;r||(n instanceof Float32Array?r="rgba32float":n instanceof Int32Array||n instanceof Uint32Array?r="rgba32uint":n instanceof Int16Array||n instanceof Uint16Array?r="rgba16uint":(n instanceof Int8Array,r="bgra8unorm")),super({...e,resource:n,format:r}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}pl.extension=ve.TextureSource;const Rc=new ae;class gm{constructor(e,n){this.mapCoord=new ae,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof n>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=n,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){var n;this._texture!==e&&((n=this._texture)==null||n.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this)),this.update()}multiplyUvs(e,n){n===void 0&&(n=e);const r=this.mapCoord;for(let s=0;s<e.length;s+=2){const i=e[s],o=e[s+1];n[s]=i*r.a+o*r.c+r.tx,n[s+1]=i*r.b+o*r.d+r.ty}return n}update(){const e=this._texture;this._updateID++;const n=e.uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);const r=e.orig,s=e.trim;s&&(Rc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Rc));const i=e.source,o=this.uClampFrame,a=this.clampMargin/i._resolution,l=this.clampOffset/i._resolution;return o[0]=(e.frame.x+a+l)/i.width,o[1]=(e.frame.y+a+l)/i.height,o[2]=(e.frame.x+e.frame.width-a+l)/i.width,o[3]=(e.frame.y+e.frame.height-a+l)/i.height,this.uClampOffset[0]=this.clampOffset/i.pixelWidth,this.uClampOffset[1]=this.clampOffset/i.pixelHeight,this.isSimple=e.frame.width===i.width&&e.frame.height===i.height&&e.rotate===0,!0}}class be extends An{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Fe("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ve,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new $t,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=i,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new gm(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:n}=this,{width:r,height:s}=this._source,i=n.x/r,o=n.y/s,a=n.width/r,l=n.height/s;let c=this.rotate;if(c){const u=a/2,h=l/2,f=i+u,d=o+h;c=xe.add(c,xe.NW),e.x0=f+u*xe.uX(c),e.y0=d+h*xe.uY(c),c=xe.add(c,2),e.x1=f+u*xe.uX(c),e.y1=d+h*xe.uY(c),c=xe.add(c,2),e.x2=f+u*xe.uX(c),e.y2=d+h*xe.uY(c),c=xe.add(c,2),e.x3=f+u*xe.uX(c),e.y3=d+h*xe.uY(c)}else e.x0=i,e.y0=o,e.x1=i+a,e.y1=o,e.x2=i+a,e.y2=o+l,e.x3=i,e.y3=o+l}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(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 Ae(Qe,"Texture.baseTexture is now Texture.source"),this._source}}be.EMPTY=new be({label:"EMPTY",source:new $t({label:"EMPTY"})});be.EMPTY.destroy=Kh;be.WHITE=new be({source:new pl({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});be.WHITE.destroy=Kh;function _m(t,e,n){const{width:r,height:s}=n.orig,i=n.trim;if(i){const o=i.width,a=i.height;t.minX=i.x-e._x*r,t.maxX=t.minX+o,t.minY=i.y-e._y*s,t.maxY=t.minY+a}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*s,t.maxY=t.minY+s}const zc=new ae;class zt{constructor(e=1/0,n=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=zc,this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Ve);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=zc,this}set(e,n,r,s){this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}addFrame(e,n,r,s,i){i||(i=this.matrix);const o=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;let f=this.minX,d=this.minY,m=this.maxX,y=this.maxY,g=o*e+l*n+u,x=a*e+c*n+h;g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*r+l*n+u,x=a*r+c*n+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*e+l*s+u,x=a*e+c*s+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*r+l*s+u,x=a*r+c*s+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),this.minX=f,this.minY=d,this.maxX=m,this.maxY=y}addRect(e,n){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,n)}addBounds(e,n){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,n)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const n=this.minX,r=this.minY,s=this.maxX,i=this.maxY,{a:o,b:a,c:l,d:c,tx:u,ty:h}=e;let f=o*n+l*r+u,d=a*n+c*r+h;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*s+l*r+u,d=a*s+c*r+h,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*n+l*i+u,d=a*n+c*i+h,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*s+l*i+u,d=a*s+c*i+h,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(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,n,r,s){return this.minX<e&&(this.minX=e),this.maxX>n&&(this.maxX=n),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(e,n=e){return this.minX-=e,this.maxX+=e,this.minY-=n,this.maxY+=n,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 zt(this.minX,this.minY,this.maxX,this.maxY)}scale(e,n=e){return this.minX*=e,this.minY*=n,this.maxX*=e,this.maxY*=n,this}get x(){return this.minX}set x(e){const n=this.maxX-this.minX;this.minX=e,this.maxX=e+n}get y(){return this.minY}set y(e){const n=this.maxY-this.minY;this.minY=e,this.maxY=e+n}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,n,r,s){let i=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);const c=s.a,u=s.b,h=s.c,f=s.d,d=s.tx,m=s.ty;for(let y=n;y<r;y+=2){const g=e[y],x=e[y+1],b=c*g+h*x+d,S=u*g+f*x+m;i=b<i?b:i,o=S<o?S:o,a=b>a?b:a,l=S>l?S:l}this.minX=i,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(e,n){return this.minX<=e&&this.minY<=n&&this.maxX>=e&&this.maxY>=n}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var ym={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},je=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},wt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},id=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Oc=function(t){return{r:wt(t.r,0,255),g:wt(t.g,0,255),b:wt(t.b,0,255),a:wt(t.a)}},Oo=function(t){return{r:je(t.r),g:je(t.g),b:je(t.b),a:je(t.a,3)}},xm=/^#([0-9a-f]{3,8})$/i,ri=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},od=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=Math.max(e,n,r),o=i-Math.min(e,n,r),a=o?i===e?(n-r)/o:i===n?2+(r-e)/o:4+(e-n)/o:0;return{h:60*(a<0?a+6:a),s:i?o/i*100:0,v:i/255*100,a:s}},ad=function(t){var e=t.h,n=t.s,r=t.v,s=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),o=r*(1-n),a=r*(1-(e-i)*n),l=r*(1-(1-e+i)*n),c=i%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:s}},$c=function(t){return{h:id(t.h),s:wt(t.s,0,100),l:wt(t.l,0,100),a:wt(t.a)}},Nc=function(t){return{h:je(t.h),s:je(t.s),l:je(t.l),a:je(t.a,3)}},Dc=function(t){return ad((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},hs=function(t){return{h:(e=od(t)).h,s:(s=(200-(n=e.s))*(r=e.v)/100)>0&&s<200?n*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,n,r,s},bm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,km=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Sa={string:[[function(t){var e=xm.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?je(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?je(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=wm.exec(t)||km.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Oc({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=bm.exec(t)||vm.exec(t);if(!e)return null;var n,r,s=$c({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(ym[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Dc(s)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=s===void 0?1:s;return Jt(e)&&Jt(n)&&Jt(r)?Oc({r:Number(e),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,s=t.a,i=s===void 0?1:s;if(!Jt(e)||!Jt(n)||!Jt(r))return null;var o=$c({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Dc(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Jt(e)||!Jt(n)||!Jt(r))return null;var o=function(a){return{h:id(a.h),s:wt(a.s,0,100),v:wt(a.v,0,100),a:wt(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return ad(o)},"hsv"]]},Lc=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},Sm=function(t){return typeof t=="string"?Lc(t.trim(),Sa.string):typeof t=="object"&&t!==null?Lc(t,Sa.object):[null,void 0]},$o=function(t,e){var n=hs(t);return{h:n.h,s:wt(n.s+100*e,0,100),l:n.l,a:n.a}},No=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Fc=function(t,e){var n=hs(t);return{h:n.h,s:n.s,l:wt(n.l+100*e,0,100),a:n.a}},Ta=function(){function t(e){this.parsed=Sm(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return je(No(this.rgba),2)},t.prototype.isDark=function(){return No(this.rgba)<.5},t.prototype.isLight=function(){return No(this.rgba)>=.5},t.prototype.toHex=function(){return e=Oo(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?ri(je(255*i)):"","#"+ri(n)+ri(r)+ri(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return Oo(this.rgba)},t.prototype.toRgbString=function(){return e=Oo(this.rgba),n=e.r,r=e.g,s=e.b,(i=e.a)<1?"rgba("+n+", "+r+", "+s+", "+i+")":"rgb("+n+", "+r+", "+s+")";var e,n,r,s,i},t.prototype.toHsl=function(){return Nc(hs(this.rgba))},t.prototype.toHslString=function(){return e=Nc(hs(this.rgba)),n=e.h,r=e.s,s=e.l,(i=e.a)<1?"hsla("+n+", "+r+"%, "+s+"%, "+i+")":"hsl("+n+", "+r+"%, "+s+"%)";var e,n,r,s,i},t.prototype.toHsv=function(){return e=od(this.rgba),{h:je(e.h),s:je(e.s),v:je(e.v),a:je(e.a,3)};var e},t.prototype.invert=function(){return Zt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),Zt($o(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Zt($o(this.rgba,-e))},t.prototype.grayscale=function(){return Zt($o(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Zt(Fc(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Zt(Fc(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?Zt({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):je(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=hs(this.rgba);return typeof e=="number"?Zt({h:e,s:n.s,l:n.l,a:n.a}):je(n.h)},t.prototype.isEqual=function(e){return this.toHex()===Zt(e).toHex()},t}(),Zt=function(t){return t instanceof Ta?t:new Ta(t)},Bc=[],Tm=function(t){t.forEach(function(e){Bc.indexOf(e)<0&&(e(Ta,Sa),Bc.push(e))})};function Am(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in n)r[n[s]]=s;var i={};t.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o!=null&&o.closest){var u=this.toRgb(),h=1/0,f="black";if(!i.length)for(var d in n)i[d]=new t(n[d]).toRgb();for(var m in n){var y=(a=u,l=i[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<h&&(h=y,f=m)}return f}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new t(l).toRgb():null},"name"])}Tm([Am]);const Er=class rs{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof rs)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,n){const r=typeof e;if(r!==typeof n)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===n;if(Array.isArray(e)&&Array.isArray(n)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(n))return e.length!==n.length?!1:e.every((i,o)=>i===n[o]);if(e!==null&&n!==null){const i=Object.keys(e),o=Object.keys(n);return i.length!==o.length?!1:i.every(a=>e[a]===n[a])}return e===n}toRgba(){const[e,n,r,s]=this._components;return{r:e,g:n,b:r,a:s}}toRgb(){const[e,n,r]=this._components;return{r:e,g:n,b:r}}toRgbaString(){const[e,n,r]=this.toUint8RgbArray();return`rgba(${e},${n},${r},${this.alpha})`}toUint8RgbArray(e){const[n,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(n*255),e[1]=Math.round(r*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[n,r,s,i]=this._components;return e[0]=n,e[1]=r,e[2]=s,e[3]=i,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[n,r,s]=this._components;return e[0]=n,e[1]=r,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){const[e,n,r]=this.toUint8RgbArray();return(r<<16)+(n<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[n,r,s,i]=rs._temp.setValue(e)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=s,this._components[3]*=i,this._refreshInt(),this._value=null,this}premultiply(e,n=!0){return n&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,n=!0){if(e===1)return(255<<24)+this._int;if(e===0)return n?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,i=this._int&255;return n&&(r=r*e+.5|0,s=s*e+.5|0,i=i*e+.5|0),(e*255<<24)+(r<<16)+(s<<8)+i}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const n=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-n.length)+n}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(e){let n,r,s,i;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;n=(o>>16&255)/255,r=(o>>8&255)/255,s=(o&255)/255,i=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[n,r,s,i=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[n,r,s,i=255]=e,n/=255,r/=255,s/=255,i/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=rs.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Zt(e);o.isValid()&&({r:n,g:r,b:s,a:i}=o.rgba,n/=255,r/=255,s/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=r,this._components[2]=s,this._components[3]=i,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,n,r]=this._components;this._int=(e*255<<16)+(n*255<<8)+(r*255|0)}_clamp(e,n=0,r=1){return typeof e=="number"?Math.min(Math.max(e,n),r):(e.forEach((s,i)=>{e[i]=Math.min(Math.max(s,n),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof rs||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};Er.shared=new Er;Er._temp=new Er;Er.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let an=Er;const Cm={cullArea:null,cullable:!1,cullableChildren:!0};let Do=0;const Uc=500;function _t(...t){Do!==Uc&&(Do++,Do===Uc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const ml={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach(t=>t.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}};class Em{constructor(e,n){this._pool=[],this._count=0,this._index=0,this._classType=e,n&&this.prepopulate(n)}prepopulate(e){for(let n=0;n<e;n++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){var r;let n;return this._index>0?n=this._pool[--this._index]:(n=new this._classType,this._count++),(r=n.init)==null||r.call(n,e),n}return(e){var n;(n=e.reset)==null||n.call(e),this._pool[this._index++]=e}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 e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class Im{constructor(){this._poolsByClass=new Map}prepopulate(e,n){this.getPool(e).prepopulate(n)}get(e,n){return this.getPool(e).get(n)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new Em(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(n=>{const r=e[n._classType.name]?n._classType.name+n._classType.ID:n._classType.name;e[r]={free:n.totalFree,used:n.totalUsed,size:n.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const ht=new Im;ml.register(ht);const Pm={get isCachedAsTexture(){var t;return!!((t=this.renderGroup)!=null&&t.isCachedAsTexture)},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){var t;(t=this.renderGroup)==null||t.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){Ae("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function Mm(t,e,n){const r=t.length;let s;if(e>=r||n===0)return;n=e+n>r?r-e:n;const i=r-n;for(s=e;s<i;++s)t[s]=t[s+n];t.length=i}const Rm={allowChildren:!0,removeChildren(t=0,e){var i;const n=e??this.children.length,r=n-t,s=[];if(r>0&&r<=n){for(let a=n-1;a>=t;a--){const l=this.children[a];l&&(s.push(l),l.parent=null)}Mm(this.children,t,n);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let a=0;a<s.length;++a){const l=s[a];(i=l.parentRenderLayer)==null||i.detach(l),this.emit("childRemoved",l,this,a),s[a].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||Ae(Qe,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(e<0||e>n.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${n.length}`);const r=t.parent===this;if(t.parent){const i=t.parent.children.indexOf(t);if(r){if(i===e)return t;t.parent.children.splice(i,1)}else t.removeFromParent()}e===n.length?n.push(t):n.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(t),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const n=this.getChildIndex(t),r=this.getChildIndex(e);this.children[n]=e,this.children[r]=t;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const n=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),n.prepend(r),t.setFromMatrix(n),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},zm={collectRenderables(t,e,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,n):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,n))},collectRenderablesSimple(t,e,n){const r=this.children,s=r.length;for(let i=0;i<s;i++)r[i].collectRenderables(t,e,n)},collectRenderablesWithEffects(t,e,n){const{renderPipes:r}=e;for(let s=0;s<this.effects.length;s++){const i=this.effects[s];r[i.pipe].push(i,this,t)}this.collectRenderablesSimple(t,e,n);for(let s=this.effects.length-1;s>=0;s--){const i=this.effects[s];r[i.pipe].pop(i,this,t)}}};class Gc{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class Om{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let n=0;n<this._tests.length;n++){const r=this._tests[n];if(r.test(e))return ht.get(r.maskClass,e)}return e}returnMaskEffect(e){ht.return(e)}}const Aa=new Om;yt.handleByList(ve.MaskEffect,Aa._effectClasses);const $m={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((n,r)=>n.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;(e==null?void 0:e.mask)!==t&&(e&&(this.removeEffect(e),Aa.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Aa.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){var t;return(t=this._maskEffect)==null?void 0:t.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){var i;!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new Gc);t=t;const n=(t==null?void 0:t.length)>0,r=((i=e.filters)==null?void 0:i.length)>0,s=n!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),s&&(n?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){var t;return(t=this._filterEffect)==null?void 0:t.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Gc),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},Nm={label:null,get name(){return Ae(Qe,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Ae(Qe,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const n=this.children;for(let r=0;r<n.length;r++){const s=n[r];if(s.label===t||t instanceof RegExp&&t.test(s.label))return s}if(e)for(let r=0;r<n.length;r++){const i=n[r].getChildByLabel(t,!0);if(i)return i}return null},getChildrenByLabel(t,e=!1,n=[]){const r=this.children;for(let s=0;s<r.length;s++){const i=r[s];(i.label===t||t instanceof RegExp&&t.test(i.label))&&n.push(i)}if(e)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(t,!0,n);return n}},it=ht.getPool(ae),rn=ht.getPool(zt),Dm=new ae,Lm={getFastGlobalBounds(t,e){e||(e=new zt),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(n.worldTransform),e},_getGlobalBoundsRecursive(t,e,n){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==n||this.localDisplayStatus!==7||!this.measurable)return;const s=!!this.effects.length;if((this.renderGroup||s)&&(r=rn.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;r.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const i=this.children;for(let o=0;o<i.length;o++)i[o]._getGlobalBoundsRecursive(t,r,n)}if(s){let i=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(i||(i=!0,r.applyMatrix(o.worldTransform)),this.effects[a].addBounds(r,!0));i&&r.applyMatrix(o.worldTransform.copyTo(Dm).invert()),e.addBounds(r),rn.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),rn.return(r))}};function ld(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=it.get().identity(),r=gl(t,s)):r=ae.IDENTITY,cd(t,n,r,e),s&&it.return(s),n.isValid||n.set(0,0,0,0),n}function cd(t,e,n,r){var a,l;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=it.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=rn.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{const c=t.bounds;c&&!c.isEmpty()&&(e.matrix=s,e.addBounds(c));for(let u=0;u<t.children.length;u++)cd(t.children[u],e,s,r)}if(o){for(let c=0;c<t.effects.length;c++)(l=(a=t.effects[c]).addBounds)==null||l.call(a,e);i.addBounds(e,ae.IDENTITY),rn.return(e)}r||it.return(s)}function gl(t,e){const n=t.parent;return n&&(gl(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function ud(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;const n=t>>16&255,r=t>>8&255,s=t&255,i=e>>16&255,o=e>>8&255,a=e&255,l=n*i/255|0,c=r*o/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}const Zc=16777215;function jc(t,e){return t===Zc?e:e===Zc?t:ud(t,e)}function bi(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const Fm={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,n=this.parent;for(;n;)e*=n.alpha,n=n.parent;return e},getGlobalTransform(t=new ae,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=gl(this,it.get().identity());return t.appendFrom(this.localTransform,n),it.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?bi(this.renderGroup.worldColor):this.parentRenderGroup?bi(jc(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=jc(e,n.localColor),n=n.parent;return bi(e)}};function hd(t,e,n){return e.clear(),n||(n=ae.IDENTITY),dd(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function dd(t,e,n,r,s){var l,c;let i;if(s)i=it.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=it.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=rn.get().clear()),t.boundsArea)e.addRect(t.boundsArea,i);else{t.renderPipeId&&(e.matrix=i,e.addBounds(t.bounds));const u=t.children;for(let h=0;h<u.length;h++)dd(u[h],e,i,r,!1)}if(a){for(let u=0;u<t.effects.length;u++)(c=(l=t.effects[u]).addLocalBounds)==null||c.call(l,e,r);o.addBounds(e,ae.IDENTITY),rn.return(e)}it.return(i)}function fd(t,e){const n=t.children;for(let r=0;r<n.length;r++){const s=n[r],i=s.uid,o=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==i||e.data[a+1]!==o)&&(e.data[e.index]=i,e.data[e.index+1]=o,e.didChange=!0),e.index=a+2,s.children.length&&fd(s,e)}return e.didChange}const Bm=new ae,Um={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const n=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*n:this.scale.x=n},_setHeight(t,e){const n=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*n:this.scale.y=n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new zt});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),fd(this,t),t.didChange&&hd(this,t.localBounds,Bm),t.localBounds},getBounds(t,e){return ld(this,t,e||new zt)}},Gm={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&(e==null||e.removeOnRender(this)),this._onRender=null;return}this._onRender||e==null||e.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},Zm={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(jm))}};function jm(t,e){return t._zIndex-e._zIndex}const Vm={getGlobalPosition(t=new et,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,n=!1){const r=this.getGlobalTransform(it.get(),n);return e=r.apply(t,e),it.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(it.get(),r);return n=s.applyInverse(t,n),it.return(s),n}};class _l{constructor(){this.uid=Fe("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(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let Hm=0;class Wm{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new nd(this.textureOptions)}createTexture(e,n,r,s){const i=new $t({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new be({source:i,label:`texturePool_${Hm++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Ic(o),a=Ic(a);const l=s?1:0,c=i?1:0,u=(o<<17)+(a<<2)+(c<<1)+l;this._texturePool[u]||(this._texturePool[u]=[]);let h=this._texturePool[u].pop();return h||(h=this.createTexture(o,a,s,i)),h.source._resolution=r,h.source.width=o/r,h.source.height=a/r,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=e,h.frame.height=n,h.updateUvs(),this._poolKeyHash[h.uid]=u,h}getSameSizeTexture(e,n=!1){const r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,n)}returnTexture(e,n=!1){const r=this._poolKeyHash[e.uid];n&&(e.source.style=this.textureStyle),this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(const n in this._texturePool){const r=this._texturePool[n];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}}const pd=new Wm;ml.register(pd);class Ym{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ae,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 _l,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const n=e.children;for(let r=0;r<n.length;r++){const s=n[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(pd.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const n=this.childrenToUpdate[e];n.list.fill(null),n.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(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const n=this.renderGroupChildren.indexOf(e);n>-1&&this.renderGroupChildren.splice(n,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const n=e.children;for(let r=0;r<n.length;r++)this.addChild(n[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const n=e.children;for(let r=0;r<n.length;r++)this.removeChild(n[r])}removeChildren(e){for(let n=0;n<e.length;n++)this.removeChild(e[n])}onChildUpdate(e){let n=this.childrenToUpdate[e.relativeRenderGroupDepth];n||(n=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),n.list[n.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let n=0;n<this._onRenderContainers.length;n++)this._onRenderContainers[n]._onRender(e)}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(e=[]){const n=this.root.children;for(let r=0;r<n.length;r++)this._getChildren(n[r],e);return e}_getChildren(e,n=[]){if(n.push(e),e.renderGroup)return n;const r=e.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],n);return n}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new ae),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new ae),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 e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new ae),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function Xm(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Lo=new Ke(null),si=new Ke(null),Fo=new Ke(null,1,1),ii=new Ke(null),Vc=1,qm=2,Bo=4;class Xt extends An{constructor(e={}){var n,r;super(),this.uid=Fe("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 ae,this.relativeGroupTransform=new ae,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ke(this,0,0),this._scale=Fo,this._pivot=si,this._origin=ii,this._skew=Lo,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=[],Xm(this,e,{children:!0,parent:!0,effects:!0}),(n=e.children)==null||n.forEach(s=>this.addChild(s)),(r=e.parent)==null||r.addChild(this)}static mixin(e){Ae("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),yt.mixin(Xt,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||Ae(Qe,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}const n=e[0],r=this.renderGroup||this.parentRenderGroup;return n.parent===this?(this.children.splice(this.children.indexOf(n),1),this.children.push(n),r&&(r.structureDidChange=!0),n):(n.parent&&n.parent.removeChild(n),this.children.push(n),this.sortableChildren&&(this.sortDirty=!0),n.parent=this,n.didChange=!0,n._updateFlags=15,r&&r.addChild(n),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this),this._didViewChangeTick++,n._zIndex!==0&&n.depthOfChildModified(),n)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}const n=e[0],r=this.children.indexOf(n);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(n):this.parentRenderGroup&&this.parentRenderGroup.removeChild(n),n.parentRenderLayer&&n.parentRenderLayer.detach(n),n.parent=null,this.emit("childRemoved",n,this,r),n.emit("removed",this)),n}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),this.renderGroup=ht.get(Ym,this),this.groupTransform=ae.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),ht.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e==null||e.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new ae),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*cm}set angle(e){this.rotation=e*um}get pivot(){return this._pivot===si&&(this._pivot=new Ke(this,0,0)),this._pivot}set pivot(e){this._pivot===si&&(this._pivot=new Ke(this,0,0),this._origin!==ii&&_t("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Lo&&(this._skew=new Ke(this,0,0)),this._skew}set skew(e){this._skew===Lo&&(this._skew=new Ke(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Fo&&(this._scale=new Ke(this,1,1)),this._scale}set scale(e){this._scale===Fo&&(this._scale=new Ke(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===ii&&(this._origin=new Ke(this,0,0)),this._origin}set origin(e){this._origin===ii&&(this._origin=new Ke(this,0,0),this._pivot!==si&&_t("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const n=this.getLocalBounds().width;this._setWidth(e,n)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const n=this.getLocalBounds().height;this._setHeight(e,n)}getSize(e){e||(e={});const n=this.getLocalBounds();return e.width=Math.abs(this.scale.x*n.width),e.height=Math.abs(this.scale.y*n.height),e}setSize(e,n){const r=this.getLocalBounds();typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,r.width),n!==void 0&&this._setHeight(n,r.height)}_updateSkew(){const e=this._rotation,n=this._skew;this._cx=Math.cos(e+n._y),this._sx=Math.sin(e+n._y),this._cy=-Math.sin(e-n._x),this._sy=Math.cos(e-n._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX:this.scale.x,typeof e.scaleY=="number"?e.scaleY:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const n=this.localTransform,r=this._scale,s=this._pivot,i=this._origin,o=this._position,a=r._x,l=r._y,c=s._x,u=s._y,h=-i._x,f=-i._y;n.a=this._cx*a,n.b=this._sx*a,n.c=this._cy*l,n.d=this._sy*l,n.tx=o._x-(c*n.a+u*n.c)+(h*n.a+f*n.c)-h,n.ty=o._y-(c*n.b+u*n.d)+(h*n.b+f*n.d)-f}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Vc,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=an.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Vc,this._onUpdate())}get tint(){return bi(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=qm,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const n=e?2:0;(this.localDisplayStatus&2)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Bo,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const n=e?0:4;(this.localDisplayStatus&4)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Bo,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const n=e?1:0;(this.localDisplayStatus&1)!==n&&(this._updateFlags|=Bo,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var s;if(this.destroyed)return;this.destroyed=!0;let n;if(this.children.length&&(n=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 e=="boolean"?e:e==null?void 0:e.children)&&n)for(let i=0;i<n.length;++i)n[i].destroy(e);(s=this.renderGroup)==null||s.destroy(),this.renderGroup=null}}yt.mixin(Xt,Rm,Lm,Vm,Gm,Um,$m,Nm,Zm,Cm,Pm,Fm,zm);class md extends Xt{constructor(e){super(e),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 zt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const n=this.bounds,{x:r,y:s}=e;return r>=n.minX&&r<=n.maxX&&s>=n.minY&&s<=n.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,n,r){const{renderPipes:s}=n;s.blendMode.pushBlendMode(this,this.groupBlendMode,e);const o=s[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,e),this.didViewUpdate=!1;const a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(e,n,r);s.blendMode.popBlendMode(e)}}class gs extends md{constructor(e=be.EMPTY){e instanceof be&&(e={texture:e});const{texture:n=be.EMPTY,anchor:r,roundPixels:s,width:i,height:o,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ke({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:n.defaultAnchor&&(this.anchor=n.defaultAnchor),this.texture=n,this.allowChildren=!1,this.roundPixels=s??!1,i!==void 0&&(this.width=i),o!==void 0&&(this.height=o)}static from(e,n=!1){return e instanceof be?new gs(e):new gs(be.from(e,n))}set texture(e){e||(e=be.EMPTY);const n=this._texture;n!==e&&(n&&n.dynamic&&n.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,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 _m(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Ae("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,n=this._texture,r=this._bounds,{width:s,height:i}=n.orig;r.minX=-e._x*s,r.maxX=r.minX+s,r.minY=-e._y*i,r.maxY=r.minY+i}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,n){typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}const Jm=new zt;function gd(t,e,n){const r=Jm;t.measurable=!0,ld(t,n,r),e.addBoundsMask(r),t.measurable=!1}function _d(t,e,n){const r=rn.get();t.measurable=!0;const s=it.get().identity(),i=yd(t,n,s);hd(t,r,i),t.measurable=!1,e.addBoundsMask(r),it.return(s),rn.return(r)}function yd(t,e,n){return t?(t!==e&&(yd(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(_t("Mask bounds, renderable is not inside the root container"),n)}class xd{constructor(e){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof gs),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(e,n){this.inverse||gd(this.mask,e,n)}addLocalBounds(e,n){_d(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof gs}}xd.extension=ve.MaskEffect;class bd{constructor(e){this.priority=0,this.pipe="colorMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}bd.extension=ve.MaskEffect;class vd{constructor(e){this.priority=0,this.pipe="stencilMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,n){gd(this.mask,e,n)}addLocalBounds(e,n){_d(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Xt}}vd.extension=ve.MaskEffect;const Km={createCanvas:(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};let Hc=Km;const Us={get(){return Hc},set(t){Hc=t}};class wd extends $t{constructor(e){e.resource||(e.resource=Us.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.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(e=this.width,n=this.height,r=this._resolution){const s=super.resize(e,n,r);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}wd.extension=ve.TextureSource;class ki extends $t{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}ki.extension=ve.TextureSource;var Ca=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Ca||{});class Uo{constructor(e,n=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=n,this.priority=r,this._once=s}match(e,n=null){return this._fn===e&&this._context===n}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const n=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),n}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 n=this.next;return this.next=e?null:n,this.previous=null,n}}const kd=class pt{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 Uo(null,null,1/0),this.deltaMS=1/pt.targetFPMS,this.elapsedMS=1/pt.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,n,r=Ca.NORMAL){return this._addListener(new Uo(e,n,r))}addOnce(e,n,r=Ca.NORMAL){return this._addListener(new Uo(e,n,r,!0))}_addListener(e){let n=this._head.next,r=this._head;if(!n)e.connect(r);else{for(;n;){if(e.priority>n.priority){e.connect(r);break}r=n,n=n.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,n){let r=this._head.next;for(;r;)r.match(e,n)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,n=this._head;for(;n=n.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let n;if(e>this.lastTime){if(n=this.elapsedMS=e-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*pt.targetFPMS;const r=this._head;let s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const n=Math.min(Math.max(0,e)/1e3,pt.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!pt._shared){const e=pt._shared=new pt;e.autoStart=!0,e._protected=!0}return pt._shared}static get system(){if(!pt._system){const e=pt._system=new pt;e.autoStart=!0,e._protected=!0}return pt._system}};kd.targetFPMS=.06;let oi=kd,Go;async function Qm(){return Go??(Go=(async()=>{var o;const e=Us.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const n=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(!n)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n);const i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(s),e.deleteTexture(r),(o=e.getExtension("WEBGL_lose_context"))==null||o.loseContext(),i[0]<=i[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Go}const Xi=class Sd extends $t{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Sd.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=oi.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,n=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(n.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.isValid||e.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await Qm(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,n.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${n.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("loadedmetadata",this._onLoadedMetadata),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(oi.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||(oi.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(oi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Xi.extension=ve.TextureSource;Xi.defaultOptions={...$t.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Xi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let eg=Xi;const fr=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class tg{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const n=this._cache.get(e);return n||_t(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=fr(e);let s;for(let l=0;l<this.parsers.length;l++){const c=this.parsers[l];if(c.test(n)){s=c.getCacheableAssets(r,n);break}}const i=new Map(Object.entries(s||{}));s||r.forEach(l=>{i.set(l,n)});const o=[...i.keys()],a={cacheKeys:o,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const c=s?s[l]:n;this._cache.has(l)&&this._cache.get(l)!==c&&_t("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){_t(`[Assets] Asset id ${e} was not found in the Cache`);return}const n=this._cacheMap.get(e);n.cacheKeys.forEach(s=>{this._cache.delete(s)}),n.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const pr=new tg,Ea=[];yt.handleByList(ve.TextureSource,Ea);function Td(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<Ea.length;s++){const i=Ea[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function ng(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&pr.has(r))return pr.get(r);const i=new be({source:Td(s)});return i.on("destroy",()=>{pr.has(r)&&pr.remove(r)}),e||pr.set(r,i),i}function rg(t,e=!1){return typeof t=="string"?pr.get(t):t instanceof $t?new be({source:t}):ng(t,e)}be.from=rg;$t.from=Td;yt.add(xd,bd,vd,eg,ki,wd,pl);var Ad=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ad||{});function Et(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Zr(t){return t.split("?")[0].split("#")[0]}function sg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ig(t,e,n){return t.replace(new RegExp(sg(e),"g"),n)}function og(t,e){let n="",r=0,s=-1,i=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){const l=n.lastIndexOf("/");if(l!==n.length-1){l===-1?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length===2||n.length===1){n="",r=0,s=a,i=0;continue}}}else n.length>0?n+=`/${t.slice(s+1,a)}`:n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i!==-1?++i:i=-1}return n}const _s={toPosix(t){return ig(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Et(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const n=/^[^/:]+:\/{0,2}/.exec(t);return n?n[0]:""},toAbsolute(t,e,n){if(Et(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=Zr(this.toPosix(e??Us.get().getBaseUrl())),s=Zr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?_s.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Et(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="";const n=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return t=og(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return Et(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let n=0;n<t.length;++n){const r=t[n];if(Et(r),r.length>0)if(e===void 0)e=r;else{const s=t[n-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(Et(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0);const n=e===47;let r=-1,s=!0;const i=this.getProtocol(t),o=t;t=t.slice(i.length);for(let a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!s){r=a;break}}else s=!1;return r===-1?n?"/":this.isUrl(o)?i+t:i:n&&r===1?"//":i+t.slice(0,r)},rootname(t){Et(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){const n=t.indexOf("/",e.length);n!==-1?e=t.slice(0,n):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Et(t),e&&Et(e),t=Zr(this.toPosix(t));let n=0,r=-1,s=!0,i;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const l=t.charCodeAt(i);if(l===47){if(!s){n=i+1;break}}else a===-1&&(s=!1,a=i+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=i):(o=-1,r=a))}return n===r?r=a:r===-1&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(t.charCodeAt(i)===47){if(!s){n=i+1;break}}else r===-1&&(s=!1,r=i+1);return r===-1?"":t.slice(n,r)},extname(t){Et(t),t=Zr(this.toPosix(t));let e=-1,n=0,r=-1,s=!0,i=0;for(let o=t.length-1;o>=0;--o){const a=t.charCodeAt(o);if(a===47){if(!s){n=o+1;break}continue}r===-1&&(s=!1,r=o+1),a===46?e===-1?e=o:i!==1&&(i=1):e!==-1&&(i=-1)}return e===-1||r===-1||i===0||i===1&&e===r-1&&e===n+1?"":t.slice(e,r)},parse(t){Et(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Zr(this.toPosix(t));let n=t.charCodeAt(0);const r=this.isAbsolute(t);let s;e.root=this.rootname(t),r||this.hasProtocol(t)?s=1:s=0;let i=-1,o=0,a=-1,l=!0,c=t.length-1,u=0;for(;c>=s;--c){if(n=t.charCodeAt(c),n===47){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===46?i===-1?i=c:u!==1&&(u=1):i!==-1&&(u=-1)}return i===-1||a===-1||u===0||u===1&&i===a-1&&i===o+1?a!==-1&&(o===0&&r?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(o,a)):(o===0&&r?(e.name=t.slice(1,i),e.base=t.slice(1,a)):(e.name=t.slice(o,i),e.base=t.slice(o,a)),e.ext=t.slice(i,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function Cd(t,e,n,r,s){const i=e[n];for(let o=0;o<i.length;o++){const a=i[o];n<e.length-1?Cd(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function ag(t){const e=/\{(.*?)\}/g,n=t.match(e),r=[];if(n){const s=[];n.forEach(i=>{const o=i.substring(1,i.length-1).split(",");s.push(o)}),Cd(t,s,0,n,r)}else r.push(t);return r}const Wc=t=>!Array.isArray(t);class Ed{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,n)=>`${e}${this._bundleIdConnector}${n}`,extractAssetIdFromBundle:(e,n)=>n.replace(`${e}${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(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(n=>{this._preferredOrder.push(n),n.priority||(n.priority=Object.keys(n.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}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(e){if(typeof e=="string")this._defaultSearchParams=e;else{const n=e;this._defaultSearchParams=Object.keys(n).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(n[r])}`).join("&")}}getAlias(e){const{alias:n,src:r}=e;return fr(n||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(o=>(o==null?void 0:o.src)??o):i!=null&&i.src?i.src:i,!0)}removeAlias(e,n){this._assetMap[e]&&(n&&n!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&_t("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(n=>{this.addBundle(n.name,n.assets)})}addBundle(e,n){const r=[];let s=n;Array.isArray(n)||(s=Object.entries(n).map(([i,o])=>typeof o=="string"||Array.isArray(o)?{alias:i,src:o}:{alias:i,...o})),s.forEach(i=>{const o=i.src,a=i.alias;let l;if(typeof a=="string"){const c=this._createBundleAssetId(e,a);r.push(c),l=[a,c]}else{const c=a.map(u=>this._createBundleAssetId(e,u));r.push(...c),l=[...a,...c]}this.add({...i,alias:l,src:o})}),this._bundles[e]=r}add(e){const n=[];Array.isArray(e)?n.push(...e):n.push(e);let r;r=i=>{this.hasKey(i)&&_t(`[Resolver] already has key: ${i} overwriting`)},fr(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=fr(o).map(y=>typeof y=="string"?ag(y):Array.isArray(y)?y:[y]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=y=>{const g=this._parsers.find(x=>x.test(y));return{src:y,...g==null?void 0:g.parse(y)}};h.forEach(y=>{y.forEach(g=>{let x={};if(typeof g!="object"?x=m(g):(a=g.data??a,l=g.format??l,(g.loadParser||g.parser)&&(c=g.loadParser??c,u=g.parser??u),x={...m(g.src),...g}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:f,data:a,format:l,loadParser:c,parser:u,progressSize:i.progressSize}),d.push(x)})}),f.forEach(y=>{this._assetMap[y]=d})})}resolveBundle(e){const n=Wc(e);e=fr(e);const r={};return e.forEach(s=>{const i=this._bundles[s];if(i){const o=this.resolve(i),a={};for(const l in o){const c=o[l];a[this._extractAssetIdFromBundle(s,l)]=c}r[s]=a}}),n?r[e[0]]:r}resolveUrl(e){const n=this.resolve(e);if(typeof e!="string"){const r={};for(const s in n)r[s]=n[s].src;return r}return n.src}resolve(e){const n=Wc(e);e=fr(e);const r={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let i=this._assetMap[s];const o=this._getPreferredOrder(i);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const c=i.filter(u=>u[a]?u[a]===l:!1);c.length&&(i=c)})}),this._resolverHash[s]=i[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),n?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let n=0;n<e.length;n++){const r=e[n],s=this._preferredOrder.find(i=>i.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const n=/\?/.test(e)?"&":"?";return`${e}${n}${this._defaultSearchParams}`}_buildResolvedAsset(e,n){const{aliases:r,data:s,loadParser:i,parser:o,format:a,progressSize:l}=n;return(this._basePath||this._rootPath)&&(e.src=_s.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=i??e.loadParser,e.parser=o??e.parser,e.format=a??e.format??lg(e.src),l!==void 0&&(e.progressSize=l),e}}Ed.RETINA_PREFIX=/@([0-9\.]+)x/;function lg(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Yc=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},Id=class ss{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof $t&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof be?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=i;const a=parseFloat(i.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=ss.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,n=!1){let r=e;const s=n?1/0:ss.BATCH_SIZE;for(;r-e<s&&r<this._frameKeys.length;){const i=this._frameKeys[r],o=this._frames[i],a=o.frame;if(a){let l=null,c=null;const u=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new Ve(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?l=new Ve(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 Ve(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new Ve(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[i]=new be({source:this.textureSource,frame:l,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:i.toString()})}r++}}_processAnimations(){const e=this.data.animations||{};for(const n in e){this.animations[n]=[];for(let r=0;r<e[n].length;r++){const s=e[n][r];this.animations[n].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ss.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ss.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var n;for(const r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((n=this._texture)==null||n.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Id.BATCH_SIZE=1e3;let Xc=Id;const cg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Pd(t,e,n){const r={};if(t.forEach(s=>{r[s]=e}),Object.keys(e.textures).forEach(s=>{r[`${e.cachePrefix}${s}`]=e.textures[s]}),!n){const s=_s.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Pd([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const ug={extension:ve.Asset,cache:{test:t=>t instanceof Xc,getCacheableAssets:(t,e)=>Pd(t,e,!1)},resolver:{extension:{type:ve.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&cg.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Ed.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:ve.LoadParser,priority:Ad.Normal,name:"spritesheetLoader"},async testParse(t,e){return _s.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,n){var h,f;const{texture:r,imageFilename:s,textureOptions:i,cachePrefix:o}=(e==null?void 0:e.data)??{};let a=_s.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof be)l=r;else{const d=Yc(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new Xc({texture:l.source,data:t,cachePrefix:o});await c.parse();const u=(h=t==null?void 0:t.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(u)){const d=[];for(const y of u){if(typeof y!="string")continue;let g=a+y;(f=e.data)!=null&&f.ignoreMultiPack||(g=Yc(g,e.src),d.push(n.load({src:g,data:{textureOptions:i,ignoreMultiPack:!0}})))}const m=await Promise.all(d);c.linkedSheets=m,m.forEach(y=>{y.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==y))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};yt.add(ug);const Zo=Object.create(null),qc=Object.create(null);function yl(t,e){let n=qc[t];return n===void 0&&(Zo[e]===void 0&&(Zo[e]=1),qc[t]=n=Zo[e]++),n}let cr;function Md(){return(!cr||cr!=null&&cr.isContextLost())&&(cr=Us.get().createCanvas().getContext("webgl",{})),cr}let ai;function hg(){if(!ai){ai="mediump";const t=Md();t&&t.getShaderPrecisionFormat&&(ai=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return ai}function dg(t,e,n){return e?t:n?(t=t.replace("out vec4 finalColor;",""),`
|
|
5
|
+
`),i?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),Pc.add(e)};Object.defineProperties(Ae,{quiet:{get:()=>xr.quiet,set:t=>{xr.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>xr.noColor,set:t=>{xr.noColor=t},enumerable:!0,configurable:!1}});const nd=()=>{};function Mc(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Rc(t){return!(t&t-1)&&!!t}function rd(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const zc=Object.create(null);function bm(t){const e=zc[t];return e===void 0&&(zc[t]=Fe("resource")),e}const sd=class id extends Cn{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...id.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){Ae(Qe,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=bm(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};sd.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let od=sd;const ad=class ld extends Cn{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Fe("textureSource"),this._resourceType="textureSource",this._resourceId=Fe("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...ld.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.transient=e.transient??!1,this.alphaMode=e.alphaMode,this.style=new od(rd(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){var n,r;this.style!==e&&((n=this._style)==null||n.off("change",this._onStyleChange,this),this._style=e,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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 e,n;this._resourceId=Fe("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(n=(e=this._gpuData[r])==null?void 0:e.destroy)==null||n.call(e);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,n,r){r||(r=this._resolution),e||(e=this.width),n||(n=this.height);const s=Math.round(e*r),i=Math.round(n*r);return this.width=s/r,this.height=i/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===i?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=i,this.emit("resize",this),this._resourceId=Fe("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Rc(this.pixelWidth)&&Rc(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};ad.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 $t=ad;class gl extends $t{constructor(e){const n=e.resource||new Float32Array(e.width*e.height*4);let r=e.format;r||(n instanceof Float32Array?r="rgba32float":n instanceof Int32Array||n instanceof Uint32Array?r="rgba32uint":n instanceof Int16Array||n instanceof Uint16Array?r="rgba16uint":(n instanceof Int8Array,r="bgra8unorm")),super({...e,resource:n,format:r}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}gl.extension=ve.TextureSource;const Oc=new le;class vm{constructor(e,n){this.mapCoord=new le,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof n>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=n,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){var n;this._texture!==e&&((n=this._texture)==null||n.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this)),this.update()}multiplyUvs(e,n){n===void 0&&(n=e);const r=this.mapCoord;for(let s=0;s<e.length;s+=2){const i=e[s],o=e[s+1];n[s]=i*r.a+o*r.c+r.tx,n[s+1]=i*r.b+o*r.d+r.ty}return n}update(){const e=this._texture;this._updateID++;const n=e.uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);const r=e.orig,s=e.trim;s&&(Oc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Oc));const i=e.source,o=this.uClampFrame,a=this.clampMargin/i._resolution,l=this.clampOffset/i._resolution;return o[0]=(e.frame.x+a+l)/i.width,o[1]=(e.frame.y+a+l)/i.height,o[2]=(e.frame.x+e.frame.width-a+l)/i.width,o[3]=(e.frame.y+e.frame.height-a+l)/i.height,this.uClampOffset[0]=this.clampOffset/i.pixelWidth,this.uClampOffset[1]=this.clampOffset/i.pixelHeight,this.isSimple=e.frame.width===i.width&&e.frame.height===i.height&&e.rotate===0,!0}}class be extends Cn{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Fe("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ve,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new $t,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=i,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new vm(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:n}=this,{width:r,height:s}=this._source,i=n.x/r,o=n.y/s,a=n.width/r,l=n.height/s;let c=this.rotate;if(c){const u=a/2,h=l/2,f=i+u,d=o+h;c=xe.add(c,xe.NW),e.x0=f+u*xe.uX(c),e.y0=d+h*xe.uY(c),c=xe.add(c,2),e.x1=f+u*xe.uX(c),e.y1=d+h*xe.uY(c),c=xe.add(c,2),e.x2=f+u*xe.uX(c),e.y2=d+h*xe.uY(c),c=xe.add(c,2),e.x3=f+u*xe.uX(c),e.y3=d+h*xe.uY(c)}else e.x0=i,e.y0=o,e.x1=i+a,e.y1=o,e.x2=i+a,e.y2=o+l,e.x3=i,e.y3=o+l}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(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 Ae(Qe,"Texture.baseTexture is now Texture.source"),this._source}}be.EMPTY=new be({label:"EMPTY",source:new $t({label:"EMPTY"})});be.EMPTY.destroy=nd;be.WHITE=new be({source:new gl({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});be.WHITE.destroy=nd;function wm(t,e,n){const{width:r,height:s}=n.orig,i=n.trim;if(i){const o=i.width,a=i.height;t.minX=i.x-e._x*r,t.maxX=t.minX+o,t.minY=i.y-e._y*s,t.maxY=t.minY+a}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*s,t.maxY=t.minY+s}const $c=new le;class zt{constructor(e=1/0,n=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=$c,this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Ve);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=$c,this}set(e,n,r,s){this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}addFrame(e,n,r,s,i){i||(i=this.matrix);const o=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;let f=this.minX,d=this.minY,m=this.maxX,y=this.maxY,g=o*e+l*n+u,x=a*e+c*n+h;g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*r+l*n+u,x=a*r+c*n+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*e+l*s+u,x=a*e+c*s+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),g=o*r+l*s+u,x=a*r+c*s+h,g<f&&(f=g),x<d&&(d=x),g>m&&(m=g),x>y&&(y=x),this.minX=f,this.minY=d,this.maxX=m,this.maxY=y}addRect(e,n){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,n)}addBounds(e,n){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,n)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const n=this.minX,r=this.minY,s=this.maxX,i=this.maxY,{a:o,b:a,c:l,d:c,tx:u,ty:h}=e;let f=o*n+l*r+u,d=a*n+c*r+h;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*s+l*r+u,d=a*s+c*r+h,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*n+l*i+u,d=a*n+c*i+h,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*s+l*i+u,d=a*s+c*i+h,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(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,n,r,s){return this.minX<e&&(this.minX=e),this.maxX>n&&(this.maxX=n),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(e,n=e){return this.minX-=e,this.maxX+=e,this.minY-=n,this.maxY+=n,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 zt(this.minX,this.minY,this.maxX,this.maxY)}scale(e,n=e){return this.minX*=e,this.minY*=n,this.maxX*=e,this.maxY*=n,this}get x(){return this.minX}set x(e){const n=this.maxX-this.minX;this.minX=e,this.maxX=e+n}get y(){return this.minY}set y(e){const n=this.maxY-this.minY;this.minY=e,this.maxY=e+n}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,n,r,s){let i=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);const c=s.a,u=s.b,h=s.c,f=s.d,d=s.tx,m=s.ty;for(let y=n;y<r;y+=2){const g=e[y],x=e[y+1],b=c*g+h*x+d,S=u*g+f*x+m;i=b<i?b:i,o=S<o?S:o,a=b>a?b:a,l=S>l?S:l}this.minX=i,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(e,n){return this.minX<=e&&this.minY<=n&&this.maxX>=e&&this.maxY>=n}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var km={grad:.9,turn:360,rad:360/(2*Math.PI)},Kt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},je=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},wt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},cd=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Nc=function(t){return{r:wt(t.r,0,255),g:wt(t.g,0,255),b:wt(t.b,0,255),a:wt(t.a)}},$o=function(t){return{r:je(t.r),g:je(t.g),b:je(t.b),a:je(t.a,3)}},Sm=/^#([0-9a-f]{3,8})$/i,si=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ud=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=Math.max(e,n,r),o=i-Math.min(e,n,r),a=o?i===e?(n-r)/o:i===n?2+(r-e)/o:4+(e-n)/o:0;return{h:60*(a<0?a+6:a),s:i?o/i*100:0,v:i/255*100,a:s}},hd=function(t){var e=t.h,n=t.s,r=t.v,s=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),o=r*(1-n),a=r*(1-(e-i)*n),l=r*(1-(1-e+i)*n),c=i%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:s}},Dc=function(t){return{h:cd(t.h),s:wt(t.s,0,100),l:wt(t.l,0,100),a:wt(t.a)}},Lc=function(t){return{h:je(t.h),s:je(t.s),l:je(t.l),a:je(t.a,3)}},Fc=function(t){return hd((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},ds=function(t){return{h:(e=ud(t)).h,s:(s=(200-(n=e.s))*(r=e.v)/100)>0&&s<200?n*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,n,r,s},Tm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Am=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Cm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Em=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Aa={string:[[function(t){var e=Sm.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?je(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?je(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Cm.exec(t)||Em.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Nc({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Tm.exec(t)||Am.exec(t);if(!e)return null;var n,r,s=Dc({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(km[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Fc(s)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=s===void 0?1:s;return Kt(e)&&Kt(n)&&Kt(r)?Nc({r:Number(e),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,s=t.a,i=s===void 0?1:s;if(!Kt(e)||!Kt(n)||!Kt(r))return null;var o=Dc({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Fc(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Kt(e)||!Kt(n)||!Kt(r))return null;var o=function(a){return{h:cd(a.h),s:wt(a.s,0,100),v:wt(a.v,0,100),a:wt(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return hd(o)},"hsv"]]},Bc=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},Im=function(t){return typeof t=="string"?Bc(t.trim(),Aa.string):typeof t=="object"&&t!==null?Bc(t,Aa.object):[null,void 0]},No=function(t,e){var n=ds(t);return{h:n.h,s:wt(n.s+100*e,0,100),l:n.l,a:n.a}},Do=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Uc=function(t,e){var n=ds(t);return{h:n.h,s:n.s,l:wt(n.l+100*e,0,100),a:n.a}},Ca=function(){function t(e){this.parsed=Im(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return je(Do(this.rgba),2)},t.prototype.isDark=function(){return Do(this.rgba)<.5},t.prototype.isLight=function(){return Do(this.rgba)>=.5},t.prototype.toHex=function(){return e=$o(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?si(je(255*i)):"","#"+si(n)+si(r)+si(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return $o(this.rgba)},t.prototype.toRgbString=function(){return e=$o(this.rgba),n=e.r,r=e.g,s=e.b,(i=e.a)<1?"rgba("+n+", "+r+", "+s+", "+i+")":"rgb("+n+", "+r+", "+s+")";var e,n,r,s,i},t.prototype.toHsl=function(){return Lc(ds(this.rgba))},t.prototype.toHslString=function(){return e=Lc(ds(this.rgba)),n=e.h,r=e.s,s=e.l,(i=e.a)<1?"hsla("+n+", "+r+"%, "+s+"%, "+i+")":"hsl("+n+", "+r+"%, "+s+"%)";var e,n,r,s,i},t.prototype.toHsv=function(){return e=ud(this.rgba),{h:je(e.h),s:je(e.s),v:je(e.v),a:je(e.a,3)};var e},t.prototype.invert=function(){return jt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),jt(No(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),jt(No(this.rgba,-e))},t.prototype.grayscale=function(){return jt(No(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),jt(Uc(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),jt(Uc(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?jt({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):je(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=ds(this.rgba);return typeof e=="number"?jt({h:e,s:n.s,l:n.l,a:n.a}):je(n.h)},t.prototype.isEqual=function(e){return this.toHex()===jt(e).toHex()},t}(),jt=function(t){return t instanceof Ca?t:new Ca(t)},Gc=[],Pm=function(t){t.forEach(function(e){Gc.indexOf(e)<0&&(e(Ca,Aa),Gc.push(e))})};function Mm(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in n)r[n[s]]=s;var i={};t.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o!=null&&o.closest){var u=this.toRgb(),h=1/0,f="black";if(!i.length)for(var d in n)i[d]=new t(n[d]).toRgb();for(var m in n){var y=(a=u,l=i[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<h&&(h=y,f=m)}return f}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new t(l).toRgb():null},"name"])}Pm([Mm]);const Ir=class ss{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof ss)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,n){const r=typeof e;if(r!==typeof n)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===n;if(Array.isArray(e)&&Array.isArray(n)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(n))return e.length!==n.length?!1:e.every((i,o)=>i===n[o]);if(e!==null&&n!==null){const i=Object.keys(e),o=Object.keys(n);return i.length!==o.length?!1:i.every(a=>e[a]===n[a])}return e===n}toRgba(){const[e,n,r,s]=this._components;return{r:e,g:n,b:r,a:s}}toRgb(){const[e,n,r]=this._components;return{r:e,g:n,b:r}}toRgbaString(){const[e,n,r]=this.toUint8RgbArray();return`rgba(${e},${n},${r},${this.alpha})`}toUint8RgbArray(e){const[n,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(n*255),e[1]=Math.round(r*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[n,r,s,i]=this._components;return e[0]=n,e[1]=r,e[2]=s,e[3]=i,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[n,r,s]=this._components;return e[0]=n,e[1]=r,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){const[e,n,r]=this.toUint8RgbArray();return(r<<16)+(n<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[n,r,s,i]=ss._temp.setValue(e)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=s,this._components[3]*=i,this._refreshInt(),this._value=null,this}premultiply(e,n=!0){return n&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,n=!0){if(e===1)return(255<<24)+this._int;if(e===0)return n?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,i=this._int&255;return n&&(r=r*e+.5|0,s=s*e+.5|0,i=i*e+.5|0),(e*255<<24)+(r<<16)+(s<<8)+i}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const n=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-n.length)+n}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(e){let n,r,s,i;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;n=(o>>16&255)/255,r=(o>>8&255)/255,s=(o&255)/255,i=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[n,r,s,i=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[n,r,s,i=255]=e,n/=255,r/=255,s/=255,i/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=ss.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=jt(e);o.isValid()&&({r:n,g:r,b:s,a:i}=o.rgba,n/=255,r/=255,s/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=r,this._components[2]=s,this._components[3]=i,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,n,r]=this._components;this._int=(e*255<<16)+(n*255<<8)+(r*255|0)}_clamp(e,n=0,r=1){return typeof e=="number"?Math.min(Math.max(e,n),r):(e.forEach((s,i)=>{e[i]=Math.min(Math.max(s,n),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof ss||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};Ir.shared=new Ir;Ir._temp=new Ir;Ir.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ln=Ir;const Rm={cullArea:null,cullable:!1,cullableChildren:!0};let Lo=0;const Zc=500;function _t(...t){Lo!==Zc&&(Lo++,Lo===Zc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const _l={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach(t=>t.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}};class zm{constructor(e,n){this._pool=[],this._count=0,this._index=0,this._classType=e,n&&this.prepopulate(n)}prepopulate(e){for(let n=0;n<e;n++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){var r;let n;return this._index>0?n=this._pool[--this._index]:(n=new this._classType,this._count++),(r=n.init)==null||r.call(n,e),n}return(e){var n;(n=e.reset)==null||n.call(e),this._pool[this._index++]=e}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 e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class Om{constructor(){this._poolsByClass=new Map}prepopulate(e,n){this.getPool(e).prepopulate(n)}get(e,n){return this.getPool(e).get(n)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new zm(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(n=>{const r=e[n._classType.name]?n._classType.name+n._classType.ID:n._classType.name;e[r]={free:n.totalFree,used:n.totalUsed,size:n.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const ht=new Om;_l.register(ht);const $m={get isCachedAsTexture(){var t;return!!((t=this.renderGroup)!=null&&t.isCachedAsTexture)},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){var t;(t=this.renderGroup)==null||t.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){Ae("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function Nm(t,e,n){const r=t.length;let s;if(e>=r||n===0)return;n=e+n>r?r-e:n;const i=r-n;for(s=e;s<i;++s)t[s]=t[s+n];t.length=i}const Dm={allowChildren:!0,removeChildren(t=0,e){var i;const n=e??this.children.length,r=n-t,s=[];if(r>0&&r<=n){for(let a=n-1;a>=t;a--){const l=this.children[a];l&&(s.push(l),l.parent=null)}Nm(this.children,t,n);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let a=0;a<s.length;++a){const l=s[a];(i=l.parentRenderLayer)==null||i.detach(l),this.emit("childRemoved",l,this,a),s[a].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||Ae(Qe,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(e<0||e>n.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${n.length}`);const r=t.parent===this;if(t.parent){const i=t.parent.children.indexOf(t);if(r){if(i===e)return t;t.parent.children.splice(i,1)}else t.removeFromParent()}e===n.length?n.push(t):n.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(t),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const n=this.getChildIndex(t),r=this.getChildIndex(e);this.children[n]=e,this.children[r]=t;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const n=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),n.prepend(r),t.setFromMatrix(n),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},Lm={collectRenderables(t,e,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,n):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,n))},collectRenderablesSimple(t,e,n){const r=this.children,s=r.length;for(let i=0;i<s;i++)r[i].collectRenderables(t,e,n)},collectRenderablesWithEffects(t,e,n){const{renderPipes:r}=e;for(let s=0;s<this.effects.length;s++){const i=this.effects[s];r[i.pipe].push(i,this,t)}this.collectRenderablesSimple(t,e,n);for(let s=this.effects.length-1;s>=0;s--){const i=this.effects[s];r[i.pipe].pop(i,this,t)}}};class jc{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class Fm{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let n=0;n<this._tests.length;n++){const r=this._tests[n];if(r.test(e))return ht.get(r.maskClass,e)}return e}returnMaskEffect(e){ht.return(e)}}const Ea=new Fm;yt.handleByList(ve.MaskEffect,Ea._effectClasses);const Bm={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((n,r)=>n.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;(e==null?void 0:e.mask)!==t&&(e&&(this.removeEffect(e),Ea.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Ea.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){var t;return(t=this._maskEffect)==null?void 0:t.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){var i;!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new jc);t=t;const n=(t==null?void 0:t.length)>0,r=((i=e.filters)==null?void 0:i.length)>0,s=n!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),s&&(n?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){var t;return(t=this._filterEffect)==null?void 0:t.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new jc),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},Um={label:null,get name(){return Ae(Qe,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Ae(Qe,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const n=this.children;for(let r=0;r<n.length;r++){const s=n[r];if(s.label===t||t instanceof RegExp&&t.test(s.label))return s}if(e)for(let r=0;r<n.length;r++){const i=n[r].getChildByLabel(t,!0);if(i)return i}return null},getChildrenByLabel(t,e=!1,n=[]){const r=this.children;for(let s=0;s<r.length;s++){const i=r[s];(i.label===t||t instanceof RegExp&&t.test(i.label))&&n.push(i)}if(e)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(t,!0,n);return n}},ot=ht.getPool(le),sn=ht.getPool(zt),Gm=new le,Zm={getFastGlobalBounds(t,e){e||(e=new zt),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(n.worldTransform),e},_getGlobalBoundsRecursive(t,e,n){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==n||this.localDisplayStatus!==7||!this.measurable)return;const s=!!this.effects.length;if((this.renderGroup||s)&&(r=sn.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;r.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const i=this.children;for(let o=0;o<i.length;o++)i[o]._getGlobalBoundsRecursive(t,r,n)}if(s){let i=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(i||(i=!0,r.applyMatrix(o.worldTransform)),this.effects[a].addBounds(r,!0));i&&r.applyMatrix(o.worldTransform.copyTo(Gm).invert()),e.addBounds(r),sn.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),sn.return(r))}};function dd(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=ot.get().identity(),r=yl(t,s)):r=le.IDENTITY,fd(t,n,r,e),s&&ot.return(s),n.isValid||n.set(0,0,0,0),n}function fd(t,e,n,r){var a,l;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=ot.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=sn.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{const c=t.bounds;c&&!c.isEmpty()&&(e.matrix=s,e.addBounds(c));for(let u=0;u<t.children.length;u++)fd(t.children[u],e,s,r)}if(o){for(let c=0;c<t.effects.length;c++)(l=(a=t.effects[c]).addBounds)==null||l.call(a,e);i.addBounds(e,le.IDENTITY),sn.return(e)}r||ot.return(s)}function yl(t,e){const n=t.parent;return n&&(yl(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function pd(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;const n=t>>16&255,r=t>>8&255,s=t&255,i=e>>16&255,o=e>>8&255,a=e&255,l=n*i/255|0,c=r*o/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}const Vc=16777215;function Hc(t,e){return t===Vc?e:e===Vc?t:pd(t,e)}function vi(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const jm={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,n=this.parent;for(;n;)e*=n.alpha,n=n.parent;return e},getGlobalTransform(t=new le,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=yl(this,ot.get().identity());return t.appendFrom(this.localTransform,n),ot.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?vi(this.renderGroup.worldColor):this.parentRenderGroup?vi(Hc(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=Hc(e,n.localColor),n=n.parent;return vi(e)}};function md(t,e,n){return e.clear(),n||(n=le.IDENTITY),gd(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function gd(t,e,n,r,s){var l,c;let i;if(s)i=ot.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=ot.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=sn.get().clear()),t.boundsArea)e.addRect(t.boundsArea,i);else{t.renderPipeId&&(e.matrix=i,e.addBounds(t.bounds));const u=t.children;for(let h=0;h<u.length;h++)gd(u[h],e,i,r,!1)}if(a){for(let u=0;u<t.effects.length;u++)(c=(l=t.effects[u]).addLocalBounds)==null||c.call(l,e,r);o.addBounds(e,le.IDENTITY),sn.return(e)}ot.return(i)}function _d(t,e){const n=t.children;for(let r=0;r<n.length;r++){const s=n[r],i=s.uid,o=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==i||e.data[a+1]!==o)&&(e.data[e.index]=i,e.data[e.index+1]=o,e.didChange=!0),e.index=a+2,s.children.length&&_d(s,e)}return e.didChange}const Vm=new le,Hm={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const n=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*n:this.scale.x=n},_setHeight(t,e){const n=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*n:this.scale.y=n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new zt});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),_d(this,t),t.didChange&&md(this,t.localBounds,Vm),t.localBounds},getBounds(t,e){return dd(this,t,e||new zt)}},Wm={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&(e==null||e.removeOnRender(this)),this._onRender=null;return}this._onRender||e==null||e.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},Ym={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(Xm))}};function Xm(t,e){return t._zIndex-e._zIndex}const qm={getGlobalPosition(t=new et,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,n=!1){const r=this.getGlobalTransform(ot.get(),n);return e=r.apply(t,e),ot.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(ot.get(),r);return n=s.applyInverse(t,n),ot.return(s),n}};class xl{constructor(){this.uid=Fe("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(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let Jm=0;class Km{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new od(this.textureOptions)}createTexture(e,n,r,s){const i=new $t({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new be({source:i,label:`texturePool_${Jm++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Mc(o),a=Mc(a);const l=s?1:0,c=i?1:0,u=(o<<17)+(a<<2)+(c<<1)+l;this._texturePool[u]||(this._texturePool[u]=[]);let h=this._texturePool[u].pop();return h||(h=this.createTexture(o,a,s,i)),h.source._resolution=r,h.source.width=o/r,h.source.height=a/r,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=e,h.frame.height=n,h.updateUvs(),this._poolKeyHash[h.uid]=u,h}getSameSizeTexture(e,n=!1){const r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,n)}returnTexture(e,n=!1){const r=this._poolKeyHash[e.uid];n&&(e.source.style=this.textureStyle),this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(const n in this._texturePool){const r=this._texturePool[n];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}}const yd=new Km;_l.register(yd);class Qm{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new le,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 xl,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const n=e.children;for(let r=0;r<n.length;r++){const s=n[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(yd.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const n=this.childrenToUpdate[e];n.list.fill(null),n.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(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const n=this.renderGroupChildren.indexOf(e);n>-1&&this.renderGroupChildren.splice(n,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const n=e.children;for(let r=0;r<n.length;r++)this.addChild(n[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const n=e.children;for(let r=0;r<n.length;r++)this.removeChild(n[r])}removeChildren(e){for(let n=0;n<e.length;n++)this.removeChild(e[n])}onChildUpdate(e){let n=this.childrenToUpdate[e.relativeRenderGroupDepth];n||(n=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),n.list[n.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let n=0;n<this._onRenderContainers.length;n++)this._onRenderContainers[n]._onRender(e)}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(e=[]){const n=this.root.children;for(let r=0;r<n.length;r++)this._getChildren(n[r],e);return e}_getChildren(e,n=[]){if(n.push(e),e.renderGroup)return n;const r=e.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],n);return n}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new le),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new le),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 e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new le),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function eg(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Fo=new Ke(null),ii=new Ke(null),Bo=new Ke(null,1,1),oi=new Ke(null),Wc=1,tg=2,Uo=4;class Nt extends Cn{constructor(e={}){var n,r;super(),this.uid=Fe("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 le,this.relativeGroupTransform=new le,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ke(this,0,0),this._scale=Bo,this._pivot=ii,this._origin=oi,this._skew=Fo,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=[],eg(this,e,{children:!0,parent:!0,effects:!0}),(n=e.children)==null||n.forEach(s=>this.addChild(s)),(r=e.parent)==null||r.addChild(this)}static mixin(e){Ae("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),yt.mixin(Nt,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||Ae(Qe,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}const n=e[0],r=this.renderGroup||this.parentRenderGroup;return n.parent===this?(this.children.splice(this.children.indexOf(n),1),this.children.push(n),r&&(r.structureDidChange=!0),n):(n.parent&&n.parent.removeChild(n),this.children.push(n),this.sortableChildren&&(this.sortDirty=!0),n.parent=this,n.didChange=!0,n._updateFlags=15,r&&r.addChild(n),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this),this._didViewChangeTick++,n._zIndex!==0&&n.depthOfChildModified(),n)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}const n=e[0],r=this.children.indexOf(n);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(n):this.parentRenderGroup&&this.parentRenderGroup.removeChild(n),n.parentRenderLayer&&n.parentRenderLayer.detach(n),n.parent=null,this.emit("childRemoved",n,this,r),n.emit("removed",this)),n}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),this.renderGroup=ht.get(Qm,this),this.groupTransform=le.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),ht.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e==null||e.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new le),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*pm}set angle(e){this.rotation=e*mm}get pivot(){return this._pivot===ii&&(this._pivot=new Ke(this,0,0)),this._pivot}set pivot(e){this._pivot===ii&&(this._pivot=new Ke(this,0,0),this._origin!==oi&&_t("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Fo&&(this._skew=new Ke(this,0,0)),this._skew}set skew(e){this._skew===Fo&&(this._skew=new Ke(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Bo&&(this._scale=new Ke(this,1,1)),this._scale}set scale(e){this._scale===Bo&&(this._scale=new Ke(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===oi&&(this._origin=new Ke(this,0,0)),this._origin}set origin(e){this._origin===oi&&(this._origin=new Ke(this,0,0),this._pivot!==ii&&_t("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const n=this.getLocalBounds().width;this._setWidth(e,n)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const n=this.getLocalBounds().height;this._setHeight(e,n)}getSize(e){e||(e={});const n=this.getLocalBounds();return e.width=Math.abs(this.scale.x*n.width),e.height=Math.abs(this.scale.y*n.height),e}setSize(e,n){const r=this.getLocalBounds();typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,r.width),n!==void 0&&this._setHeight(n,r.height)}_updateSkew(){const e=this._rotation,n=this._skew;this._cx=Math.cos(e+n._y),this._sx=Math.sin(e+n._y),this._cy=-Math.sin(e-n._x),this._sy=Math.cos(e-n._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX:this.scale.x,typeof e.scaleY=="number"?e.scaleY:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const n=this.localTransform,r=this._scale,s=this._pivot,i=this._origin,o=this._position,a=r._x,l=r._y,c=s._x,u=s._y,h=-i._x,f=-i._y;n.a=this._cx*a,n.b=this._sx*a,n.c=this._cy*l,n.d=this._sy*l,n.tx=o._x-(c*n.a+u*n.c)+(h*n.a+f*n.c)-h,n.ty=o._y-(c*n.b+u*n.d)+(h*n.b+f*n.d)-f}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Wc,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=ln.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Wc,this._onUpdate())}get tint(){return vi(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=tg,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const n=e?2:0;(this.localDisplayStatus&2)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Uo,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const n=e?0:4;(this.localDisplayStatus&4)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Uo,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const n=e?1:0;(this.localDisplayStatus&1)!==n&&(this._updateFlags|=Uo,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var s;if(this.destroyed)return;this.destroyed=!0;let n;if(this.children.length&&(n=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 e=="boolean"?e:e==null?void 0:e.children)&&n)for(let i=0;i<n.length;++i)n[i].destroy(e);(s=this.renderGroup)==null||s.destroy(),this.renderGroup=null}}yt.mixin(Nt,Dm,Zm,qm,Wm,Hm,Bm,Um,Ym,Rm,$m,jm,Lm);class xd extends Nt{constructor(e){super(e),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 zt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const n=this.bounds,{x:r,y:s}=e;return r>=n.minX&&r<=n.maxX&&s>=n.minY&&s<=n.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,n,r){const{renderPipes:s}=n;s.blendMode.pushBlendMode(this,this.groupBlendMode,e);const o=s[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,e),this.didViewUpdate=!1;const a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(e,n,r);s.blendMode.popBlendMode(e)}}class _s extends xd{constructor(e=be.EMPTY){e instanceof be&&(e={texture:e});const{texture:n=be.EMPTY,anchor:r,roundPixels:s,width:i,height:o,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ke({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:n.defaultAnchor&&(this.anchor=n.defaultAnchor),this.texture=n,this.allowChildren=!1,this.roundPixels=s??!1,i!==void 0&&(this.width=i),o!==void 0&&(this.height=o)}static from(e,n=!1){return e instanceof be?new _s(e):new _s(be.from(e,n))}set texture(e){e||(e=be.EMPTY);const n=this._texture;n!==e&&(n&&n.dynamic&&n.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,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 wm(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Ae("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,n=this._texture,r=this._bounds,{width:s,height:i}=n.orig;r.minX=-e._x*s,r.maxX=r.minX+s,r.minY=-e._y*i,r.maxY=r.minY+i}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,n){typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}const ng=new zt;function bd(t,e,n){const r=ng;t.measurable=!0,dd(t,n,r),e.addBoundsMask(r),t.measurable=!1}function vd(t,e,n){const r=sn.get();t.measurable=!0;const s=ot.get().identity(),i=wd(t,n,s);md(t,r,i),t.measurable=!1,e.addBoundsMask(r),ot.return(s),sn.return(r)}function wd(t,e,n){return t?(t!==e&&(wd(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(_t("Mask bounds, renderable is not inside the root container"),n)}class kd{constructor(e){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof _s),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(e,n){this.inverse||bd(this.mask,e,n)}addLocalBounds(e,n){vd(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof _s}}kd.extension=ve.MaskEffect;class Sd{constructor(e){this.priority=0,this.pipe="colorMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}Sd.extension=ve.MaskEffect;class Td{constructor(e){this.priority=0,this.pipe="stencilMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,n){bd(this.mask,e,n)}addLocalBounds(e,n){vd(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Nt}}Td.extension=ve.MaskEffect;const rg={createCanvas:(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};let Yc=rg;const Gs={get(){return Yc},set(t){Yc=t}};class Ad extends $t{constructor(e){e.resource||(e.resource=Gs.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.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(e=this.width,n=this.height,r=this._resolution){const s=super.resize(e,n,r);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}Ad.extension=ve.TextureSource;class Ti extends $t{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}Ti.extension=ve.TextureSource;var Ia=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Ia||{});class Go{constructor(e,n=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=n,this.priority=r,this._once=s}match(e,n=null){return this._fn===e&&this._context===n}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const n=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),n}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 n=this.next;return this.next=e?null:n,this.previous=null,n}}const Cd=class pt{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 Go(null,null,1/0),this.deltaMS=1/pt.targetFPMS,this.elapsedMS=1/pt.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,n,r=Ia.NORMAL){return this._addListener(new Go(e,n,r))}addOnce(e,n,r=Ia.NORMAL){return this._addListener(new Go(e,n,r,!0))}_addListener(e){let n=this._head.next,r=this._head;if(!n)e.connect(r);else{for(;n;){if(e.priority>n.priority){e.connect(r);break}r=n,n=n.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,n){let r=this._head.next;for(;r;)r.match(e,n)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,n=this._head;for(;n=n.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let n;if(e>this.lastTime){if(n=this.elapsedMS=e-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*pt.targetFPMS;const r=this._head;let s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const n=Math.min(Math.max(0,e)/1e3,pt.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!pt._shared){const e=pt._shared=new pt;e.autoStart=!0,e._protected=!0}return pt._shared}static get system(){if(!pt._system){const e=pt._system=new pt;e.autoStart=!0,e._protected=!0}return pt._system}};Cd.targetFPMS=.06;let ai=Cd,Zo;async function sg(){return Zo??(Zo=(async()=>{var o;const e=Gs.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const n=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(!n)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n);const i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(s),e.deleteTexture(r),(o=e.getExtension("WEBGL_lose_context"))==null||o.loseContext(),i[0]<=i[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Zo}const qi=class Ed extends $t{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Ed.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=ai.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,n=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(n.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.isValid||e.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await sg(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,n.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${n.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("loadedmetadata",this._onLoadedMetadata),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ai.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||(ai.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ai.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};qi.extension=ve.TextureSource;qi.defaultOptions={...$t.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};qi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let ig=qi;const pr=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class og{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const n=this._cache.get(e);return n||_t(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=pr(e);let s;for(let l=0;l<this.parsers.length;l++){const c=this.parsers[l];if(c.test(n)){s=c.getCacheableAssets(r,n);break}}const i=new Map(Object.entries(s||{}));s||r.forEach(l=>{i.set(l,n)});const o=[...i.keys()],a={cacheKeys:o,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const c=s?s[l]:n;this._cache.has(l)&&this._cache.get(l)!==c&&_t("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){_t(`[Assets] Asset id ${e} was not found in the Cache`);return}const n=this._cacheMap.get(e);n.cacheKeys.forEach(s=>{this._cache.delete(s)}),n.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const mr=new og,Pa=[];yt.handleByList(ve.TextureSource,Pa);function Id(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<Pa.length;s++){const i=Pa[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function ag(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&mr.has(r))return mr.get(r);const i=new be({source:Id(s)});return i.on("destroy",()=>{mr.has(r)&&mr.remove(r)}),e||mr.set(r,i),i}function lg(t,e=!1){return typeof t=="string"?mr.get(t):t instanceof $t?new be({source:t}):ag(t,e)}be.from=lg;$t.from=Id;yt.add(kd,Sd,Td,ig,Ti,Ad,gl);var Pd=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Pd||{});function It(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function jr(t){return t.split("?")[0].split("#")[0]}function cg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ug(t,e,n){return t.replace(new RegExp(cg(e),"g"),n)}function hg(t,e){let n="",r=0,s=-1,i=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){const l=n.lastIndexOf("/");if(l!==n.length-1){l===-1?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length===2||n.length===1){n="",r=0,s=a,i=0;continue}}}else n.length>0?n+=`/${t.slice(s+1,a)}`:n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i!==-1?++i:i=-1}return n}const ys={toPosix(t){return ug(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){It(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const n=/^[^/:]+:\/{0,2}/.exec(t);return n?n[0]:""},toAbsolute(t,e,n){if(It(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=jr(this.toPosix(e??Gs.get().getBaseUrl())),s=jr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?ys.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(It(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="";const n=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return t=hg(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return It(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let n=0;n<t.length;++n){const r=t[n];if(It(r),r.length>0)if(e===void 0)e=r;else{const s=t[n-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(It(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0);const n=e===47;let r=-1,s=!0;const i=this.getProtocol(t),o=t;t=t.slice(i.length);for(let a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!s){r=a;break}}else s=!1;return r===-1?n?"/":this.isUrl(o)?i+t:i:n&&r===1?"//":i+t.slice(0,r)},rootname(t){It(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){const n=t.indexOf("/",e.length);n!==-1?e=t.slice(0,n):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){It(t),e&&It(e),t=jr(this.toPosix(t));let n=0,r=-1,s=!0,i;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const l=t.charCodeAt(i);if(l===47){if(!s){n=i+1;break}}else a===-1&&(s=!1,a=i+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=i):(o=-1,r=a))}return n===r?r=a:r===-1&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(t.charCodeAt(i)===47){if(!s){n=i+1;break}}else r===-1&&(s=!1,r=i+1);return r===-1?"":t.slice(n,r)},extname(t){It(t),t=jr(this.toPosix(t));let e=-1,n=0,r=-1,s=!0,i=0;for(let o=t.length-1;o>=0;--o){const a=t.charCodeAt(o);if(a===47){if(!s){n=o+1;break}continue}r===-1&&(s=!1,r=o+1),a===46?e===-1?e=o:i!==1&&(i=1):e!==-1&&(i=-1)}return e===-1||r===-1||i===0||i===1&&e===r-1&&e===n+1?"":t.slice(e,r)},parse(t){It(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=jr(this.toPosix(t));let n=t.charCodeAt(0);const r=this.isAbsolute(t);let s;e.root=this.rootname(t),r||this.hasProtocol(t)?s=1:s=0;let i=-1,o=0,a=-1,l=!0,c=t.length-1,u=0;for(;c>=s;--c){if(n=t.charCodeAt(c),n===47){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===46?i===-1?i=c:u!==1&&(u=1):i!==-1&&(u=-1)}return i===-1||a===-1||u===0||u===1&&i===a-1&&i===o+1?a!==-1&&(o===0&&r?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(o,a)):(o===0&&r?(e.name=t.slice(1,i),e.base=t.slice(1,a)):(e.name=t.slice(o,i),e.base=t.slice(o,a)),e.ext=t.slice(i,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function Md(t,e,n,r,s){const i=e[n];for(let o=0;o<i.length;o++){const a=i[o];n<e.length-1?Md(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function dg(t){const e=/\{(.*?)\}/g,n=t.match(e),r=[];if(n){const s=[];n.forEach(i=>{const o=i.substring(1,i.length-1).split(",");s.push(o)}),Md(t,s,0,n,r)}else r.push(t);return r}const Xc=t=>!Array.isArray(t);class Rd{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,n)=>`${e}${this._bundleIdConnector}${n}`,extractAssetIdFromBundle:(e,n)=>n.replace(`${e}${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(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(n=>{this._preferredOrder.push(n),n.priority||(n.priority=Object.keys(n.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}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(e){if(typeof e=="string")this._defaultSearchParams=e;else{const n=e;this._defaultSearchParams=Object.keys(n).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(n[r])}`).join("&")}}getAlias(e){const{alias:n,src:r}=e;return pr(n||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(o=>(o==null?void 0:o.src)??o):i!=null&&i.src?i.src:i,!0)}removeAlias(e,n){this._assetMap[e]&&(n&&n!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&_t("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(n=>{this.addBundle(n.name,n.assets)})}addBundle(e,n){const r=[];let s=n;Array.isArray(n)||(s=Object.entries(n).map(([i,o])=>typeof o=="string"||Array.isArray(o)?{alias:i,src:o}:{alias:i,...o})),s.forEach(i=>{const o=i.src,a=i.alias;let l;if(typeof a=="string"){const c=this._createBundleAssetId(e,a);r.push(c),l=[a,c]}else{const c=a.map(u=>this._createBundleAssetId(e,u));r.push(...c),l=[...a,...c]}this.add({...i,alias:l,src:o})}),this._bundles[e]=r}add(e){const n=[];Array.isArray(e)?n.push(...e):n.push(e);let r;r=i=>{this.hasKey(i)&&_t(`[Resolver] already has key: ${i} overwriting`)},pr(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=pr(o).map(y=>typeof y=="string"?dg(y):Array.isArray(y)?y:[y]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=y=>{const g=this._parsers.find(x=>x.test(y));return{src:y,...g==null?void 0:g.parse(y)}};h.forEach(y=>{y.forEach(g=>{let x={};if(typeof g!="object"?x=m(g):(a=g.data??a,l=g.format??l,(g.loadParser||g.parser)&&(c=g.loadParser??c,u=g.parser??u),x={...m(g.src),...g}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:f,data:a,format:l,loadParser:c,parser:u,progressSize:i.progressSize}),d.push(x)})}),f.forEach(y=>{this._assetMap[y]=d})})}resolveBundle(e){const n=Xc(e);e=pr(e);const r={};return e.forEach(s=>{const i=this._bundles[s];if(i){const o=this.resolve(i),a={};for(const l in o){const c=o[l];a[this._extractAssetIdFromBundle(s,l)]=c}r[s]=a}}),n?r[e[0]]:r}resolveUrl(e){const n=this.resolve(e);if(typeof e!="string"){const r={};for(const s in n)r[s]=n[s].src;return r}return n.src}resolve(e){const n=Xc(e);e=pr(e);const r={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let i=this._assetMap[s];const o=this._getPreferredOrder(i);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const c=i.filter(u=>u[a]?u[a]===l:!1);c.length&&(i=c)})}),this._resolverHash[s]=i[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),n?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let n=0;n<e.length;n++){const r=e[n],s=this._preferredOrder.find(i=>i.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const n=/\?/.test(e)?"&":"?";return`${e}${n}${this._defaultSearchParams}`}_buildResolvedAsset(e,n){const{aliases:r,data:s,loadParser:i,parser:o,format:a,progressSize:l}=n;return(this._basePath||this._rootPath)&&(e.src=ys.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=i??e.loadParser,e.parser=o??e.parser,e.format=a??e.format??fg(e.src),l!==void 0&&(e.progressSize=l),e}}Rd.RETINA_PREFIX=/@([0-9\.]+)x/;function fg(t){return t.split(".").pop().split("?").shift().split("#").shift()}const qc=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},zd=class is{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof $t&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof be?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=i;const a=parseFloat(i.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=is.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,n=!1){let r=e;const s=n?1/0:is.BATCH_SIZE;for(;r-e<s&&r<this._frameKeys.length;){const i=this._frameKeys[r],o=this._frames[i],a=o.frame;if(a){let l=null,c=null;const u=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new Ve(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?l=new Ve(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 Ve(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new Ve(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[i]=new be({source:this.textureSource,frame:l,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:i.toString()})}r++}}_processAnimations(){const e=this.data.animations||{};for(const n in e){this.animations[n]=[];for(let r=0;r<e[n].length;r++){const s=e[n][r];this.animations[n].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*is.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*is.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var n;for(const r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((n=this._texture)==null||n.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};zd.BATCH_SIZE=1e3;let Jc=zd;const pg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Od(t,e,n){const r={};if(t.forEach(s=>{r[s]=e}),Object.keys(e.textures).forEach(s=>{r[`${e.cachePrefix}${s}`]=e.textures[s]}),!n){const s=ys.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Od([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const mg={extension:ve.Asset,cache:{test:t=>t instanceof Jc,getCacheableAssets:(t,e)=>Od(t,e,!1)},resolver:{extension:{type:ve.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&pg.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Rd.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:ve.LoadParser,priority:Pd.Normal,name:"spritesheetLoader"},async testParse(t,e){return ys.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,n){var h,f;const{texture:r,imageFilename:s,textureOptions:i,cachePrefix:o}=(e==null?void 0:e.data)??{};let a=ys.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof be)l=r;else{const d=qc(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new Jc({texture:l.source,data:t,cachePrefix:o});await c.parse();const u=(h=t==null?void 0:t.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(u)){const d=[];for(const y of u){if(typeof y!="string")continue;let g=a+y;(f=e.data)!=null&&f.ignoreMultiPack||(g=qc(g,e.src),d.push(n.load({src:g,data:{textureOptions:i,ignoreMultiPack:!0}})))}const m=await Promise.all(d);c.linkedSheets=m,m.forEach(y=>{y.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==y))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};yt.add(mg);const jo=Object.create(null),Kc=Object.create(null);function bl(t,e){let n=Kc[t];return n===void 0&&(jo[e]===void 0&&(jo[e]=1),Kc[t]=n=jo[e]++),n}let ur;function $d(){return(!ur||ur!=null&&ur.isContextLost())&&(ur=Gs.get().createCanvas().getContext("webgl",{})),ur}let li;function gg(){if(!li){li="mediump";const t=$d();t&&t.getShaderPrecisionFormat&&(li=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return li}function _g(t,e,n){return e?t:n?(t=t.replace("out vec4 finalColor;",""),`
|
|
6
6
|
|
|
7
7
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
8
8
|
#define in varying
|
|
@@ -17,29 +17,29 @@ Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!yr.noColor
|
|
|
17
17
|
#define out varying
|
|
18
18
|
#endif
|
|
19
19
|
${t}
|
|
20
|
-
`}function
|
|
21
|
-
${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}function
|
|
22
|
-
${t}`:t}const
|
|
23
|
-
${t}`}function yg(t,e){return e?t.replace("#version 300 es",""):t}const jo={stripVersion:yg,ensurePrecision:fg,addProgramDefines:dg,setProgramName:_g,insertVersion:pg},jr=Object.create(null),Rd=class Ia{constructor(e){e={...Ia.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:hg()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(jo).forEach(o=>{const a=r[o];s=jo[o](s,a,!0),i=jo[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=yl(`${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,jr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return jr[n]||(jr[n]=new Ia(e),jr[n]._cacheKey=n),jr[n]}};Rd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let zd=Rd;const Jc={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 xg(t){return Jc[t]??Jc.float32}const bg={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"},Kc=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Qc(t,e){let n;for(;(n=Kc.exec(t))!==null;){const r=bg[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:xg(r).stride,offset:0,instance:!1,start:0}}Kc.lastIndex=0}function vg(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function wg({source:t,entryPoint:e}){const n={},r=vg(t),s=r.indexOf(`fn ${e}(`);if(s===-1)return n;const i=r.indexOf("->",s);if(i===-1)return n;const o=r.substring(s,i);if(Qc(o,n),Object.keys(n).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const l=a[1],c=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),u=r.match(c);u&&Qc(u[1],n)}}return n}function Vo(t){var h,f;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,i=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=(h=t.match(e))==null?void 0:h.map(d=>({group:parseInt(d.match(n)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(s)[2],isUniform:d.match(s)[1]==="<uniform>",type:d.match(i)[1]}));if(!c)return{groups:[],structs:[]};const u=((f=t.match(o))==null?void 0:f.map(d=>{const m=d.match(l)[1],y=d.match(a).reduce((g,x)=>{const[b,S]=x.split(":");return g[b.trim()]=S.trim(),g},{});return y?{name:m,members:y}:null}).filter(({name:d})=>c.some(m=>m.type===d||m.type.includes(`<${d}>`))))??[];return{groups:c,structs:u}}var jn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(jn||{});function kg({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:jn.VERTEX|jn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:jn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:jn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:jn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:jn.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function Sg({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function Tg(t,e){const n=new Set,r=new Set,s=[...t.structs,...e.structs].filter(o=>n.has(o.name)?!1:(n.add(o.name),!0)),i=[...t.groups,...e.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:i}}const Vr=Object.create(null);class qi{constructor(e){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:r,layout:s,gpuLayout:i,name:o}=e;if(this.name=o,this.fragment=n,this.vertex=r,n.source===r.source){const c=Vo(n.source);this.structsAndGroups=c}else{const c=Vo(r.source),u=Vo(n.source);this.structsAndGroups=Tg(c,u)}this.layout=s??Sg(this.structsAndGroups),this.gpuLayout=i??kg(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:e,fragment:n}=this,r=e.source+n.source+e.entryPoint+n.entryPoint;this._layoutKey=yl(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=wg(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Vr[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Vr[n]||(Vr[n]=new qi(e),Vr[n]._cacheKey=n),Vr[n]}}const Od=["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>"],Ag=Od.reduce((t,e)=>(t[e]=!0,t),{});function Cg(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 $d=class Nd{constructor(e,n){this._touched=0,this.uid=Fe("uniform"),this._resourceType="uniformGroup",this._resourceId=Fe("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...Nd.defaultOptions,...n},this.uniformStructures=e;const r={};for(const s in e){const i=e[s];if(i.name=s,i.size=i.size??1,!Ag[i.type]){const o=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${Od.join(", ")}`)}i.value??(i.value=Cg(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=yl(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};$d.defaultOptions={ubo:!1,isStatic:!1};let Dd=$d;class vi{constructor(e){this.resources=Object.create(null),this._dirty=!0;let n=0;for(const r in e){const s=e[r];this.setResource(s,n++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const e=[];let n=0;for(const r in this.resources)e[n++]=this.resources[r]._resourceId;this._key=e.join("|")}setResource(e,n){var s,i;const r=this.resources[n];e!==r&&((s=r==null?void 0:r.off)==null||s.call(r,"change",this.onResourceChange,this),(i=e.on)==null||i.call(e,"change",this.onResourceChange,this),this.resources[n]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e,n){const r=this.resources;for(const s in r)r[s]._gcLastUsed=e,r[s]._touched=n}destroy(){var n;const e=this.resources;for(const r in e){const s=e[r];(n=s==null?void 0:s.off)==null||n.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(e){this._dirty=!0,e.destroyed?this.destroy():this._updateKey()}}var Pa=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Pa||{});class xl extends An{constructor(e){super(),this.uid=Fe("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:n,glProgram:r,groups:s,resources:i,compatibleRenderers:o,groupMap:a}=e;this.gpuProgram=n,this.glProgram=r,o===void 0&&(o=0,n&&(o|=Pa.WEBGPU),r&&(o|=Pa.WEBGL)),this.compatibleRenderers=o;const l={};if(!i&&!s&&(i={}),i&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!n&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!n&&s&&a)for(const c in a)for(const u in a[c]){const h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(n&&s&&!a){const c=n.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(i){s={},a={},n&&n.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(const u in i)l[u]||(s[99]||(s[99]=new vi,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(const u in i){const h=u;let f=i[u];!f.source&&!f._resourceType&&(f=new Dd(f));const d=l[h];d&&(s[d.group]||(s[d.group]=new vi,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,n,r){var s,i;(s=this._uniformBindMap)[n]||(s[n]={}),(i=this._uniformBindMap[n])[r]||(i[r]=e),this.groups[n]||(this.groups[n]=new vi,this._ownedBindGroups.push(this.groups[n]))}_buildResourceAccessor(e,n){const r={};for(const s in n){const i=n[s];Object.defineProperty(r,i.name,{get(){return e[i.group].getResource(i.binding)},set(o){e[i.group].setResource(o,i.binding)}})}return r}destroy(e=!1){var n,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&((n=this.gpuProgram)==null||n.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(e){const{gpu:n,gl:r,...s}=e;let i,o;return n&&(i=qi.from(n)),r&&(o=zd.from(r)),new xl({gpuProgram:i,glProgram:o,...s})}}const Eg={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},Ho=0,Wo=1,Yo=2,Xo=3,qo=4,Jo=5,Ma=class Ld{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ho)}set blend(e){!!(this.data&1<<Ho)!==e&&(this.data^=1<<Ho)}get offsets(){return!!(this.data&1<<Wo)}set offsets(e){!!(this.data&1<<Wo)!==e&&(this.data^=1<<Wo)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Yo)}set culling(e){!!(this.data&1<<Yo)!==e&&(this.data^=1<<Yo)}get depthTest(){return!!(this.data&1<<Xo)}set depthTest(e){!!(this.data&1<<Xo)!==e&&(this.data^=1<<Xo)}get depthMask(){return!!(this.data&1<<Jo)}set depthMask(e){!!(this.data&1<<Jo)!==e&&(this.data^=1<<Jo)}get clockwiseFrontFace(){return!!(this.data&1<<qo)}set clockwiseFrontFace(e){!!(this.data&1<<qo)!==e&&(this.data^=1<<qo)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Eg[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new Ld;return e.depthTest=!1,e.blend=!0,e}};Ma.default2d=Ma.for2d();let Fd=Ma;const ys=new Set;let Ra=!1;function eu(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;ys.size&&ys.clear();let i=Bd(t,0,s,n,!0);const o=[];if(!i||i.next===i.prev)return o;let a=0,l=0,c=0;if(r&&(i=zg(t,e,i,n)),t.length>80*n){a=t[0],l=t[1];let u=a,h=l;for(let f=n;f<s;f+=n){const d=t[f],m=t[f+1];d<a&&(a=d),m<l&&(l=m),d>u&&(u=d),m>h&&(h=m)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return za(i,o,a,l,c),o}function Bd(t,e,n,r,s){let i=null;if(s===Hg(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=ru(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=ru(o/r|0,t[o],t[o+1],i);return i&&xs(i,i.next)&&(vs(i),i=i.next),i}function Xn(t,e=t){const n=e===t;let r=t,s;do s=!1,r!==r.next&&(ys.size===0||!ys.has(r))&&(xs(r,r.next)||De(r.prev,r,r.next)===0)?((n||r===e)&&(e=r.prev),Ra=!0,vs(r),r=r.prev,s=!0):(n||r!==e)&&(r=r.next,s=!n);while(s||r!==e);return e}function za(t,e,n,r,s){s&&Bg(t,n,r,s);let i=t,o=!1;for(;t.prev!==t.next;){const a=t.prev,l=t.next;if(De(a,t,l)<0&&(s?Pg(t,n,r,s):Ig(t))){e.push(a.i,t.i,l.i),vs(t),t=l,i=l;continue}if(t=l,t===i){if(Ra=!1,t=Xn(t),Ra){i=t;continue}if(!o){t=Mg(t,e),i=t,o=!0;continue}Rg(t,e,n,r,s);break}}}function Ig(t){const e=t.prev,n=t,r=t.next,s=e.x,i=n.x,o=r.x,a=e.y,l=n.y,c=r.y,u=Math.min(s,i,o),h=Math.min(a,l,c),f=Math.max(s,i,o),d=Math.max(a,l,c);let m=r.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&!(s===m.x&&a===m.y)&&Ti(s,a,i,l,o,c,m.x,m.y)&&De(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Pg(t,e,n,r){const s=t.prev,i=t,o=t.next,a=s.x,l=i.x,c=o.x,u=s.y,h=i.y,f=o.y,d=Math.min(a,l,c),m=Math.min(u,h,f),y=Math.max(a,l,c),g=Math.max(u,h,f),x=Da(d,m,e,n,r),b=Da(y,g,e,n,r);let S=t.prevZ;for(;S&&S.z>=x;){if(S.x>=d&&S.x<=y&&S.y>=m&&S.y<=g&&S!==o&&!(a===S.x&&u===S.y)&&Ti(a,u,l,h,c,f,S.x,S.y)&&De(S.prev,S,S.next)>=0)return!1;S=S.prevZ}let T=t.nextZ;for(;T&&T.z<=b;){if(T.x>=d&&T.x<=y&&T.y>=m&&T.y<=g&&T!==o&&!(a===T.x&&u===T.y)&&Ti(a,u,l,h,c,f,T.x,T.y)&&De(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function Mg(t,e){let n=t,r=!1;do{const s=n.prev,i=n.next.next;Zd(s,n,n.next,i,!1)&&bs(s,i)&&bs(i,s)&&(e.push(s.i,n.i,i.i),vs(n),vs(n.next),n=t=i,r=!0),n=n.next}while(n!==t);return r?Xn(n):n}function Rg(t,e,n,r,s){let i=t;do{let o=i.next.next;for(;o!==i.prev;){if(i.i!==o.i&&Zg(i,o)){let a=jd(i,o);i=Xn(i,i.next),a=Xn(a,a.next),za(i,e,n,r,s),za(a,e,n,r,s);return}o=o.next}i=i.next}while(i!==t)}let Oa=!1;function zg(t,e,n,r){const s=[];for(let i=0,o=e.length;i<o;i++){const a=e[i]*r,l=i<o-1?e[i+1]*r:t.length,c=Bd(t,a,l,r,!1);c===c.next&&ys.add(c),s.push(Gg(c))}s.sort(Og),Ng(t.length/r,e.length),Gd(n,n),Oa=!0;for(let i=0;i<s.length;i++)n=$g(s[i],n);return Oa=!1,Xn(n)}function Og(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function $g(t,e){const n=Lg(t,e);if(!n)return e;const r=jd(n,t),s=r.next;return Gd(n,s.next),Xn(r,r.next),Xn(n,n.next)}const Ud=16;let Oe=new Float64Array(0),Si=0;const $a=[],Na=[];function Ng(t,e){const n=Math.ceil((t+2*e)/Ud)+e+2;Oe.length<n*4&&(Oe=new Float64Array(n*4)),Si=0}function Gd(t,e){let n=t;do{const r=Si++;$a[r]=n;let s=1/0,i=1/0,o=-1/0,a=-1/0,l=0;do{const u=n.next;n.z=r,n.x<s&&(s=n.x),n.x>o&&(o=n.x),n.y<i&&(i=n.y),n.y>a&&(a=n.y),u.x<s&&(s=u.x),u.x>o&&(o=u.x),u.y<i&&(i=u.y),u.y>a&&(a=u.y),n=u}while(++l<Ud&&n!==e);Na[r]=n;const c=r*4;Oe[c]=s,Oe[c+1]=i,Oe[c+2]=o,Oe[c+3]=a}while(n!==e)}function Dg(t,e){const n=t.z*4;e.x<Oe[n]&&(Oe[n]=e.x),e.y<Oe[n+1]&&(Oe[n+1]=e.y),e.x>Oe[n+2]&&(Oe[n+2]=e.x),e.y>Oe[n+3]&&(Oe[n+3]=e.y)}function tu(t){let e=Na[t];for(;e.prev.next!==e;)e=e.next;return Na[t]=e,e}function nu(t){let e=$a[t];for(;e.prev.next!==e;)e=e.next;return $a[t]=e,e}function Lg(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(xs(t,n))return n;for(let f=0,d=0;f<Si;f++,d+=4){if(s<Oe[d+1]||s>Oe[d+3]||Oe[d]>r||Oe[d+2]<=i)continue;const m=tu(f);n=nu(f);do{if(n.prev.next===n){if(xs(t,n.next))return n.next;if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const y=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(y<=r&&y>i&&(i=y,o=n.x<n.next.x?n:n.next,y===r))return o}}n=n.next}while(n!==m)}if(!o)return null;const a=o.x,l=o.y,c=Math.min(s,l),u=Math.max(s,l);let h=1/0;for(let f=0,d=0;f<Si;f++,d+=4){if(Oe[d+2]<a||Oe[d]>r||Oe[d+3]<c||Oe[d+1]>u)continue;const m=tu(f);n=nu(f);do{if(n.prev.next===n&&r>=n.x&&n.x>=a&&r!==n.x&&Ti(s<l?r:i,s,a,l,s<l?i:r,s,n.x,n.y)){const y=Math.abs(s-n.y)/(r-n.x);(bs(n,t)||n.y===s&&n.next.y===s&&n.next.x>r)&&(y<h||y===h&&(n.x>o.x||n.x===o.x&&Fg(o,n)))&&(o=n,h=y)}n=n.next}while(n!==m)}return o}function Fg(t,e){return De(t.prev,t,e.prev)<0&&De(e.next,t,t.next)<0}const bt=[];let Hr=[],Dn=new Uint32Array(0),Wr=new Uint32Array(0);const Yr=new Uint32Array(256);function Bg(t,e,n,r){let s=t,i=0;do s.z=Da(s.x,s.y,e,n,r),bt[i++]=s,s=s.next;while(s!==t);Ug(i);let o=null;for(let a=0;a<i;a++){const l=bt[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Ug(t){if(t<=32){for(let e=1;e<t;e++){const n=bt[e],r=n.z;let s=e-1;for(;s>=0&&bt[s].z>r;)bt[s+1]=bt[s],s--;bt[s+1]=n}return}Dn.length<t&&(Dn=new Uint32Array(t),Wr=new Uint32Array(t),Hr=new Array(t));for(let e=0;e<t;e++)Dn[e]=bt[e].z;li(t,bt,Dn,Hr,Wr,0),li(t,Hr,Wr,bt,Dn,8),li(t,bt,Dn,Hr,Wr,16),li(t,Hr,Wr,bt,Dn,24)}function li(t,e,n,r,s,i){Yr.fill(0);for(let a=0;a<t;a++)Yr[n[a]>>>i&255]++;let o=0;for(let a=0;a<256;a++){const l=Yr[a];Yr[a]=o,o+=l}for(let a=0;a<t;a++){const l=n[a],c=Yr[l>>>i&255]++;r[c]=e[a],s[c]=l}}function Da(t,e,n,r,s){return t=(t-n)*s|0,e=(e-r)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Gg(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function Ti(t,e,n,r,s,i,o,a){return(s-o)*(e-a)>=(t-o)*(i-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function Zg(t,e){const n=xs(t,e)&&De(t.prev,t,t.next)>0&&De(e.prev,e,e.next)>0;return t.next.i!==e.i&&(n||bs(t,e)&&bs(e,t)&&(De(t.prev,t,e.prev)!==0||De(t,e.prev,e)!==0))&&!jg(t,e)&&(n||Vg(t,e))}function De(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function xs(t,e){return t.x===e.x&&t.y===e.y}function Zd(t,e,n,r,s=!0){const i=De(t,e,n),o=De(t,e,r),a=De(n,r,t),l=De(n,r,e);return(i>0&&o<0||i<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:s?!!(i===0&&ci(t,n,e)||o===0&&ci(t,r,e)||a===0&&ci(n,t,r)||l===0&&ci(n,e,r)):!1}function ci(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function jg(t,e){const n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y);let o=t;do{const a=o.next;if(o.x>r&&a.x>r||o.x<n&&a.x<n||o.y>i&&a.y>i||o.y<s&&a.y<s){o=a;continue}if(o.i!==t.i&&a.i!==t.i&&o.i!==e.i&&a.i!==e.i&&Zd(o,a,t,e))return!0;o=a}while(o!==t);return!1}function bs(t,e){return De(t.prev,t,t.next)<0?De(t,e,t.next)>=0&&De(t,t.prev,e)>=0:De(t,e,t.prev)<0||De(t,t.next,e)<0}function Vg(t,e){let n=t,r=!1;const s=(t.x+e.x)/2,i=(t.y+e.y)/2;do{const o=n.next;n.y>i!=o.y>i&&s<(o.x-n.x)*(i-n.y)/(o.y-n.y)+n.x&&(r=!r),n=o}while(n!==t);return r}function jd(t,e){const n=La(t.i,t.x,t.y),r=La(e.i,e.x,e.y),s=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function ru(t,e,n,r){const s=La(t,e,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function vs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),Oa&&Dg(t.prev,t.next)}function La(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Hg(t,e,n,r){let s=0;for(let i=e,o=n-r;i<n;i+=r)s+=(t[o]-t[i])*(t[i+1]+t[o+1]),o=i;return s}const Wg=eu.default||eu,Ko={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Yg=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Xg=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function qg(t){const e=[];return t.replace(Yg,(n,r,s)=>{let i=r.toLowerCase(),o=r;const a=Jg(s);for(i==="m"&&a.length>2&&(e.push([o,...a.splice(0,2)]),i="l",o=o==="m"?"l":"L");;){if(a.length===Ko[i])return e.push([o,...a]),"";if(a.length<Ko[i])throw new Error("malformed path data");e.push([o,...a.splice(0,Ko[i])])}}),e}function Jg(t){const e=t.match(Xg);return e?e.map(Number):[]}function Kg(t,e){const n=qg(t),r=[];let s=null,i=0,o=0;for(let a=0;a<n.length;a++){const l=n[a],c=l[0],u=l;switch(c){case"M":i=u[1],o=u[2],e.moveTo(i,o);break;case"m":i+=u[1],o+=u[2],e.moveTo(i,o);break;case"H":i=u[1],e.lineTo(i,o);break;case"h":i+=u[1],e.lineTo(i,o);break;case"V":o=u[1],e.lineTo(i,o);break;case"v":o+=u[1],e.lineTo(i,o);break;case"L":i=u[1],o=u[2],e.lineTo(i,o);break;case"l":i+=u[1],o+=u[2],e.lineTo(i,o);break;case"C":i=u[5],o=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],i,o);break;case"c":e.bezierCurveTo(i+u[1],o+u[2],i+u[3],o+u[4],i+u[5],o+u[6]),i+=u[5],o+=u[6];break;case"S":i=u[3],o=u[4],e.bezierCurveToShort(u[1],u[2],i,o);break;case"s":e.bezierCurveToShort(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"Q":i=u[3],o=u[4],e.quadraticCurveTo(u[1],u[2],i,o);break;case"q":e.quadraticCurveTo(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"T":i=u[1],o=u[2],e.quadraticCurveToShort(i,o);break;case"t":i+=u[1],o+=u[2],e.quadraticCurveToShort(i,o);break;case"A":i=u[6],o=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"a":i+=u[6],o+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"Z":case"z":e.closePath(),r.length>0&&(s=r.pop(),s?(i=s.startX,o=s.startY):(i=0,o=0)),s=null;break;default:_t(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class bl{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new bl(this.x,this.y,this.radius)}contains(e,n){if(this.radius<=0)return!1;const r=this.radius*this.radius;let s=this.x-e,i=this.y-n;return s*=s,i*=i,s+i<=r}strokeContains(e,n,r,s=.5){if(this.radius===0)return!1;const i=this.x-e,o=this.y-n,a=this.radius,l=(1-s)*r,c=Math.sqrt(i*i+o*o);return c<=a+l&&c>a-(r-l)}getBounds(e){return e||(e=new Ve),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class vl{constructor(e=0,n=0,r=0,s=0){this.type="ellipse",this.x=e,this.y=n,this.halfWidth=r,this.halfHeight=s}clone(){return new vl(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,n){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,s=(n-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(e,n,r,s=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const a=r*(1-s),l=r-a,c=i-l,u=o-l,h=i+a,f=o+a,d=e-this.x,m=n-this.y,y=d*d/(c*c)+m*m/(u*u),g=d*d/(h*h)+m*m/(f*f);return y>1&&g<=1}getBounds(e){return e||(e=new Ve),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function Qg(t,e,n,r,s,i){const o=t-n,a=e-r,l=s-n,c=i-r,u=o*l+a*c,h=l*l+c*c;let f=-1;h!==0&&(f=u/h);let d,m;f<0?(d=n,m=r):f>1?(d=s,m=i):(d=n+f*l,m=r+f*c);const y=t-d,g=e-m;return y*y+g*g}let e_,t_;class ds{constructor(...e){this.type="polygon";let n=Array.isArray(e[0])?e[0]:e;if(typeof n[0]!="number"){const r=[];for(let s=0,i=n.length;s<i;s++)r.push(n[s].x,n[s].y);n=r}this.points=n,this.closePath=!0}isClockwise(){let e=0;const n=this.points,r=n.length;for(let s=0;s<r;s+=2){const i=n[s],o=n[s+1],a=n[(s+2)%r],l=n[(s+3)%r];e+=(a-i)*(l+o)}return e<0}containsPolygon(e){const n=this.getBounds(e_),r=e.getBounds(t_);if(!n.containsRect(r))return!1;const s=e.points;for(let i=0;i<s.length;i+=2){const o=s[i],a=s[i+1];if(!this.contains(o,a))return!1}return!0}clone(){const e=this.points.slice(),n=new ds(e);return n.closePath=this.closePath,n}contains(e,n){let r=!1;const s=this.points.length/2;for(let i=0,o=s-1;i<s;o=i++){const a=this.points[i*2],l=this.points[i*2+1],c=this.points[o*2],u=this.points[o*2+1];l>n!=u>n&&e<(c-a)*((n-l)/(u-l))+a&&(r=!r)}return r}strokeContains(e,n,r,s=.5){const i=r*r,o=i*(1-s),a=i-o,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;u<c;u+=2){const h=l[u],f=l[u+1],d=l[(u+2)%l.length],m=l[(u+3)%l.length],y=Qg(e,n,h,f,d,m),g=Math.sign((d-h)*(n-f)-(m-f)*(e-h));if(y<=(g<0?a:o))return!0}return!1}getBounds(e){e||(e=new Ve);const n=this.points;let r=1/0,s=-1/0,i=1/0,o=-1/0;for(let a=0,l=n.length;a<l;a+=2){const c=n[a],u=n[a+1];r=c<r?c:r,s=c>s?c:s,i=u<i?u:i,o=u>o?u:o}return e.x=r,e.width=s-r,e.y=i,e.height=o-i,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,n)=>`${e}, ${n}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return Ae("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return Ae("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 ui=(t,e,n,r,s,i,o)=>{const a=t-n,l=e-r,c=Math.sqrt(a*a+l*l);return c>=s-i&&c<=s+o};class wl{constructor(e=0,n=0,r=0,s=0,i=20){this.type="roundedRectangle",this.x=e,this.y=n,this.width=r,this.height=s,this.radius=i}getBounds(e){return e||(e=new Ve),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new wl(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&n>=this.y&&n<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(n>=this.y+r&&n<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let s=e-(this.x+r),i=n-(this.y+r);const o=r*r;if(s*s+i*i<=o||(s=e-(this.x+this.width-r),s*s+i*i<=o)||(i=n-(this.y+this.height-r),s*s+i*i<=o)||(s=e-(this.x+r),s*s+i*i<=o))return!0}return!1}strokeContains(e,n,r,s=.5){const{x:i,y:o,width:a,height:l,radius:c}=this,u=r*(1-s),h=r-u,f=i+c,d=o+c,m=a-c*2,y=l-c*2,g=i+a,x=o+l;return(e>=i-u&&e<=i+h||e>=g-h&&e<=g+u)&&n>=d&&n<=d+y||(n>=o-u&&n<=o+h||n>=x-h&&n<=x+u)&&e>=f&&e<=f+m?!0:e<f&&n<d&&ui(e,n,f,d,c,h,u)||e>g-c&&n<d&&ui(e,n,g-c,d,c,h,u)||e>g-c&&n>x-c&&ui(e,n,g-c,x-c,c,h,u)||e<f&&n>x-c&&ui(e,n,f,x-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const Vd={};function n_(t,e,n){let r=2166136261;for(let s=0;s<e;s++)r^=t[s].uid,r=Math.imul(r,16777619),r>>>=0;return Vd[r]||r_(t,e,r,n)}function r_(t,e,n,r){const s={};let i=0;for(let a=0;a<r;a++){const l=a<e?t[a]:be.EMPTY.source;s[i++]=l.source,s[i++]=l.style}const o=new vi(s);return Vd[n]=o,o}class su{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function iu(t,e,n,r){if(n??(n=0),r??(r=Math.min(t.byteLength-n,e.byteLength)),!(n&7)&&!(r&7)){const s=r/8;new Float64Array(e,0,s).set(new Float64Array(t,n,s))}else if(!(n&3)&&!(r&3)){const s=r/4;new Float32Array(e,0,s).set(new Float32Array(t,n,s))}else new Uint8Array(e).set(new Uint8Array(t,n,r))}const s_={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function ou(t,e){return e.alphaMode==="no-premultiply-alpha"&&s_[t]||t}const i_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
-
`);function
|
|
25
|
-
else `),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function a_(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const r=i_.replace(/%forloop%/gi,o_(t));if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(n)}return t}let ur=null;function l_(){var e;if(ur)return ur;const t=Md();return ur=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ur=a_(ur,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),ur}class c_{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const n=this.textures[e];this.textures[e]=null,this.ids[n.uid]=null}this.count=0}}class u_{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new c_,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 fs=[];let Ai=0;ml.register({clear:()=>{if(fs.length>0)for(const t of fs)t&&t.destroy();fs.length=0,Ai=0}});function au(){return Ai>0?fs[--Ai]:new u_}function lu(t){t.elements=null,fs[Ai++]=t}let Xr=0;const Hd=class Wd{constructor(e){this.uid=Fe("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Wd.defaultOptions,...e},e.maxTextures||(Ae("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=l_());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new su(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)lu(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,n){const r=e._batch.textures.ids[n._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=n,!0)}updateElement(e){this.dirty=!0;const n=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId)}break(e){const n=this._elements;if(!n[this.elementStart])return;let r=au(),s=r.textures;s.clear();const i=n[this.elementStart];let o=ou(i.blendMode,i.texture._source),a=i.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,c=this.attributeBuffer.uint32View,u=this.indexBuffer;let h=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=[];const y=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const x=n[g];n[g]=null;const S=x.texture._source,T=ou(x.blendMode,S),I=o!==T||a!==x.topology;if(S._batchTick===Xr&&!I){x._textureId=S._textureBindLocation,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r,m.push(x);continue}S._batchTick=Xr,(s.count>=y||I)&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),d="renderBatch",f=h,o=T,a=x.topology,r=au(),s=r.textures,s.clear(),m=[],++Xr),x._textureId=S._textureBindLocation=s.count,s.ids[S.uid]=s.count,s.textures[s.count++]=S,x._batch=r,m.push(x),h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),f=h,++Xr),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=h}_finishBatch(e,n,r,s,i,o,a,l,c){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=i,e.topology=o,e.start=n,e.size=r,e.elements=c,++Xr,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const n=Math.max(e,this.attributeBuffer.size*2),r=new su(n);iu(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const n=this.indexBuffer;let r=Math.max(e,n.length*1.5);r+=r%2;const s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==n.BYTES_PER_ELEMENT)for(let i=0;i<n.length;i++)s[i]=n[i];else iu(n.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(e,n,r){e[n]=r+0,e[n+1]=r+1,e[n+2]=r+2,e[n+3]=r+0,e[n+4]=r+2,e[n+5]=r+3}packIndex(e,n,r,s){const i=e.indices,o=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let c=0;c<o;c++)n[r++]=s+i[c+a]-l}destroy(e={}){var n;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)lu(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&((n=this.shader)==null||n.destroy(),this.shader=null);for(let r=0;r<this._elements.length;r++)this._elements[r]&&(this._elements[r]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};Hd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let h_=Hd;var ct=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(ct||{});class ws extends An{constructor(e){let{data:n,size:r}=e;const{usage:s,label:i,shrinkToFit:o}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=Fe("buffer"),this._resourceType="buffer",this._resourceId=Fe("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,n instanceof Array&&(n=new Float32Array(n)),this._data=n,r??(r=n==null?void 0:n.byteLength);const a=!!n;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:i},this.shrinkToFit=o??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ct.STATIC)}set static(e){e?this.descriptor.usage|=ct.STATIC:this.descriptor.usage&=~ct.STATIC}setDataWithSize(e,n,r){if(this._updateID++,this._updateSize=n*e.BYTES_PER_ELEMENT,this._data===e){r&&this.emit("update",this);return}const s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=Fe("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.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 Yd(t,e){if(!(t instanceof ws)){let n=e?ct.INDEX:ct.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=ct.INDEX|ct.COPY_DST):(t=new Float32Array(t),n=ct.VERTEX|ct.COPY_DST)),t=new ws({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function d_(t,e,n){const r=t.getAttribute(e);if(!r)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const s=r.buffer.data;let i=1/0,o=1/0,a=-1/0,l=-1/0;const c=s.BYTES_PER_ELEMENT,u=(r.offset||0)/c,h=(r.stride||2*4)/c;for(let f=u;f<s.length;f+=h){const d=s[f],m=s[f+1];d>a&&(a=d),m>l&&(l=m),d<i&&(i=d),m<o&&(o=m)}return n.minX=i,n.minY=o,n.maxX=a,n.maxY=l,n}function f_(t){return(t instanceof ws||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Yd(t.buffer,!1),t}class p_ extends An{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Fe("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new zt,this._boundsDirty=!0;const{attributes:n,indexBuffer:r,topology:s}=e;if(this.buffers=[],this.attributes={},n)for(const i in n)this.addAttribute(i,n[i]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(const e in this.attributes){const n=this.attributes[e];return n.buffer.data.length/(n.stride/4||n.size)}return 0}addAttribute(e,n){const r=f_(n);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r}addIndex(e){this.indexBuffer=Yd(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,d_(this,"aPosition",this._bounds)):this._bounds}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){var n;this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(r=>r.destroy()),this.unload(),(n=this.indexBuffer)==null||n.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const m_=new Float32Array(1),g_=new Uint32Array(1);class __ extends p_{constructor(){const n=new ws({data:m_,label:"attribute-batch-buffer",usage:ct.VERTEX|ct.COPY_DST,shrinkToFit:!1}),r=new ws({data:g_,label:"index-batch-buffer",usage:ct.INDEX|ct.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:n,format:"float32x2",stride:s,offset:0},aUV:{buffer:n,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:n,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:n,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}function cu(t,e,n){if(t)for(const r in t){const s=r.toLocaleLowerCase(),i=e[s];if(i){let o=t[r];r==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&i.push(`//----${n}----//`),i.push(o)}else _t(`${r} placement hook does not exist in shader`)}}const y_=/\{\{(.*?)\}\}/g;function uu(t){var r;const e={};return(((r=t.match(y_))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function hu(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function du(t,e,n=!1){const r=[];hu(e,r),t.forEach(a=>{a.header&&hu(a.header,r)});const s=r;n&&s.sort();const i=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
20
|
+
`}function yg(t,e,n){const r=n?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let s=n?e.requestedFragmentPrecision:e.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
21
|
+
${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}function xg(t,e){return e?`#version 300 es
|
|
22
|
+
${t}`:t}const bg={},vg={};function wg(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-"),e+=n?"-fragment":"-vertex";const r=n?bg:vg;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
|
|
23
|
+
${t}`}function kg(t,e){return e?t.replace("#version 300 es",""):t}const Vo={stripVersion:kg,ensurePrecision:yg,addProgramDefines:_g,setProgramName:wg,insertVersion:xg},Vr=Object.create(null),Nd=class Ma{constructor(e){e={...Ma.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:gg()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(Vo).forEach(o=>{const a=r[o];s=Vo[o](s,a,!0),i=Vo[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=bl(`${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,Vr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return Vr[n]||(Vr[n]=new Ma(e),Vr[n]._cacheKey=n),Vr[n]}};Nd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Dd=Nd;const Qc={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 Sg(t){return Qc[t]??Qc.float32}const Tg={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"},eu=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function tu(t,e){let n;for(;(n=eu.exec(t))!==null;){const r=Tg[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:Sg(r).stride,offset:0,instance:!1,start:0}}eu.lastIndex=0}function Ag(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Cg({source:t,entryPoint:e}){const n={},r=Ag(t),s=r.indexOf(`fn ${e}(`);if(s===-1)return n;const i=r.indexOf("->",s);if(i===-1)return n;const o=r.substring(s,i);if(tu(o,n),Object.keys(n).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const l=a[1],c=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),u=r.match(c);u&&tu(u[1],n)}}return n}function Ho(t){var h,f;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,i=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=(h=t.match(e))==null?void 0:h.map(d=>({group:parseInt(d.match(n)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(s)[2],isUniform:d.match(s)[1]==="<uniform>",type:d.match(i)[1]}));if(!c)return{groups:[],structs:[]};const u=((f=t.match(o))==null?void 0:f.map(d=>{const m=d.match(l)[1],y=d.match(a).reduce((g,x)=>{const[b,S]=x.split(":");return g[b.trim()]=S.trim(),g},{});return y?{name:m,members:y}:null}).filter(({name:d})=>c.some(m=>m.type===d||m.type.includes(`<${d}>`))))??[];return{groups:c,structs:u}}var Vn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(Vn||{});function Eg({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:Vn.VERTEX|Vn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:Vn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:Vn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:Vn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:Vn.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function Ig({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function Pg(t,e){const n=new Set,r=new Set,s=[...t.structs,...e.structs].filter(o=>n.has(o.name)?!1:(n.add(o.name),!0)),i=[...t.groups,...e.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:i}}const Hr=Object.create(null);class Ji{constructor(e){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:r,layout:s,gpuLayout:i,name:o}=e;if(this.name=o,this.fragment=n,this.vertex=r,n.source===r.source){const c=Ho(n.source);this.structsAndGroups=c}else{const c=Ho(r.source),u=Ho(n.source);this.structsAndGroups=Pg(c,u)}this.layout=s??Ig(this.structsAndGroups),this.gpuLayout=i??Eg(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:e,fragment:n}=this,r=e.source+n.source+e.entryPoint+n.entryPoint;this._layoutKey=bl(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Cg(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Hr[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Hr[n]||(Hr[n]=new Ji(e),Hr[n]._cacheKey=n),Hr[n]}}const Ld=["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>"],Mg=Ld.reduce((t,e)=>(t[e]=!0,t),{});function Rg(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 Fd=class Bd{constructor(e,n){this._touched=0,this.uid=Fe("uniform"),this._resourceType="uniformGroup",this._resourceId=Fe("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...Bd.defaultOptions,...n},this.uniformStructures=e;const r={};for(const s in e){const i=e[s];if(i.name=s,i.size=i.size??1,!Mg[i.type]){const o=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${Ld.join(", ")}`)}i.value??(i.value=Rg(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=bl(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Fd.defaultOptions={ubo:!1,isStatic:!1};let Ud=Fd;class wi{constructor(e){this.resources=Object.create(null),this._dirty=!0;let n=0;for(const r in e){const s=e[r];this.setResource(s,n++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const e=[];let n=0;for(const r in this.resources)e[n++]=this.resources[r]._resourceId;this._key=e.join("|")}setResource(e,n){var s,i;const r=this.resources[n];e!==r&&((s=r==null?void 0:r.off)==null||s.call(r,"change",this.onResourceChange,this),(i=e.on)==null||i.call(e,"change",this.onResourceChange,this),this.resources[n]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e,n){const r=this.resources;for(const s in r)r[s]._gcLastUsed=e,r[s]._touched=n}destroy(){var n;const e=this.resources;for(const r in e){const s=e[r];(n=s==null?void 0:s.off)==null||n.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(e){this._dirty=!0,e.destroyed?this.destroy():this._updateKey()}}var Ra=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Ra||{});class vl extends Cn{constructor(e){super(),this.uid=Fe("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:n,glProgram:r,groups:s,resources:i,compatibleRenderers:o,groupMap:a}=e;this.gpuProgram=n,this.glProgram=r,o===void 0&&(o=0,n&&(o|=Ra.WEBGPU),r&&(o|=Ra.WEBGL)),this.compatibleRenderers=o;const l={};if(!i&&!s&&(i={}),i&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!n&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!n&&s&&a)for(const c in a)for(const u in a[c]){const h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(n&&s&&!a){const c=n.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(i){s={},a={},n&&n.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(const u in i)l[u]||(s[99]||(s[99]=new wi,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(const u in i){const h=u;let f=i[u];!f.source&&!f._resourceType&&(f=new Ud(f));const d=l[h];d&&(s[d.group]||(s[d.group]=new wi,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,n,r){var s,i;(s=this._uniformBindMap)[n]||(s[n]={}),(i=this._uniformBindMap[n])[r]||(i[r]=e),this.groups[n]||(this.groups[n]=new wi,this._ownedBindGroups.push(this.groups[n]))}_buildResourceAccessor(e,n){const r={};for(const s in n){const i=n[s];Object.defineProperty(r,i.name,{get(){return e[i.group].getResource(i.binding)},set(o){e[i.group].setResource(o,i.binding)}})}return r}destroy(e=!1){var n,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&((n=this.gpuProgram)==null||n.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(e){const{gpu:n,gl:r,...s}=e;let i,o;return n&&(i=Ji.from(n)),r&&(o=Dd.from(r)),new vl({gpuProgram:i,glProgram:o,...s})}}const zg={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},Wo=0,Yo=1,Xo=2,qo=3,Jo=4,Ko=5,za=class Gd{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Wo)}set blend(e){!!(this.data&1<<Wo)!==e&&(this.data^=1<<Wo)}get offsets(){return!!(this.data&1<<Yo)}set offsets(e){!!(this.data&1<<Yo)!==e&&(this.data^=1<<Yo)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Xo)}set culling(e){!!(this.data&1<<Xo)!==e&&(this.data^=1<<Xo)}get depthTest(){return!!(this.data&1<<qo)}set depthTest(e){!!(this.data&1<<qo)!==e&&(this.data^=1<<qo)}get depthMask(){return!!(this.data&1<<Ko)}set depthMask(e){!!(this.data&1<<Ko)!==e&&(this.data^=1<<Ko)}get clockwiseFrontFace(){return!!(this.data&1<<Jo)}set clockwiseFrontFace(e){!!(this.data&1<<Jo)!==e&&(this.data^=1<<Jo)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=zg[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new Gd;return e.depthTest=!1,e.blend=!0,e}};za.default2d=za.for2d();let Zd=za;const xs=new Set;let Oa=!1;function nu(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;xs.size&&xs.clear();let i=jd(t,0,s,n,!0);const o=[];if(!i||i.next===i.prev)return o;let a=0,l=0,c=0;if(r&&(i=Lg(t,e,i,n)),t.length>80*n){a=t[0],l=t[1];let u=a,h=l;for(let f=n;f<s;f+=n){const d=t[f],m=t[f+1];d<a&&(a=d),m<l&&(l=m),d>u&&(u=d),m>h&&(h=m)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return $a(i,o,a,l,c),o}function jd(t,e,n,r,s){let i=null;if(s===Jg(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=iu(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=iu(o/r|0,t[o],t[o+1],i);return i&&bs(i,i.next)&&(ws(i),i=i.next),i}function qn(t,e=t){const n=e===t;let r=t,s;do s=!1,r!==r.next&&(xs.size===0||!xs.has(r))&&(bs(r,r.next)||De(r.prev,r,r.next)===0)?((n||r===e)&&(e=r.prev),Oa=!0,ws(r),r=r.prev,s=!0):(n||r!==e)&&(r=r.next,s=!n);while(s||r!==e);return e}function $a(t,e,n,r,s){s&&Vg(t,n,r,s);let i=t,o=!1;for(;t.prev!==t.next;){const a=t.prev,l=t.next;if(De(a,t,l)<0&&(s?$g(t,n,r,s):Og(t))){e.push(a.i,t.i,l.i),ws(t),t=l,i=l;continue}if(t=l,t===i){if(Oa=!1,t=qn(t),Oa){i=t;continue}if(!o){t=Ng(t,e),i=t,o=!0;continue}Dg(t,e,n,r,s);break}}}function Og(t){const e=t.prev,n=t,r=t.next,s=e.x,i=n.x,o=r.x,a=e.y,l=n.y,c=r.y,u=Math.min(s,i,o),h=Math.min(a,l,c),f=Math.max(s,i,o),d=Math.max(a,l,c);let m=r.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&!(s===m.x&&a===m.y)&&Ci(s,a,i,l,o,c,m.x,m.y)&&De(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function $g(t,e,n,r){const s=t.prev,i=t,o=t.next,a=s.x,l=i.x,c=o.x,u=s.y,h=i.y,f=o.y,d=Math.min(a,l,c),m=Math.min(u,h,f),y=Math.max(a,l,c),g=Math.max(u,h,f),x=Fa(d,m,e,n,r),b=Fa(y,g,e,n,r);let S=t.prevZ;for(;S&&S.z>=x;){if(S.x>=d&&S.x<=y&&S.y>=m&&S.y<=g&&S!==o&&!(a===S.x&&u===S.y)&&Ci(a,u,l,h,c,f,S.x,S.y)&&De(S.prev,S,S.next)>=0)return!1;S=S.prevZ}let T=t.nextZ;for(;T&&T.z<=b;){if(T.x>=d&&T.x<=y&&T.y>=m&&T.y<=g&&T!==o&&!(a===T.x&&u===T.y)&&Ci(a,u,l,h,c,f,T.x,T.y)&&De(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function Ng(t,e){let n=t,r=!1;do{const s=n.prev,i=n.next.next;Wd(s,n,n.next,i,!1)&&vs(s,i)&&vs(i,s)&&(e.push(s.i,n.i,i.i),ws(n),ws(n.next),n=t=i,r=!0),n=n.next}while(n!==t);return r?qn(n):n}function Dg(t,e,n,r,s){let i=t;do{let o=i.next.next;for(;o!==i.prev;){if(i.i!==o.i&&Yg(i,o)){let a=Yd(i,o);i=qn(i,i.next),a=qn(a,a.next),$a(i,e,n,r,s),$a(a,e,n,r,s);return}o=o.next}i=i.next}while(i!==t)}let Na=!1;function Lg(t,e,n,r){const s=[];for(let i=0,o=e.length;i<o;i++){const a=e[i]*r,l=i<o-1?e[i+1]*r:t.length,c=jd(t,a,l,r,!1);c===c.next&&xs.add(c),s.push(Wg(c))}s.sort(Fg),Ug(t.length/r,e.length),Hd(n,n),Na=!0;for(let i=0;i<s.length;i++)n=Bg(s[i],n);return Na=!1,qn(n)}function Fg(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function Bg(t,e){const n=Zg(t,e);if(!n)return e;const r=Yd(n,t),s=r.next;return Hd(n,s.next),qn(r,r.next),qn(n,n.next)}const Vd=16;let Oe=new Float64Array(0),Ai=0;const Da=[],La=[];function Ug(t,e){const n=Math.ceil((t+2*e)/Vd)+e+2;Oe.length<n*4&&(Oe=new Float64Array(n*4)),Ai=0}function Hd(t,e){let n=t;do{const r=Ai++;Da[r]=n;let s=1/0,i=1/0,o=-1/0,a=-1/0,l=0;do{const u=n.next;n.z=r,n.x<s&&(s=n.x),n.x>o&&(o=n.x),n.y<i&&(i=n.y),n.y>a&&(a=n.y),u.x<s&&(s=u.x),u.x>o&&(o=u.x),u.y<i&&(i=u.y),u.y>a&&(a=u.y),n=u}while(++l<Vd&&n!==e);La[r]=n;const c=r*4;Oe[c]=s,Oe[c+1]=i,Oe[c+2]=o,Oe[c+3]=a}while(n!==e)}function Gg(t,e){const n=t.z*4;e.x<Oe[n]&&(Oe[n]=e.x),e.y<Oe[n+1]&&(Oe[n+1]=e.y),e.x>Oe[n+2]&&(Oe[n+2]=e.x),e.y>Oe[n+3]&&(Oe[n+3]=e.y)}function ru(t){let e=La[t];for(;e.prev.next!==e;)e=e.next;return La[t]=e,e}function su(t){let e=Da[t];for(;e.prev.next!==e;)e=e.next;return Da[t]=e,e}function Zg(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(bs(t,n))return n;for(let f=0,d=0;f<Ai;f++,d+=4){if(s<Oe[d+1]||s>Oe[d+3]||Oe[d]>r||Oe[d+2]<=i)continue;const m=ru(f);n=su(f);do{if(n.prev.next===n){if(bs(t,n.next))return n.next;if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const y=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(y<=r&&y>i&&(i=y,o=n.x<n.next.x?n:n.next,y===r))return o}}n=n.next}while(n!==m)}if(!o)return null;const a=o.x,l=o.y,c=Math.min(s,l),u=Math.max(s,l);let h=1/0;for(let f=0,d=0;f<Ai;f++,d+=4){if(Oe[d+2]<a||Oe[d]>r||Oe[d+3]<c||Oe[d+1]>u)continue;const m=ru(f);n=su(f);do{if(n.prev.next===n&&r>=n.x&&n.x>=a&&r!==n.x&&Ci(s<l?r:i,s,a,l,s<l?i:r,s,n.x,n.y)){const y=Math.abs(s-n.y)/(r-n.x);(vs(n,t)||n.y===s&&n.next.y===s&&n.next.x>r)&&(y<h||y===h&&(n.x>o.x||n.x===o.x&&jg(o,n)))&&(o=n,h=y)}n=n.next}while(n!==m)}return o}function jg(t,e){return De(t.prev,t,e.prev)<0&&De(e.next,t,t.next)<0}const bt=[];let Wr=[],Ln=new Uint32Array(0),Yr=new Uint32Array(0);const Xr=new Uint32Array(256);function Vg(t,e,n,r){let s=t,i=0;do s.z=Fa(s.x,s.y,e,n,r),bt[i++]=s,s=s.next;while(s!==t);Hg(i);let o=null;for(let a=0;a<i;a++){const l=bt[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Hg(t){if(t<=32){for(let e=1;e<t;e++){const n=bt[e],r=n.z;let s=e-1;for(;s>=0&&bt[s].z>r;)bt[s+1]=bt[s],s--;bt[s+1]=n}return}Ln.length<t&&(Ln=new Uint32Array(t),Yr=new Uint32Array(t),Wr=new Array(t));for(let e=0;e<t;e++)Ln[e]=bt[e].z;ci(t,bt,Ln,Wr,Yr,0),ci(t,Wr,Yr,bt,Ln,8),ci(t,bt,Ln,Wr,Yr,16),ci(t,Wr,Yr,bt,Ln,24)}function ci(t,e,n,r,s,i){Xr.fill(0);for(let a=0;a<t;a++)Xr[n[a]>>>i&255]++;let o=0;for(let a=0;a<256;a++){const l=Xr[a];Xr[a]=o,o+=l}for(let a=0;a<t;a++){const l=n[a],c=Xr[l>>>i&255]++;r[c]=e[a],s[c]=l}}function Fa(t,e,n,r,s){return t=(t-n)*s|0,e=(e-r)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Wg(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function Ci(t,e,n,r,s,i,o,a){return(s-o)*(e-a)>=(t-o)*(i-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function Yg(t,e){const n=bs(t,e)&&De(t.prev,t,t.next)>0&&De(e.prev,e,e.next)>0;return t.next.i!==e.i&&(n||vs(t,e)&&vs(e,t)&&(De(t.prev,t,e.prev)!==0||De(t,e.prev,e)!==0))&&!Xg(t,e)&&(n||qg(t,e))}function De(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function bs(t,e){return t.x===e.x&&t.y===e.y}function Wd(t,e,n,r,s=!0){const i=De(t,e,n),o=De(t,e,r),a=De(n,r,t),l=De(n,r,e);return(i>0&&o<0||i<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:s?!!(i===0&&ui(t,n,e)||o===0&&ui(t,r,e)||a===0&&ui(n,t,r)||l===0&&ui(n,e,r)):!1}function ui(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Xg(t,e){const n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y);let o=t;do{const a=o.next;if(o.x>r&&a.x>r||o.x<n&&a.x<n||o.y>i&&a.y>i||o.y<s&&a.y<s){o=a;continue}if(o.i!==t.i&&a.i!==t.i&&o.i!==e.i&&a.i!==e.i&&Wd(o,a,t,e))return!0;o=a}while(o!==t);return!1}function vs(t,e){return De(t.prev,t,t.next)<0?De(t,e,t.next)>=0&&De(t,t.prev,e)>=0:De(t,e,t.prev)<0||De(t,t.next,e)<0}function qg(t,e){let n=t,r=!1;const s=(t.x+e.x)/2,i=(t.y+e.y)/2;do{const o=n.next;n.y>i!=o.y>i&&s<(o.x-n.x)*(i-n.y)/(o.y-n.y)+n.x&&(r=!r),n=o}while(n!==t);return r}function Yd(t,e){const n=Ba(t.i,t.x,t.y),r=Ba(e.i,e.x,e.y),s=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function iu(t,e,n,r){const s=Ba(t,e,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function ws(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),Na&&Gg(t.prev,t.next)}function Ba(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Jg(t,e,n,r){let s=0;for(let i=e,o=n-r;i<n;i+=r)s+=(t[o]-t[i])*(t[i+1]+t[o+1]),o=i;return s}const Kg=nu.default||nu,Qo={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Qg=/([astvzqmhlc])([^astvzqmhlc]*)/gi,e_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function t_(t){const e=[];return t.replace(Qg,(n,r,s)=>{let i=r.toLowerCase(),o=r;const a=n_(s);for(i==="m"&&a.length>2&&(e.push([o,...a.splice(0,2)]),i="l",o=o==="m"?"l":"L");;){if(a.length===Qo[i])return e.push([o,...a]),"";if(a.length<Qo[i])throw new Error("malformed path data");e.push([o,...a.splice(0,Qo[i])])}}),e}function n_(t){const e=t.match(e_);return e?e.map(Number):[]}function r_(t,e){const n=t_(t),r=[];let s=null,i=0,o=0;for(let a=0;a<n.length;a++){const l=n[a],c=l[0],u=l;switch(c){case"M":i=u[1],o=u[2],e.moveTo(i,o);break;case"m":i+=u[1],o+=u[2],e.moveTo(i,o);break;case"H":i=u[1],e.lineTo(i,o);break;case"h":i+=u[1],e.lineTo(i,o);break;case"V":o=u[1],e.lineTo(i,o);break;case"v":o+=u[1],e.lineTo(i,o);break;case"L":i=u[1],o=u[2],e.lineTo(i,o);break;case"l":i+=u[1],o+=u[2],e.lineTo(i,o);break;case"C":i=u[5],o=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],i,o);break;case"c":e.bezierCurveTo(i+u[1],o+u[2],i+u[3],o+u[4],i+u[5],o+u[6]),i+=u[5],o+=u[6];break;case"S":i=u[3],o=u[4],e.bezierCurveToShort(u[1],u[2],i,o);break;case"s":e.bezierCurveToShort(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"Q":i=u[3],o=u[4],e.quadraticCurveTo(u[1],u[2],i,o);break;case"q":e.quadraticCurveTo(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"T":i=u[1],o=u[2],e.quadraticCurveToShort(i,o);break;case"t":i+=u[1],o+=u[2],e.quadraticCurveToShort(i,o);break;case"A":i=u[6],o=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"a":i+=u[6],o+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"Z":case"z":e.closePath(),r.length>0&&(s=r.pop(),s?(i=s.startX,o=s.startY):(i=0,o=0)),s=null;break;default:_t(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class wl{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new wl(this.x,this.y,this.radius)}contains(e,n){if(this.radius<=0)return!1;const r=this.radius*this.radius;let s=this.x-e,i=this.y-n;return s*=s,i*=i,s+i<=r}strokeContains(e,n,r,s=.5){if(this.radius===0)return!1;const i=this.x-e,o=this.y-n,a=this.radius,l=(1-s)*r,c=Math.sqrt(i*i+o*o);return c<=a+l&&c>a-(r-l)}getBounds(e){return e||(e=new Ve),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class kl{constructor(e=0,n=0,r=0,s=0){this.type="ellipse",this.x=e,this.y=n,this.halfWidth=r,this.halfHeight=s}clone(){return new kl(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,n){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,s=(n-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(e,n,r,s=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const a=r*(1-s),l=r-a,c=i-l,u=o-l,h=i+a,f=o+a,d=e-this.x,m=n-this.y,y=d*d/(c*c)+m*m/(u*u),g=d*d/(h*h)+m*m/(f*f);return y>1&&g<=1}getBounds(e){return e||(e=new Ve),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function s_(t,e,n,r,s,i){const o=t-n,a=e-r,l=s-n,c=i-r,u=o*l+a*c,h=l*l+c*c;let f=-1;h!==0&&(f=u/h);let d,m;f<0?(d=n,m=r):f>1?(d=s,m=i):(d=n+f*l,m=r+f*c);const y=t-d,g=e-m;return y*y+g*g}let i_,o_;class fs{constructor(...e){this.type="polygon";let n=Array.isArray(e[0])?e[0]:e;if(typeof n[0]!="number"){const r=[];for(let s=0,i=n.length;s<i;s++)r.push(n[s].x,n[s].y);n=r}this.points=n,this.closePath=!0}isClockwise(){let e=0;const n=this.points,r=n.length;for(let s=0;s<r;s+=2){const i=n[s],o=n[s+1],a=n[(s+2)%r],l=n[(s+3)%r];e+=(a-i)*(l+o)}return e<0}containsPolygon(e){const n=this.getBounds(i_),r=e.getBounds(o_);if(!n.containsRect(r))return!1;const s=e.points;for(let i=0;i<s.length;i+=2){const o=s[i],a=s[i+1];if(!this.contains(o,a))return!1}return!0}clone(){const e=this.points.slice(),n=new fs(e);return n.closePath=this.closePath,n}contains(e,n){let r=!1;const s=this.points.length/2;for(let i=0,o=s-1;i<s;o=i++){const a=this.points[i*2],l=this.points[i*2+1],c=this.points[o*2],u=this.points[o*2+1];l>n!=u>n&&e<(c-a)*((n-l)/(u-l))+a&&(r=!r)}return r}strokeContains(e,n,r,s=.5){const i=r*r,o=i*(1-s),a=i-o,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;u<c;u+=2){const h=l[u],f=l[u+1],d=l[(u+2)%l.length],m=l[(u+3)%l.length],y=s_(e,n,h,f,d,m),g=Math.sign((d-h)*(n-f)-(m-f)*(e-h));if(y<=(g<0?a:o))return!0}return!1}getBounds(e){e||(e=new Ve);const n=this.points;let r=1/0,s=-1/0,i=1/0,o=-1/0;for(let a=0,l=n.length;a<l;a+=2){const c=n[a],u=n[a+1];r=c<r?c:r,s=c>s?c:s,i=u<i?u:i,o=u>o?u:o}return e.x=r,e.width=s-r,e.y=i,e.height=o-i,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,n)=>`${e}, ${n}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return Ae("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return Ae("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 hi=(t,e,n,r,s,i,o)=>{const a=t-n,l=e-r,c=Math.sqrt(a*a+l*l);return c>=s-i&&c<=s+o};class Sl{constructor(e=0,n=0,r=0,s=0,i=20){this.type="roundedRectangle",this.x=e,this.y=n,this.width=r,this.height=s,this.radius=i}getBounds(e){return e||(e=new Ve),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new Sl(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&n>=this.y&&n<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(n>=this.y+r&&n<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let s=e-(this.x+r),i=n-(this.y+r);const o=r*r;if(s*s+i*i<=o||(s=e-(this.x+this.width-r),s*s+i*i<=o)||(i=n-(this.y+this.height-r),s*s+i*i<=o)||(s=e-(this.x+r),s*s+i*i<=o))return!0}return!1}strokeContains(e,n,r,s=.5){const{x:i,y:o,width:a,height:l,radius:c}=this,u=r*(1-s),h=r-u,f=i+c,d=o+c,m=a-c*2,y=l-c*2,g=i+a,x=o+l;return(e>=i-u&&e<=i+h||e>=g-h&&e<=g+u)&&n>=d&&n<=d+y||(n>=o-u&&n<=o+h||n>=x-h&&n<=x+u)&&e>=f&&e<=f+m?!0:e<f&&n<d&&hi(e,n,f,d,c,h,u)||e>g-c&&n<d&&hi(e,n,g-c,d,c,h,u)||e>g-c&&n>x-c&&hi(e,n,g-c,x-c,c,h,u)||e<f&&n>x-c&&hi(e,n,f,x-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const Xd={};function a_(t,e,n){let r=2166136261;for(let s=0;s<e;s++)r^=t[s].uid,r=Math.imul(r,16777619),r>>>=0;return Xd[r]||l_(t,e,r,n)}function l_(t,e,n,r){const s={};let i=0;for(let a=0;a<r;a++){const l=a<e?t[a]:be.EMPTY.source;s[i++]=l.source,s[i++]=l.style}const o=new wi(s);return Xd[n]=o,o}class ou{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function au(t,e,n,r){if(n??(n=0),r??(r=Math.min(t.byteLength-n,e.byteLength)),!(n&7)&&!(r&7)){const s=r/8;new Float64Array(e,0,s).set(new Float64Array(t,n,s))}else if(!(n&3)&&!(r&3)){const s=r/4;new Float32Array(e,0,s).set(new Float32Array(t,n,s))}else new Uint8Array(e).set(new Uint8Array(t,n,r))}const c_={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function lu(t,e){return e.alphaMode==="no-premultiply-alpha"&&c_[t]||t}const u_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
+
`);function h_(t){let e="";for(let n=0;n<t;++n)n>0&&(e+=`
|
|
25
|
+
else `),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function d_(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const r=u_.replace(/%forloop%/gi,h_(t));if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(n)}return t}let hr=null;function f_(){var e;if(hr)return hr;const t=$d();return hr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),hr=d_(hr,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),hr}class p_{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const n=this.textures[e];this.textures[e]=null,this.ids[n.uid]=null}this.count=0}}class m_{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new p_,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 ps=[];let Ei=0;_l.register({clear:()=>{if(ps.length>0)for(const t of ps)t&&t.destroy();ps.length=0,Ei=0}});function cu(){return Ei>0?ps[--Ei]:new m_}function uu(t){t.elements=null,ps[Ei++]=t}let qr=0;const qd=class Jd{constructor(e){this.uid=Fe("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Jd.defaultOptions,...e},e.maxTextures||(Ae("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=f_());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new ou(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)uu(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,n){const r=e._batch.textures.ids[n._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=n,!0)}updateElement(e){this.dirty=!0;const n=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId)}break(e){const n=this._elements;if(!n[this.elementStart])return;let r=cu(),s=r.textures;s.clear();const i=n[this.elementStart];let o=lu(i.blendMode,i.texture._source),a=i.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,c=this.attributeBuffer.uint32View,u=this.indexBuffer;let h=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=[];const y=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const x=n[g];n[g]=null;const S=x.texture._source,T=lu(x.blendMode,S),I=o!==T||a!==x.topology;if(S._batchTick===qr&&!I){x._textureId=S._textureBindLocation,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r,m.push(x);continue}S._batchTick=qr,(s.count>=y||I)&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),d="renderBatch",f=h,o=T,a=x.topology,r=cu(),s=r.textures,s.clear(),m=[],++qr),x._textureId=S._textureBindLocation=s.count,s.ids[S.uid]=s.count,s.textures[s.count++]=S,x._batch=r,m.push(x),h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),f=h,++qr),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=h}_finishBatch(e,n,r,s,i,o,a,l,c){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=i,e.topology=o,e.start=n,e.size=r,e.elements=c,++qr,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const n=Math.max(e,this.attributeBuffer.size*2),r=new ou(n);au(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const n=this.indexBuffer;let r=Math.max(e,n.length*1.5);r+=r%2;const s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==n.BYTES_PER_ELEMENT)for(let i=0;i<n.length;i++)s[i]=n[i];else au(n.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(e,n,r){e[n]=r+0,e[n+1]=r+1,e[n+2]=r+2,e[n+3]=r+0,e[n+4]=r+2,e[n+5]=r+3}packIndex(e,n,r,s){const i=e.indices,o=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let c=0;c<o;c++)n[r++]=s+i[c+a]-l}destroy(e={}){var n;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)uu(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&((n=this.shader)==null||n.destroy(),this.shader=null);for(let r=0;r<this._elements.length;r++)this._elements[r]&&(this._elements[r]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};qd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let g_=qd;var ct=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(ct||{});class ks extends Cn{constructor(e){let{data:n,size:r}=e;const{usage:s,label:i,shrinkToFit:o}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=Fe("buffer"),this._resourceType="buffer",this._resourceId=Fe("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,n instanceof Array&&(n=new Float32Array(n)),this._data=n,r??(r=n==null?void 0:n.byteLength);const a=!!n;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:i},this.shrinkToFit=o??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ct.STATIC)}set static(e){e?this.descriptor.usage|=ct.STATIC:this.descriptor.usage&=~ct.STATIC}setDataWithSize(e,n,r){if(this._updateID++,this._updateSize=n*e.BYTES_PER_ELEMENT,this._data===e){r&&this.emit("update",this);return}const s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=Fe("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.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 Kd(t,e){if(!(t instanceof ks)){let n=e?ct.INDEX:ct.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=ct.INDEX|ct.COPY_DST):(t=new Float32Array(t),n=ct.VERTEX|ct.COPY_DST)),t=new ks({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function __(t,e,n){const r=t.getAttribute(e);if(!r)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const s=r.buffer.data;let i=1/0,o=1/0,a=-1/0,l=-1/0;const c=s.BYTES_PER_ELEMENT,u=(r.offset||0)/c,h=(r.stride||2*4)/c;for(let f=u;f<s.length;f+=h){const d=s[f],m=s[f+1];d>a&&(a=d),m>l&&(l=m),d<i&&(i=d),m<o&&(o=m)}return n.minX=i,n.minY=o,n.maxX=a,n.maxY=l,n}function y_(t){return(t instanceof ks||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Kd(t.buffer,!1),t}class x_ extends Cn{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Fe("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new zt,this._boundsDirty=!0;const{attributes:n,indexBuffer:r,topology:s}=e;if(this.buffers=[],this.attributes={},n)for(const i in n)this.addAttribute(i,n[i]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(const e in this.attributes){const n=this.attributes[e];return n.buffer.data.length/(n.stride/4||n.size)}return 0}addAttribute(e,n){const r=y_(n);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r}addIndex(e){this.indexBuffer=Kd(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,__(this,"aPosition",this._bounds)):this._bounds}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){var n;this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(r=>r.destroy()),this.unload(),(n=this.indexBuffer)==null||n.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const b_=new Float32Array(1),v_=new Uint32Array(1);class w_ extends x_{constructor(){const n=new ks({data:b_,label:"attribute-batch-buffer",usage:ct.VERTEX|ct.COPY_DST,shrinkToFit:!1}),r=new ks({data:v_,label:"index-batch-buffer",usage:ct.INDEX|ct.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:n,format:"float32x2",stride:s,offset:0},aUV:{buffer:n,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:n,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:n,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}function hu(t,e,n){if(t)for(const r in t){const s=r.toLocaleLowerCase(),i=e[s];if(i){let o=t[r];r==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&i.push(`//----${n}----//`),i.push(o)}else _t(`${r} placement hook does not exist in shader`)}}const k_=/\{\{(.*?)\}\}/g;function du(t){var r;const e={};return(((r=t.match(k_))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function fu(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function pu(t,e,n=!1){const r=[];fu(e,r),t.forEach(a=>{a.header&&fu(a.header,r)});const s=r;n&&s.sort();const i=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
26
26
|
`);let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
27
27
|
${i}
|
|
28
|
-
`),o}function
|
|
29
|
-
`),i=n.sort().map(l=>` var ${
|
|
28
|
+
`),o}function mu(t,e){let n;const r=/@out\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function S_(t){const n=/\b(\w+)\s*:/g.exec(t);return n?n[1]:""}function T_(t){const e=/@.*?\s+/g;return t.replace(e,"")}function A_(t,e){const n=[];mu(e,n),t.forEach(l=>{l.header&&mu(l.header,n)});let r=0;const s=n.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
29
|
+
`),i=n.sort().map(l=>` var ${T_(l)};`).join(`
|
|
30
30
|
`),o=`return VSOutput(
|
|
31
|
-
${n.sort().map(l=>` ${
|
|
31
|
+
${n.sort().map(l=>` ${S_(l)}`).join(`,
|
|
32
32
|
`)});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
33
33
|
${s}
|
|
34
34
|
`),a=a.replace("{{start}}",`
|
|
35
35
|
${i}
|
|
36
36
|
`),a=a.replace("{{return}}",`
|
|
37
37
|
${o}
|
|
38
|
-
`),a}function
|
|
38
|
+
`),a}function gu(t,e){let n=t;for(const r in e){const s=e[r];s.join(`
|
|
39
39
|
`).length?n=n.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
40
40
|
${s.join(`
|
|
41
41
|
`)}
|
|
42
|
-
//----${r} FINISH----//`):n=n.replace(`{{${r}}}`,"")}return n}const
|
|
42
|
+
//----${r} FINISH----//`):n=n.replace(`{{${r}}}`,"")}return n}const kn=Object.create(null),ea=new Map;let C_=0;function E_({template:t,bits:e}){const n=Qd(t,e);if(kn[n])return kn[n];const{vertex:r,fragment:s}=P_(t,e);return kn[n]=ef(r,s,e),kn[n]}function I_({template:t,bits:e}){const n=Qd(t,e);return kn[n]||(kn[n]=ef(t.vertex,t.fragment,e)),kn[n]}function P_(t,e){const n=e.map(o=>o.vertex).filter(o=>!!o),r=e.map(o=>o.fragment).filter(o=>!!o);let s=pu(n,t.vertex,!0);s=A_(n,s);const i=pu(r,t.fragment,!0);return{vertex:s,fragment:i}}function Qd(t,e){return e.map(n=>(ea.has(n)||ea.set(n,C_++),ea.get(n))).sort((n,r)=>n-r).join("-")+t.vertex+t.fragment}function ef(t,e,n){const r=du(t),s=du(e);return n.forEach(i=>{hu(i.vertex,r,i.name),hu(i.fragment,s,i.name)}),{vertex:gu(t,r),fragment:gu(e,s)}}const M_=`
|
|
43
43
|
@in aPosition: vec2<f32>;
|
|
44
44
|
@in aUV: vec2<f32>;
|
|
45
45
|
|
|
@@ -83,7 +83,7 @@ ${s.join(`
|
|
|
83
83
|
|
|
84
84
|
{{return}}
|
|
85
85
|
};
|
|
86
|
-
`,
|
|
86
|
+
`,R_=`
|
|
87
87
|
@in vUV : vec2<f32>;
|
|
88
88
|
@in vColor : vec4<f32>;
|
|
89
89
|
|
|
@@ -106,7 +106,7 @@ ${s.join(`
|
|
|
106
106
|
|
|
107
107
|
return finalColor;
|
|
108
108
|
};
|
|
109
|
-
`,
|
|
109
|
+
`,z_=`
|
|
110
110
|
in vec2 aPosition;
|
|
111
111
|
in vec2 aUV;
|
|
112
112
|
|
|
@@ -142,7 +142,7 @@ ${s.join(`
|
|
|
142
142
|
|
|
143
143
|
{{end}}
|
|
144
144
|
}
|
|
145
|
-
`,
|
|
145
|
+
`,O_=`
|
|
146
146
|
|
|
147
147
|
in vec4 vColor;
|
|
148
148
|
in vec2 vUV;
|
|
@@ -163,7 +163,7 @@ ${s.join(`
|
|
|
163
163
|
|
|
164
164
|
{{end}}
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
`,$_={name:"global-uniforms-bit",vertex:{header:`
|
|
167
167
|
struct GlobalUniforms {
|
|
168
168
|
uProjectionMatrix:mat3x3<f32>,
|
|
169
169
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
@@ -172,22 +172,22 @@ ${s.join(`
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
175
|
-
`}},
|
|
175
|
+
`}},N_={name:"global-uniforms-bit",vertex:{header:`
|
|
176
176
|
uniform mat3 uProjectionMatrix;
|
|
177
177
|
uniform mat3 uWorldTransformMatrix;
|
|
178
178
|
uniform vec4 uWorldColorAlpha;
|
|
179
179
|
uniform vec2 uResolution;
|
|
180
|
-
`}};function
|
|
180
|
+
`}};function D_({bits:t,name:e}){const n=E_({template:{fragment:R_,vertex:M_},bits:[$_,...t]});return Ji.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function L_({bits:t,name:e}){return new Dd({name:e,...I_({template:{vertex:z_,fragment:O_},bits:[N_,...t]})})}const F_={name:"color-bit",vertex:{header:`
|
|
181
181
|
@in aColor: vec4<f32>;
|
|
182
182
|
`,main:`
|
|
183
183
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
184
|
-
`}}
|
|
184
|
+
`}},B_={name:"color-bit",vertex:{header:`
|
|
185
185
|
in vec4 aColor;
|
|
186
186
|
`,main:`
|
|
187
187
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
188
|
-
`}},
|
|
189
|
-
`)}function
|
|
190
|
-
`)}function
|
|
188
|
+
`}},ta={};function U_(t){const e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let n=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${n++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${n++}) var textureSampler${r+1}: sampler;`)}return e.join(`
|
|
189
|
+
`)}function G_(t){const e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let n=0;n<t;n++)n===t-1?e.push(" default:{"):e.push(` case ${n}:{`),e.push(` outColor = textureSampleGrad(textureSource${n+1}, textureSampler${n+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
|
|
190
|
+
`)}function Z_(t){return ta[t]||(ta[t]={name:"texture-batch-bit",vertex:{header:`
|
|
191
191
|
@in aTextureIdAndRound: vec2<u32>;
|
|
192
192
|
@out @interpolate(flat) vTextureId : u32;
|
|
193
193
|
`,main:`
|
|
@@ -200,14 +200,14 @@ ${s.join(`
|
|
|
200
200
|
`},fragment:{header:`
|
|
201
201
|
@in @interpolate(flat) vTextureId: u32;
|
|
202
202
|
|
|
203
|
-
${
|
|
203
|
+
${U_(t)}
|
|
204
204
|
`,main:`
|
|
205
205
|
var uvDx = dpdx(vUV);
|
|
206
206
|
var uvDy = dpdy(vUV);
|
|
207
207
|
|
|
208
|
-
${
|
|
209
|
-
`}}),
|
|
210
|
-
`)}function
|
|
208
|
+
${G_(t)}
|
|
209
|
+
`}}),ta[t]}const na={};function j_(t){const e=[];for(let n=0;n<t;n++)n>0&&e.push("else"),n<t-1&&e.push(`if(vTextureId < ${n}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${n}], vUV);`),e.push("}");return e.join(`
|
|
210
|
+
`)}function V_(t){return na[t]||(na[t]={name:"texture-batch-bit",vertex:{header:`
|
|
211
211
|
in vec2 aTextureIdAndRound;
|
|
212
212
|
out float vTextureId;
|
|
213
213
|
|
|
@@ -225,25 +225,25 @@ ${s.join(`
|
|
|
225
225
|
|
|
226
226
|
`,main:`
|
|
227
227
|
|
|
228
|
-
${
|
|
229
|
-
`}}),
|
|
228
|
+
${j_(t)}
|
|
229
|
+
`}}),na[t]}const H_={name:"round-pixels-bit",vertex:{header:`
|
|
230
230
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
231
231
|
{
|
|
232
232
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
233
233
|
}
|
|
234
|
-
`}},
|
|
234
|
+
`}},W_={name:"round-pixels-bit",vertex:{header:`
|
|
235
235
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
236
236
|
{
|
|
237
237
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
238
238
|
}
|
|
239
|
-
`}},mu={};function Z_(t){let e=mu[t];if(e)return e;const n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=r;return e=mu[t]=new Dd({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}class gu extends xl{constructor(e){const n=z_({name:"batch",bits:[$_,B_(e),G_]}),r=R_({name:"batch",bits:[O_,L_(e),U_]});super({glProgram:n,gpuProgram:r,resources:{batchSamplers:Z_(e)}}),this.maxTextures=e}}let qr=null;const Jd=class Kd extends h_{constructor(e){super(e),this.geometry=new __,this.name=Kd.extension.name,this.vertexSize=6,qr??(qr=new gu(e.maxTextures)),this.shader=qr}packAttributes(e,n,r,s,i){const o=i<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,{positions:m,uvs:y}=e,g=e.color,x=e.attributeOffset,b=x+e.attributeSize;for(let S=x;S<b;S++){const T=S*2,I=m[T],A=m[T+1];n[s++]=l*I+u*A+f,n[s++]=h*A+c*I+d,n[s++]=y[T],n[s++]=y[T+1],r[s++]=g,r[s++]=o}}packQuadAttributes(e,n,r,s,i){const o=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,m=e.bounds,y=m.maxX,g=m.minX,x=m.maxY,b=m.minY,S=o.uvs,T=e.color,I=i<<16|e.roundPixels&65535;n[s+0]=l*g+u*b+f,n[s+1]=h*b+c*g+d,n[s+2]=S.x0,n[s+3]=S.y0,r[s+4]=T,r[s+5]=I,n[s+6]=l*y+u*b+f,n[s+7]=h*b+c*y+d,n[s+8]=S.x1,n[s+9]=S.y1,r[s+10]=T,r[s+11]=I,n[s+12]=l*y+u*x+f,n[s+13]=h*x+c*y+d,n[s+14]=S.x2,n[s+15]=S.y2,r[s+16]=T,r[s+17]=I,n[s+18]=l*g+u*x+f,n[s+19]=h*x+c*g+d,n[s+20]=S.x3,n[s+21]=S.y3,r[s+22]=T,r[s+23]=I}_updateMaxTextures(e){this.shader.maxTextures!==e&&(qr=new gu(e),this.shader=qr)}destroy(){this.shader=null,super.destroy()}};Jd.extension={type:[ve.Batcher],name:"default"};let j_=Jd;class Ji{constructor(e){this.items=Object.create(null);const{renderer:n,type:r,onUnload:s,priority:i,name:o}=e;this._renderer=n,n.gc.addResourceHash(this,"items",r,i??0),this._onUnload=s,this.name=o}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...n){var s;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((s=this._onUnload)==null||s.call(this,e,...n),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(n=>n&&this.remove(n,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function V_(t,e,n,r,s,i,o,a=null){let l=0;n*=e,s*=i;const c=a.a,u=a.b,h=a.c,f=a.d,d=a.tx,m=a.ty;for(;l<o;){const y=t[n],g=t[n+1];r[s]=c*y+h*g+d,r[s+1]=u*y+f*g+m,s+=i,n+=e,l++}}function H_(t,e,n,r){let s=0;for(e*=n;s<r;)t[e]=0,t[e+1]=0,e+=n,s++}function Qd(t,e,n,r,s){const i=e.a,o=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;n||(n=0),r||(r=2),s||(s=t.length/r-n);let h=n*r;for(let f=0;f<s;f++){const d=t[h],m=t[h+1];t[h]=i*d+a*m+c,t[h+1]=o*d+l*m+u,h+=r}}const W_=new ae;class kl{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 e=this.baseColor,n=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?ud(n,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):n+(this.alpha*255<<24)}get transform(){var e;return((e=this.renderable)==null?void 0:e.groupTransform)||W_}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.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 ks={extension:{type:ve.ShapeBuilder,name:"circle"},build(t,e){let n,r,s,i,o,a;if(t.type==="circle"){const T=t;if(o=a=T.radius,o<=0)return!1;n=T.x,r=T.y,s=i=0}else if(t.type==="ellipse"){const T=t;if(o=T.halfWidth,a=T.halfHeight,o<=0||a<=0)return!1;n=T.x,r=T.y,s=i=0}else{const T=t,I=T.width/2,A=T.height/2;n=T.x+I,r=T.y+A,o=a=Math.max(0,Math.min(T.radius,Math.min(I,A))),s=I-o,i=A-a}if(s<0||i<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),c=l*8+(s?4:0)+(i?4:0);if(c===0)return!1;if(l===0)return e[0]=e[6]=n+s,e[1]=e[3]=r+i,e[2]=e[4]=n-s,e[5]=e[7]=r-i,!0;let u=0,h=l*4+(s?2:0)+2,f=h,d=c,m=s+o,y=i,g=n+m,x=n-m,b=r+y;if(e[u++]=g,e[u++]=b,e[--h]=b,e[--h]=x,i){const T=r-y;e[f++]=x,e[f++]=T,e[--d]=T,e[--d]=g}for(let T=1;T<l;T++){const I=Math.PI/2*(T/l),A=s+Math.cos(I)*o,E=i+Math.sin(I)*a,Z=n+A,Y=n-A,$=r+E,F=r-E;e[u++]=Z,e[u++]=$,e[--h]=$,e[--h]=Y,e[f++]=Y,e[f++]=F,e[--d]=F,e[--d]=Z}m=s,y=i+a,g=n+m,x=n-m,b=r+y;const S=r-y;return e[u++]=g,e[u++]=b,e[--d]=S,e[--d]=g,s&&(e[u++]=x,e[u++]=b,e[--d]=S,e[--d]=x),!0},triangulate(t,e,n,r,s,i){if(t.length===0)return;let o=0,a=0;for(let u=0;u<t.length;u+=2)o+=t[u],a+=t[u+1];o/=t.length/2,a/=t.length/2;let l=r;e[l*n]=o,e[l*n+1]=a;const c=l++;for(let u=0;u<t.length;u+=2)e[l*n]=t[u],e[l*n+1]=t[u+1],u>0&&(s[i++]=l,s[i++]=c,s[i++]=l-1),l++;s[i++]=c+1,s[i++]=c,s[i++]=l-1}},Y_={...ks,extension:{...ks.extension,name:"ellipse"}},X_={...ks,extension:{...ks.extension,name:"roundedRectangle"}},ef=1e-4,_u=1e-4;function q_(t){const e=t.length;if(e<6)return 1;let n=0;for(let r=0,s=t[e-2],i=t[e-1];r<e;r+=2){const o=t[r],a=t[r+1];n+=(o-s)*(a+i),s=o,i=a}return n<0?-1:1}function yu(t,e,n,r,s,i,o,a){const l=t-n*s,c=e-r*s,u=t+n*i,h=e+r*i;let f,d;o?(f=r,d=-n):(f=-r,d=n);const m=l+f,y=c+d,g=u+f,x=h+d;return a.push(m,y),a.push(g,x),2}function Ln(t,e,n,r,s,i,o,a){const l=n-t,c=r-e;let u=Math.atan2(l,c),h=Math.atan2(s-t,i-e);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let f=u;const d=h-u,m=Math.abs(d),y=Math.sqrt(l*l+c*c),g=(15*m*Math.sqrt(y)/Math.PI>>0)+1,x=d/g;if(f+=x,a){o.push(t,e),o.push(n,r);for(let b=1,S=f;b<g;b++,S+=x)o.push(t,e),o.push(t+Math.sin(S)*y,e+Math.cos(S)*y);o.push(t,e),o.push(s,i)}else{o.push(n,r),o.push(t,e);for(let b=1,S=f;b<g;b++,S+=x)o.push(t+Math.sin(S)*y,e+Math.cos(S)*y),o.push(t,e);o.push(s,i),o.push(t,e)}return g*2}function J_(t,e,n,r,s,i){const o=ef;if(t.length===0)return;const a=e;let l=a.alignment;if(e.alignment!==.5){let ce=q_(t);l=(l-.5)*ce+.5}const c=new et(t[0],t[1]),u=new et(t[t.length-2],t[t.length-1]),h=r,f=Math.abs(c.x-u.x)<o&&Math.abs(c.y-u.y)<o;if(h){t=t.slice(),f&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));const ce=(c.x+u.x)*.5,Nt=(u.y+c.y)*.5;t.unshift(ce,Nt),t.push(ce,Nt)}const d=s,m=t.length/2;let y=t.length;const g=d.length/2,x=a.width/2,b=x*x,S=a.miterLimit*a.miterLimit;let T=t[0],I=t[1],A=t[2],E=t[3],Z=0,Y=0,$=-(I-E),F=T-A,se=0,ke=0,Se=Math.sqrt($*$+F*F);$/=Se,F/=Se,$*=x,F*=x;const Tt=l,L=(1-Tt)*2,V=Tt*2;h||(a.cap==="round"?y+=Ln(T-$*(L-V)*.5,I-F*(L-V)*.5,T-$*L,I-F*L,T+$*V,I+F*V,d,!0)+2:a.cap==="square"&&(y+=yu(T,I,$,F,L,V,!0,d))),d.push(T-$*L,I-F*L),d.push(T+$*V,I+F*V);for(let ce=1;ce<m-1;++ce){T=t[(ce-1)*2],I=t[(ce-1)*2+1],A=t[ce*2],E=t[ce*2+1],Z=t[(ce+1)*2],Y=t[(ce+1)*2+1],$=-(I-E),F=T-A,Se=Math.sqrt($*$+F*F),$/=Se,F/=Se,$*=x,F*=x,se=-(E-Y),ke=A-Z,Se=Math.sqrt(se*se+ke*ke),se/=Se,ke/=Se,se*=x,ke*=x;const Nt=A-T,ye=I-E,Pn=A-Z,Mn=Y-E,Vs=Nt*Pn+ye*Mn,nr=ye*Pn-Mn*Nt,Rn=nr<0;if(Math.abs(nr)<.001*Math.abs(Vs)){d.push(A-$*L,E-F*L),d.push(A+$*V,E+F*V),Vs>=0&&(a.join==="round"?y+=Ln(A,E,A-$*L,E-F*L,A-se*L,E-ke*L,d,!1)+4:y+=2,d.push(A-se*V,E-ke*V),d.push(A+se*L,E+ke*L));continue}const Hs=(-$+T)*(-F+E)-(-$+A)*(-F+I),Lr=(-se+Z)*(-ke+E)-(-se+A)*(-ke+Y),rr=(Nt*Lr-Pn*Hs)/nr,zn=(Mn*Hs-ye*Lr)/nr,we=(rr-A)*(rr-A)+(zn-E)*(zn-E),Dt=A+(rr-A)*L,fe=E+(zn-E)*L,Lt=A-(rr-A)*V,pe=E-(zn-E)*V,On=Math.min(Nt*Nt+ye*ye,Pn*Pn+Mn*Mn),Fr=Rn?L:V,Ft=On+Fr*Fr*b;we<=Ft?a.join==="bevel"||we/b>S?(Rn?(d.push(Dt,fe),d.push(A+$*V,E+F*V),d.push(Dt,fe),d.push(A+se*V,E+ke*V)):(d.push(A-$*L,E-F*L),d.push(Lt,pe),d.push(A-se*L,E-ke*L),d.push(Lt,pe)),y+=2):a.join==="round"?Rn?(d.push(Dt,fe),d.push(A+$*V,E+F*V),y+=Ln(A,E,A+$*V,E+F*V,A+se*V,E+ke*V,d,!0)+4,d.push(Dt,fe),d.push(A+se*V,E+ke*V)):(d.push(A-$*L,E-F*L),d.push(Lt,pe),y+=Ln(A,E,A-$*L,E-F*L,A-se*L,E-ke*L,d,!1)+4,d.push(A-se*L,E-ke*L),d.push(Lt,pe)):(d.push(Dt,fe),d.push(Lt,pe)):(d.push(A-$*L,E-F*L),d.push(A+$*V,E+F*V),a.join==="round"?Rn?y+=Ln(A,E,A+$*V,E+F*V,A+se*V,E+ke*V,d,!0)+2:y+=Ln(A,E,A-$*L,E-F*L,A-se*L,E-ke*L,d,!1)+2:a.join==="miter"&&we/b<=S&&(Rn?(d.push(Lt,pe),d.push(Lt,pe)):(d.push(Dt,fe),d.push(Dt,fe)),y+=2),d.push(A-se*L,E-ke*L),d.push(A+se*V,E+ke*V),y+=2)}T=t[(m-2)*2],I=t[(m-2)*2+1],A=t[(m-1)*2],E=t[(m-1)*2+1],$=-(I-E),F=T-A,Se=Math.sqrt($*$+F*F),$/=Se,F/=Se,$*=x,F*=x,d.push(A-$*L,E-F*L),d.push(A+$*V,E+F*V),h||(a.cap==="round"?y+=Ln(A-$*(L-V)*.5,E-F*(L-V)*.5,A-$*L,E-F*L,A+$*V,E+F*V,d,!1)+2:a.cap==="square"&&(y+=yu(A,E,$,F,L,V,!1,d)));const In=_u*_u;for(let ce=g;ce<y+g-2;++ce)T=d[ce*2],I=d[ce*2+1],A=d[(ce+1)*2],E=d[(ce+1)*2+1],Z=d[(ce+2)*2],Y=d[(ce+2)*2+1],!(Math.abs(T*(E-Y)+A*(Y-I)+Z*(I-E))<In)&&i.push(ce,ce+1,ce+2)}function K_(t,e,n,r){const s=ef;if(t.length===0)return;const i=t[0],o=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(i-a)<s&&Math.abs(o-l)<s,u=n,h=t.length/2,f=u.length/2;for(let d=0;d<h;d++)u.push(t[d*2]),u.push(t[d*2+1]);for(let d=0;d<h-1;d++)r.push(f+d,f+d+1);c&&r.push(f+h-1,f)}function tf(t,e,n,r,s,i,o){const a=Wg(t,e,2);if(!a)return;for(let c=0;c<a.length;c+=3)i[o++]=a[c]+s,i[o++]=a[c+1]+s,i[o++]=a[c+2]+s;let l=s*r;for(let c=0;c<t.length;c+=2)n[l]=t[c],n[l+1]=t[c+1],l+=r}const Q_=[],ey={extension:{type:ve.ShapeBuilder,name:"polygon"},build(t,e){for(let n=0;n<t.points.length;n++)e[n]=t.points[n];return!0},triangulate(t,e,n,r,s,i){tf(t,Q_,e,n,r,s,i)}},ty={extension:{type:ve.ShapeBuilder,name:"rectangle"},build(t,e){const n=t,r=n.x,s=n.y,i=n.width,o=n.height;return i>0&&o>0?(e[0]=r,e[1]=s,e[2]=r+i,e[3]=s,e[4]=r+i,e[5]=s+o,e[6]=r,e[7]=s+o,!0):!1},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[6],e[r+o+1]=t[7],o+=n,e[r+o]=t[4],e[r+o+1]=t[5],o+=n;const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2,s[i++]=a+1,s[i++]=a+3,s[i++]=a+2}},ny={extension:{type:ve.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[4],e[r+o+1]=t[5];const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2}},xu=[{offset:0,color:"white"},{offset:1,color:"black"}],Sl=class Fa{constructor(...e){this.uid=Fe("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=ry(e);n={...n.type==="radial"?Fa.defaultRadialOptions:Fa.defaultLinearOptions,...Qh(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,n.type==="radial"?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,n){return this.colorStops.push({offset:e,color:an.shared.setValue(n).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:n}=this.start,{x:r,y:s}=this.end,i=r-e,o=s-n;const a=i<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(i<0){const g=e;e=r,r=g,i*=-1}if(o<0){const g=n;n=s,s=g,o*=-1}}const l=this.colorStops.length?this.colorStops:xu,c=this._textureSize,{canvas:u,context:h}=vu(c,1),f=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);bu(f,l),h.fillStyle=f,h.fillRect(0,0,c,1),this.texture=new be({source:new ki({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(i*i+o*o),m=Math.atan2(o,i),y=new ae;y.scale(d/c,1),y.rotate(m),y.translate(e,n),this.textureSpace==="local"&&y.scale(c,c),this.transform=y}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:xu,n=this._textureSize,{canvas:r,context:s}=vu(n,n),{x:i,y:o}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,f=l-u,d=n/(u*2),m=(i-h)*d,y=(o-f)*d,g=s.createRadialGradient(m,y,c*d,(a-h)*d,(l-f)*d,u*d);bu(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,n,n),s.fillStyle=g,s.translate(m,y),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-y),s.fillRect(0,0,n,n),this.texture=new be({source:new ki({resource:r,addressMode:this._wrapMode})});const x=new ae;this.textureSpace==="local"?x.scale(2*u,2*u):x.scale(1/d,1/d),x.translate(h,f),this.transform=x}destroy(){var e;(e=this.texture)==null||e.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}`}};Sl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Gs=Sl;function bu(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function vu(t,e){const n=Us.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}function ry(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(Ae("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??Gs.defaultLinearOptions.textureSize}),e}const sy=new ae,iy=new Ve;function oy(t,e,n,r){const s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const o=n.getBounds(iy);e.width&&o.pad(e.width);const{x:a,y:l}=o,c=1/o.width,u=1/o.height,h=-a*c,f=-l*u,d=s.a,m=s.b,y=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*d+f*y+s.tx,s.ty=h*m+f*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);const i=e.texture.source.style;return!(e.fill instanceof Gs)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),r&&s.append(sy.copyFrom(r).invert()),s}const Ki={};yt.handleByMap(ve.ShapeBuilder,Ki);yt.add(ty,ey,ny,ks,Y_,X_);const ay=new Ve,ly=new ae;function cy(t,e){const{geometryData:n,batches:r}=e;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let s=0;s<t.instructions.length;s++){const i=t.instructions[s];if(i.action==="texture")uy(i.data,r,n);else if(i.action==="fill"||i.action==="stroke"){const o=i.action==="stroke",a=i.data.path.shapePath,l=i.data.style,c=i.data.hole;o&&c&&wu(c.shapePath,l,!0,r,n),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),wu(a,l,o,r,n)}}}function uy(t,e,n){const r=[],s=Ki.rectangle,i=ay;i.x=t.dx,i.y=t.dy,i.width=t.dw,i.height=t.dh;const o=t.transform;if(!s.build(i,r))return;const{vertices:a,uvs:l,indices:c}=n,u=c.length,h=a.length/2;o&&Qd(r,o),s.triangulate(r,a,2,h,c,u);const f=t.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const m=ht.get(kl);m.indexOffset=u,m.indexSize=c.length-u,m.attributeOffset=h,m.attributeSize=a.length/2-h,m.baseColor=t.style,m.alpha=t.alpha,m.texture=f,m.geometryData=n,e.push(m)}function wu(t,e,n,r,s){const{vertices:i,uvs:o,indices:a}=s;t.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{const h=[],f=Ki[l.type];if(!f.build(l,h))return;const d=a.length,m=i.length/2;let y="triangle-list";if(c&&Qd(h,c),n){const S=l.closePath??!0,T=e;T.pixelLine?(K_(h,S,i,a),y="line-list"):J_(h,T,!1,S,i,a)}else if(u){const S=[],T=h.slice();hy(u).forEach(A=>{S.push(T.length/2),T.push(...A)}),tf(T,S,i,2,m,a,d)}else f.triangulate(h,i,2,m,a,d);const g=o.length/2,x=e.texture;if(x!==be.WHITE){const S=oy(ly,e,l,c);V_(i,2,m,o,g,2,i.length/2-m,S)}else H_(o,g,2,i.length/2-m);const b=ht.get(kl);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=m,b.attributeSize=i.length/2-m,b.baseColor=e.color,b.alpha=e.alpha,b.texture=x,b.geometryData=s,b.topology=y,r.push(b)})}function hy(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,s=[];Ki[r.type].build(r,s)&&e.push(s)}return e}class dy{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{ht.return(e)}),this.graphicsData&&ht.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 fy{constructor(){this.instructions=new _l}init(e){const n=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(n):this.batcher=new j_({maxTextures:n}),this.instructions.reset()}get geometry(){return Ae(pm,"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 Tl=class Ba{constructor(e){this._renderer=e,this._managedContexts=new Ji({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Ba.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Ba.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!n){n&&r.reset(),cy(e,r);const s=e.batchMode;e.customShader||s==="no-batch"?r.isBatchable=!1:s==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=ht.get(fy,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:s,geometryData:i}=r;r.graphicsData=n;const o=i.vertices.length,a=i.indices.length;for(let h=0;h<s.length;h++)s[h].applyTransform=!1;const l=n.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let h=0;h<s.length;h++){const f=s[h];l.add(f)}l.finish(n.instructions);const c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let h=0;h<u.length;h++){const f=u[h];f.bindGroup=n_(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return n}_initContext(e){const n=new dy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Tl.extension={type:[ve.WebGLSystem,ve.WebGPUSystem],name:"graphicsContext"};Tl.defaultOptions={bezierSmoothness:.5};let Al=Tl;const py=8,hi=11920929e-14,my=1;function nf(t,e,n,r,s,i,o,a,l,c){const h=Math.min(.99,Math.max(0,c??Al.defaultOptions.bezierSmoothness));let f=(my-h)/1;return f*=f,gy(e,n,r,s,i,o,a,l,t,f),t}function gy(t,e,n,r,s,i,o,a,l,c){Ua(t,e,n,r,s,i,o,a,l,c,0),l.push(o,a)}function Ua(t,e,n,r,s,i,o,a,l,c,u){if(u>py)return;const h=(t+n)/2,f=(e+r)/2,d=(n+s)/2,m=(r+i)/2,y=(s+o)/2,g=(i+a)/2,x=(h+d)/2,b=(f+m)/2,S=(d+y)/2,T=(m+g)/2,I=(x+S)/2,A=(b+T)/2;if(u>0){let E=o-t,Z=a-e;const Y=Math.abs((n-o)*Z-(r-a)*E),$=Math.abs((s-o)*Z-(i-a)*E);if(Y>hi&&$>hi){if((Y+$)*(Y+$)<=c*(E*E+Z*Z)){l.push(I,A);return}}else if(Y>hi){if(Y*Y<=c*(E*E+Z*Z)){l.push(I,A);return}}else if($>hi){if($*$<=c*(E*E+Z*Z)){l.push(I,A);return}}else if(E=I-(t+o)/2,Z=A-(e+a)/2,E*E+Z*Z<=c){l.push(I,A);return}}Ua(t,e,h,f,x,b,I,A,l,c,u+1),Ua(I,A,S,T,y,g,o,a,l,c,u+1)}const _y=8,yy=11920929e-14,xy=1;function by(t,e,n,r,s,i,o,a){const c=Math.min(.99,Math.max(0,a??Al.defaultOptions.bezierSmoothness));let u=(xy-c)/1;return u*=u,vy(e,n,r,s,i,o,t,u),t}function vy(t,e,n,r,s,i,o,a){Ga(o,t,e,n,r,s,i,a,0),o.push(s,i)}function Ga(t,e,n,r,s,i,o,a,l){if(l>_y)return;const c=(e+r)/2,u=(n+s)/2,h=(r+i)/2,f=(s+o)/2,d=(c+h)/2,m=(u+f)/2;let y=i-e,g=o-n;const x=Math.abs((r-i)*g-(s-o)*y);if(x>yy){if(x*x<=a*(y*y+g*g)){t.push(d,m);return}}else if(y=d-(e+i)/2,g=m-(n+o)/2,y*y+g*g<=a){t.push(d,m);return}Ga(t,e,n,c,u,d,m,a,l+1),Ga(t,d,m,h,f,i,o,a,l+1)}function rf(t,e,n,r,s,i,o,a){let l=Math.abs(s-i);(!o&&s>i||o&&i>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=o?-1:1;for(let h=0;h<a+1;h++){const f=Math.cos(u),d=Math.sin(u),m=e+f*r,y=n+d*r;t.push(m,y),u+=c}}function wy(t,e,n,r,s,i){const o=t[t.length-2],l=t[t.length-1]-n,c=o-e,u=s-n,h=r-e,f=Math.abs(l*h-c*u);if(f<1e-8||i===0){(t[t.length-2]!==e||t[t.length-1]!==n)&&t.push(e,n);return}const d=l*l+c*c,m=u*u+h*h,y=l*u+c*h,g=i*Math.sqrt(d)/f,x=i*Math.sqrt(m)/f,b=g*y/d,S=x*y/m,T=g*h+x*c,I=g*u+x*l,A=c*(x+b),E=l*(x+b),Z=h*(g+S),Y=u*(g+S),$=Math.atan2(E-I,A-T),F=Math.atan2(Y-I,Z-T);rf(t,T+e,I+n,i,$,F,c*u>h*l)}const ps=Math.PI*2,na={centerX:0,centerY:0,ang1:0,ang2:0},ra=({x:t,y:e},n,r,s,i,o,a,l)=>{t*=n,e*=r;const c=s*t-i*e,u=i*t+s*e;return l.x=c+o,l.y=u+a,l};function ky(t,e){const n=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:n,s=Math.cos(t),i=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:s-i*r,y:i+s*r},{x:o+a*r,y:a-o*r},{x:o,y:a}]}const ku=(t,e,n,r)=>{const s=t*r-e*n<0?-1:1;let i=t*n+e*r;return i>1&&(i=1),i<-1&&(i=-1),s*Math.acos(i)},Sy=(t,e,n,r,s,i,o,a,l,c,u,h,f)=>{const d=Math.pow(s,2),m=Math.pow(i,2),y=Math.pow(u,2),g=Math.pow(h,2);let x=d*m-d*g-m*y;x<0&&(x=0),x/=d*g+m*y,x=Math.sqrt(x)*(o===a?-1:1);const b=x*s/i*h,S=x*-i/s*u,T=c*b-l*S+(t+n)/2,I=l*b+c*S+(e+r)/2,A=(u-b)/s,E=(h-S)/i,Z=(-u-b)/s,Y=(-h-S)/i,$=ku(1,0,A,E);let F=ku(A,E,Z,Y);a===0&&F>0&&(F-=ps),a===1&&F<0&&(F+=ps),f.centerX=T,f.centerY=I,f.ang1=$,f.ang2=F};function Ty(t,e,n,r,s,i,o,a=0,l=0,c=0){if(i===0||o===0)return;const u=Math.sin(a*ps/360),h=Math.cos(a*ps/360),f=h*(e-r)/2+u*(n-s)/2,d=-u*(e-r)/2+h*(n-s)/2;if(f===0&&d===0)return;i=Math.abs(i),o=Math.abs(o);const m=Math.pow(f,2)/Math.pow(i,2)+Math.pow(d,2)/Math.pow(o,2);m>1&&(i*=Math.sqrt(m),o*=Math.sqrt(m)),Sy(e,n,r,s,i,o,l,c,u,h,f,d,na);let{ang1:y,ang2:g}=na;const{centerX:x,centerY:b}=na;let S=Math.abs(g)/(ps/4);Math.abs(1-S)<1e-7&&(S=1);const T=Math.max(Math.ceil(S),1);g/=T;let I=t[t.length-2],A=t[t.length-1];const E={x:0,y:0};for(let Z=0;Z<T;Z++){const Y=ky(y,g),{x:$,y:F}=ra(Y[0],i,o,h,u,x,b,E),{x:se,y:ke}=ra(Y[1],i,o,h,u,x,b,E),{x:Se,y:Tt}=ra(Y[2],i,o,h,u,x,b,E);nf(t,I,A,$,F,se,ke,Se,Tt),I=Se,A=Tt,y+=g}}function Ay(t,e,n){const r=(o,a)=>{const l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c),h=l/u,f=c/u;return{len:u,nx:h,ny:f}},s=(o,a)=>{o===0?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)};let i=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??n;if(l<=0){s(o,a),i=a;continue}const c=e[(o+1)%e.length],u=r(a,i),h=r(a,c);if(u.len<1e-4||h.len<1e-4){s(o,a),i=a;continue}let f=Math.asin(u.nx*h.ny-u.ny*h.nx),d=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=!0):f>0&&(d=-1,m=!0);const y=f/2;let g,x=Math.abs(Math.cos(y)*l/Math.sin(y));x>Math.min(u.len/2,h.len/2)?(x=Math.min(u.len/2,h.len/2),g=Math.abs(x*Math.sin(y)/Math.cos(y))):g=l;const b=a.x+h.nx*x+-h.ny*g*d,S=a.y+h.ny*x+h.nx*g*d,T=Math.atan2(u.ny,u.nx)+Math.PI/2*d,I=Math.atan2(h.ny,h.nx)-Math.PI/2*d;o===0&&t.moveTo(b+Math.cos(T)*g,S+Math.sin(T)*g),t.arc(b,S,g,T,I,m),i=a}}function Cy(t,e,n,r){const s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),i=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],c=l.radius??n;if(c<=0){a===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const u=e[a],h=e[(a+2)%o],f=s(u,l);let d;if(f<1e-4)d=l;else{const g=Math.min(f/2,c);d=i(l,u,g/f)}const m=s(h,l);let y;if(m<1e-4)y=l;else{const g=Math.min(m/2,c);y=i(l,h,g/m)}a===0?t.moveTo(d.x,d.y):t.lineTo(d.x,d.y),t.quadraticCurveTo(l.x,l.y,y.x,y.y,r)}}const Ey=new Ve;class Iy{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new zt,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,n){return this.startPoly(e,n),this}lineTo(e,n){this._ensurePoly();const r=this._currentPoly.points,s=r[r.length-2],i=r[r.length-1];return(s!==e||i!==n)&&r.push(e,n),this}arc(e,n,r,s,i,o){this._ensurePoly(!1);const a=this._currentPoly.points;return rf(a,e,n,r,s,i,o),this}arcTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly.points;return wy(o,e,n,r,s,i),this}arcToSvg(e,n,r,s,i,o,a){const l=this._currentPoly.points;return Ty(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,e,n,r,s,i),this}bezierCurveTo(e,n,r,s,i,o,a){this._ensurePoly();const l=this._currentPoly;return nf(this._currentPoly.points,l.lastX,l.lastY,e,n,r,s,i,o,a),this}quadraticCurveTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly;return by(this._currentPoly.points,o.lastX,o.lastY,e,n,r,s,i),this}closePath(){return this.endPoly(!0),this}addPath(e,n){this.endPoly(),n&&!n.isIdentity()&&(e=e.clone(!0),e.transform(n));const r=this.shapePrimitives,s=r.length;for(let i=0;i<e.instructions.length;i++){const o=e.instructions[i];this[o.action](...o.data)}if(e.checkForHoles&&r.length-s>1){let i=null;for(let o=s;o<r.length;o++){const a=r[o];if(a.shape.type==="polygon"){const l=a.shape,c=i==null?void 0:i.shape;c&&c.containsPolygon(l)?(i.holes||(i.holes=[]),i.holes.push(a),r.copyWithin(o,o+1),r.length--,o--):i=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,n,r,s,i){return this.drawShape(new Ve(e,n,r,s),i),this}circle(e,n,r,s){return this.drawShape(new bl(e,n,r),s),this}poly(e,n,r){const s=new ds(e);return s.closePath=n,this.drawShape(s,r),this}regularPoly(e,n,r,s,i=0,o){s=Math.max(s|0,3);const a=-1*Math.PI/2+i,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){const h=a-u*l;c.push(e+r*Math.cos(h),n+r*Math.sin(h))}return this.poly(c,!0,o),this}roundPoly(e,n,r,s,i,o=0,a){if(s=Math.max(s|0,3),i<=0)return this.regularPoly(e,n,r,s,o);const l=r*Math.sin(Math.PI/s)-.001;i=Math.min(i,l);const c=-1*Math.PI/2+o,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){const d=f*u+c,m=e+r*Math.cos(d),y=n+r*Math.sin(d),g=d+Math.PI+h,x=d-Math.PI-h,b=m+i*Math.cos(g),S=y+i*Math.sin(g),T=m+i*Math.cos(x),I=y+i*Math.sin(x);f===0?this.moveTo(b,S):this.lineTo(b,S),this.quadraticCurveTo(m,y,T,I,a)}return this.closePath()}roundShape(e,n,r=!1,s){return e.length<3?this:(r?Cy(this,e,n,s):Ay(this,e,n),this.closePath())}filletRect(e,n,r,s,i){if(i===0)return this.rect(e,n,r,s);const o=Math.min(r,s)/2,a=Math.min(o,Math.max(-o,i)),l=e+r,c=n+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,n+h).arcTo(e+u,n+u,e+h,n,h).lineTo(l-h,n).arcTo(l-u,n+u,l,n+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+r-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,n,r,s,i,o){if(i<=0)return this.rect(e,n,r,s);const a=Math.min(i,Math.min(r,s)/2),l=e+r,c=n+s,u=[e+a,n,l-a,n,l,n+a,l,c-a,l-a,c,e+a,c,e,c-a,e,n+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,o)}ellipse(e,n,r,s,i){return this.drawShape(new vl(e,n,r,s),i),this}roundRect(e,n,r,s,i,o){return this.drawShape(new wl(e,n,r,s,i),o),this}drawShape(e,n){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:n}),this}startPoly(e,n){let r=this._currentPoly;return r&&this.endPoly(),r=new ds,r.points.push(e,n),this._currentPoly=r,this}endPoly(e=!1){const n=this._currentPoly;return n&&n.points.length>2&&(n.closePath=e,this.shapePrimitives.push({shape:n})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new ds,e)){const n=this.shapePrimitives[this.shapePrimitives.length-1];if(n){let r=n.shape.x,s=n.shape.y;if(n.transform&&!n.transform.isIdentity()){const i=n.transform,o=r;r=i.a*r+i.c*s+i.tx,s=i.b*o+i.d*s+i.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let n=0;n<e.instructions.length;n++){const r=e.instructions[n];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const n=this.shapePrimitives;for(let r=0;r<n.length;r++){const s=n[r],i=s.shape.getBounds(Ey);s.transform?e.addRect(i,s.transform):e.addRect(i)}return e}}class sn{constructor(e,n=!1){this.instructions=[],this.uid=Fe("graphicsPath"),this._dirty=!0,this.checkForHoles=n,typeof e=="string"?Kg(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new Iy(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,n){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,n]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,n,r,s,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(et.shared);let l=0,c=0;if(!o||o.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=o.data[2],c=o.data[3];const u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,n,r,s,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,n,r){const s=this.instructions[this.instructions.length-1],i=this.getLastPoint(et.shared);let o=0,a=0;if(!s||s.action!=="quadraticCurveTo")o=i.x,a=i.y;else{o=s.data[0],a=s.data[1];const l=i.x,c=i.y;o=l+(l-o),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,e,n,r]}),this._dirty=!0,this}rect(e,n,r,s,i){return this.instructions.push({action:"rect",data:[e,n,r,s,i]}),this._dirty=!0,this}circle(e,n,r,s){return this.instructions.push({action:"circle",data:[e,n,r,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,n,r,s,i,o,a){i||(i=s/2);const l=-1*Math.PI/2+o,c=r*2,u=Math.PI*2/c,h=[];for(let f=0;f<c;f++){const d=f%2?i:s,m=f*u+l;h.push(e+d*Math.cos(m),n+d*Math.sin(m))}return this.poly(h,!0,a),this}clone(e=!1){const n=new sn;if(n.checkForHoles=this.checkForHoles,!e)n.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const s=this.instructions[r];n.instructions.push({action:s.action,data:s.data.slice()})}return n}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const n=e.a,r=e.b,s=e.c,i=e.d,o=e.tx,a=e.ty;let l=0,c=0,u=0,h=0,f=0,d=0,m=0,y=0;for(let g=0;g<this.instructions.length;g++){const x=this.instructions[g],b=x.data;switch(x.action){case"moveTo":case"lineTo":l=b[0],c=b[1],b[0]=n*l+s*c+o,b[1]=r*l+i*c+a;break;case"bezierCurveTo":u=b[0],h=b[1],f=b[2],d=b[3],l=b[4],c=b[5],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*f+s*d+o,b[3]=r*f+i*d+a,b[4]=n*l+s*c+o,b[5]=r*l+i*c+a;break;case"quadraticCurveTo":u=b[0],h=b[1],l=b[2],c=b[3],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*l+s*c+o,b[3]=r*l+i*c+a;break;case"arcToSvg":l=b[5],c=b[6],m=b[0],y=b[1],b[0]=n*m+s*y,b[1]=r*m+i*y,b[5]=n*l+s*c+o,b[6]=r*l+i*c+a;break;case"circle":b[4]=hr(b[3],e);break;case"rect":b[4]=hr(b[4],e);break;case"ellipse":b[8]=hr(b[8],e);break;case"roundRect":b[5]=hr(b[5],e);break;case"addPath":b[0].transform(e);break;case"poly":b[2]=hr(b[2],e);break;case"regularPoly":case"chamferRect":b[5]=hr(b[5],e);break;case"closePath":break;default:_t("unknown transform action",x.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let n=this.instructions.length-1,r=this.instructions[n];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(n--,n<0)return e.x=0,e.y=0,e;r=this.instructions[n]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}function hr(t,e){return t?t.prepend(e):e.clone()}function ze(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function Py(t,e){const n=t.querySelectorAll("defs");for(let r=0;r<n.length;r++){const s=n[r];for(let i=0;i<s.children.length;i++){const o=s.children[i];switch(o.nodeName.toLowerCase()){case"lineargradient":e.defs[o.id]=My(o);break;case"radialgradient":e.defs[o.id]=Ry();break}}}}function My(t){const e=ze(t,"x1",0),n=ze(t,"y1",0),r=ze(t,"x2",1),s=ze(t,"y2",0),i=t.getAttribute("gradientUnits")||"objectBoundingBox",o=new Gs(e,n,r,s,i==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){const l=t.children[a],c=ze(l,"offset",0),u=an.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(c,u)}return o}function Ry(t){return _t("[SVG Parser] Radial gradients are not yet supported"),new Gs(0,0,1,0)}function Su(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Tu={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 sf(t,e){const n=t.getAttribute("style"),r={},s={},i={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(const o in Tu){const a=t.getAttribute(o);a&&Au(e,i,o,a.trim())}if(n){const o=n.split(";");for(let a=0;a<o.length;a++){const l=o[a].trim(),[c,u]=l.split(":");Tu[c]&&Au(e,i,c,u.trim())}}return{strokeStyle:i.useStroke?r:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function Au(t,e,n,r){switch(n){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const s=Su(r);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=an.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const s=Su(r);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=an.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r);break}}function zy(t){if(t.length<=2)return!0;const e=t.map(a=>a.area).sort((a,l)=>l-a),[n,r]=e,s=e[e.length-1],i=n/r,o=r/s;return!(i>3&&o<2)}function Oy(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function $y(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const n=e.map(Number),r=[],s=[];for(let u=0;u<n.length;u+=2)u+1<n.length&&(r.push(n[u]),s.push(n[u+1]));if(r.length===0||s.length===0)return 0;const i=Math.min(...r),o=Math.max(...r),a=Math.min(...s),l=Math.max(...s);return(o-i)*(l-a)}function Cu(t,e){const n=new sn(t,!1);for(const r of n.instructions)e.instructions.push(r)}function Ny(t,e){if(typeof t=="string"){const o=document.createElement("div");o.innerHTML=t.trim(),t=o.querySelector("svg")}const n={context:e,defs:{},path:new sn};Py(t,n);const r=t.children,{fillStyle:s,strokeStyle:i}=sf(t,n);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&of(a,n,s,i)}return e}function of(t,e,n,r){const s=t.children,{fillStyle:i,strokeStyle:o}=sf(t,e);i&&n?n={...n,...i}:i&&(n=i),o&&r?r={...r,...o}:o&&(r=o);const a=!n&&!r;a&&(n={color:0});let l,c,u,h,f,d,m,y,g,x,b,S,T,I,A,E,Z;switch(t.nodeName.toLowerCase()){case"path":{I=t.getAttribute("d");const Y=t.getAttribute("fill-rule"),$=Oy(I),F=Y==="evenodd",se=$.length>1;if(F&&se){const Se=$.map(L=>({path:L,area:$y(L)}));if(Se.sort((L,V)=>V.area-L.area),$.length>3||!zy(Se))for(let L=0;L<Se.length;L++){const V=Se[L],In=L===0;e.context.beginPath();const ce=new sn(void 0,!0);Cu(V.path,ce),e.context.path(ce),In?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let L=0;L<Se.length;L++){const V=Se[L],In=L%2===1;e.context.beginPath();const ce=new sn(void 0,!0);Cu(V.path,ce),e.context.path(ce),In?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{const Se=Y?Y==="evenodd":!0;A=new sn(I,Se),e.context.path(A),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=ze(t,"cx",0),y=ze(t,"cy",0),g=ze(t,"r",0),e.context.ellipse(m,y,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=ze(t,"x",0),c=ze(t,"y",0),E=ze(t,"width",0),Z=ze(t,"height",0),x=ze(t,"rx",0),b=ze(t,"ry",0),x||b?e.context.roundRect(l,c,E,Z,x||b):e.context.rect(l,c,E,Z),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=ze(t,"cx",0),y=ze(t,"cy",0),x=ze(t,"rx",0),b=ze(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,x,b),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"line":u=ze(t,"x1",0),h=ze(t,"y1",0),f=ze(t,"x2",0),d=ze(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(f,d),r&&e.context.stroke(r);break;case"polygon":T=t.getAttribute("points"),S=T.match(/-?\d+/g).map(Y=>parseInt(Y,10)),e.context.poly(S,!0),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"polyline":T=t.getAttribute("points"),S=T.match(/-?\d+/g).map(Y=>parseInt(Y,10)),e.context.poly(S,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{_t(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(n=null);for(let Y=0;Y<s.length;Y++)of(s[Y],e,n,r)}function Dy(t){return t.texture!==void 0}const Eu={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 Ly{constructor(e,n){this.uid=Fe("fillPattern"),this._tick=0,this.transform=new ae;const r=Dy(e)?e:{texture:e,repetition:n};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const s=r.repetition;s&&(this.texture.source.style.addressModeU=Eu[s].addressModeU,this.texture.source.style.addressModeV=Eu[s].addressModeV)}setTransform(e){if(e){if(this.transform.equals(e))return;this.transform.copyFrom(e)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function Fy(t){return an.isColorLike(t)}function Iu(t){return t instanceof Ly}function Pu(t){return t instanceof Gs}function By(t){return t instanceof be}function Uy(t,e,n){const r=an.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?n.alpha:r.alpha,t.texture=be.WHITE,{...n,...t}}function Gy(t,e,n){return t.texture=e,{...n,...t}}function Mu(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function Ru(t,e,n){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function Zy(t,e){const n={...e,...t},r=an.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function is(t,e){if(t==null)return null;const n={},r=t;return Fy(t)?Uy(n,t,e):By(t)?Gy(n,t,e):Iu(t)?Mu(n,t,e):Pu(t)?Ru(n,t,e):r.fill&&Iu(r.fill)?Mu(r,r.fill,e):r.fill&&Pu(r.fill)?Ru(r,r.fill,e):Zy(r,e)}function zu(t,e){const{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...l}=e,c=is(t,l);return c?{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...c}:null}function jy(t,e){let n=1;const r=t.shapePath.shapePrimitives;for(let s=0;s<r.length;s++){const i=r[s].shape;if(i.type!=="polygon")continue;const o=i.points,a=o.length;if(a<6)continue;const l=i.closePath;for(let c=0;c<a;c+=2){if(!l&&(c===0||c===a-2))continue;const u=(c-2+a)%a,h=(c+2)%a,f=o[u],d=o[u+1],m=o[c],y=o[c+1],g=o[h],x=o[h+1],b=f-m,S=d-y,T=g-m,I=x-y,A=b*b+S*S,E=T*T+I*I;if(A<1e-12||E<1e-12)continue;let $=(b*T+S*I)/Math.sqrt(A*E);$<-1?$=-1:$>1&&($=1);const F=Math.sqrt((1-$)*.5);if(F<1e-6)continue;const se=Math.min(1/F,e);se>n&&(n=se)}}return n}const Vy=new et,Ou=new ae,Cl=class jt extends An{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Fe("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new sn,this._transform=new ae,this._fillStyle={...jt.defaultFillStyle},this._strokeStyle={...jt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new zt,this._boundsDirty=!0}clone(){const e=new jt;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=is(e,jt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=zu(e,jt.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=is(e,jt.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=is(e,jt.defaultStrokeStyle),this}texture(e,n,r,s,i,o){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:s||0,dw:i||e.frame.width,dh:o||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:n||n===0?an.shared.setValue(n).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new sn,this}fill(e,n){let r;const s=this.instructions[this.instructions.length-1];return this._tick===0&&(s==null?void 0:s.action)==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(e!=null&&(n!==void 0&&typeof e=="number"&&(Ae(Qe,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=is(e,jt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:n}=this._activePath.getLastPoint(et.shared);this._activePath.clear(),this._activePath.moveTo(e,n)}stroke(e){let n;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?n=r.data.path:n=this._activePath.clone(),n?(e!=null&&(this._strokeStyle=zu(e,jt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const n=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(n&&(n.action==="stroke"||n.action==="fill"))if(n.data.hole)n.data.hole.addPath(r);else{n.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,n,r,s,i,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*e+a.c*n+a.tx,a.b*e+a.d*n+a.ty,r,s,i,o),this}arcTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}arcToSvg(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(e,n,r,s,i,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*n+l.tx,l.b*e+l.d*n+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*i+l.c*o+l.tx,l.b*i+l.d*o+l.ty,a),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,n,r,s){return this._tick++,this._activePath.ellipse(e,n,r,s,this._transform.clone()),this}circle(e,n,r){return this._tick++,this._activePath.circle(e,n,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,n){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*n+r.tx,r.b*e+r.d*n+r.ty),this}moveTo(e,n){this._tick++;const r=this._transform,s=this._activePath.instructions,i=r.a*e+r.c*n+r.tx,o=r.b*e+r.d*n+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=i,s[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}rect(e,n,r,s){return this._tick++,this._activePath.rect(e,n,r,s,this._transform.clone()),this}roundRect(e,n,r,s,i){return this._tick++,this._activePath.roundRect(e,n,r,s,i,this._transform.clone()),this}poly(e,n){return this._tick++,this._activePath.poly(e,n,this._transform.clone()),this}regularPoly(e,n,r,s,i=0,o){return this._tick++,this._activePath.regularPoly(e,n,r,s,i,o),this}roundPoly(e,n,r,s,i,o){return this._tick++,this._activePath.roundPoly(e,n,r,s,i,o),this}roundShape(e,n,r,s){return this._tick++,this._activePath.roundShape(e,n,r,s),this}filletRect(e,n,r,s,i){return this._tick++,this._activePath.filletRect(e,n,r,s,i),this}chamferRect(e,n,r,s,i,o){return this._tick++,this._activePath.chamferRect(e,n,r,s,i,o),this}star(e,n,r,s,i=0,o=0){return this._tick++,this._activePath.star(e,n,r,s,i,o,this._transform.clone()),this}svg(e){return this._tick++,Ny(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,n=e){return this._transform.scale(e,n),this}setTransform(e,n,r,s,i,o){return e instanceof ae?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,n,r,s,i,o),this)}transform(e,n,r,s,i,o){return e instanceof ae?(this._transform.append(e),this):(Ou.set(e,n,r,s,i,o),this._transform.append(Ou),this)}translate(e,n=e){return this._transform.translate(e,n),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 e=this._bounds;e.clear();for(let n=0;n<this.instructions.length;n++){const r=this.instructions[n],s=r.action;if(s==="fill"){const i=r.data;e.addBounds(i.path.bounds)}else if(s==="texture"){const i=r.data;e.addFrame(i.dx,i.dy,i.dx+i.dw,i.dy+i.dh,i.transform)}if(s==="stroke"){const i=r.data,o=i.style.alignment;let a=i.style.width*(1-o);i.style.join==="miter"&&(a*=jy(i.path,i.style.miterLimit));const l=i.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){var s;if(!this.bounds.containsPoint(e.x,e.y))return!1;const n=this.instructions;let r=!1;for(let i=0;i<n.length;i++){const o=n[i],a=o.data,l=a.path;if(!o.action||!l)continue;const c=a.style,u=l.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const f=u[h].shape;if(!c||!f)continue;const d=u[h].transform,m=d?d.applyInverse(e,Vy):e;if(o.action==="fill")r=f.contains(m.x,m.y);else{const g=c;r=f.strokeContains(m.x,m.y,g.width,g.alignment)}const y=a.hole;if(y){const g=(s=y.shapePath)==null?void 0:s.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(m.x,m.y)&&(r=!1)}if(r)return!0}}return r}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!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 e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Cl.defaultFillStyle={color:16777215,alpha:1,texture:be.WHITE,matrix:null,fill:null,textureSpace:"local"};Cl.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:be.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Jr=Cl;class Hy{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Wy{constructor(){this.instructions=new _l}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const El=class Za{constructor(e){this._renderer=e,this._managedContexts=new Ji({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Za.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Za.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=e._gpuData,r=!!n[this._renderer.uid],s=n[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&s.reset(),s.isBatchable=!1,e.dirty=!1),s}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=new Wy,r=this.getGpuContext(e);return r.graphicsData=n,n.init(),n}_initContext(e){const n=new Hy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};El.extension={type:[ve.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};let Yy=El;class af{constructor(e,n){this.state=Fd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ji({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,n){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(n),n.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}af.extension={type:[ve.CanvasPipes],name:"graphics"};function Xy(t,e,n){const r=(t>>24&255)/255;e[n++]=(t&255)/255*r,e[n++]=(t>>8&255)/255*r,e[n++]=(t>>16&255)/255*r,e[n++]=r}class qy{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ht.return(e)}),this.batches.length=0}}class lf{constructor(e,n){this.state=Fd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ji({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const n=e.context,r=!!e._gpuData,i=this.renderer.graphicsContext.updateGpuContext(n);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(e,n){const s=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),s.isBatchable?this._addToBatcher(e,n):(this.renderer.renderPipes.batch.break(n),n.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let s=0;s<r.length;s++){const i=r[s];i._batcher.updateElement(i)}}execute(e){if(!e.isRenderable)return;const n=this.renderer,r=e.context;if(!n.graphicsContext.getGpuContext(r).batches.length)return;const i=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const o=i.resources.localUniforms.uniforms;o.uTransformMatrix=e.groupTransform,o.uRound=n._roundPixels|e._roundPixels,Xy(e.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const n=this._getGpuDataForRenderable(e),s=this.renderer.graphicsContext.updateGpuContext(e.context);n.destroy(),s.isBatchable&&this._updateBatchesForRenderable(e,n)}_addToBatcher(e,n){const r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(e).batches;for(let i=0;i<s.length;i++){const o=s[i];r.addToBatch(o,n)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const n=new qy;return e._gpuData[this.renderer.uid]=n,this._managedGraphics.add(e),n}_updateBatchesForRenderable(e,n){const r=e.context,i=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|e._roundPixels;n.batches=i.batches.map(a=>{const l=ht.get(kl);return a.copyTo(l),l.renderable=e,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}lf.extension={type:[ve.WebGLPipes,ve.WebGPUPipes],name:"graphics"};yt.add(af);yt.add(lf);yt.add(Yy);yt.add(Al);class Ci extends md{constructor(e){e instanceof Jr&&(e={context:e});const{context:n,roundPixels:r,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",n?this.context=n:(this.context=this._ownedContext=new Jr,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,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(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||(e==null?void 0:e.context)===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,n){return this.context[e](...n),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Ci(this._context.clone()):(this._ownedContext=null,new Ci(this._context))}lineStyle(e,n,r){Ae(Qe,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const s={};return e&&(s.width=e),n&&(s.color=n),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(e,n){Ae(Qe,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return e!==void 0&&(r.color=e),n!==void 0&&(r.alpha=n),this.context.fillStyle=r,this}endFill(){Ae(Qe,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return(e.width!==Jr.defaultStrokeStyle.width||e.color!==Jr.defaultStrokeStyle.color||e.alpha!==Jr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Ae(Qe,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Ae(Qe,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Ae(Qe,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Ae(Qe,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Ae(Qe,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Ae(Qe,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}yt.add(sm,im);const Jy={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 Ky(t){return{...Jy,...t}}var he;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(he||(he={}));var $u;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})($u||($u={}));const D=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gn=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}},P=he.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ln extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof ln))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,he.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ln.create=t=>new ln(t);const ja=(t,e)=>{let n;switch(t.code){case P.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case P.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,he.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:n=`Unrecognized key(s) in object: ${he.joinValues(t.keys,", ")}`;break;case P.invalid_union:n="Invalid input";break;case P.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${he.joinValues(t.options)}`;break;case P.invalid_enum_value:n=`Invalid enum value. Expected ${he.joinValues(t.options)}, received '${t.received}'`;break;case P.invalid_arguments:n="Invalid function arguments";break;case P.invalid_return_type:n="Invalid function return type";break;case P.invalid_date:n="Invalid date";break;case P.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:he.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case P.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case P.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case P.custom:n="Invalid input";break;case P.invalid_intersection_types:n="Intersection results could not be merged";break;case P.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case P.not_finite:n="Number must be finite";break;default:n=e.defaultError,he.assertNever(t)}return{message:n}};let Qy=ja;function ex(){return Qy}const tx=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function N(t,e){const n=ex(),r=tx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ja?void 0:ja].filter(s=>!!s)});t.common.issues.push(r)}class at{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return X;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return at.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return X;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const X=Object.freeze({status:"aborted"}),os=t=>({status:"dirty",value:t}),kt=t=>({status:"valid",value:t}),Nu=t=>t.status==="aborted",Du=t=>t.status==="dirty",Ir=t=>t.status==="valid",Ei=t=>typeof Promise<"u"&&t instanceof Promise;var U;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(U||(U={}));class Wt{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lu=(t,e)=>{if(Ir(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ln(t.common.issues);return this._error=n,this._error}}};function K(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let re=class{get description(){return this._def.description}_getType(e){return gn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:gn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:gn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ei(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gn(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Lu(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gn(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Ir(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ir(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ei(s)?s:Promise.resolve(s));return Lu(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:P.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Jn({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return on.create(this,this._def)}nullable(){return Kn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return $i.create(this,this._def)}or(e){return Ri.create([this,e],this._def)}and(e){return zi.create(this,e,this._def)}transform(e){return new Jn({...K(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ni({...K(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new ff({typeName:q.ZodBranded,type:this,...K(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Di({...K(this._def),innerType:this,catchValue:n,typeName:q.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Il.create(this,e)}readonly(){return Li.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const nx=/^c[^\s-]{8,}$/i,rx=/^[0-9a-z]+$/,sx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ix=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ox=/^[a-z0-9_-]{21}$/i,ax=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ux="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sa;const hx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,fx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,px=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",_x=new RegExp(`^${cf}$`);function uf(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function yx(t){return new RegExp(`^${uf(t)}$`)}function xx(t){let e=`${cf}T${uf(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function bx(t,e){return!!((e==="v4"||!e)&&hx.test(t)||(e==="v6"||!e)&&fx.test(t))}function vx(t,e){if(!ax.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function wx(t,e){return!!((e==="v4"||!e)&&dx.test(t)||(e==="v6"||!e)&&px.test(t))}let Ii=class as extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.string,received:i.parsedType}),X}const r=new at;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?N(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")cx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")sa||(sa=new RegExp(ux,"u")),sa.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ix.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")ox.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"nanoid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")nx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")rx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")sx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:P.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"regex",code:P.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?xx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?_x.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?yx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?lx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"duration",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?bx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?vx(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"jwt",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?wx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cidr",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?mx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?gx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64url",code:P.invalid_string,message:i.message}),r.dirty()):he.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:P.invalid_string,...U.errToObj(r)})}_addCheck(e){return new as({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...U.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...U.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...U.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...U.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...U.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...U.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...U.errToObj(n)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new as({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new as({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new as({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ii.create=t=>new Ii({checks:[],typeName:q.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...K(t)});function kx(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let Va=class Ha extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.number,received:i.parsedType}),X}let r;const s=new at;for(const i of this._def.checks)i.kind==="int"?he.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:P.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?kx(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_finite,message:i.message}),s.dirty()):he.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new Ha({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new Ha({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&he.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Va.create=t=>new Va({checks:[],typeName:q.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...K(t)});class Ss extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r;const s=new at;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):he.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:D.bigint,received:n.parsedType}),X}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new Ss({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new Ss({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ss.create=t=>new Ss({checks:[],typeName:q.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...K(t)});let Wa=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.boolean,received:r.parsedType}),X}return kt(e.data)}};Wa.create=t=>new Wa({typeName:q.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...K(t)});class Pi extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.date,received:i.parsedType}),X}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_date}),X}const r=new at;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):he.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pi({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Pi.create=t=>new Pi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:q.ZodDate,...K(t)});class Fu extends re{_parse(e){if(this._getType(e)!==D.symbol){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.symbol,received:r.parsedType}),X}return kt(e.data)}}Fu.create=t=>new Fu({typeName:q.ZodSymbol,...K(t)});class Ya extends re{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.undefined,received:r.parsedType}),X}return kt(e.data)}}Ya.create=t=>new Ya({typeName:q.ZodUndefined,...K(t)});class Mi extends re{_parse(e){if(this._getType(e)!==D.null){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.null,received:r.parsedType}),X}return kt(e.data)}}Mi.create=t=>new Mi({typeName:q.ZodNull,...K(t)});let Bu=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return kt(e.data)}};Bu.create=t=>new Bu({typeName:q.ZodAny,...K(t)});let Xa=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return kt(e.data)}};Xa.create=t=>new Xa({typeName:q.ZodUnknown,...K(t)});let Tn=class extends re{_parse(e){const n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:D.never,received:n.parsedType}),X}};Tn.create=t=>new Tn({typeName:q.ZodNever,...K(t)});class Uu extends re{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.void,received:r.parsedType}),X}return kt(e.data)}}Uu.create=t=>new Uu({typeName:q.ZodVoid,...K(t)});let Pr=class wi extends re{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==D.array)return N(n,{code:P.invalid_type,expected:D.array,received:n.parsedType}),X;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(N(n,{code:o?P.too_big:P.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(N(n,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(N(n,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Wt(n,o,n.path,a)))).then(o=>at.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Wt(n,o,n.path,a)));return at.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new wi({...this._def,minLength:{value:e,message:U.toString(n)}})}max(e,n){return new wi({...this._def,maxLength:{value:e,message:U.toString(n)}})}length(e,n){return new wi({...this._def,exactLength:{value:e,message:U.toString(n)}})}nonempty(e){return this.min(1,e)}};Pr.create=(t,e)=>new Pr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...K(e)});function mr(t){if(t instanceof cn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=on.create(mr(r))}return new cn({...t._def,shape:()=>e})}else return t instanceof Pr?new Pr({...t._def,type:mr(t.element)}):t instanceof on?on.create(mr(t.unwrap())):t instanceof Kn?Kn.create(mr(t.unwrap())):t instanceof qn?qn.create(t.items.map(e=>mr(e))):t}let cn=class It extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=he.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){const c=this._getOrReturnCtx(e);return N(c,{code:P.invalid_type,expected:D.object,received:c.parsedType}),X}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Tn&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],h=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Wt(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Tn){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(N(s,{code:P.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const h=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Wt(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const h=await u.key,f=await u.value;c.push({key:h,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>at.mergeObjectSync(r,c)):at.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new It({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:U.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new It({...this._def,unknownKeys:"strip"})}passthrough(){return new It({...this._def,unknownKeys:"passthrough"})}extend(e){return new It({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new It({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new It({...this._def,catchall:e})}pick(e){const n={};for(const r of he.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new It({...this._def,shape:()=>n})}omit(e){const n={};for(const r of he.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new It({...this._def,shape:()=>n})}deepPartial(){return mr(this)}partial(e){const n={};for(const r of he.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new It({...this._def,shape:()=>n})}required(e){const n={};for(const r of he.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof on;)i=i._def.innerType;n[r]=i}return new It({...this._def,shape:()=>n})}keyof(){return df(he.objectKeys(this.shape))}};cn.create=(t,e)=>new cn({shape:()=>t,unknownKeys:"strip",catchall:Tn.create(),typeName:q.ZodObject,...K(e)});cn.strictCreate=(t,e)=>new cn({shape:()=>t,unknownKeys:"strict",catchall:Tn.create(),typeName:q.ZodObject,...K(e)});cn.lazycreate=(t,e)=>new cn({shape:t,unknownKeys:"strip",catchall:Tn.create(),typeName:q.ZodObject,...K(e)});let Ri=class extends re{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new ln(a.ctx.common.issues));return N(n,{code:P.invalid_union,unionErrors:o}),X}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new ln(l));return N(n,{code:P.invalid_union,unionErrors:a}),X}}get options(){return this._def.options}};Ri.create=(t,e)=>new Ri({options:t,typeName:q.ZodUnion,...K(e)});const Kt=t=>t instanceof Ka?Kt(t.schema):t instanceof Jn?Kt(t.innerType()):t instanceof Oi?[t.value]:t instanceof Qi?t.options:t instanceof el?he.objectValues(t.enum):t instanceof Ni?Kt(t._def.innerType):t instanceof Ya?[void 0]:t instanceof Mi?[null]:t instanceof on?[void 0,...Kt(t.unwrap())]:t instanceof Kn?[null,...Kt(t.unwrap())]:t instanceof ff||t instanceof Li?Kt(t.unwrap()):t instanceof Di?Kt(t._def.innerType):[];let Sx=class hf extends re{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return N(n,{code:P.invalid_type,expected:D.object,received:n.parsedType}),X;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=Kt(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new hf({typeName:q.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...K(r)})}};function qa(t,e){const n=gn(t),r=gn(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){const s=he.objectKeys(e),i=he.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=qa(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=qa(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let zi=class extends re{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Nu(i)||Nu(o))return X;const a=qa(i.value,o.value);return a.valid?((Du(i)||Du(o))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:P.invalid_intersection_types}),X)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};zi.create=(t,e,n)=>new zi({left:t,right:e,typeName:q.ZodIntersection,...K(n)});class qn extends re{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return N(r,{code:P.invalid_type,expected:D.array,received:r.parsedType}),X;if(r.data.length<this._def.items.length)return N(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Wt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>at.mergeArray(n,o)):at.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new qn({...this._def,rest:e})}}qn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qn({items:t,typeName:q.ZodTuple,rest:null,...K(e)})};let Tx=class Ja extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return N(r,{code:P.invalid_type,expected:D.object,received:r.parsedType}),X;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Wt(r,a,r.path,a)),value:o._parse(new Wt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?at.mergeObjectAsync(n,s):at.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof re?new Ja({keyType:e,valueType:n,typeName:q.ZodRecord,...K(r)}):new Ja({keyType:Ii.create(),valueType:e,typeName:q.ZodRecord,...K(n)})}};class Gu extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return N(r,{code:P.invalid_type,expected:D.map,received:r.parsedType}),X;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Wt(r,a,r.path,[c,"key"])),value:i._parse(new Wt(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return X;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return X;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Gu.create=(t,e,n)=>new Gu({valueType:e,keyType:t,typeName:q.ZodMap,...K(n)});class Ts extends re{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return N(r,{code:P.invalid_type,expected:D.set,received:r.parsedType}),X;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(N(r,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(N(r,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return X;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Wt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Ts({...this._def,minSize:{value:e,message:U.toString(n)}})}max(e,n){return new Ts({...this._def,maxSize:{value:e,message:U.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Ts.create=(t,e)=>new Ts({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...K(e)});let Ka=class extends re{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ka.create=(t,e)=>new Ka({getter:t,typeName:q.ZodLazy,...K(e)});let Oi=class extends re{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return N(n,{received:n.data,code:P.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}};Oi.create=(t,e)=>new Oi({value:t,typeName:q.ZodLiteral,...K(e)});function df(t,e){return new Qi({values:t,typeName:q.ZodEnum,...K(e)})}let Qi=class Qa extends re{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return N(n,{expected:he.joinValues(r),received:n.parsedType,code:P.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return N(n,{received:n.data,code:P.invalid_enum_value,options:r}),X}return kt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Qa.create(e,{...this._def,...n})}exclude(e,n=this._def){return Qa.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Qi.create=df;class el extends re{_parse(e){const n=he.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){const s=he.objectValues(n);return N(r,{expected:he.joinValues(s),received:r.parsedType,code:P.invalid_type}),X}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=he.objectValues(n);return N(r,{received:r.data,code:P.invalid_enum_value,options:s}),X}return kt(e.data)}get enum(){return this._def.values}}el.create=(t,e)=>new el({values:t,typeName:q.ZodNativeEnum,...K(e)});class $i extends re{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return N(n,{code:P.invalid_type,expected:D.promise,received:n.parsedType}),X;const r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return kt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}$i.create=(t,e)=>new $i({type:t,typeName:q.ZodPromise,...K(e)});class Jn extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{N(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return X;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?X:l.status==="dirty"||n.value==="dirty"?os(l.value):l});{if(n.value==="aborted")return X;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?X:a.status==="dirty"||n.value==="dirty"?os(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ir(o))return X;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ir(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):X);he.assertNever(s)}}Jn.create=(t,e,n)=>new Jn({schema:t,typeName:q.ZodEffects,effect:e,...K(n)});Jn.createWithPreprocess=(t,e,n)=>new Jn({schema:e,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...K(n)});let on=class extends re{_parse(e){return this._getType(e)===D.undefined?kt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};on.create=(t,e)=>new on({innerType:t,typeName:q.ZodOptional,...K(e)});let Kn=class extends re{_parse(e){return this._getType(e)===D.null?kt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Kn.create=(t,e)=>new Kn({innerType:t,typeName:q.ZodNullable,...K(e)});let Ni=class extends re{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ni.create=(t,e)=>new Ni({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});let Di=class extends re{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ei(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ln(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ln(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Di.create=(t,e)=>new Di({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});class Zu extends re{_parse(e){if(this._getType(e)!==D.nan){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.nan,received:r.parsedType}),X}return{status:"valid",value:e.data}}}Zu.create=t=>new Zu({typeName:q.ZodNaN,...K(t)});class ff extends re{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Il extends re{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?X:i.status==="dirty"?(n.dirty(),os(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?X:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Il({in:e,out:n,typeName:q.ZodPipeline})}}let Li=class extends re{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ir(s)&&(s.value=Object.freeze(s.value)),s);return Ei(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Li.create=(t,e)=>new Li({innerType:t,typeName:q.ZodReadonly,...K(e)});var q;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(q||(q={}));const H=Ii.create,j=Va.create,gt=Wa.create,tl=Mi.create,Pl=Xa.create;Tn.create;const Fi=Pr.create,ee=cn.create,Mr=Ri.create,Ax=Sx.create;zi.create;qn.create;const Rt=Tx.create,ge=Oi.create,lt=Qi.create;$i.create;on.create;Kn.create;const tt=H().trim().min(1),Or=H().trim().min(1),eo=j().finite().positive(),Ml=ee({status:lt(["available","sold"]),soldToPlayerId:tt.optional(),soldAt:Or.optional()});ee({id:tt,spaceId:tt,type:lt(["book","music","coffee"]),name:tt,description:H(),priceUsd:eo,createdAt:Or,sale:Ml});ee({id:tt,spaceId:tt,row:Mr([ge(1),ge(2),ge(3),ge(4)]),column:Mr([ge(1),ge(2),ge(3),ge(4),ge(5)]),name:tt,description:H(),priceUsd:eo,createdAt:Or,sale:Ml});const Cx=H().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color");ee({id:tt,spaceId:tt,slot:Mr([ge(1),ge(2),ge(3),ge(4),ge(5),ge(6),ge(7),ge(8),ge(9)]),name:tt,model:tt,year:j().int().min(1900).max(3e3),priceUsd:eo,colorHex:Cx,createdAt:Or,sale:Ml});ee({playerId:tt,balanceUsd:j().finite().nonnegative(),currency:ge("USD"),updatedAt:Or,powerUps:j().int().nonnegative().default(0)});const Ex=ee({id:tt,playerId:tt,spaceId:tt,amenityKind:lt(["shop","supermarket","car_wash","talk_time","wallet_bundle","apu_credit","apu_debit"]),itemRef:ee({kind:lt(["shop","supermarket","carwash","game","apu","talk","bundle"]),id:tt}),priceUsd:eo.optional(),at:Or,detail:H().optional(),powerUpsSpent:j().int().positive().optional(),powerUpsEarned:j().int().positive().optional(),powerUpsDelta:j().int().optional(),debitSource:H().optional(),creditSource:H().optional(),counterpartyNodeId:H().optional(),token:ge("APU").optional()}),Ix=new Set(["hidden-gems","map-recall","price-check","signal-hunt","delivery-dash","lease-locker","talk-timer","daily-rotator"]),Px=t=>Ix.has(t),Mx=Ax("type",[ee({type:ge("chest_open"),correct:gt(),tutorial:gt().optional()}),ee({type:ge("sequence_step"),correct:gt(),tutorial:gt().optional()}),ee({type:ge("price_guess"),correct:gt(),round:j().int().min(1)}),ee({type:ge("signal_pick"),correct:gt()}),ee({type:ge("delivery_finish"),band:lt(["fast","ok","slow"]),hits:j().int().min(0)}),ee({type:ge("door_pick"),correct:gt()}),ee({type:ge("talk_release"),success:gt(),round:j().int().min(1).max(3)})]);ee({gameId:H().refine(Px,"invalid gameId"),roundId:H().min(1),events:Fi(Mx).min(1)});const Rx=ee({plays:j().int().min(0),bestNetPu:j().int()});ee({dayStreak:j().int().min(0),bestStreak:j().int().min(0),puEarnedToday:j().int().min(0),puCapRemaining:j().int().min(0),gamesPlayedToday:j().int().min(0),featuredGameId:H(),firstGamePlayed:gt(),perGame:Rt(H(),Rx)});const kn=H().trim().min(1),Yt=H().trim().min(1),zx=lt(["purchase","redeemWalletBundle","applyGameOutcome","talkTick","talkStop","talkStart","walletSeeded"]),Ox=Ex.extend({hostId:kn,indexedAt:Yt,op:zx,blockRev:j().int().nonnegative().optional(),merkleRootHex:H().optional()});ee({rev:j().int().nonnegative(),merkleRootHex:H(),merkleLeafCount:j().int().nonnegative(),at:Yt,occupantCount:j().int().nonnegative().optional(),leafDeltaCount:j().int().nonnegative().optional(),label:H().optional()});const pf=lt(["pending","running","completed","failed"]);ee({status:pf,cursor:H(),totalIndexed:j().int().nonnegative(),startedAt:Yt,completedAt:Yt.optional(),error:H().optional()});ee({playerId:kn,balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),updatedAt:Yt});ee({generatedAt:Yt,hostId:kn,snapshotRev:j().int().nonnegative(),merkleRootHex:H().nullable(),merkleLeafCount:j().int().nonnegative().nullable(),sid:H().nullable(),txsLast24h:j().int().nonnegative(),apuMintedLast24h:j().int().nonnegative(),apuBurnedLast24h:j().int().nonnegative(),migrationStatus:pf});const $x=lt(["main","agent","unknown"]),Nx=ee({balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),currency:ge("USD"),updatedAt:Yt}),Dx=ee({txCount:j().int().nonnegative(),usdSpent:j().finite().nonnegative(),apuMinted:j().int().nonnegative(),apuBurned:j().int().nonnegative(),lastTxAt:Yt.nullable()}),Lx=ee({byAmenityKind:Rt(H(),j().int().nonnegative()),bySpaceId:Rt(H(),j().int().nonnegative()),byToken:ee({usd:j().finite().nonnegative(),apu:j().int().nonnegative()})}),Fx=ee({eventsLast24h:j().int().nonnegative(),topEvents:Fi(ee({event:kn,count:j().int().nonnegative()}))});ee({nodeId:kn,kind:$x,generatedAt:Yt,wallet:Nx.nullable(),ledger:Dx,breakdown:Lx,txs:Fi(Ox),txsNextCursor:H().nullable(),gameStats:ee({dayStreak:j().int().min(0),bestStreak:j().int().min(0),puEarnedToday:j().int().min(0),puCapRemaining:j().int().min(0),gamesPlayedToday:j().int().min(0),featuredGameId:H(),firstGamePlayed:gt(),perGame:Rt(H(),ee({plays:j().int().min(0),bestNetPu:j().int()}))}).nullable(),analyticsEvents:Fi(ee({messageId:kn,event:kn,distinctId:kn,timestamp:Yt,properties:Rt(Mr([H(),j(),gt(),tl()]))})),analyticsEventsNextCursor:H().nullable(),analytics:Fx,traits:Rt(Mr([H(),j(),gt(),tl()]))});const ms=H().trim().min(1),Bi=H().trim().min(1),mf=Mr([H(),j(),gt(),tl()]),Bx=ee({hostId:ms,sid:H().optional(),snapshotRev:j().int().nonnegative().optional(),library:lt(["agent-play-server","agent-play-client"])});ee({messageId:ms,event:ms,distinctId:ms,timestamp:Bi,properties:Rt(mf),context:Bx.optional()});ee({distinctId:ms,traits:Rt(mf),timestamp:Bi});const Ux=lt(["pending","running","completed","failed"]);ee({status:Ux,cursor:H(),totalIndexed:j().int().nonnegative(),startedAt:Bi,completedAt:Bi.optional(),error:H().optional()});function Gx(){return["park","new_york","tokyo"]}const Zx="agent-play-preview-view-settings-v2",jx="agent-play-deep-logs",Vx=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function Hx(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Wx(){if(typeof window>"u")return!1;const t=window.location.hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function gf(t){const e=t.trim().toLowerCase();if(e==="on"||e==="true"||e==="1")return!0;if(e==="off"||e==="false"||e==="0")return!1}function Yx(){if(typeof window>"u")return;const e=new URL(window.location.href).searchParams.get("deepLogs");if(e!==null)return gf(e)}function Xx(){if(typeof localStorage>"u")return;const t=localStorage.getItem(jx);if(!(t===null||t.length===0))return gf(t)}function qx(){const t=Yx();return t!==void 0?t:Xx()}function _f(t){return t==="default"||t==="ember"||t==="forest"}function yf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function xf(t){return Vx.includes(t)}function xr(){return{themeId:"park",showChatUi:!0,debugMode:Hx(),debugOccupancyQuartiles:!1,debugOccupancyFreeGrids:!1,worldGeographyEnabled:!1,joystickEnabled:!0,stationaryPanels:!1,p2aEnabled:!1,deepLogsEnabled:Wx(),profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function bf(t){return Gx().includes(t)}function Jx(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.themeId=="string"&&bf(n.themeId)&&(r.themeId=n.themeId),typeof n.showChatUi=="boolean"&&(r.showChatUi=n.showChatUi),typeof n.debugMode=="boolean"&&(r.debugMode=n.debugMode),typeof n.debugOccupancyQuartiles=="boolean"&&(r.debugOccupancyQuartiles=n.debugOccupancyQuartiles),typeof n.debugOccupancyFreeGrids=="boolean"&&(r.debugOccupancyFreeGrids=n.debugOccupancyFreeGrids),typeof n.worldGeographyEnabled=="boolean"&&(r.worldGeographyEnabled=n.worldGeographyEnabled),typeof n.joystickEnabled=="boolean"&&(r.joystickEnabled=n.joystickEnabled),typeof n.stationaryPanels=="boolean"&&(r.stationaryPanels=n.stationaryPanels),typeof n.p2aEnabled=="boolean"&&(r.p2aEnabled=n.p2aEnabled),typeof n.deepLogsEnabled=="boolean"&&(r.deepLogsEnabled=n.deepLogsEnabled),typeof n.profileAvatarPresetId=="string"&&_f(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&yf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&xf(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let ju=xr();function Kx(t){const e=bf(t.themeId)?t.themeId:xr().themeId,n=_f(t.profileAvatarPresetId)?t.profileAvatarPresetId:xr().profileAvatarPresetId,r=yf(t.profileGender)?t.profileGender:xr().profileGender,s=xf(t.language)?t.language:xr().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,debugOccupancyQuartiles:t.debugOccupancyQuartiles,debugOccupancyFreeGrids:t.debugOccupancyFreeGrids,worldGeographyEnabled:t.worldGeographyEnabled,joystickEnabled:t.joystickEnabled,stationaryPanels:t.stationaryPanels,p2aEnabled:t.p2aEnabled,deepLogsEnabled:t.deepLogsEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function Qx(){const t=Jx(typeof localStorage<"u"?localStorage.getItem(Zx):null),e={...xr(),...t},n=qx();return ju=Kx({...e,...n!==void 0?{deepLogsEnabled:n}:{}}),{...ju}}typeof localStorage<"u"&&Qx();var eb=/^[a-z][a-z0-9-]*$/;function tb(t){const e=t.trim(),n=e.indexOf("://");if(n<=0)throw new Error("invalid intercom-address");const r=e.slice(0,n).trim().toLowerCase(),s=e.slice(n+3).trim();if(!eb.test(r)||!r.endsWith("-intercom"))throw new Error("invalid intercom-address");if(s.length===0)throw new Error("invalid intercom-address");return{protocol:r,value:s}}function nb(t){return tb(t).value}var Le=H().trim().min(1),Rl=H().trim().transform(t=>(nb(t),t)),rb=ee({requestId:Le,mainNodeId:Le,fromPlayerId:Le,toPlayerId:Le,kind:lt(["assist","chat","realtime"]),toolName:H().optional(),args:Rt(H(),Pl()).optional(),text:H().optional(),intercomAddress:Rl.optional()}).superRefine((t,e)=>{t.kind==="assist"&&(t.toolName??"").trim().length===0&&e.addIssue({code:P.custom,path:["toolName"],message:"toolName is required for assist"}),t.kind==="chat"&&(t.text??"").trim().length===0&&e.addIssue({code:P.custom,path:["text"],message:"text is required for chat"})});ee({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:lt(["assist","chat","realtime"]),status:lt(["started","stream","completed","failed","forwarded"]),toolName:H().optional(),message:H().optional(),result:Rt(H(),Pl()).optional(),error:H().nullable().optional(),ts:Le,channelKey:H().optional(),intercomAddress:Rl.optional(),command:rb.optional()});ee({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:lt(["assist","chat","realtime"]),status:lt(["stream","completed","failed"]),toolName:H().optional(),message:H().optional(),result:Rt(H(),Pl()).optional(),error:H().nullable().optional(),ts:Le,intercomAddress:Rl.optional()}).superRefine((t,e)=>{t.status==="failed"&&(t.error??"").trim().length===0&&e.addIssue({code:P.custom,path:["error"],message:"error is required when status is failed"})});ee({consent:ge(!0),nodeId:Le,passwHash:Le}).strict();ee({requestId:Le,mainNodeId:Le,fromPlayerId:Le,message:Le}).strict();new TextEncoder;/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Vu(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function sb(t){if(Array.isArray(t))return t}function ib(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){c=!0,s=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}function ob(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
240
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ab(t,e){return sb(t)||ib(t,e)||lb(t,e)||ob()}function lb(t,e){if(t){if(typeof t=="string")return Vu(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vu(t,e):void 0}}const vf=Object.entries,Hu=Object.setPrototypeOf,cb=Object.isFrozen,ub=Object.getPrototypeOf,hb=Object.getOwnPropertyDescriptor;let Ye=Object.freeze,Xe=Object.seal,gr=Object.create,wf=typeof Reflect<"u"&&Reflect,nl=wf.apply,rl=wf.construct;Ye||(Ye=function(e){return e});Xe||(Xe=function(e){return e});nl||(nl=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});rl||(rl=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});const Kr=Be(Array.prototype.forEach),db=Be(Array.prototype.lastIndexOf),Wu=Be(Array.prototype.pop),dr=Be(Array.prototype.push),fb=Be(Array.prototype.splice),_n=Array.isArray,ls=Be(String.prototype.toLowerCase),ia=Be(String.prototype.toString),Yu=Be(String.prototype.match),Qr=Be(String.prototype.replace),Xu=Be(String.prototype.indexOf),pb=Be(String.prototype.trim),mb=Be(Number.prototype.toString),gb=Be(Boolean.prototype.toString),qu=typeof BigInt>"u"?null:Be(BigInt.prototype.toString),Ju=typeof Symbol>"u"?null:Be(Symbol.prototype.toString),Ze=Be(Object.prototype.hasOwnProperty),es=Be(Object.prototype.toString),He=Be(RegExp.prototype.test),Fn=_b(TypeError);function Be(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return nl(t,e,r)}}function _b(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return rl(t,n)}}function ie(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ls;if(Hu&&Hu(t,null),!_n(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(cb(e)||(e[r]=i),s=i)}t[s]=!0}return t}function yb(t){for(let e=0;e<t.length;e++)Ze(t,e)||(t[e]=null);return t}function st(t){const e=gr(null);for(const r of vf(t)){var n=ab(r,2);const s=n[0],i=n[1];Ze(t,s)&&(_n(i)?e[s]=yb(i):i&&typeof i=="object"&&i.constructor===Object?e[s]=st(i):e[s]=i)}return e}function xb(t){switch(typeof t){case"string":return t;case"number":return mb(t);case"boolean":return gb(t);case"bigint":return qu?qu(t):"0";case"symbol":return Ju?Ju(t):"Symbol()";case"undefined":return es(t);case"function":case"object":{if(t===null)return es(t);const e=t,n=Vt(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:es(r)}return es(t)}default:return es(t)}}function Vt(t,e){for(;t!==null;){const r=hb(t,e);if(r){if(r.get)return Be(r.get);if(typeof r.value=="function")return Be(r.value)}t=ub(t)}function n(){return null}return n}function bb(t){try{return He(t,""),!0}catch{return!1}}const Ku=Ye(["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"]),oa=Ye(["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"]),aa=Ye(["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"]),vb=Ye(["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"]),la=Ye(["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"]),wb=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qu=Ye(["#text"]),eh=Ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),ca=Ye(["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"]),th=Ye(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),di=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kb=Xe(/{{[\w\W]*|^[\w\W]*}}/g),Sb=Xe(/<%[\w\W]*|^[\w\W]*%>/g),Tb=Xe(/\${[\w\W]*/g),Ab=Xe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cb=Xe(/^aria-[\-\w]+$/),nh=Xe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Eb=Xe(/^(?:\w+script|data):/i),Ib=Xe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pb=Xe(/^html$/i),Mb=Xe(/^[a-z][.\w]*(-[.\w]+)+$/i),rh=Xe(/<[/\w!]/g),Rb=Xe(/<[/\w]/g),zb=Xe(/<\/no(script|embed|frames)/i),Ob=Xe(/\/>/i),Gt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$b=function(){return typeof window>"u"?null:window},Nb=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},sh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},pn=function(e,n,r,s){return Ze(e,n)&&_n(e[n])?ie(s.base?st(s.base):{},e[n],s.transform):r};function kf(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$b();const e=O=>kf(O);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==Gt.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,s=r.currentScript;t.DocumentFragment;const i=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,h=t.trustedTypes,f=a.prototype,d=Vt(f,"cloneNode"),m=Vt(f,"remove"),y=Vt(f,"nextSibling"),g=Vt(f,"childNodes"),x=Vt(f,"parentNode"),b=Vt(f,"shadowRoot"),S=Vt(f,"attributes"),T=o&&o.prototype?Vt(o.prototype,"nodeType"):null,I=o&&o.prototype?Vt(o.prototype,"nodeName"):null;if(typeof i=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let A,E="",Z,Y=!1,$=0;const F=function(){if($>0)throw Fn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},se=function(_){F(),$++;try{return A.createHTML(_)}finally{$--}},ke=function(_){F(),$++;try{return A.createScriptURL(_)}finally{$--}},Se=function(){return Y||(Z=Nb(h,s),Y=!0),Z},Tt=n,L=Tt.implementation,V=Tt.createNodeIterator,In=Tt.createDocumentFragment,ce=Tt.getElementsByTagName,Nt=r.importNode;let ye=sh();e.isSupported=typeof vf=="function"&&typeof x=="function"&&L&&L.createHTMLDocument!==void 0;const Pn=kb,Mn=Sb,Vs=Tb,nr=Ab,Rn=Cb,Hs=Eb,Lr=Ib,rr=Mb;let zn=nh,we=null;const Dt=ie({},[...Ku,...oa,...aa,...la,...Qu]);let fe=null;const Lt=ie({},[...eh,...ca,...th,...di]);let pe=Object.seal(gr(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}})),On=null,Fr=null;const Ft=Object.seal(gr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ho=!0,fo=!0,ic=!1,oc=!0,dn=!1,Br=!0,$n=!1,po=!1,mo=null,go=null,_o=!1,sr=!1,Ws=!1,Ys=!1,ac=!0,lc=!1;const cc="user-content-";let yo=!0,xo=!1,ir={},Bt=null;const bo=ie({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let uc=null;const hc=ie({},["audio","video","img","source","image","track"]);let vo=null;const dc=ie({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xs="http://www.w3.org/1998/Math/MathML",qs="http://www.w3.org/2000/svg",Ut="http://www.w3.org/1999/xhtml";let or=Ut,wo=!1,ko=null;const Lp=ie({},[Xs,qs,Ut],ia),fc=Ye(["mi","mo","mn","ms","mtext"]);let So=ie({},fc);const pc=Ye(["annotation-xml"]);let To=ie({},pc);const Fp=ie({},["title","style","font","a","script"]);let Ur=null;const Bp=["application/xhtml+xml","text/html"],Up="text/html";let Re=null,ar=null;const Gp=n.createElement("form"),mc=function(_){return _ instanceof RegExp||_ instanceof Function},Ao=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ar&&ar===_)return;(!_||typeof _!="object")&&(_={}),_=st(_),Ur=Bp.indexOf(_.PARSER_MEDIA_TYPE)===-1?Up:_.PARSER_MEDIA_TYPE,Re=Ur==="application/xhtml+xml"?ia:ls,we=pn(_,"ALLOWED_TAGS",Dt,{transform:Re}),fe=pn(_,"ALLOWED_ATTR",Lt,{transform:Re}),ko=pn(_,"ALLOWED_NAMESPACES",Lp,{transform:ia}),vo=pn(_,"ADD_URI_SAFE_ATTR",dc,{transform:Re,base:dc}),uc=pn(_,"ADD_DATA_URI_TAGS",hc,{transform:Re,base:hc}),Bt=pn(_,"FORBID_CONTENTS",bo,{transform:Re}),On=pn(_,"FORBID_TAGS",st({}),{transform:Re}),Fr=pn(_,"FORBID_ATTR",st({}),{transform:Re}),ir=Ze(_,"USE_PROFILES")?_.USE_PROFILES&&typeof _.USE_PROFILES=="object"?st(_.USE_PROFILES):_.USE_PROFILES:!1,ho=_.ALLOW_ARIA_ATTR!==!1,fo=_.ALLOW_DATA_ATTR!==!1,ic=_.ALLOW_UNKNOWN_PROTOCOLS||!1,oc=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,dn=_.SAFE_FOR_TEMPLATES||!1,Br=_.SAFE_FOR_XML!==!1,$n=_.WHOLE_DOCUMENT||!1,sr=_.RETURN_DOM||!1,Ws=_.RETURN_DOM_FRAGMENT||!1,Ys=_.RETURN_TRUSTED_TYPE||!1,_o=_.FORCE_BODY||!1,ac=_.SANITIZE_DOM!==!1,lc=_.SANITIZE_NAMED_PROPS||!1,yo=_.KEEP_CONTENT!==!1,xo=_.IN_PLACE||!1,zn=bb(_.ALLOWED_URI_REGEXP)?_.ALLOWED_URI_REGEXP:nh,or=typeof _.NAMESPACE=="string"?_.NAMESPACE:Ut,So=Ze(_,"MATHML_TEXT_INTEGRATION_POINTS")&&_.MATHML_TEXT_INTEGRATION_POINTS&&typeof _.MATHML_TEXT_INTEGRATION_POINTS=="object"?st(_.MATHML_TEXT_INTEGRATION_POINTS):ie({},fc),To=Ze(_,"HTML_INTEGRATION_POINTS")&&_.HTML_INTEGRATION_POINTS&&typeof _.HTML_INTEGRATION_POINTS=="object"?st(_.HTML_INTEGRATION_POINTS):ie({},pc);const w=Ze(_,"CUSTOM_ELEMENT_HANDLING")&&_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING=="object"?st(_.CUSTOM_ELEMENT_HANDLING):gr(null);if(pe=gr(null),Ze(w,"tagNameCheck")&&mc(w.tagNameCheck)&&(pe.tagNameCheck=w.tagNameCheck),Ze(w,"attributeNameCheck")&&mc(w.attributeNameCheck)&&(pe.attributeNameCheck=w.attributeNameCheck),Ze(w,"allowCustomizedBuiltInElements")&&typeof w.allowCustomizedBuiltInElements=="boolean"&&(pe.allowCustomizedBuiltInElements=w.allowCustomizedBuiltInElements),Xe(pe),dn&&(fo=!1),Ws&&(sr=!0),ir&&(we=ie({},Qu),fe=gr(null),ir.html===!0&&(ie(we,Ku),ie(fe,eh)),ir.svg===!0&&(ie(we,oa),ie(fe,ca),ie(fe,di)),ir.svgFilters===!0&&(ie(we,aa),ie(fe,ca),ie(fe,di)),ir.mathMl===!0&&(ie(we,la),ie(fe,th),ie(fe,di))),Ft.tagCheck=null,Ft.attributeCheck=null,Ze(_,"ADD_TAGS")&&(typeof _.ADD_TAGS=="function"?Ft.tagCheck=_.ADD_TAGS:_n(_.ADD_TAGS)&&(we===Dt&&(we=st(we)),ie(we,_.ADD_TAGS,Re))),Ze(_,"ADD_ATTR")&&(typeof _.ADD_ATTR=="function"?Ft.attributeCheck=_.ADD_ATTR:_n(_.ADD_ATTR)&&(fe===Lt&&(fe=st(fe)),ie(fe,_.ADD_ATTR,Re))),Ze(_,"ADD_URI_SAFE_ATTR")&&_n(_.ADD_URI_SAFE_ATTR)&&ie(vo,_.ADD_URI_SAFE_ATTR,Re),Ze(_,"FORBID_CONTENTS")&&_n(_.FORBID_CONTENTS)&&(Bt===bo&&(Bt=st(Bt)),ie(Bt,_.FORBID_CONTENTS,Re)),Ze(_,"ADD_FORBID_CONTENTS")&&_n(_.ADD_FORBID_CONTENTS)&&(Bt===bo&&(Bt=st(Bt)),ie(Bt,_.ADD_FORBID_CONTENTS,Re)),yo&&(we["#text"]=!0),$n&&ie(we,["html","head","body"]),we.table&&(ie(we,["tbody"]),delete On.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const R=A;A=_.TRUSTED_TYPES_POLICY;try{E=se("")}catch(B){throw A=R,B}}else _.TRUSTED_TYPES_POLICY===null?(A=void 0,E=""):(A===void 0&&(A=Se()),A&&typeof E=="string"&&(E=se("")));Ye&&Ye(_),ar=_},gc=ie({},[...oa,...aa,...vb]),_c=ie({},[...la,...wb]),Zp=function(_,w,R){return w.namespaceURI===Ut?_==="svg":w.namespaceURI===Xs?_==="svg"&&(R==="annotation-xml"||So[R]):!!gc[_]},jp=function(_,w,R){return w.namespaceURI===Ut?_==="math":w.namespaceURI===qs?_==="math"&&To[R]:!!_c[_]},Vp=function(_,w,R){return w.namespaceURI===qs&&!To[R]||w.namespaceURI===Xs&&!So[R]?!1:!_c[_]&&(Fp[_]||!gc[_])},Hp=function(_){let w=x(_);(!w||!w.tagName)&&(w={namespaceURI:or,tagName:"template"});const R=ls(_.tagName),B=ls(w.tagName);return ko[_.namespaceURI]?_.namespaceURI===qs?Zp(R,w,B):_.namespaceURI===Xs?jp(R,w,B):_.namespaceURI===Ut?Vp(R,w,B):!!(Ur==="application/xhtml+xml"&&ko[_.namespaceURI]):!1},fn=function(_){dr(e.removed,{element:_});try{x(_).removeChild(_)}catch{if(m(_),!x(_))throw Fn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},yc=function(_){const w=g(_);if(w){const B=[];Kr(w,te=>{dr(B,te)}),Kr(B,te=>{try{m(te)}catch{}})}const R=S(_);if(R)for(let B=R.length-1;B>=0;--B){const te=R[B],ue=te&&te.name;if(typeof ue=="string")try{_.removeAttribute(ue)}catch{}}},Nn=function(_,w){try{dr(e.removed,{attribute:w.getAttributeNode(_),from:w})}catch{dr(e.removed,{attribute:null,from:w})}if(w.removeAttribute(_),_==="is")if(sr||Ws)try{fn(w)}catch{}else try{w.setAttribute(_,"")}catch{}},Wp=function(_){const w=S(_);if(w)for(let R=w.length-1;R>=0;--R){const B=w[R],te=B&&B.name;if(!(typeof te!="string"||fe[Re(te)]))try{_.removeAttribute(te)}catch{}}},Yp=function(_){const w=[_];for(;w.length>0;){const R=w.pop();(T?T(R):R.nodeType)===Gt.element&&Wp(R);const te=g(R);if(te)for(let ue=te.length-1;ue>=0;--ue)w.push(te[ue])}},xc=function(_){let w=null,R=null;if(_o)_="<remove></remove>"+_;else{const ue=Yu(_,/^[\r\n\t ]+/);R=ue&&ue[0]}Ur==="application/xhtml+xml"&&or===Ut&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const B=A?se(_):_;if(or===Ut)try{w=new u().parseFromString(B,Ur)}catch{}if(!w||!w.documentElement){w=L.createDocument(or,"template",null);try{w.documentElement.innerHTML=wo?E:B}catch{}}const te=w.body||w.documentElement;return _&&R&&te.insertBefore(n.createTextNode(R),te.childNodes[0]||null),or===Ut?ce.call(w,$n?"html":"body")[0]:$n?w.documentElement:te},bc=function(_){return V.call(_.ownerDocument||_,_,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Js=function(_){return _=Qr(_,Pn," "),_=Qr(_,Mn," "),_=Qr(_,Vs," "),_},Co=function(_){var w;_.normalize();const R=V.call(_.ownerDocument||_,_,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let B=R.nextNode();for(;B;)B.data=Js(B.data),B=R.nextNode();const te=(w=_.querySelectorAll)===null||w===void 0?void 0:w.call(_,"template");te&&Kr(te,ue=>{lr(ue.content)&&Co(ue.content)})},Ks=function(_){const w=I?I(_):null;return typeof w!="string"||Re(w)!=="form"?!1:typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||_.attributes!==S(_)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function"||_.nodeType!==T(_)||_.childNodes!==g(_)},lr=function(_){if(!T||typeof _!="object"||_===null)return!1;try{return T(_)===Gt.documentFragment}catch{return!1}},Gr=function(_){if(!T||typeof _!="object"||_===null)return!1;try{return typeof T(_)=="number"}catch{return!1}};function qt(O,_,w){O.length!==0&&Kr(O,R=>{R.call(e,_,w,ar)})}const Xp=function(_,w){return!!(Br&&_.hasChildNodes()&&!Gr(_.firstElementChild)&&He(rh,_.textContent)&&He(rh,_.innerHTML)||Br&&_.namespaceURI===Ut&&w==="style"&&Gr(_.firstElementChild)||_.nodeType===Gt.processingInstruction||Br&&_.nodeType===Gt.comment&&He(Rb,_.data))},qp=function(_,w){if(!On[w]&&kc(w)&&(pe.tagNameCheck instanceof RegExp&&He(pe.tagNameCheck,w)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(w)))return!1;if(yo&&!Bt[w]){const R=x(_),B=g(_);if(B&&R){const te=B.length;for(let ue=te-1;ue>=0;--ue){const Ge=xo?B[ue]:d(B[ue],!0);R.insertBefore(Ge,y(_))}}}return fn(_),!0},vc=function(_){if(qt(ye.beforeSanitizeElements,_,null),Ks(_))return fn(_),!0;const w=Re(I?I(_):_.nodeName);if(qt(ye.uponSanitizeElement,_,{tagName:w,allowedTags:we}),Xp(_,w))return fn(_),!0;if(On[w]||!(Ft.tagCheck instanceof Function&&Ft.tagCheck(w))&&!we[w])return qp(_,w);if((T?T(_):_.nodeType)===Gt.element&&!Hp(_)||(w==="noscript"||w==="noembed"||w==="noframes")&&He(zb,_.innerHTML))return fn(_),!0;if(dn&&_.nodeType===Gt.text){const B=Js(_.textContent);_.textContent!==B&&(dr(e.removed,{element:_.cloneNode()}),_.textContent=B)}return qt(ye.afterSanitizeElements,_,null),!1},wc=function(_,w,R){if(Fr[w]||ac&&(w==="id"||w==="name")&&(R in n||R in Gp))return!1;const B=fe[w]||Ft.attributeCheck instanceof Function&&Ft.attributeCheck(w,_);if(!(fo&&He(nr,w))){if(!(ho&&He(Rn,w))){if(B){if(!vo[w]){if(!He(zn,Qr(R,Lr,""))){if(!((w==="src"||w==="xlink:href"||w==="href")&&_!=="script"&&Xu(R,"data:")===0&&uc[_])){if(!(ic&&!He(Hs,Qr(R,Lr,"")))){if(R)return!1}}}}}else if(!(kc(_)&&(pe.tagNameCheck instanceof RegExp&&He(pe.tagNameCheck,_)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(_))&&(pe.attributeNameCheck instanceof RegExp&&He(pe.attributeNameCheck,w)||pe.attributeNameCheck instanceof Function&&pe.attributeNameCheck(w,_))||w==="is"&&pe.allowCustomizedBuiltInElements&&(pe.tagNameCheck instanceof RegExp&&He(pe.tagNameCheck,R)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(R))))return!1}}return!0},Jp=ie({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),kc=function(_){return!Jp[ls(_)]&&He(rr,_)},Kp=function(_,w,R,B){if(A&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!R)switch(h.getAttributeType(_,w)){case"TrustedHTML":return se(B);case"TrustedScriptURL":return ke(B)}return B},Qp=function(_,w,R,B){try{R?_.setAttributeNS(R,w,B):_.setAttribute(w,B),Ks(_)?fn(_):Wu(e.removed)}catch{Nn(w,_)}},Sc=function(_){qt(ye.beforeSanitizeAttributes,_,null);const w=_.attributes;if(!w||Ks(_))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0};let B=w.length;const te=Re(_.nodeName);for(;B--;){const ue=w[B],Ge=ue.name,Ne=ue.namespaceURI,xt=ue.value,At=Re(Ge),Io=xt;let nt=Ge==="value"?Io:pb(Io);if(R.attrName=At,R.attrValue=nt,R.keepAttr=!0,R.forceKeepAttr=void 0,qt(ye.uponSanitizeAttribute,_,R),nt=R.attrValue,lc&&(At==="id"||At==="name")&&Xu(nt,cc)!==0&&(Nn(Ge,_),nt=cc+nt),Br&&He(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,nt)){Nn(Ge,_);continue}if(At==="attributename"&&Yu(nt,"href")){Nn(Ge,_);continue}if(!R.forceKeepAttr){if(!R.keepAttr){Nn(Ge,_);continue}if(!oc&&He(Ob,nt)){Nn(Ge,_);continue}if(dn&&(nt=Js(nt)),!wc(te,At,nt)){Nn(Ge,_);continue}nt=Kp(te,At,Ne,nt),nt!==Io&&Qp(_,Ge,Ne,nt)}}qt(ye.afterSanitizeAttributes,_,null)},Qs=function(_){let w=null;const R=bc(_);for(qt(ye.beforeSanitizeShadowDOM,_,null);w=R.nextNode();)if(qt(ye.uponSanitizeShadowNode,w,null),vc(w),Sc(w),lr(w.content)&&Qs(w.content),(T?T(w):w.nodeType)===Gt.element){const te=b(w);lr(te)&&(Eo(te),Qs(te))}qt(ye.afterSanitizeShadowDOM,_,null)},Eo=function(_){const w=[{node:_,shadow:null}];for(;w.length>0;){const R=w.pop();if(R.shadow){Qs(R.shadow);continue}const B=R.node,ue=(T?T(B):B.nodeType)===Gt.element,Ge=g(B);if(Ge)for(let Ne=Ge.length-1;Ne>=0;--Ne)w.push({node:Ge[Ne],shadow:null});if(ue){const Ne=I?I(B):null;if(typeof Ne=="string"&&Re(Ne)==="template"){const xt=B.content;lr(xt)&&w.push({node:xt,shadow:null})}}if(ue){const Ne=b(B);lr(Ne)&&w.push({node:null,shadow:Ne},{node:Ne,shadow:null})}}};return e.sanitize=function(O){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,R=null,B=null,te=null;if(wo=!O,wo&&(O="<!-->"),typeof O!="string"&&!Gr(O)&&(O=xb(O),typeof O!="string"))throw Fn("dirty is not a string, aborting");if(!e.isSupported)return O;po?(we=mo,fe=go):Ao(_),(ye.uponSanitizeElement.length>0||ye.uponSanitizeAttribute.length>0)&&(we=st(we)),ye.uponSanitizeAttribute.length>0&&(fe=st(fe)),e.removed=[];const ue=xo&&typeof O!="string"&&Gr(O);if(ue){const xt=I?I(O):O.nodeName;if(typeof xt=="string"){const At=Re(xt);if(!we[At]||On[At])throw Fn("root node is forbidden and cannot be sanitized in-place")}if(Ks(O))throw Fn("root node is clobbered and cannot be sanitized in-place");try{Eo(O)}catch(At){throw yc(O),At}}else if(Gr(O))w=xc("<!---->"),R=w.ownerDocument.importNode(O,!0),R.nodeType===Gt.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?w=R:w.appendChild(R),Eo(R);else{if(!sr&&!dn&&!$n&&O.indexOf("<")===-1)return A&&Ys?se(O):O;if(w=xc(O),!w)return sr?null:Ys?E:""}w&&_o&&fn(w.firstChild);const Ge=bc(ue?O:w);try{for(;B=Ge.nextNode();)vc(B),Sc(B),lr(B.content)&&Qs(B.content)}catch(xt){throw ue&&yc(O),xt}if(ue)return Kr(e.removed,xt=>{xt.element&&Yp(xt.element)}),dn&&Co(O),O;if(sr){if(dn&&Co(w),Ws)for(te=In.call(w.ownerDocument);w.firstChild;)te.appendChild(w.firstChild);else te=w;return(fe.shadowroot||fe.shadowrootmode)&&(te=Nt.call(r,te,!0)),te}let Ne=$n?w.outerHTML:w.innerHTML;return $n&&we["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&He(Pb,w.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
|
|
241
|
-
`+Ne),
|
|
242
|
-
]`).replace("lheading",
|
|
239
|
+
`}},_u={};function Y_(t){let e=_u[t];if(e)return e;const n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=r;return e=_u[t]=new Ud({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}class yu extends vl{constructor(e){const n=L_({name:"batch",bits:[B_,V_(e),W_]}),r=D_({name:"batch",bits:[F_,Z_(e),H_]});super({glProgram:n,gpuProgram:r,resources:{batchSamplers:Y_(e)}}),this.maxTextures=e}}let Jr=null;const tf=class nf extends g_{constructor(e){super(e),this.geometry=new w_,this.name=nf.extension.name,this.vertexSize=6,Jr??(Jr=new yu(e.maxTextures)),this.shader=Jr}packAttributes(e,n,r,s,i){const o=i<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,{positions:m,uvs:y}=e,g=e.color,x=e.attributeOffset,b=x+e.attributeSize;for(let S=x;S<b;S++){const T=S*2,I=m[T],A=m[T+1];n[s++]=l*I+u*A+f,n[s++]=h*A+c*I+d,n[s++]=y[T],n[s++]=y[T+1],r[s++]=g,r[s++]=o}}packQuadAttributes(e,n,r,s,i){const o=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,m=e.bounds,y=m.maxX,g=m.minX,x=m.maxY,b=m.minY,S=o.uvs,T=e.color,I=i<<16|e.roundPixels&65535;n[s+0]=l*g+u*b+f,n[s+1]=h*b+c*g+d,n[s+2]=S.x0,n[s+3]=S.y0,r[s+4]=T,r[s+5]=I,n[s+6]=l*y+u*b+f,n[s+7]=h*b+c*y+d,n[s+8]=S.x1,n[s+9]=S.y1,r[s+10]=T,r[s+11]=I,n[s+12]=l*y+u*x+f,n[s+13]=h*x+c*y+d,n[s+14]=S.x2,n[s+15]=S.y2,r[s+16]=T,r[s+17]=I,n[s+18]=l*g+u*x+f,n[s+19]=h*x+c*g+d,n[s+20]=S.x3,n[s+21]=S.y3,r[s+22]=T,r[s+23]=I}_updateMaxTextures(e){this.shader.maxTextures!==e&&(Jr=new yu(e),this.shader=Jr)}destroy(){this.shader=null,super.destroy()}};tf.extension={type:[ve.Batcher],name:"default"};let X_=tf;class Ki{constructor(e){this.items=Object.create(null);const{renderer:n,type:r,onUnload:s,priority:i,name:o}=e;this._renderer=n,n.gc.addResourceHash(this,"items",r,i??0),this._onUnload=s,this.name=o}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...n){var s;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((s=this._onUnload)==null||s.call(this,e,...n),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(n=>n&&this.remove(n,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function q_(t,e,n,r,s,i,o,a=null){let l=0;n*=e,s*=i;const c=a.a,u=a.b,h=a.c,f=a.d,d=a.tx,m=a.ty;for(;l<o;){const y=t[n],g=t[n+1];r[s]=c*y+h*g+d,r[s+1]=u*y+f*g+m,s+=i,n+=e,l++}}function J_(t,e,n,r){let s=0;for(e*=n;s<r;)t[e]=0,t[e+1]=0,e+=n,s++}function rf(t,e,n,r,s){const i=e.a,o=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;n||(n=0),r||(r=2),s||(s=t.length/r-n);let h=n*r;for(let f=0;f<s;f++){const d=t[h],m=t[h+1];t[h]=i*d+a*m+c,t[h+1]=o*d+l*m+u,h+=r}}const K_=new le;class Tl{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 e=this.baseColor,n=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?pd(n,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):n+(this.alpha*255<<24)}get transform(){var e;return((e=this.renderable)==null?void 0:e.groupTransform)||K_}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.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 Ss={extension:{type:ve.ShapeBuilder,name:"circle"},build(t,e){let n,r,s,i,o,a;if(t.type==="circle"){const T=t;if(o=a=T.radius,o<=0)return!1;n=T.x,r=T.y,s=i=0}else if(t.type==="ellipse"){const T=t;if(o=T.halfWidth,a=T.halfHeight,o<=0||a<=0)return!1;n=T.x,r=T.y,s=i=0}else{const T=t,I=T.width/2,A=T.height/2;n=T.x+I,r=T.y+A,o=a=Math.max(0,Math.min(T.radius,Math.min(I,A))),s=I-o,i=A-a}if(s<0||i<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),c=l*8+(s?4:0)+(i?4:0);if(c===0)return!1;if(l===0)return e[0]=e[6]=n+s,e[1]=e[3]=r+i,e[2]=e[4]=n-s,e[5]=e[7]=r-i,!0;let u=0,h=l*4+(s?2:0)+2,f=h,d=c,m=s+o,y=i,g=n+m,x=n-m,b=r+y;if(e[u++]=g,e[u++]=b,e[--h]=b,e[--h]=x,i){const T=r-y;e[f++]=x,e[f++]=T,e[--d]=T,e[--d]=g}for(let T=1;T<l;T++){const I=Math.PI/2*(T/l),A=s+Math.cos(I)*o,E=i+Math.sin(I)*a,V=n+A,Y=n-A,$=r+E,F=r-E;e[u++]=V,e[u++]=$,e[--h]=$,e[--h]=Y,e[f++]=Y,e[f++]=F,e[--d]=F,e[--d]=V}m=s,y=i+a,g=n+m,x=n-m,b=r+y;const S=r-y;return e[u++]=g,e[u++]=b,e[--d]=S,e[--d]=g,s&&(e[u++]=x,e[u++]=b,e[--d]=S,e[--d]=x),!0},triangulate(t,e,n,r,s,i){if(t.length===0)return;let o=0,a=0;for(let u=0;u<t.length;u+=2)o+=t[u],a+=t[u+1];o/=t.length/2,a/=t.length/2;let l=r;e[l*n]=o,e[l*n+1]=a;const c=l++;for(let u=0;u<t.length;u+=2)e[l*n]=t[u],e[l*n+1]=t[u+1],u>0&&(s[i++]=l,s[i++]=c,s[i++]=l-1),l++;s[i++]=c+1,s[i++]=c,s[i++]=l-1}},Q_={...Ss,extension:{...Ss.extension,name:"ellipse"}},ey={...Ss,extension:{...Ss.extension,name:"roundedRectangle"}},sf=1e-4,xu=1e-4;function ty(t){const e=t.length;if(e<6)return 1;let n=0;for(let r=0,s=t[e-2],i=t[e-1];r<e;r+=2){const o=t[r],a=t[r+1];n+=(o-s)*(a+i),s=o,i=a}return n<0?-1:1}function bu(t,e,n,r,s,i,o,a){const l=t-n*s,c=e-r*s,u=t+n*i,h=e+r*i;let f,d;o?(f=r,d=-n):(f=-r,d=n);const m=l+f,y=c+d,g=u+f,x=h+d;return a.push(m,y),a.push(g,x),2}function Fn(t,e,n,r,s,i,o,a){const l=n-t,c=r-e;let u=Math.atan2(l,c),h=Math.atan2(s-t,i-e);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let f=u;const d=h-u,m=Math.abs(d),y=Math.sqrt(l*l+c*c),g=(15*m*Math.sqrt(y)/Math.PI>>0)+1,x=d/g;if(f+=x,a){o.push(t,e),o.push(n,r);for(let b=1,S=f;b<g;b++,S+=x)o.push(t,e),o.push(t+Math.sin(S)*y,e+Math.cos(S)*y);o.push(t,e),o.push(s,i)}else{o.push(n,r),o.push(t,e);for(let b=1,S=f;b<g;b++,S+=x)o.push(t+Math.sin(S)*y,e+Math.cos(S)*y),o.push(t,e);o.push(s,i),o.push(t,e)}return g*2}function ny(t,e,n,r,s,i){const o=sf;if(t.length===0)return;const a=e;let l=a.alignment;if(e.alignment!==.5){let ue=ty(t);l=(l-.5)*ue+.5}const c=new et(t[0],t[1]),u=new et(t[t.length-2],t[t.length-1]),h=r,f=Math.abs(c.x-u.x)<o&&Math.abs(c.y-u.y)<o;if(h){t=t.slice(),f&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));const ue=(c.x+u.x)*.5,Dt=(u.y+c.y)*.5;t.unshift(ue,Dt),t.push(ue,Dt)}const d=s,m=t.length/2;let y=t.length;const g=d.length/2,x=a.width/2,b=x*x,S=a.miterLimit*a.miterLimit;let T=t[0],I=t[1],A=t[2],E=t[3],V=0,Y=0,$=-(I-E),F=T-A,ie=0,ke=0,Se=Math.sqrt($*$+F*F);$/=Se,F/=Se,$*=x,F*=x;const At=l,L=(1-At)*2,H=At*2;h||(a.cap==="round"?y+=Fn(T-$*(L-H)*.5,I-F*(L-H)*.5,T-$*L,I-F*L,T+$*H,I+F*H,d,!0)+2:a.cap==="square"&&(y+=bu(T,I,$,F,L,H,!0,d))),d.push(T-$*L,I-F*L),d.push(T+$*H,I+F*H);for(let ue=1;ue<m-1;++ue){T=t[(ue-1)*2],I=t[(ue-1)*2+1],A=t[ue*2],E=t[ue*2+1],V=t[(ue+1)*2],Y=t[(ue+1)*2+1],$=-(I-E),F=T-A,Se=Math.sqrt($*$+F*F),$/=Se,F/=Se,$*=x,F*=x,ie=-(E-Y),ke=A-V,Se=Math.sqrt(ie*ie+ke*ke),ie/=Se,ke/=Se,ie*=x,ke*=x;const Dt=A-T,ye=I-E,Mn=A-V,Rn=Y-E,Hs=Dt*Mn+ye*Rn,rr=ye*Mn-Rn*Dt,zn=rr<0;if(Math.abs(rr)<.001*Math.abs(Hs)){d.push(A-$*L,E-F*L),d.push(A+$*H,E+F*H),Hs>=0&&(a.join==="round"?y+=Fn(A,E,A-$*L,E-F*L,A-ie*L,E-ke*L,d,!1)+4:y+=2,d.push(A-ie*H,E-ke*H),d.push(A+ie*L,E+ke*L));continue}const Ws=(-$+T)*(-F+E)-(-$+A)*(-F+I),Fr=(-ie+V)*(-ke+E)-(-ie+A)*(-ke+Y),sr=(Dt*Fr-Mn*Ws)/rr,On=(Rn*Ws-ye*Fr)/rr,we=(sr-A)*(sr-A)+(On-E)*(On-E),Lt=A+(sr-A)*L,pe=E+(On-E)*L,Ft=A-(sr-A)*H,me=E-(On-E)*H,$n=Math.min(Dt*Dt+ye*ye,Mn*Mn+Rn*Rn),Br=zn?L:H,Bt=$n+Br*Br*b;we<=Bt?a.join==="bevel"||we/b>S?(zn?(d.push(Lt,pe),d.push(A+$*H,E+F*H),d.push(Lt,pe),d.push(A+ie*H,E+ke*H)):(d.push(A-$*L,E-F*L),d.push(Ft,me),d.push(A-ie*L,E-ke*L),d.push(Ft,me)),y+=2):a.join==="round"?zn?(d.push(Lt,pe),d.push(A+$*H,E+F*H),y+=Fn(A,E,A+$*H,E+F*H,A+ie*H,E+ke*H,d,!0)+4,d.push(Lt,pe),d.push(A+ie*H,E+ke*H)):(d.push(A-$*L,E-F*L),d.push(Ft,me),y+=Fn(A,E,A-$*L,E-F*L,A-ie*L,E-ke*L,d,!1)+4,d.push(A-ie*L,E-ke*L),d.push(Ft,me)):(d.push(Lt,pe),d.push(Ft,me)):(d.push(A-$*L,E-F*L),d.push(A+$*H,E+F*H),a.join==="round"?zn?y+=Fn(A,E,A+$*H,E+F*H,A+ie*H,E+ke*H,d,!0)+2:y+=Fn(A,E,A-$*L,E-F*L,A-ie*L,E-ke*L,d,!1)+2:a.join==="miter"&&we/b<=S&&(zn?(d.push(Ft,me),d.push(Ft,me)):(d.push(Lt,pe),d.push(Lt,pe)),y+=2),d.push(A-ie*L,E-ke*L),d.push(A+ie*H,E+ke*H),y+=2)}T=t[(m-2)*2],I=t[(m-2)*2+1],A=t[(m-1)*2],E=t[(m-1)*2+1],$=-(I-E),F=T-A,Se=Math.sqrt($*$+F*F),$/=Se,F/=Se,$*=x,F*=x,d.push(A-$*L,E-F*L),d.push(A+$*H,E+F*H),h||(a.cap==="round"?y+=Fn(A-$*(L-H)*.5,E-F*(L-H)*.5,A-$*L,E-F*L,A+$*H,E+F*H,d,!1)+2:a.cap==="square"&&(y+=bu(A,E,$,F,L,H,!1,d)));const Pn=xu*xu;for(let ue=g;ue<y+g-2;++ue)T=d[ue*2],I=d[ue*2+1],A=d[(ue+1)*2],E=d[(ue+1)*2+1],V=d[(ue+2)*2],Y=d[(ue+2)*2+1],!(Math.abs(T*(E-Y)+A*(Y-I)+V*(I-E))<Pn)&&i.push(ue,ue+1,ue+2)}function ry(t,e,n,r){const s=sf;if(t.length===0)return;const i=t[0],o=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(i-a)<s&&Math.abs(o-l)<s,u=n,h=t.length/2,f=u.length/2;for(let d=0;d<h;d++)u.push(t[d*2]),u.push(t[d*2+1]);for(let d=0;d<h-1;d++)r.push(f+d,f+d+1);c&&r.push(f+h-1,f)}function of(t,e,n,r,s,i,o){const a=Kg(t,e,2);if(!a)return;for(let c=0;c<a.length;c+=3)i[o++]=a[c]+s,i[o++]=a[c+1]+s,i[o++]=a[c+2]+s;let l=s*r;for(let c=0;c<t.length;c+=2)n[l]=t[c],n[l+1]=t[c+1],l+=r}const sy=[],iy={extension:{type:ve.ShapeBuilder,name:"polygon"},build(t,e){for(let n=0;n<t.points.length;n++)e[n]=t.points[n];return!0},triangulate(t,e,n,r,s,i){of(t,sy,e,n,r,s,i)}},oy={extension:{type:ve.ShapeBuilder,name:"rectangle"},build(t,e){const n=t,r=n.x,s=n.y,i=n.width,o=n.height;return i>0&&o>0?(e[0]=r,e[1]=s,e[2]=r+i,e[3]=s,e[4]=r+i,e[5]=s+o,e[6]=r,e[7]=s+o,!0):!1},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[6],e[r+o+1]=t[7],o+=n,e[r+o]=t[4],e[r+o+1]=t[5],o+=n;const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2,s[i++]=a+1,s[i++]=a+3,s[i++]=a+2}},ay={extension:{type:ve.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[4],e[r+o+1]=t[5];const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2}},vu=[{offset:0,color:"white"},{offset:1,color:"black"}],Al=class Ua{constructor(...e){this.uid=Fe("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=ly(e);n={...n.type==="radial"?Ua.defaultRadialOptions:Ua.defaultLinearOptions,...rd(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,n.type==="radial"?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,n){return this.colorStops.push({offset:e,color:ln.shared.setValue(n).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:n}=this.start,{x:r,y:s}=this.end,i=r-e,o=s-n;const a=i<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(i<0){const g=e;e=r,r=g,i*=-1}if(o<0){const g=n;n=s,s=g,o*=-1}}const l=this.colorStops.length?this.colorStops:vu,c=this._textureSize,{canvas:u,context:h}=ku(c,1),f=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);wu(f,l),h.fillStyle=f,h.fillRect(0,0,c,1),this.texture=new be({source:new Ti({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(i*i+o*o),m=Math.atan2(o,i),y=new le;y.scale(d/c,1),y.rotate(m),y.translate(e,n),this.textureSpace==="local"&&y.scale(c,c),this.transform=y}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:vu,n=this._textureSize,{canvas:r,context:s}=ku(n,n),{x:i,y:o}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,f=l-u,d=n/(u*2),m=(i-h)*d,y=(o-f)*d,g=s.createRadialGradient(m,y,c*d,(a-h)*d,(l-f)*d,u*d);wu(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,n,n),s.fillStyle=g,s.translate(m,y),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-y),s.fillRect(0,0,n,n),this.texture=new be({source:new Ti({resource:r,addressMode:this._wrapMode})});const x=new le;this.textureSpace==="local"?x.scale(2*u,2*u):x.scale(1/d,1/d),x.translate(h,f),this.transform=x}destroy(){var e;(e=this.texture)==null||e.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}`}};Al.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Al.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Zs=Al;function wu(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function ku(t,e){const n=Gs.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}function ly(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(Ae("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??Zs.defaultLinearOptions.textureSize}),e}const cy=new le,uy=new Ve;function hy(t,e,n,r){const s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const o=n.getBounds(uy);e.width&&o.pad(e.width);const{x:a,y:l}=o,c=1/o.width,u=1/o.height,h=-a*c,f=-l*u,d=s.a,m=s.b,y=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*d+f*y+s.tx,s.ty=h*m+f*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);const i=e.texture.source.style;return!(e.fill instanceof Zs)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),r&&s.append(cy.copyFrom(r).invert()),s}const Qi={};yt.handleByMap(ve.ShapeBuilder,Qi);yt.add(oy,iy,ay,Ss,Q_,ey);const dy=new Ve,fy=new le;function py(t,e){const{geometryData:n,batches:r}=e;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let s=0;s<t.instructions.length;s++){const i=t.instructions[s];if(i.action==="texture")my(i.data,r,n);else if(i.action==="fill"||i.action==="stroke"){const o=i.action==="stroke",a=i.data.path.shapePath,l=i.data.style,c=i.data.hole;o&&c&&Su(c.shapePath,l,!0,r,n),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),Su(a,l,o,r,n)}}}function my(t,e,n){const r=[],s=Qi.rectangle,i=dy;i.x=t.dx,i.y=t.dy,i.width=t.dw,i.height=t.dh;const o=t.transform;if(!s.build(i,r))return;const{vertices:a,uvs:l,indices:c}=n,u=c.length,h=a.length/2;o&&rf(r,o),s.triangulate(r,a,2,h,c,u);const f=t.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const m=ht.get(Tl);m.indexOffset=u,m.indexSize=c.length-u,m.attributeOffset=h,m.attributeSize=a.length/2-h,m.baseColor=t.style,m.alpha=t.alpha,m.texture=f,m.geometryData=n,e.push(m)}function Su(t,e,n,r,s){const{vertices:i,uvs:o,indices:a}=s;t.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{const h=[],f=Qi[l.type];if(!f.build(l,h))return;const d=a.length,m=i.length/2;let y="triangle-list";if(c&&rf(h,c),n){const S=l.closePath??!0,T=e;T.pixelLine?(ry(h,S,i,a),y="line-list"):ny(h,T,!1,S,i,a)}else if(u){const S=[],T=h.slice();gy(u).forEach(A=>{S.push(T.length/2),T.push(...A)}),of(T,S,i,2,m,a,d)}else f.triangulate(h,i,2,m,a,d);const g=o.length/2,x=e.texture;if(x!==be.WHITE){const S=hy(fy,e,l,c);q_(i,2,m,o,g,2,i.length/2-m,S)}else J_(o,g,2,i.length/2-m);const b=ht.get(Tl);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=m,b.attributeSize=i.length/2-m,b.baseColor=e.color,b.alpha=e.alpha,b.texture=x,b.geometryData=s,b.topology=y,r.push(b)})}function gy(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,s=[];Qi[r.type].build(r,s)&&e.push(s)}return e}class _y{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{ht.return(e)}),this.graphicsData&&ht.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 yy{constructor(){this.instructions=new xl}init(e){const n=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(n):this.batcher=new X_({maxTextures:n}),this.instructions.reset()}get geometry(){return Ae(xm,"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 Cl=class Ga{constructor(e){this._renderer=e,this._managedContexts=new Ki({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Ga.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Ga.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!n){n&&r.reset(),py(e,r);const s=e.batchMode;e.customShader||s==="no-batch"?r.isBatchable=!1:s==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=ht.get(yy,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:s,geometryData:i}=r;r.graphicsData=n;const o=i.vertices.length,a=i.indices.length;for(let h=0;h<s.length;h++)s[h].applyTransform=!1;const l=n.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let h=0;h<s.length;h++){const f=s[h];l.add(f)}l.finish(n.instructions);const c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let h=0;h<u.length;h++){const f=u[h];f.bindGroup=a_(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return n}_initContext(e){const n=new _y;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Cl.extension={type:[ve.WebGLSystem,ve.WebGPUSystem],name:"graphicsContext"};Cl.defaultOptions={bezierSmoothness:.5};let El=Cl;const xy=8,di=11920929e-14,by=1;function af(t,e,n,r,s,i,o,a,l,c){const h=Math.min(.99,Math.max(0,c??El.defaultOptions.bezierSmoothness));let f=(by-h)/1;return f*=f,vy(e,n,r,s,i,o,a,l,t,f),t}function vy(t,e,n,r,s,i,o,a,l,c){Za(t,e,n,r,s,i,o,a,l,c,0),l.push(o,a)}function Za(t,e,n,r,s,i,o,a,l,c,u){if(u>xy)return;const h=(t+n)/2,f=(e+r)/2,d=(n+s)/2,m=(r+i)/2,y=(s+o)/2,g=(i+a)/2,x=(h+d)/2,b=(f+m)/2,S=(d+y)/2,T=(m+g)/2,I=(x+S)/2,A=(b+T)/2;if(u>0){let E=o-t,V=a-e;const Y=Math.abs((n-o)*V-(r-a)*E),$=Math.abs((s-o)*V-(i-a)*E);if(Y>di&&$>di){if((Y+$)*(Y+$)<=c*(E*E+V*V)){l.push(I,A);return}}else if(Y>di){if(Y*Y<=c*(E*E+V*V)){l.push(I,A);return}}else if($>di){if($*$<=c*(E*E+V*V)){l.push(I,A);return}}else if(E=I-(t+o)/2,V=A-(e+a)/2,E*E+V*V<=c){l.push(I,A);return}}Za(t,e,h,f,x,b,I,A,l,c,u+1),Za(I,A,S,T,y,g,o,a,l,c,u+1)}const wy=8,ky=11920929e-14,Sy=1;function Ty(t,e,n,r,s,i,o,a){const c=Math.min(.99,Math.max(0,a??El.defaultOptions.bezierSmoothness));let u=(Sy-c)/1;return u*=u,Ay(e,n,r,s,i,o,t,u),t}function Ay(t,e,n,r,s,i,o,a){ja(o,t,e,n,r,s,i,a,0),o.push(s,i)}function ja(t,e,n,r,s,i,o,a,l){if(l>wy)return;const c=(e+r)/2,u=(n+s)/2,h=(r+i)/2,f=(s+o)/2,d=(c+h)/2,m=(u+f)/2;let y=i-e,g=o-n;const x=Math.abs((r-i)*g-(s-o)*y);if(x>ky){if(x*x<=a*(y*y+g*g)){t.push(d,m);return}}else if(y=d-(e+i)/2,g=m-(n+o)/2,y*y+g*g<=a){t.push(d,m);return}ja(t,e,n,c,u,d,m,a,l+1),ja(t,d,m,h,f,i,o,a,l+1)}function lf(t,e,n,r,s,i,o,a){let l=Math.abs(s-i);(!o&&s>i||o&&i>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=o?-1:1;for(let h=0;h<a+1;h++){const f=Math.cos(u),d=Math.sin(u),m=e+f*r,y=n+d*r;t.push(m,y),u+=c}}function Cy(t,e,n,r,s,i){const o=t[t.length-2],l=t[t.length-1]-n,c=o-e,u=s-n,h=r-e,f=Math.abs(l*h-c*u);if(f<1e-8||i===0){(t[t.length-2]!==e||t[t.length-1]!==n)&&t.push(e,n);return}const d=l*l+c*c,m=u*u+h*h,y=l*u+c*h,g=i*Math.sqrt(d)/f,x=i*Math.sqrt(m)/f,b=g*y/d,S=x*y/m,T=g*h+x*c,I=g*u+x*l,A=c*(x+b),E=l*(x+b),V=h*(g+S),Y=u*(g+S),$=Math.atan2(E-I,A-T),F=Math.atan2(Y-I,V-T);lf(t,T+e,I+n,i,$,F,c*u>h*l)}const ms=Math.PI*2,ra={centerX:0,centerY:0,ang1:0,ang2:0},sa=({x:t,y:e},n,r,s,i,o,a,l)=>{t*=n,e*=r;const c=s*t-i*e,u=i*t+s*e;return l.x=c+o,l.y=u+a,l};function Ey(t,e){const n=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:n,s=Math.cos(t),i=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:s-i*r,y:i+s*r},{x:o+a*r,y:a-o*r},{x:o,y:a}]}const Tu=(t,e,n,r)=>{const s=t*r-e*n<0?-1:1;let i=t*n+e*r;return i>1&&(i=1),i<-1&&(i=-1),s*Math.acos(i)},Iy=(t,e,n,r,s,i,o,a,l,c,u,h,f)=>{const d=Math.pow(s,2),m=Math.pow(i,2),y=Math.pow(u,2),g=Math.pow(h,2);let x=d*m-d*g-m*y;x<0&&(x=0),x/=d*g+m*y,x=Math.sqrt(x)*(o===a?-1:1);const b=x*s/i*h,S=x*-i/s*u,T=c*b-l*S+(t+n)/2,I=l*b+c*S+(e+r)/2,A=(u-b)/s,E=(h-S)/i,V=(-u-b)/s,Y=(-h-S)/i,$=Tu(1,0,A,E);let F=Tu(A,E,V,Y);a===0&&F>0&&(F-=ms),a===1&&F<0&&(F+=ms),f.centerX=T,f.centerY=I,f.ang1=$,f.ang2=F};function Py(t,e,n,r,s,i,o,a=0,l=0,c=0){if(i===0||o===0)return;const u=Math.sin(a*ms/360),h=Math.cos(a*ms/360),f=h*(e-r)/2+u*(n-s)/2,d=-u*(e-r)/2+h*(n-s)/2;if(f===0&&d===0)return;i=Math.abs(i),o=Math.abs(o);const m=Math.pow(f,2)/Math.pow(i,2)+Math.pow(d,2)/Math.pow(o,2);m>1&&(i*=Math.sqrt(m),o*=Math.sqrt(m)),Iy(e,n,r,s,i,o,l,c,u,h,f,d,ra);let{ang1:y,ang2:g}=ra;const{centerX:x,centerY:b}=ra;let S=Math.abs(g)/(ms/4);Math.abs(1-S)<1e-7&&(S=1);const T=Math.max(Math.ceil(S),1);g/=T;let I=t[t.length-2],A=t[t.length-1];const E={x:0,y:0};for(let V=0;V<T;V++){const Y=Ey(y,g),{x:$,y:F}=sa(Y[0],i,o,h,u,x,b,E),{x:ie,y:ke}=sa(Y[1],i,o,h,u,x,b,E),{x:Se,y:At}=sa(Y[2],i,o,h,u,x,b,E);af(t,I,A,$,F,ie,ke,Se,At),I=Se,A=At,y+=g}}function My(t,e,n){const r=(o,a)=>{const l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c),h=l/u,f=c/u;return{len:u,nx:h,ny:f}},s=(o,a)=>{o===0?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)};let i=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??n;if(l<=0){s(o,a),i=a;continue}const c=e[(o+1)%e.length],u=r(a,i),h=r(a,c);if(u.len<1e-4||h.len<1e-4){s(o,a),i=a;continue}let f=Math.asin(u.nx*h.ny-u.ny*h.nx),d=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=!0):f>0&&(d=-1,m=!0);const y=f/2;let g,x=Math.abs(Math.cos(y)*l/Math.sin(y));x>Math.min(u.len/2,h.len/2)?(x=Math.min(u.len/2,h.len/2),g=Math.abs(x*Math.sin(y)/Math.cos(y))):g=l;const b=a.x+h.nx*x+-h.ny*g*d,S=a.y+h.ny*x+h.nx*g*d,T=Math.atan2(u.ny,u.nx)+Math.PI/2*d,I=Math.atan2(h.ny,h.nx)-Math.PI/2*d;o===0&&t.moveTo(b+Math.cos(T)*g,S+Math.sin(T)*g),t.arc(b,S,g,T,I,m),i=a}}function Ry(t,e,n,r){const s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),i=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],c=l.radius??n;if(c<=0){a===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const u=e[a],h=e[(a+2)%o],f=s(u,l);let d;if(f<1e-4)d=l;else{const g=Math.min(f/2,c);d=i(l,u,g/f)}const m=s(h,l);let y;if(m<1e-4)y=l;else{const g=Math.min(m/2,c);y=i(l,h,g/m)}a===0?t.moveTo(d.x,d.y):t.lineTo(d.x,d.y),t.quadraticCurveTo(l.x,l.y,y.x,y.y,r)}}const zy=new Ve;class Oy{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new zt,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,n){return this.startPoly(e,n),this}lineTo(e,n){this._ensurePoly();const r=this._currentPoly.points,s=r[r.length-2],i=r[r.length-1];return(s!==e||i!==n)&&r.push(e,n),this}arc(e,n,r,s,i,o){this._ensurePoly(!1);const a=this._currentPoly.points;return lf(a,e,n,r,s,i,o),this}arcTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly.points;return Cy(o,e,n,r,s,i),this}arcToSvg(e,n,r,s,i,o,a){const l=this._currentPoly.points;return Py(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,e,n,r,s,i),this}bezierCurveTo(e,n,r,s,i,o,a){this._ensurePoly();const l=this._currentPoly;return af(this._currentPoly.points,l.lastX,l.lastY,e,n,r,s,i,o,a),this}quadraticCurveTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly;return Ty(this._currentPoly.points,o.lastX,o.lastY,e,n,r,s,i),this}closePath(){return this.endPoly(!0),this}addPath(e,n){this.endPoly(),n&&!n.isIdentity()&&(e=e.clone(!0),e.transform(n));const r=this.shapePrimitives,s=r.length;for(let i=0;i<e.instructions.length;i++){const o=e.instructions[i];this[o.action](...o.data)}if(e.checkForHoles&&r.length-s>1){let i=null;for(let o=s;o<r.length;o++){const a=r[o];if(a.shape.type==="polygon"){const l=a.shape,c=i==null?void 0:i.shape;c&&c.containsPolygon(l)?(i.holes||(i.holes=[]),i.holes.push(a),r.copyWithin(o,o+1),r.length--,o--):i=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,n,r,s,i){return this.drawShape(new Ve(e,n,r,s),i),this}circle(e,n,r,s){return this.drawShape(new wl(e,n,r),s),this}poly(e,n,r){const s=new fs(e);return s.closePath=n,this.drawShape(s,r),this}regularPoly(e,n,r,s,i=0,o){s=Math.max(s|0,3);const a=-1*Math.PI/2+i,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){const h=a-u*l;c.push(e+r*Math.cos(h),n+r*Math.sin(h))}return this.poly(c,!0,o),this}roundPoly(e,n,r,s,i,o=0,a){if(s=Math.max(s|0,3),i<=0)return this.regularPoly(e,n,r,s,o);const l=r*Math.sin(Math.PI/s)-.001;i=Math.min(i,l);const c=-1*Math.PI/2+o,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){const d=f*u+c,m=e+r*Math.cos(d),y=n+r*Math.sin(d),g=d+Math.PI+h,x=d-Math.PI-h,b=m+i*Math.cos(g),S=y+i*Math.sin(g),T=m+i*Math.cos(x),I=y+i*Math.sin(x);f===0?this.moveTo(b,S):this.lineTo(b,S),this.quadraticCurveTo(m,y,T,I,a)}return this.closePath()}roundShape(e,n,r=!1,s){return e.length<3?this:(r?Ry(this,e,n,s):My(this,e,n),this.closePath())}filletRect(e,n,r,s,i){if(i===0)return this.rect(e,n,r,s);const o=Math.min(r,s)/2,a=Math.min(o,Math.max(-o,i)),l=e+r,c=n+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,n+h).arcTo(e+u,n+u,e+h,n,h).lineTo(l-h,n).arcTo(l-u,n+u,l,n+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+r-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,n,r,s,i,o){if(i<=0)return this.rect(e,n,r,s);const a=Math.min(i,Math.min(r,s)/2),l=e+r,c=n+s,u=[e+a,n,l-a,n,l,n+a,l,c-a,l-a,c,e+a,c,e,c-a,e,n+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,o)}ellipse(e,n,r,s,i){return this.drawShape(new kl(e,n,r,s),i),this}roundRect(e,n,r,s,i,o){return this.drawShape(new Sl(e,n,r,s,i),o),this}drawShape(e,n){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:n}),this}startPoly(e,n){let r=this._currentPoly;return r&&this.endPoly(),r=new fs,r.points.push(e,n),this._currentPoly=r,this}endPoly(e=!1){const n=this._currentPoly;return n&&n.points.length>2&&(n.closePath=e,this.shapePrimitives.push({shape:n})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new fs,e)){const n=this.shapePrimitives[this.shapePrimitives.length-1];if(n){let r=n.shape.x,s=n.shape.y;if(n.transform&&!n.transform.isIdentity()){const i=n.transform,o=r;r=i.a*r+i.c*s+i.tx,s=i.b*o+i.d*s+i.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let n=0;n<e.instructions.length;n++){const r=e.instructions[n];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const n=this.shapePrimitives;for(let r=0;r<n.length;r++){const s=n[r],i=s.shape.getBounds(zy);s.transform?e.addRect(i,s.transform):e.addRect(i)}return e}}class on{constructor(e,n=!1){this.instructions=[],this.uid=Fe("graphicsPath"),this._dirty=!0,this.checkForHoles=n,typeof e=="string"?r_(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new Oy(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,n){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,n]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,n,r,s,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(et.shared);let l=0,c=0;if(!o||o.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=o.data[2],c=o.data[3];const u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,n,r,s,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,n,r){const s=this.instructions[this.instructions.length-1],i=this.getLastPoint(et.shared);let o=0,a=0;if(!s||s.action!=="quadraticCurveTo")o=i.x,a=i.y;else{o=s.data[0],a=s.data[1];const l=i.x,c=i.y;o=l+(l-o),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,e,n,r]}),this._dirty=!0,this}rect(e,n,r,s,i){return this.instructions.push({action:"rect",data:[e,n,r,s,i]}),this._dirty=!0,this}circle(e,n,r,s){return this.instructions.push({action:"circle",data:[e,n,r,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,n,r,s,i,o,a){i||(i=s/2);const l=-1*Math.PI/2+o,c=r*2,u=Math.PI*2/c,h=[];for(let f=0;f<c;f++){const d=f%2?i:s,m=f*u+l;h.push(e+d*Math.cos(m),n+d*Math.sin(m))}return this.poly(h,!0,a),this}clone(e=!1){const n=new on;if(n.checkForHoles=this.checkForHoles,!e)n.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const s=this.instructions[r];n.instructions.push({action:s.action,data:s.data.slice()})}return n}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const n=e.a,r=e.b,s=e.c,i=e.d,o=e.tx,a=e.ty;let l=0,c=0,u=0,h=0,f=0,d=0,m=0,y=0;for(let g=0;g<this.instructions.length;g++){const x=this.instructions[g],b=x.data;switch(x.action){case"moveTo":case"lineTo":l=b[0],c=b[1],b[0]=n*l+s*c+o,b[1]=r*l+i*c+a;break;case"bezierCurveTo":u=b[0],h=b[1],f=b[2],d=b[3],l=b[4],c=b[5],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*f+s*d+o,b[3]=r*f+i*d+a,b[4]=n*l+s*c+o,b[5]=r*l+i*c+a;break;case"quadraticCurveTo":u=b[0],h=b[1],l=b[2],c=b[3],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*l+s*c+o,b[3]=r*l+i*c+a;break;case"arcToSvg":l=b[5],c=b[6],m=b[0],y=b[1],b[0]=n*m+s*y,b[1]=r*m+i*y,b[5]=n*l+s*c+o,b[6]=r*l+i*c+a;break;case"circle":b[4]=dr(b[3],e);break;case"rect":b[4]=dr(b[4],e);break;case"ellipse":b[8]=dr(b[8],e);break;case"roundRect":b[5]=dr(b[5],e);break;case"addPath":b[0].transform(e);break;case"poly":b[2]=dr(b[2],e);break;case"regularPoly":case"chamferRect":b[5]=dr(b[5],e);break;case"closePath":break;default:_t("unknown transform action",x.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let n=this.instructions.length-1,r=this.instructions[n];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(n--,n<0)return e.x=0,e.y=0,e;r=this.instructions[n]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}function dr(t,e){return t?t.prepend(e):e.clone()}function ze(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function $y(t,e){const n=t.querySelectorAll("defs");for(let r=0;r<n.length;r++){const s=n[r];for(let i=0;i<s.children.length;i++){const o=s.children[i];switch(o.nodeName.toLowerCase()){case"lineargradient":e.defs[o.id]=Ny(o);break;case"radialgradient":e.defs[o.id]=Dy();break}}}}function Ny(t){const e=ze(t,"x1",0),n=ze(t,"y1",0),r=ze(t,"x2",1),s=ze(t,"y2",0),i=t.getAttribute("gradientUnits")||"objectBoundingBox",o=new Zs(e,n,r,s,i==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){const l=t.children[a],c=ze(l,"offset",0),u=ln.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(c,u)}return o}function Dy(t){return _t("[SVG Parser] Radial gradients are not yet supported"),new Zs(0,0,1,0)}function Au(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Cu={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 cf(t,e){const n=t.getAttribute("style"),r={},s={},i={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(const o in Cu){const a=t.getAttribute(o);a&&Eu(e,i,o,a.trim())}if(n){const o=n.split(";");for(let a=0;a<o.length;a++){const l=o[a].trim(),[c,u]=l.split(":");Cu[c]&&Eu(e,i,c,u.trim())}}return{strokeStyle:i.useStroke?r:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function Eu(t,e,n,r){switch(n){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const s=Au(r);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=ln.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const s=Au(r);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=ln.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r);break}}function Ly(t){if(t.length<=2)return!0;const e=t.map(a=>a.area).sort((a,l)=>l-a),[n,r]=e,s=e[e.length-1],i=n/r,o=r/s;return!(i>3&&o<2)}function Fy(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function By(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const n=e.map(Number),r=[],s=[];for(let u=0;u<n.length;u+=2)u+1<n.length&&(r.push(n[u]),s.push(n[u+1]));if(r.length===0||s.length===0)return 0;const i=Math.min(...r),o=Math.max(...r),a=Math.min(...s),l=Math.max(...s);return(o-i)*(l-a)}function Iu(t,e){const n=new on(t,!1);for(const r of n.instructions)e.instructions.push(r)}function Uy(t,e){if(typeof t=="string"){const o=document.createElement("div");o.innerHTML=t.trim(),t=o.querySelector("svg")}const n={context:e,defs:{},path:new on};$y(t,n);const r=t.children,{fillStyle:s,strokeStyle:i}=cf(t,n);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&uf(a,n,s,i)}return e}function uf(t,e,n,r){const s=t.children,{fillStyle:i,strokeStyle:o}=cf(t,e);i&&n?n={...n,...i}:i&&(n=i),o&&r?r={...r,...o}:o&&(r=o);const a=!n&&!r;a&&(n={color:0});let l,c,u,h,f,d,m,y,g,x,b,S,T,I,A,E,V;switch(t.nodeName.toLowerCase()){case"path":{I=t.getAttribute("d");const Y=t.getAttribute("fill-rule"),$=Fy(I),F=Y==="evenodd",ie=$.length>1;if(F&&ie){const Se=$.map(L=>({path:L,area:By(L)}));if(Se.sort((L,H)=>H.area-L.area),$.length>3||!Ly(Se))for(let L=0;L<Se.length;L++){const H=Se[L],Pn=L===0;e.context.beginPath();const ue=new on(void 0,!0);Iu(H.path,ue),e.context.path(ue),Pn?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let L=0;L<Se.length;L++){const H=Se[L],Pn=L%2===1;e.context.beginPath();const ue=new on(void 0,!0);Iu(H.path,ue),e.context.path(ue),Pn?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{const Se=Y?Y==="evenodd":!0;A=new on(I,Se),e.context.path(A),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=ze(t,"cx",0),y=ze(t,"cy",0),g=ze(t,"r",0),e.context.ellipse(m,y,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=ze(t,"x",0),c=ze(t,"y",0),E=ze(t,"width",0),V=ze(t,"height",0),x=ze(t,"rx",0),b=ze(t,"ry",0),x||b?e.context.roundRect(l,c,E,V,x||b):e.context.rect(l,c,E,V),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=ze(t,"cx",0),y=ze(t,"cy",0),x=ze(t,"rx",0),b=ze(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,x,b),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"line":u=ze(t,"x1",0),h=ze(t,"y1",0),f=ze(t,"x2",0),d=ze(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(f,d),r&&e.context.stroke(r);break;case"polygon":T=t.getAttribute("points"),S=T.match(/-?\d+/g).map(Y=>parseInt(Y,10)),e.context.poly(S,!0),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"polyline":T=t.getAttribute("points"),S=T.match(/-?\d+/g).map(Y=>parseInt(Y,10)),e.context.poly(S,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{_t(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(n=null);for(let Y=0;Y<s.length;Y++)uf(s[Y],e,n,r)}function Gy(t){return t.texture!==void 0}const Pu={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 Zy{constructor(e,n){this.uid=Fe("fillPattern"),this._tick=0,this.transform=new le;const r=Gy(e)?e:{texture:e,repetition:n};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const s=r.repetition;s&&(this.texture.source.style.addressModeU=Pu[s].addressModeU,this.texture.source.style.addressModeV=Pu[s].addressModeV)}setTransform(e){if(e){if(this.transform.equals(e))return;this.transform.copyFrom(e)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function jy(t){return ln.isColorLike(t)}function Mu(t){return t instanceof Zy}function Ru(t){return t instanceof Zs}function Vy(t){return t instanceof be}function Hy(t,e,n){const r=ln.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?n.alpha:r.alpha,t.texture=be.WHITE,{...n,...t}}function Wy(t,e,n){return t.texture=e,{...n,...t}}function zu(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function Ou(t,e,n){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function Yy(t,e){const n={...e,...t},r=ln.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function os(t,e){if(t==null)return null;const n={},r=t;return jy(t)?Hy(n,t,e):Vy(t)?Wy(n,t,e):Mu(t)?zu(n,t,e):Ru(t)?Ou(n,t,e):r.fill&&Mu(r.fill)?zu(r,r.fill,e):r.fill&&Ru(r.fill)?Ou(r,r.fill,e):Yy(r,e)}function $u(t,e){const{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...l}=e,c=os(t,l);return c?{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...c}:null}function Xy(t,e){let n=1;const r=t.shapePath.shapePrimitives;for(let s=0;s<r.length;s++){const i=r[s].shape;if(i.type!=="polygon")continue;const o=i.points,a=o.length;if(a<6)continue;const l=i.closePath;for(let c=0;c<a;c+=2){if(!l&&(c===0||c===a-2))continue;const u=(c-2+a)%a,h=(c+2)%a,f=o[u],d=o[u+1],m=o[c],y=o[c+1],g=o[h],x=o[h+1],b=f-m,S=d-y,T=g-m,I=x-y,A=b*b+S*S,E=T*T+I*I;if(A<1e-12||E<1e-12)continue;let $=(b*T+S*I)/Math.sqrt(A*E);$<-1?$=-1:$>1&&($=1);const F=Math.sqrt((1-$)*.5);if(F<1e-6)continue;const ie=Math.min(1/F,e);ie>n&&(n=ie)}}return n}const qy=new et,Nu=new le,Il=class Vt extends Cn{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Fe("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new on,this._transform=new le,this._fillStyle={...Vt.defaultFillStyle},this._strokeStyle={...Vt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new zt,this._boundsDirty=!0}clone(){const e=new Vt;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=os(e,Vt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=$u(e,Vt.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=os(e,Vt.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=os(e,Vt.defaultStrokeStyle),this}texture(e,n,r,s,i,o){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:s||0,dw:i||e.frame.width,dh:o||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:n||n===0?ln.shared.setValue(n).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new on,this}fill(e,n){let r;const s=this.instructions[this.instructions.length-1];return this._tick===0&&(s==null?void 0:s.action)==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(e!=null&&(n!==void 0&&typeof e=="number"&&(Ae(Qe,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=os(e,Vt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:n}=this._activePath.getLastPoint(et.shared);this._activePath.clear(),this._activePath.moveTo(e,n)}stroke(e){let n;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?n=r.data.path:n=this._activePath.clone(),n?(e!=null&&(this._strokeStyle=$u(e,Vt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const n=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(n&&(n.action==="stroke"||n.action==="fill"))if(n.data.hole)n.data.hole.addPath(r);else{n.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,n,r,s,i,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*e+a.c*n+a.tx,a.b*e+a.d*n+a.ty,r,s,i,o),this}arcTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}arcToSvg(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(e,n,r,s,i,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*n+l.tx,l.b*e+l.d*n+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*i+l.c*o+l.tx,l.b*i+l.d*o+l.ty,a),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,n,r,s){return this._tick++,this._activePath.ellipse(e,n,r,s,this._transform.clone()),this}circle(e,n,r){return this._tick++,this._activePath.circle(e,n,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,n){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*n+r.tx,r.b*e+r.d*n+r.ty),this}moveTo(e,n){this._tick++;const r=this._transform,s=this._activePath.instructions,i=r.a*e+r.c*n+r.tx,o=r.b*e+r.d*n+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=i,s[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}rect(e,n,r,s){return this._tick++,this._activePath.rect(e,n,r,s,this._transform.clone()),this}roundRect(e,n,r,s,i){return this._tick++,this._activePath.roundRect(e,n,r,s,i,this._transform.clone()),this}poly(e,n){return this._tick++,this._activePath.poly(e,n,this._transform.clone()),this}regularPoly(e,n,r,s,i=0,o){return this._tick++,this._activePath.regularPoly(e,n,r,s,i,o),this}roundPoly(e,n,r,s,i,o){return this._tick++,this._activePath.roundPoly(e,n,r,s,i,o),this}roundShape(e,n,r,s){return this._tick++,this._activePath.roundShape(e,n,r,s),this}filletRect(e,n,r,s,i){return this._tick++,this._activePath.filletRect(e,n,r,s,i),this}chamferRect(e,n,r,s,i,o){return this._tick++,this._activePath.chamferRect(e,n,r,s,i,o),this}star(e,n,r,s,i=0,o=0){return this._tick++,this._activePath.star(e,n,r,s,i,o,this._transform.clone()),this}svg(e){return this._tick++,Uy(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,n=e){return this._transform.scale(e,n),this}setTransform(e,n,r,s,i,o){return e instanceof le?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,n,r,s,i,o),this)}transform(e,n,r,s,i,o){return e instanceof le?(this._transform.append(e),this):(Nu.set(e,n,r,s,i,o),this._transform.append(Nu),this)}translate(e,n=e){return this._transform.translate(e,n),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 e=this._bounds;e.clear();for(let n=0;n<this.instructions.length;n++){const r=this.instructions[n],s=r.action;if(s==="fill"){const i=r.data;e.addBounds(i.path.bounds)}else if(s==="texture"){const i=r.data;e.addFrame(i.dx,i.dy,i.dx+i.dw,i.dy+i.dh,i.transform)}if(s==="stroke"){const i=r.data,o=i.style.alignment;let a=i.style.width*(1-o);i.style.join==="miter"&&(a*=Xy(i.path,i.style.miterLimit));const l=i.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){var s;if(!this.bounds.containsPoint(e.x,e.y))return!1;const n=this.instructions;let r=!1;for(let i=0;i<n.length;i++){const o=n[i],a=o.data,l=a.path;if(!o.action||!l)continue;const c=a.style,u=l.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const f=u[h].shape;if(!c||!f)continue;const d=u[h].transform,m=d?d.applyInverse(e,qy):e;if(o.action==="fill")r=f.contains(m.x,m.y);else{const g=c;r=f.strokeContains(m.x,m.y,g.width,g.alignment)}const y=a.hole;if(y){const g=(s=y.shapePath)==null?void 0:s.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(m.x,m.y)&&(r=!1)}if(r)return!0}}return r}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!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 e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Il.defaultFillStyle={color:16777215,alpha:1,texture:be.WHITE,matrix:null,fill:null,textureSpace:"local"};Il.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:be.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Kr=Il;class Jy{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Ky{constructor(){this.instructions=new xl}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Pl=class Va{constructor(e){this._renderer=e,this._managedContexts=new Ki({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Va.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Va.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=e._gpuData,r=!!n[this._renderer.uid],s=n[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&s.reset(),s.isBatchable=!1,e.dirty=!1),s}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=new Ky,r=this.getGpuContext(e);return r.graphicsData=n,n.init(),n}_initContext(e){const n=new Jy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Pl.extension={type:[ve.CanvasSystem],name:"graphicsContext"};Pl.defaultOptions={bezierSmoothness:.5};let Qy=Pl;class hf{constructor(e,n){this.state=Zd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ki({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,n){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(n),n.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}hf.extension={type:[ve.CanvasPipes],name:"graphics"};function ex(t,e,n){const r=(t>>24&255)/255;e[n++]=(t&255)/255*r,e[n++]=(t>>8&255)/255*r,e[n++]=(t>>16&255)/255*r,e[n++]=r}class tx{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ht.return(e)}),this.batches.length=0}}class df{constructor(e,n){this.state=Zd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ki({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const n=e.context,r=!!e._gpuData,i=this.renderer.graphicsContext.updateGpuContext(n);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(e,n){const s=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),s.isBatchable?this._addToBatcher(e,n):(this.renderer.renderPipes.batch.break(n),n.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let s=0;s<r.length;s++){const i=r[s];i._batcher.updateElement(i)}}execute(e){if(!e.isRenderable)return;const n=this.renderer,r=e.context;if(!n.graphicsContext.getGpuContext(r).batches.length)return;const i=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const o=i.resources.localUniforms.uniforms;o.uTransformMatrix=e.groupTransform,o.uRound=n._roundPixels|e._roundPixels,ex(e.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const n=this._getGpuDataForRenderable(e),s=this.renderer.graphicsContext.updateGpuContext(e.context);n.destroy(),s.isBatchable&&this._updateBatchesForRenderable(e,n)}_addToBatcher(e,n){const r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(e).batches;for(let i=0;i<s.length;i++){const o=s[i];r.addToBatch(o,n)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const n=new tx;return e._gpuData[this.renderer.uid]=n,this._managedGraphics.add(e),n}_updateBatchesForRenderable(e,n){const r=e.context,i=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|e._roundPixels;n.batches=i.batches.map(a=>{const l=ht.get(Tl);return a.copyTo(l),l.renderable=e,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}df.extension={type:[ve.WebGLPipes,ve.WebGPUPipes],name:"graphics"};yt.add(hf);yt.add(df);yt.add(Qy);yt.add(El);class Ii extends xd{constructor(e){e instanceof Kr&&(e={context:e});const{context:n,roundPixels:r,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",n?this.context=n:(this.context=this._ownedContext=new Kr,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,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(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||(e==null?void 0:e.context)===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,n){return this.context[e](...n),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Ii(this._context.clone()):(this._ownedContext=null,new Ii(this._context))}lineStyle(e,n,r){Ae(Qe,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const s={};return e&&(s.width=e),n&&(s.color=n),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(e,n){Ae(Qe,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return e!==void 0&&(r.color=e),n!==void 0&&(r.alpha=n),this.context.fillStyle=r,this}endFill(){Ae(Qe,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return(e.width!==Kr.defaultStrokeStyle.width||e.color!==Kr.defaultStrokeStyle.color||e.alpha!==Kr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Ae(Qe,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Ae(Qe,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Ae(Qe,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Ae(Qe,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Ae(Qe,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Ae(Qe,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}yt.add(cm,um);const nx={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 rx(t){return{...nx,...t}}var de;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(de||(de={}));var Du;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Du||(Du={}));const D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_n=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}},P=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class cn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof cn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}cn.create=t=>new cn(t);const Ha=(t,e)=>{let n;switch(t.code){case P.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case P.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case P.invalid_union:n="Invalid input";break;case P.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case P.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case P.invalid_arguments:n="Invalid function arguments";break;case P.invalid_return_type:n="Invalid function return type";break;case P.invalid_date:n="Invalid date";break;case P.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case P.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case P.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case P.custom:n="Invalid input";break;case P.invalid_intersection_types:n="Intersection results could not be merged";break;case P.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case P.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}};let sx=Ha;function ix(){return sx}const ox=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function N(t,e){const n=ix(),r=ox({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ha?void 0:Ha].filter(s=>!!s)});t.common.issues.push(r)}class lt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return X;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return lt.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return X;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const X=Object.freeze({status:"aborted"}),as=t=>({status:"dirty",value:t}),St=t=>({status:"valid",value:t}),Lu=t=>t.status==="aborted",Fu=t=>t.status==="dirty",Pr=t=>t.status==="valid",Pi=t=>typeof Promise<"u"&&t instanceof Promise;var U;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(U||(U={}));class Yt{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Bu=(t,e)=>{if(Pr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new cn(t.common.issues);return this._error=n,this._error}}};function ee(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let se=class{get description(){return this._def.description}_getType(e){return _n(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:_n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new lt,ctx:{common:e.parent.common,data:e.data,parsedType:_n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Pi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_n(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Bu(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_n(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Pr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Pr(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_n(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Pi(s)?s:Promise.resolve(s));return Bu(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:P.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Kn({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return an.create(this,this._def)}nullable(){return Qn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mr.create(this)}promise(){return Di.create(this,this._def)}or(e){return Oi.create([this,e],this._def)}and(e){return $i.create(this,e,this._def)}transform(e){return new Kn({...ee(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Li({...ee(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new _f({typeName:q.ZodBranded,type:this,...ee(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Fi({...ee(this._def),innerType:this,catchValue:n,typeName:q.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ml.create(this,e)}readonly(){return Bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const ax=/^c[^\s-]{8,}$/i,lx=/^[0-9a-z]+$/,cx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ux=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hx=/^[a-z0-9_-]{21}$/i,dx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,px=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ia;const gx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_x=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ff="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wx=new RegExp(`^${ff}$`);function pf(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function kx(t){return new RegExp(`^${pf(t)}$`)}function Sx(t){let e=`${ff}T${pf(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Tx(t,e){return!!((e==="v4"||!e)&&gx.test(t)||(e==="v6"||!e)&&yx.test(t))}function Ax(t,e){if(!dx.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Cx(t,e){return!!((e==="v4"||!e)&&_x.test(t)||(e==="v6"||!e)&&xx.test(t))}let Mi=class ls extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.string,received:i.parsedType}),X}const r=new lt;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?N(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")px.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")ia||(ia=new RegExp(mx,"u")),ia.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ux.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")hx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"nanoid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ax.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")lx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")cx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:P.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"regex",code:P.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Sx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?wx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?kx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?fx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"duration",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Tx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Ax(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"jwt",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Cx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cidr",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?bx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?vx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64url",code:P.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:P.invalid_string,...U.errToObj(r)})}_addCheck(e){return new ls({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...U.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...U.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...U.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...U.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...U.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...U.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...U.errToObj(n)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new ls({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ls({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ls({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Mi.create=t=>new Mi({checks:[],typeName:q.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ee(t)});function Ex(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let Wa=class Ya extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.number,received:i.parsedType}),X}let r;const s=new lt;for(const i of this._def.checks)i.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:P.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Ex(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_finite,message:i.message}),s.dirty()):de.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new Ya({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new Ya({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Wa.create=t=>new Wa({checks:[],typeName:q.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ee(t)});class Ts extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r;const s=new lt;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),N(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):de.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:D.bigint,received:n.parsedType}),X}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new Ts({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new Ts({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ts.create=t=>new Ts({checks:[],typeName:q.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ee(t)});let Xa=class extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.boolean,received:r.parsedType}),X}return St(e.data)}};Xa.create=t=>new Xa({typeName:q.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ee(t)});class Ri extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_type,expected:D.date,received:i.parsedType}),X}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return N(i,{code:P.invalid_date}),X}const r=new lt;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ri({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ri.create=t=>new Ri({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:q.ZodDate,...ee(t)});class Uu extends se{_parse(e){if(this._getType(e)!==D.symbol){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.symbol,received:r.parsedType}),X}return St(e.data)}}Uu.create=t=>new Uu({typeName:q.ZodSymbol,...ee(t)});class qa extends se{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.undefined,received:r.parsedType}),X}return St(e.data)}}qa.create=t=>new qa({typeName:q.ZodUndefined,...ee(t)});class zi extends se{_parse(e){if(this._getType(e)!==D.null){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.null,received:r.parsedType}),X}return St(e.data)}}zi.create=t=>new zi({typeName:q.ZodNull,...ee(t)});let Gu=class extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return St(e.data)}};Gu.create=t=>new Gu({typeName:q.ZodAny,...ee(t)});let Ja=class extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return St(e.data)}};Ja.create=t=>new Ja({typeName:q.ZodUnknown,...ee(t)});let An=class extends se{_parse(e){const n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:D.never,received:n.parsedType}),X}};An.create=t=>new An({typeName:q.ZodNever,...ee(t)});class Zu extends se{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.void,received:r.parsedType}),X}return St(e.data)}}Zu.create=t=>new Zu({typeName:q.ZodVoid,...ee(t)});let Mr=class ki extends se{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==D.array)return N(n,{code:P.invalid_type,expected:D.array,received:n.parsedType}),X;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(N(n,{code:o?P.too_big:P.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(N(n,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(N(n,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Yt(n,o,n.path,a)))).then(o=>lt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Yt(n,o,n.path,a)));return lt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new ki({...this._def,minLength:{value:e,message:U.toString(n)}})}max(e,n){return new ki({...this._def,maxLength:{value:e,message:U.toString(n)}})}length(e,n){return new ki({...this._def,exactLength:{value:e,message:U.toString(n)}})}nonempty(e){return this.min(1,e)}};Mr.create=(t,e)=>new Mr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...ee(e)});function gr(t){if(t instanceof un){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=an.create(gr(r))}return new un({...t._def,shape:()=>e})}else return t instanceof Mr?new Mr({...t._def,type:gr(t.element)}):t instanceof an?an.create(gr(t.unwrap())):t instanceof Qn?Qn.create(gr(t.unwrap())):t instanceof Jn?Jn.create(t.items.map(e=>gr(e))):t}let un=class Pt extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){const c=this._getOrReturnCtx(e);return N(c,{code:P.invalid_type,expected:D.object,received:c.parsedType}),X}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof An&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],h=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Yt(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof An){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(N(s,{code:P.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const h=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Yt(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const h=await u.key,f=await u.value;c.push({key:h,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>lt.mergeObjectSync(r,c)):lt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new Pt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:U.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Pt({...this._def,unknownKeys:"strip"})}passthrough(){return new Pt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Pt({...this._def,catchall:e})}pick(e){const n={};for(const r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Pt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Pt({...this._def,shape:()=>n})}deepPartial(){return gr(this)}partial(e){const n={};for(const r of de.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Pt({...this._def,shape:()=>n})}required(e){const n={};for(const r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof an;)i=i._def.innerType;n[r]=i}return new Pt({...this._def,shape:()=>n})}keyof(){return gf(de.objectKeys(this.shape))}};un.create=(t,e)=>new un({shape:()=>t,unknownKeys:"strip",catchall:An.create(),typeName:q.ZodObject,...ee(e)});un.strictCreate=(t,e)=>new un({shape:()=>t,unknownKeys:"strict",catchall:An.create(),typeName:q.ZodObject,...ee(e)});un.lazycreate=(t,e)=>new un({shape:t,unknownKeys:"strip",catchall:An.create(),typeName:q.ZodObject,...ee(e)});let Oi=class extends se{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new cn(a.ctx.common.issues));return N(n,{code:P.invalid_union,unionErrors:o}),X}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new cn(l));return N(n,{code:P.invalid_union,unionErrors:a}),X}}get options(){return this._def.options}};Oi.create=(t,e)=>new Oi({options:t,typeName:q.ZodUnion,...ee(e)});const Qt=t=>t instanceof el?Qt(t.schema):t instanceof Kn?Qt(t.innerType()):t instanceof Ni?[t.value]:t instanceof eo?t.options:t instanceof nl?de.objectValues(t.enum):t instanceof Li?Qt(t._def.innerType):t instanceof qa?[void 0]:t instanceof zi?[null]:t instanceof an?[void 0,...Qt(t.unwrap())]:t instanceof Qn?[null,...Qt(t.unwrap())]:t instanceof _f||t instanceof Bi?Qt(t.unwrap()):t instanceof Fi?Qt(t._def.innerType):[];let Ix=class mf extends se{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return N(n,{code:P.invalid_type,expected:D.object,received:n.parsedType}),X;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=Qt(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new mf({typeName:q.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ee(r)})}};function Ka(t,e){const n=_n(t),r=_n(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){const s=de.objectKeys(e),i=de.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Ka(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Ka(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let $i=class extends se{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Lu(i)||Lu(o))return X;const a=Ka(i.value,o.value);return a.valid?((Fu(i)||Fu(o))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:P.invalid_intersection_types}),X)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};$i.create=(t,e,n)=>new $i({left:t,right:e,typeName:q.ZodIntersection,...ee(n)});class Jn extends se{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return N(r,{code:P.invalid_type,expected:D.array,received:r.parsedType}),X;if(r.data.length<this._def.items.length)return N(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Yt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>lt.mergeArray(n,o)):lt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Jn({...this._def,rest:e})}}Jn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jn({items:t,typeName:q.ZodTuple,rest:null,...ee(e)})};let Px=class Qa extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return N(r,{code:P.invalid_type,expected:D.object,received:r.parsedType}),X;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Yt(r,a,r.path,a)),value:o._parse(new Yt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?lt.mergeObjectAsync(n,s):lt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof se?new Qa({keyType:e,valueType:n,typeName:q.ZodRecord,...ee(r)}):new Qa({keyType:Mi.create(),valueType:e,typeName:q.ZodRecord,...ee(n)})}};class ju extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return N(r,{code:P.invalid_type,expected:D.map,received:r.parsedType}),X;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Yt(r,a,r.path,[c,"key"])),value:i._parse(new Yt(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return X;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return X;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}ju.create=(t,e,n)=>new ju({valueType:e,keyType:t,typeName:q.ZodMap,...ee(n)});class As extends se{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return N(r,{code:P.invalid_type,expected:D.set,received:r.parsedType}),X;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(N(r,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(N(r,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return X;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Yt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new As({...this._def,minSize:{value:e,message:U.toString(n)}})}max(e,n){return new As({...this._def,maxSize:{value:e,message:U.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}As.create=(t,e)=>new As({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...ee(e)});let el=class extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};el.create=(t,e)=>new el({getter:t,typeName:q.ZodLazy,...ee(e)});let Ni=class extends se{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return N(n,{received:n.data,code:P.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ni.create=(t,e)=>new Ni({value:t,typeName:q.ZodLiteral,...ee(e)});function gf(t,e){return new eo({values:t,typeName:q.ZodEnum,...ee(e)})}let eo=class tl extends se{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return N(n,{expected:de.joinValues(r),received:n.parsedType,code:P.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return N(n,{received:n.data,code:P.invalid_enum_value,options:r}),X}return St(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return tl.create(e,{...this._def,...n})}exclude(e,n=this._def){return tl.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};eo.create=gf;class nl extends se{_parse(e){const n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){const s=de.objectValues(n);return N(r,{expected:de.joinValues(s),received:r.parsedType,code:P.invalid_type}),X}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=de.objectValues(n);return N(r,{received:r.data,code:P.invalid_enum_value,options:s}),X}return St(e.data)}get enum(){return this._def.values}}nl.create=(t,e)=>new nl({values:t,typeName:q.ZodNativeEnum,...ee(e)});class Di extends se{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return N(n,{code:P.invalid_type,expected:D.promise,received:n.parsedType}),X;const r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return St(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Di.create=(t,e)=>new Di({type:t,typeName:q.ZodPromise,...ee(e)});class Kn extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{N(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return X;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?X:l.status==="dirty"||n.value==="dirty"?as(l.value):l});{if(n.value==="aborted")return X;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?X:a.status==="dirty"||n.value==="dirty"?as(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Pr(o))return X;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Pr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):X);de.assertNever(s)}}Kn.create=(t,e,n)=>new Kn({schema:t,typeName:q.ZodEffects,effect:e,...ee(n)});Kn.createWithPreprocess=(t,e,n)=>new Kn({schema:e,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...ee(n)});let an=class extends se{_parse(e){return this._getType(e)===D.undefined?St(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};an.create=(t,e)=>new an({innerType:t,typeName:q.ZodOptional,...ee(e)});let Qn=class extends se{_parse(e){return this._getType(e)===D.null?St(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qn.create=(t,e)=>new Qn({innerType:t,typeName:q.ZodNullable,...ee(e)});let Li=class extends se{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Li.create=(t,e)=>new Li({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ee(e)});let Fi=class extends se{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new cn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new cn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Fi.create=(t,e)=>new Fi({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ee(e)});class Vu extends se{_parse(e){if(this._getType(e)!==D.nan){const r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:D.nan,received:r.parsedType}),X}return{status:"valid",value:e.data}}}Vu.create=t=>new Vu({typeName:q.ZodNaN,...ee(t)});class _f extends se{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ml extends se{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?X:i.status==="dirty"?(n.dirty(),as(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?X:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Ml({in:e,out:n,typeName:q.ZodPipeline})}}let Bi=class extends se{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Pr(s)&&(s.value=Object.freeze(s.value)),s);return Pi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Bi.create=(t,e)=>new Bi({innerType:t,typeName:q.ZodReadonly,...ee(e)});var q;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(q||(q={}));const G=Mi.create,j=Wa.create,gt=Xa.create,rl=zi.create,Rl=Ja.create;An.create;const Rr=Mr.create,J=un.create,Xt=Oi.create,Mx=Ix.create;$i.create;Jn.create;const kt=Px.create,Q=Ni.create,nt=eo.create;Di.create;an.create;Qn.create;const tt=G().trim().min(1),$r=G().trim().min(1),to=j().finite().positive(),zl=J({status:nt(["available","sold"]),soldToPlayerId:tt.optional(),soldAt:$r.optional()});J({id:tt,spaceId:tt,type:nt(["book","music","coffee"]),name:tt,description:G(),priceUsd:to,createdAt:$r,sale:zl});J({id:tt,spaceId:tt,row:Xt([Q(1),Q(2),Q(3),Q(4)]),column:Xt([Q(1),Q(2),Q(3),Q(4),Q(5)]),name:tt,description:G(),priceUsd:to,createdAt:$r,sale:zl});const Rx=G().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color");J({id:tt,spaceId:tt,slot:Xt([Q(1),Q(2),Q(3),Q(4),Q(5),Q(6),Q(7),Q(8),Q(9)]),name:tt,model:tt,year:j().int().min(1900).max(3e3),priceUsd:to,colorHex:Rx,createdAt:$r,sale:zl});J({playerId:tt,balanceUsd:j().finite().nonnegative(),currency:Q("USD"),updatedAt:$r,powerUps:j().int().nonnegative().default(0)});const zx=J({id:tt,playerId:tt,spaceId:tt,amenityKind:nt(["shop","supermarket","car_wash","parking","house","talk_time","wallet_bundle","apu_credit","apu_debit"]),itemRef:J({kind:nt(["shop","supermarket","carwash","parking","house","game","apu","talk","bundle"]),id:tt}),priceUsd:to.optional(),at:$r,detail:G().optional(),powerUpsSpent:j().int().positive().optional(),powerUpsEarned:j().int().positive().optional(),powerUpsDelta:j().int().optional(),debitSource:G().optional(),creditSource:G().optional(),counterpartyNodeId:G().optional(),token:Q("APU").optional()}),Si=G().trim().min(1),Hu=G().trim().min(1),Ox=j().finite().positive(),$x=G().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color"),yf=nt(["1h","12h","1d","3d","7d","1mo","3mo","1y","forever"]),Nx=Xt([Q(1),Q(2),Q(3),Q(4)]),Dx=Xt([Q(1),Q(2)]),Lx=J({nodeId:Si,carPurchaseId:Si,displayNick:G().trim().min(1).max(24),colorHex:$x,model:Si,tier:yf,purchasedAt:Hu,expiresAt:Hu.nullable()}),Fx=J({id:Si,bay:Nx,layer:Dx,occupant:Lx.nullable()});J({spots:Rr(Fx).length(8),rates:kt(yf,Ox)});const oa=G().trim().min(1),Bx=G().trim().min(1),Ux=j().finite().positive(),Gx=G().trim().min(1).max(40),Zx=G().trim().min(1).max(8),jx=G().trim().min(1).max(24),Wu=Xt([Q(1),Q(2),Q(3),Q(4)]),Vx=Xt([Q(1),Q(2),Q(3),Q(4)]),Hx=J({id:oa,houseId:Wu,bay:Vx,worldX:j().finite(),priceUsd:Ux,layoutId:Wu,layoutLabel:oa,ownerNodeId:oa.nullable(),ownerDisplayName:jx.nullable(),ownerName:Gx.nullable(),ownerSignature:Zx.nullable(),purchasedAt:Bx.nullable()});J({houses:Rr(Hx).length(4)});const Wx=new Set(["hidden-gems","map-recall","price-check","signal-hunt","delivery-dash","lease-locker","talk-timer","daily-rotator"]),Yx=t=>Wx.has(t),Xx=Mx("type",[J({type:Q("chest_open"),correct:gt(),tutorial:gt().optional()}),J({type:Q("sequence_step"),correct:gt(),tutorial:gt().optional()}),J({type:Q("price_guess"),correct:gt(),round:j().int().min(1)}),J({type:Q("signal_pick"),correct:gt()}),J({type:Q("delivery_finish"),band:nt(["fast","ok","slow"]),hits:j().int().min(0)}),J({type:Q("door_pick"),correct:gt()}),J({type:Q("talk_release"),success:gt(),round:j().int().min(1).max(3)})]);J({gameId:G().refine(Yx,"invalid gameId"),roundId:G().min(1),events:Rr(Xx).min(1)});const qx=J({plays:j().int().min(0),bestNetPu:j().int()});J({dayStreak:j().int().min(0),bestStreak:j().int().min(0),puEarnedToday:j().int().min(0),puCapRemaining:j().int().min(0),gamesPlayedToday:j().int().min(0),featuredGameId:G(),firstGamePlayed:gt(),perGame:kt(G(),qx)});const Sn=G().trim().min(1),qt=G().trim().min(1),Jx=nt(["purchase","redeemWalletBundle","applyGameOutcome","talkTick","talkStop","talkStart","walletSeeded"]),Kx=zx.extend({hostId:Sn,indexedAt:qt,op:Jx,blockRev:j().int().nonnegative().optional(),merkleRootHex:G().optional()});J({rev:j().int().nonnegative(),merkleRootHex:G(),merkleLeafCount:j().int().nonnegative(),at:qt,occupantCount:j().int().nonnegative().optional(),leafDeltaCount:j().int().nonnegative().optional(),label:G().optional()});const xf=nt(["pending","running","completed","failed"]);J({status:xf,cursor:G(),totalIndexed:j().int().nonnegative(),startedAt:qt,completedAt:qt.optional(),error:G().optional()});J({playerId:Sn,balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),updatedAt:qt});J({generatedAt:qt,hostId:Sn,snapshotRev:j().int().nonnegative(),merkleRootHex:G().nullable(),merkleLeafCount:j().int().nonnegative().nullable(),sid:G().nullable(),txsLast24h:j().int().nonnegative(),apuMintedLast24h:j().int().nonnegative(),apuBurnedLast24h:j().int().nonnegative(),migrationStatus:xf});const Qx=nt(["main","agent","unknown"]),eb=J({balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),currency:Q("USD"),updatedAt:qt}),tb=J({txCount:j().int().nonnegative(),usdSpent:j().finite().nonnegative(),apuMinted:j().int().nonnegative(),apuBurned:j().int().nonnegative(),lastTxAt:qt.nullable()}),nb=J({byAmenityKind:kt(G(),j().int().nonnegative()),bySpaceId:kt(G(),j().int().nonnegative()),byToken:J({usd:j().finite().nonnegative(),apu:j().int().nonnegative()})}),rb=J({eventsLast24h:j().int().nonnegative(),topEvents:Rr(J({event:Sn,count:j().int().nonnegative()}))});J({nodeId:Sn,kind:Qx,generatedAt:qt,wallet:eb.nullable(),ledger:tb,breakdown:nb,txs:Rr(Kx),txsNextCursor:G().nullable(),gameStats:J({dayStreak:j().int().min(0),bestStreak:j().int().min(0),puEarnedToday:j().int().min(0),puCapRemaining:j().int().min(0),gamesPlayedToday:j().int().min(0),featuredGameId:G(),firstGamePlayed:gt(),perGame:kt(G(),J({plays:j().int().min(0),bestNetPu:j().int()}))}).nullable(),analyticsEvents:Rr(J({messageId:Sn,event:Sn,distinctId:Sn,timestamp:qt,properties:kt(Xt([G(),j(),gt(),rl()]))})),analyticsEventsNextCursor:G().nullable(),analytics:rb,traits:kt(Xt([G(),j(),gt(),rl()]))});const gs=G().trim().min(1),Ui=G().trim().min(1),bf=Xt([G(),j(),gt(),rl()]),sb=J({hostId:gs,sid:G().optional(),snapshotRev:j().int().nonnegative().optional(),library:nt(["agent-play-server","agent-play-client"])});J({messageId:gs,event:gs,distinctId:gs,timestamp:Ui,properties:kt(bf),context:sb.optional()});J({distinctId:gs,traits:kt(bf),timestamp:Ui});const ib=nt(["pending","running","completed","failed"]);J({status:ib,cursor:G(),totalIndexed:j().int().nonnegative(),startedAt:Ui,completedAt:Ui.optional(),error:G().optional()});function ob(){return["park","new_york","tokyo"]}const ab="agent-play-preview-view-settings-v2",lb="agent-play-deep-logs",cb=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function ub(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function hb(){if(typeof window>"u")return!1;const t=window.location.hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function vf(t){const e=t.trim().toLowerCase();if(e==="on"||e==="true"||e==="1")return!0;if(e==="off"||e==="false"||e==="0")return!1}function db(){if(typeof window>"u")return;const e=new URL(window.location.href).searchParams.get("deepLogs");if(e!==null)return vf(e)}function fb(){if(typeof localStorage>"u")return;const t=localStorage.getItem(lb);if(!(t===null||t.length===0))return vf(t)}function pb(){const t=db();return t!==void 0?t:fb()}function wf(t){return t==="default"||t==="ember"||t==="forest"}function kf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function Sf(t){return cb.includes(t)}function br(){return{themeId:"park",showChatUi:!0,debugMode:ub(),debugOccupancyQuartiles:!1,debugOccupancyFreeGrids:!1,worldGeographyEnabled:!1,joystickEnabled:!0,stationaryPanels:!1,p2aEnabled:!1,deepLogsEnabled:hb(),profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function Tf(t){return ob().includes(t)}function mb(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.themeId=="string"&&Tf(n.themeId)&&(r.themeId=n.themeId),typeof n.showChatUi=="boolean"&&(r.showChatUi=n.showChatUi),typeof n.debugMode=="boolean"&&(r.debugMode=n.debugMode),typeof n.debugOccupancyQuartiles=="boolean"&&(r.debugOccupancyQuartiles=n.debugOccupancyQuartiles),typeof n.debugOccupancyFreeGrids=="boolean"&&(r.debugOccupancyFreeGrids=n.debugOccupancyFreeGrids),typeof n.worldGeographyEnabled=="boolean"&&(r.worldGeographyEnabled=n.worldGeographyEnabled),typeof n.joystickEnabled=="boolean"&&(r.joystickEnabled=n.joystickEnabled),typeof n.stationaryPanels=="boolean"&&(r.stationaryPanels=n.stationaryPanels),typeof n.p2aEnabled=="boolean"&&(r.p2aEnabled=n.p2aEnabled),typeof n.deepLogsEnabled=="boolean"&&(r.deepLogsEnabled=n.deepLogsEnabled),typeof n.profileAvatarPresetId=="string"&&wf(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&kf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&Sf(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Yu=br();function gb(t){const e=Tf(t.themeId)?t.themeId:br().themeId,n=wf(t.profileAvatarPresetId)?t.profileAvatarPresetId:br().profileAvatarPresetId,r=kf(t.profileGender)?t.profileGender:br().profileGender,s=Sf(t.language)?t.language:br().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,debugOccupancyQuartiles:t.debugOccupancyQuartiles,debugOccupancyFreeGrids:t.debugOccupancyFreeGrids,worldGeographyEnabled:t.worldGeographyEnabled,joystickEnabled:t.joystickEnabled,stationaryPanels:t.stationaryPanels,p2aEnabled:t.p2aEnabled,deepLogsEnabled:t.deepLogsEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function _b(){const t=mb(typeof localStorage<"u"?localStorage.getItem(ab):null),e={...br(),...t},n=pb();return Yu=gb({...e,...n!==void 0?{deepLogsEnabled:n}:{}}),{...Yu}}typeof localStorage<"u"&&_b();var yb=/^[a-z][a-z0-9-]*$/;function xb(t){const e=t.trim(),n=e.indexOf("://");if(n<=0)throw new Error("invalid intercom-address");const r=e.slice(0,n).trim().toLowerCase(),s=e.slice(n+3).trim();if(!yb.test(r)||!r.endsWith("-intercom"))throw new Error("invalid intercom-address");if(s.length===0)throw new Error("invalid intercom-address");return{protocol:r,value:s}}function bb(t){return xb(t).value}var Le=G().trim().min(1),Ol=G().trim().transform(t=>(bb(t),t)),vb=J({requestId:Le,mainNodeId:Le,fromPlayerId:Le,toPlayerId:Le,kind:nt(["assist","chat","realtime"]),toolName:G().optional(),args:kt(G(),Rl()).optional(),text:G().optional(),intercomAddress:Ol.optional()}).superRefine((t,e)=>{t.kind==="assist"&&(t.toolName??"").trim().length===0&&e.addIssue({code:P.custom,path:["toolName"],message:"toolName is required for assist"}),t.kind==="chat"&&(t.text??"").trim().length===0&&e.addIssue({code:P.custom,path:["text"],message:"text is required for chat"})});J({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:nt(["assist","chat","realtime"]),status:nt(["started","stream","completed","failed","forwarded"]),toolName:G().optional(),message:G().optional(),result:kt(G(),Rl()).optional(),error:G().nullable().optional(),ts:Le,channelKey:G().optional(),intercomAddress:Ol.optional(),command:vb.optional()});J({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:nt(["assist","chat","realtime"]),status:nt(["stream","completed","failed"]),toolName:G().optional(),message:G().optional(),result:kt(G(),Rl()).optional(),error:G().nullable().optional(),ts:Le,intercomAddress:Ol.optional()}).superRefine((t,e)=>{t.status==="failed"&&(t.error??"").trim().length===0&&e.addIssue({code:P.custom,path:["error"],message:"error is required when status is failed"})});J({consent:Q(!0),nodeId:Le,passwHash:Le}).strict();J({requestId:Le,mainNodeId:Le,fromPlayerId:Le,message:Le}).strict();new TextEncoder;/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Xu(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wb(t){if(Array.isArray(t))return t}function kb(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){c=!0,s=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}function Sb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
240
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tb(t,e){return wb(t)||kb(t,e)||Ab(t,e)||Sb()}function Ab(t,e){if(t){if(typeof t=="string")return Xu(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xu(t,e):void 0}}const Af=Object.entries,qu=Object.setPrototypeOf,Cb=Object.isFrozen,Eb=Object.getPrototypeOf,Ib=Object.getOwnPropertyDescriptor;let Ye=Object.freeze,Xe=Object.seal,_r=Object.create,Cf=typeof Reflect<"u"&&Reflect,sl=Cf.apply,il=Cf.construct;Ye||(Ye=function(e){return e});Xe||(Xe=function(e){return e});sl||(sl=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});il||(il=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});const Qr=Be(Array.prototype.forEach),Pb=Be(Array.prototype.lastIndexOf),Ju=Be(Array.prototype.pop),fr=Be(Array.prototype.push),Mb=Be(Array.prototype.splice),yn=Array.isArray,cs=Be(String.prototype.toLowerCase),aa=Be(String.prototype.toString),Ku=Be(String.prototype.match),es=Be(String.prototype.replace),Qu=Be(String.prototype.indexOf),Rb=Be(String.prototype.trim),zb=Be(Number.prototype.toString),Ob=Be(Boolean.prototype.toString),eh=typeof BigInt>"u"?null:Be(BigInt.prototype.toString),th=typeof Symbol>"u"?null:Be(Symbol.prototype.toString),Ze=Be(Object.prototype.hasOwnProperty),ts=Be(Object.prototype.toString),He=Be(RegExp.prototype.test),Bn=$b(TypeError);function Be(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return sl(t,e,r)}}function $b(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return il(t,n)}}function oe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cs;if(qu&&qu(t,null),!yn(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(Cb(e)||(e[r]=i),s=i)}t[s]=!0}return t}function Nb(t){for(let e=0;e<t.length;e++)Ze(t,e)||(t[e]=null);return t}function it(t){const e=_r(null);for(const r of Af(t)){var n=Tb(r,2);const s=n[0],i=n[1];Ze(t,s)&&(yn(i)?e[s]=Nb(i):i&&typeof i=="object"&&i.constructor===Object?e[s]=it(i):e[s]=i)}return e}function Db(t){switch(typeof t){case"string":return t;case"number":return zb(t);case"boolean":return Ob(t);case"bigint":return eh?eh(t):"0";case"symbol":return th?th(t):"Symbol()";case"undefined":return ts(t);case"function":case"object":{if(t===null)return ts(t);const e=t,n=Ht(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:ts(r)}return ts(t)}default:return ts(t)}}function Ht(t,e){for(;t!==null;){const r=Ib(t,e);if(r){if(r.get)return Be(r.get);if(typeof r.value=="function")return Be(r.value)}t=Eb(t)}function n(){return null}return n}function Lb(t){try{return He(t,""),!0}catch{return!1}}const nh=Ye(["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"]),la=Ye(["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"]),ca=Ye(["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"]),Fb=Ye(["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"]),ua=Ye(["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"]),Bb=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rh=Ye(["#text"]),sh=Ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),ha=Ye(["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"]),ih=Ye(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),fi=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ub=Xe(/{{[\w\W]*|^[\w\W]*}}/g),Gb=Xe(/<%[\w\W]*|^[\w\W]*%>/g),Zb=Xe(/\${[\w\W]*/g),jb=Xe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Vb=Xe(/^aria-[\-\w]+$/),oh=Xe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hb=Xe(/^(?:\w+script|data):/i),Wb=Xe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yb=Xe(/^html$/i),Xb=Xe(/^[a-z][.\w]*(-[.\w]+)+$/i),ah=Xe(/<[/\w!]/g),qb=Xe(/<[/\w]/g),Jb=Xe(/<\/no(script|embed|frames)/i),Kb=Xe(/\/>/i),Zt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Qb=function(){return typeof window>"u"?null:window},e0=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},lh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},mn=function(e,n,r,s){return Ze(e,n)&&yn(e[n])?oe(s.base?it(s.base):{},e[n],s.transform):r};function Ef(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qb();const e=O=>Ef(O);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==Zt.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,s=r.currentScript;t.DocumentFragment;const i=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,h=t.trustedTypes,f=a.prototype,d=Ht(f,"cloneNode"),m=Ht(f,"remove"),y=Ht(f,"nextSibling"),g=Ht(f,"childNodes"),x=Ht(f,"parentNode"),b=Ht(f,"shadowRoot"),S=Ht(f,"attributes"),T=o&&o.prototype?Ht(o.prototype,"nodeType"):null,I=o&&o.prototype?Ht(o.prototype,"nodeName"):null;if(typeof i=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let A,E="",V,Y=!1,$=0;const F=function(){if($>0)throw Bn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ie=function(_){F(),$++;try{return A.createHTML(_)}finally{$--}},ke=function(_){F(),$++;try{return A.createScriptURL(_)}finally{$--}},Se=function(){return Y||(V=e0(h,s),Y=!0),V},At=n,L=At.implementation,H=At.createNodeIterator,Pn=At.createDocumentFragment,ue=At.getElementsByTagName,Dt=r.importNode;let ye=lh();e.isSupported=typeof Af=="function"&&typeof x=="function"&&L&&L.createHTMLDocument!==void 0;const Mn=Ub,Rn=Gb,Hs=Zb,rr=jb,zn=Vb,Ws=Hb,Fr=Wb,sr=Xb;let On=oh,we=null;const Lt=oe({},[...nh,...la,...ca,...ua,...rh]);let pe=null;const Ft=oe({},[...sh,...ha,...ih,...fi]);let me=Object.seal(_r(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}})),$n=null,Br=null;const Bt=Object.seal(_r(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let fo=!0,po=!0,ac=!1,lc=!0,fn=!1,Ur=!0,Nn=!1,mo=!1,go=null,_o=null,yo=!1,ir=!1,Ys=!1,Xs=!1,cc=!0,uc=!1;const hc="user-content-";let xo=!0,bo=!1,or={},Ut=null;const vo=oe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let dc=null;const fc=oe({},["audio","video","img","source","image","track"]);let wo=null;const pc=oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qs="http://www.w3.org/1998/Math/MathML",Js="http://www.w3.org/2000/svg",Gt="http://www.w3.org/1999/xhtml";let ar=Gt,ko=!1,So=null;const Zp=oe({},[qs,Js,Gt],aa),mc=Ye(["mi","mo","mn","ms","mtext"]);let To=oe({},mc);const gc=Ye(["annotation-xml"]);let Ao=oe({},gc);const jp=oe({},["title","style","font","a","script"]);let Gr=null;const Vp=["application/xhtml+xml","text/html"],Hp="text/html";let Re=null,lr=null;const Wp=n.createElement("form"),_c=function(_){return _ instanceof RegExp||_ instanceof Function},Co=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(lr&&lr===_)return;(!_||typeof _!="object")&&(_={}),_=it(_),Gr=Vp.indexOf(_.PARSER_MEDIA_TYPE)===-1?Hp:_.PARSER_MEDIA_TYPE,Re=Gr==="application/xhtml+xml"?aa:cs,we=mn(_,"ALLOWED_TAGS",Lt,{transform:Re}),pe=mn(_,"ALLOWED_ATTR",Ft,{transform:Re}),So=mn(_,"ALLOWED_NAMESPACES",Zp,{transform:aa}),wo=mn(_,"ADD_URI_SAFE_ATTR",pc,{transform:Re,base:pc}),dc=mn(_,"ADD_DATA_URI_TAGS",fc,{transform:Re,base:fc}),Ut=mn(_,"FORBID_CONTENTS",vo,{transform:Re}),$n=mn(_,"FORBID_TAGS",it({}),{transform:Re}),Br=mn(_,"FORBID_ATTR",it({}),{transform:Re}),or=Ze(_,"USE_PROFILES")?_.USE_PROFILES&&typeof _.USE_PROFILES=="object"?it(_.USE_PROFILES):_.USE_PROFILES:!1,fo=_.ALLOW_ARIA_ATTR!==!1,po=_.ALLOW_DATA_ATTR!==!1,ac=_.ALLOW_UNKNOWN_PROTOCOLS||!1,lc=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fn=_.SAFE_FOR_TEMPLATES||!1,Ur=_.SAFE_FOR_XML!==!1,Nn=_.WHOLE_DOCUMENT||!1,ir=_.RETURN_DOM||!1,Ys=_.RETURN_DOM_FRAGMENT||!1,Xs=_.RETURN_TRUSTED_TYPE||!1,yo=_.FORCE_BODY||!1,cc=_.SANITIZE_DOM!==!1,uc=_.SANITIZE_NAMED_PROPS||!1,xo=_.KEEP_CONTENT!==!1,bo=_.IN_PLACE||!1,On=Lb(_.ALLOWED_URI_REGEXP)?_.ALLOWED_URI_REGEXP:oh,ar=typeof _.NAMESPACE=="string"?_.NAMESPACE:Gt,To=Ze(_,"MATHML_TEXT_INTEGRATION_POINTS")&&_.MATHML_TEXT_INTEGRATION_POINTS&&typeof _.MATHML_TEXT_INTEGRATION_POINTS=="object"?it(_.MATHML_TEXT_INTEGRATION_POINTS):oe({},mc),Ao=Ze(_,"HTML_INTEGRATION_POINTS")&&_.HTML_INTEGRATION_POINTS&&typeof _.HTML_INTEGRATION_POINTS=="object"?it(_.HTML_INTEGRATION_POINTS):oe({},gc);const w=Ze(_,"CUSTOM_ELEMENT_HANDLING")&&_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING=="object"?it(_.CUSTOM_ELEMENT_HANDLING):_r(null);if(me=_r(null),Ze(w,"tagNameCheck")&&_c(w.tagNameCheck)&&(me.tagNameCheck=w.tagNameCheck),Ze(w,"attributeNameCheck")&&_c(w.attributeNameCheck)&&(me.attributeNameCheck=w.attributeNameCheck),Ze(w,"allowCustomizedBuiltInElements")&&typeof w.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=w.allowCustomizedBuiltInElements),Xe(me),fn&&(po=!1),Ys&&(ir=!0),or&&(we=oe({},rh),pe=_r(null),or.html===!0&&(oe(we,nh),oe(pe,sh)),or.svg===!0&&(oe(we,la),oe(pe,ha),oe(pe,fi)),or.svgFilters===!0&&(oe(we,ca),oe(pe,ha),oe(pe,fi)),or.mathMl===!0&&(oe(we,ua),oe(pe,ih),oe(pe,fi))),Bt.tagCheck=null,Bt.attributeCheck=null,Ze(_,"ADD_TAGS")&&(typeof _.ADD_TAGS=="function"?Bt.tagCheck=_.ADD_TAGS:yn(_.ADD_TAGS)&&(we===Lt&&(we=it(we)),oe(we,_.ADD_TAGS,Re))),Ze(_,"ADD_ATTR")&&(typeof _.ADD_ATTR=="function"?Bt.attributeCheck=_.ADD_ATTR:yn(_.ADD_ATTR)&&(pe===Ft&&(pe=it(pe)),oe(pe,_.ADD_ATTR,Re))),Ze(_,"ADD_URI_SAFE_ATTR")&&yn(_.ADD_URI_SAFE_ATTR)&&oe(wo,_.ADD_URI_SAFE_ATTR,Re),Ze(_,"FORBID_CONTENTS")&&yn(_.FORBID_CONTENTS)&&(Ut===vo&&(Ut=it(Ut)),oe(Ut,_.FORBID_CONTENTS,Re)),Ze(_,"ADD_FORBID_CONTENTS")&&yn(_.ADD_FORBID_CONTENTS)&&(Ut===vo&&(Ut=it(Ut)),oe(Ut,_.ADD_FORBID_CONTENTS,Re)),xo&&(we["#text"]=!0),Nn&&oe(we,["html","head","body"]),we.table&&(oe(we,["tbody"]),delete $n.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const R=A;A=_.TRUSTED_TYPES_POLICY;try{E=ie("")}catch(B){throw A=R,B}}else _.TRUSTED_TYPES_POLICY===null?(A=void 0,E=""):(A===void 0&&(A=Se()),A&&typeof E=="string"&&(E=ie("")));Ye&&Ye(_),lr=_},yc=oe({},[...la,...ca,...Fb]),xc=oe({},[...ua,...Bb]),Yp=function(_,w,R){return w.namespaceURI===Gt?_==="svg":w.namespaceURI===qs?_==="svg"&&(R==="annotation-xml"||To[R]):!!yc[_]},Xp=function(_,w,R){return w.namespaceURI===Gt?_==="math":w.namespaceURI===Js?_==="math"&&Ao[R]:!!xc[_]},qp=function(_,w,R){return w.namespaceURI===Js&&!Ao[R]||w.namespaceURI===qs&&!To[R]?!1:!xc[_]&&(jp[_]||!yc[_])},Jp=function(_){let w=x(_);(!w||!w.tagName)&&(w={namespaceURI:ar,tagName:"template"});const R=cs(_.tagName),B=cs(w.tagName);return So[_.namespaceURI]?_.namespaceURI===Js?Yp(R,w,B):_.namespaceURI===qs?Xp(R,w,B):_.namespaceURI===Gt?qp(R,w,B):!!(Gr==="application/xhtml+xml"&&So[_.namespaceURI]):!1},pn=function(_){fr(e.removed,{element:_});try{x(_).removeChild(_)}catch{if(m(_),!x(_))throw Bn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},bc=function(_){const w=g(_);if(w){const B=[];Qr(w,ne=>{fr(B,ne)}),Qr(B,ne=>{try{m(ne)}catch{}})}const R=S(_);if(R)for(let B=R.length-1;B>=0;--B){const ne=R[B],he=ne&&ne.name;if(typeof he=="string")try{_.removeAttribute(he)}catch{}}},Dn=function(_,w){try{fr(e.removed,{attribute:w.getAttributeNode(_),from:w})}catch{fr(e.removed,{attribute:null,from:w})}if(w.removeAttribute(_),_==="is")if(ir||Ys)try{pn(w)}catch{}else try{w.setAttribute(_,"")}catch{}},Kp=function(_){const w=S(_);if(w)for(let R=w.length-1;R>=0;--R){const B=w[R],ne=B&&B.name;if(!(typeof ne!="string"||pe[Re(ne)]))try{_.removeAttribute(ne)}catch{}}},Qp=function(_){const w=[_];for(;w.length>0;){const R=w.pop();(T?T(R):R.nodeType)===Zt.element&&Kp(R);const ne=g(R);if(ne)for(let he=ne.length-1;he>=0;--he)w.push(ne[he])}},vc=function(_){let w=null,R=null;if(yo)_="<remove></remove>"+_;else{const he=Ku(_,/^[\r\n\t ]+/);R=he&&he[0]}Gr==="application/xhtml+xml"&&ar===Gt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const B=A?ie(_):_;if(ar===Gt)try{w=new u().parseFromString(B,Gr)}catch{}if(!w||!w.documentElement){w=L.createDocument(ar,"template",null);try{w.documentElement.innerHTML=ko?E:B}catch{}}const ne=w.body||w.documentElement;return _&&R&&ne.insertBefore(n.createTextNode(R),ne.childNodes[0]||null),ar===Gt?ue.call(w,Nn?"html":"body")[0]:Nn?w.documentElement:ne},wc=function(_){return H.call(_.ownerDocument||_,_,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ks=function(_){return _=es(_,Mn," "),_=es(_,Rn," "),_=es(_,Hs," "),_},Eo=function(_){var w;_.normalize();const R=H.call(_.ownerDocument||_,_,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let B=R.nextNode();for(;B;)B.data=Ks(B.data),B=R.nextNode();const ne=(w=_.querySelectorAll)===null||w===void 0?void 0:w.call(_,"template");ne&&Qr(ne,he=>{cr(he.content)&&Eo(he.content)})},Qs=function(_){const w=I?I(_):null;return typeof w!="string"||Re(w)!=="form"?!1:typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||_.attributes!==S(_)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function"||_.nodeType!==T(_)||_.childNodes!==g(_)},cr=function(_){if(!T||typeof _!="object"||_===null)return!1;try{return T(_)===Zt.documentFragment}catch{return!1}},Zr=function(_){if(!T||typeof _!="object"||_===null)return!1;try{return typeof T(_)=="number"}catch{return!1}};function Jt(O,_,w){O.length!==0&&Qr(O,R=>{R.call(e,_,w,lr)})}const em=function(_,w){return!!(Ur&&_.hasChildNodes()&&!Zr(_.firstElementChild)&&He(ah,_.textContent)&&He(ah,_.innerHTML)||Ur&&_.namespaceURI===Gt&&w==="style"&&Zr(_.firstElementChild)||_.nodeType===Zt.processingInstruction||Ur&&_.nodeType===Zt.comment&&He(qb,_.data))},tm=function(_,w){if(!$n[w]&&Tc(w)&&(me.tagNameCheck instanceof RegExp&&He(me.tagNameCheck,w)||me.tagNameCheck instanceof Function&&me.tagNameCheck(w)))return!1;if(xo&&!Ut[w]){const R=x(_),B=g(_);if(B&&R){const ne=B.length;for(let he=ne-1;he>=0;--he){const Ge=bo?B[he]:d(B[he],!0);R.insertBefore(Ge,y(_))}}}return pn(_),!0},kc=function(_){if(Jt(ye.beforeSanitizeElements,_,null),Qs(_))return pn(_),!0;const w=Re(I?I(_):_.nodeName);if(Jt(ye.uponSanitizeElement,_,{tagName:w,allowedTags:we}),em(_,w))return pn(_),!0;if($n[w]||!(Bt.tagCheck instanceof Function&&Bt.tagCheck(w))&&!we[w])return tm(_,w);if((T?T(_):_.nodeType)===Zt.element&&!Jp(_)||(w==="noscript"||w==="noembed"||w==="noframes")&&He(Jb,_.innerHTML))return pn(_),!0;if(fn&&_.nodeType===Zt.text){const B=Ks(_.textContent);_.textContent!==B&&(fr(e.removed,{element:_.cloneNode()}),_.textContent=B)}return Jt(ye.afterSanitizeElements,_,null),!1},Sc=function(_,w,R){if(Br[w]||cc&&(w==="id"||w==="name")&&(R in n||R in Wp))return!1;const B=pe[w]||Bt.attributeCheck instanceof Function&&Bt.attributeCheck(w,_);if(!(po&&He(rr,w))){if(!(fo&&He(zn,w))){if(B){if(!wo[w]){if(!He(On,es(R,Fr,""))){if(!((w==="src"||w==="xlink:href"||w==="href")&&_!=="script"&&Qu(R,"data:")===0&&dc[_])){if(!(ac&&!He(Ws,es(R,Fr,"")))){if(R)return!1}}}}}else if(!(Tc(_)&&(me.tagNameCheck instanceof RegExp&&He(me.tagNameCheck,_)||me.tagNameCheck instanceof Function&&me.tagNameCheck(_))&&(me.attributeNameCheck instanceof RegExp&&He(me.attributeNameCheck,w)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(w,_))||w==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&He(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R))))return!1}}return!0},nm=oe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Tc=function(_){return!nm[cs(_)]&&He(sr,_)},rm=function(_,w,R,B){if(A&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!R)switch(h.getAttributeType(_,w)){case"TrustedHTML":return ie(B);case"TrustedScriptURL":return ke(B)}return B},sm=function(_,w,R,B){try{R?_.setAttributeNS(R,w,B):_.setAttribute(w,B),Qs(_)?pn(_):Ju(e.removed)}catch{Dn(w,_)}},Ac=function(_){Jt(ye.beforeSanitizeAttributes,_,null);const w=_.attributes;if(!w||Qs(_))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pe,forceKeepAttr:void 0};let B=w.length;const ne=Re(_.nodeName);for(;B--;){const he=w[B],Ge=he.name,Ne=he.namespaceURI,xt=he.value,Ct=Re(Ge),Po=xt;let rt=Ge==="value"?Po:Rb(Po);if(R.attrName=Ct,R.attrValue=rt,R.keepAttr=!0,R.forceKeepAttr=void 0,Jt(ye.uponSanitizeAttribute,_,R),rt=R.attrValue,uc&&(Ct==="id"||Ct==="name")&&Qu(rt,hc)!==0&&(Dn(Ge,_),rt=hc+rt),Ur&&He(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,rt)){Dn(Ge,_);continue}if(Ct==="attributename"&&Ku(rt,"href")){Dn(Ge,_);continue}if(!R.forceKeepAttr){if(!R.keepAttr){Dn(Ge,_);continue}if(!lc&&He(Kb,rt)){Dn(Ge,_);continue}if(fn&&(rt=Ks(rt)),!Sc(ne,Ct,rt)){Dn(Ge,_);continue}rt=rm(ne,Ct,Ne,rt),rt!==Po&&sm(_,Ge,Ne,rt)}}Jt(ye.afterSanitizeAttributes,_,null)},ei=function(_){let w=null;const R=wc(_);for(Jt(ye.beforeSanitizeShadowDOM,_,null);w=R.nextNode();)if(Jt(ye.uponSanitizeShadowNode,w,null),kc(w),Ac(w),cr(w.content)&&ei(w.content),(T?T(w):w.nodeType)===Zt.element){const ne=b(w);cr(ne)&&(Io(ne),ei(ne))}Jt(ye.afterSanitizeShadowDOM,_,null)},Io=function(_){const w=[{node:_,shadow:null}];for(;w.length>0;){const R=w.pop();if(R.shadow){ei(R.shadow);continue}const B=R.node,he=(T?T(B):B.nodeType)===Zt.element,Ge=g(B);if(Ge)for(let Ne=Ge.length-1;Ne>=0;--Ne)w.push({node:Ge[Ne],shadow:null});if(he){const Ne=I?I(B):null;if(typeof Ne=="string"&&Re(Ne)==="template"){const xt=B.content;cr(xt)&&w.push({node:xt,shadow:null})}}if(he){const Ne=b(B);cr(Ne)&&w.push({node:null,shadow:Ne},{node:Ne,shadow:null})}}};return e.sanitize=function(O){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,R=null,B=null,ne=null;if(ko=!O,ko&&(O="<!-->"),typeof O!="string"&&!Zr(O)&&(O=Db(O),typeof O!="string"))throw Bn("dirty is not a string, aborting");if(!e.isSupported)return O;mo?(we=go,pe=_o):Co(_),(ye.uponSanitizeElement.length>0||ye.uponSanitizeAttribute.length>0)&&(we=it(we)),ye.uponSanitizeAttribute.length>0&&(pe=it(pe)),e.removed=[];const he=bo&&typeof O!="string"&&Zr(O);if(he){const xt=I?I(O):O.nodeName;if(typeof xt=="string"){const Ct=Re(xt);if(!we[Ct]||$n[Ct])throw Bn("root node is forbidden and cannot be sanitized in-place")}if(Qs(O))throw Bn("root node is clobbered and cannot be sanitized in-place");try{Io(O)}catch(Ct){throw bc(O),Ct}}else if(Zr(O))w=vc("<!---->"),R=w.ownerDocument.importNode(O,!0),R.nodeType===Zt.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?w=R:w.appendChild(R),Io(R);else{if(!ir&&!fn&&!Nn&&O.indexOf("<")===-1)return A&&Xs?ie(O):O;if(w=vc(O),!w)return ir?null:Xs?E:""}w&&yo&&pn(w.firstChild);const Ge=wc(he?O:w);try{for(;B=Ge.nextNode();)kc(B),Ac(B),cr(B.content)&&ei(B.content)}catch(xt){throw he&&bc(O),xt}if(he)return Qr(e.removed,xt=>{xt.element&&Qp(xt.element)}),fn&&Eo(O),O;if(ir){if(fn&&Eo(w),Ys)for(ne=Pn.call(w.ownerDocument);w.firstChild;)ne.appendChild(w.firstChild);else ne=w;return(pe.shadowroot||pe.shadowrootmode)&&(ne=Dt.call(r,ne,!0)),ne}let Ne=Nn?w.outerHTML:w.innerHTML;return Nn&&we["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&He(Yb,w.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
|
|
241
|
+
`+Ne),fn&&(Ne=Ks(Ne)),A&&Xs?ie(Ne):Ne},e.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Co(O),mo=!0,go=we,_o=pe},e.clearConfig=function(){lr=null,mo=!1,go=null,_o=null,A=V,E=""},e.isValidAttribute=function(O,_,w){lr||Co({});const R=Re(O),B=Re(_);return Sc(R,B,w)},e.addHook=function(O,_){typeof _=="function"&&Ze(ye,O)&&fr(ye[O],_)},e.removeHook=function(O,_){if(Ze(ye,O)){if(_!==void 0){const w=Pb(ye[O],_);return w===-1?void 0:Mb(ye[O],w,1)[0]}return Ju(ye[O])}},e.removeHooks=function(O){Ze(ye,O)&&(ye[O]=[])},e.removeAllHooks=function(){ye=lh()},e}Ef();function $l(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tr=$l();function If(t){tr=t}var Hn={exec:()=>null};function ce(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(at.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var t0=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),at={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:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},n0=/^(?:[ \t]*(?:\n|$))+/,r0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,s0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,js=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,i0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Nl=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Pf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Mf=ce(Pf).replace(/bull/g,Nl).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(),o0=ce(Pf).replace(/bull/g,Nl).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(),Dl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,a0=/^[^\n]+/,Ll=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,l0=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ll).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),c0=ce(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Nl).getRegex(),no="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",Fl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,u0=ce("^ {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",Fl).replace("tag",no).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Rf=ce(Dl).replace("hr",js).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",no).getRegex(),h0=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Rf).getRegex(),Bl={blockquote:h0,code:r0,def:l0,fences:s0,heading:i0,hr:js,html:u0,lheading:Mf,list:c0,newline:n0,paragraph:Rf,table:Hn,text:a0},ch=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",js).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",no).getRegex(),d0={...Bl,lheading:o0,table:ch,paragraph:ce(Dl).replace("hr",js).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ch).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",no).getRegex()},f0={...Bl,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Fl).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:Hn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Dl).replace("hr",js).replace("heading",` *#{1,6} *[^
|
|
242
|
+
]`).replace("lheading",Mf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},p0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zf=/^( {2,}|\\)\n(?!\s*$)/,g0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Nr=/[\p{P}\p{S}]/u,ro=/[\s\p{P}\p{S}]/u,Ul=/[^\s\p{P}\p{S}]/u,_0=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ro).getRegex(),Of=/(?!~)[\p{P}\p{S}]/u,y0=/(?!~)[\s\p{P}\p{S}]/u,x0=/(?:[^\s\p{P}\p{S}]|~)/u,b0=ce(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",t0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$f=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,v0=ce($f,"u").replace(/punct/g,Nr).getRegex(),w0=ce($f,"u").replace(/punct/g,Of).getRegex(),Nf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",k0=ce(Nf,"gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,ro).replace(/punct/g,Nr).getRegex(),S0=ce(Nf,"gu").replace(/notPunctSpace/g,x0).replace(/punctSpace/g,y0).replace(/punct/g,Of).getRegex(),T0=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,ro).replace(/punct/g,Nr).getRegex(),A0=ce(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Nr).getRegex(),C0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",E0=ce(C0,"gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,ro).replace(/punct/g,Nr).getRegex(),I0=ce(/\\(punct)/,"gu").replace(/punct/g,Nr).getRegex(),P0=ce(/^<(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(),M0=ce(Fl).replace("(?:-->|$)","-->").getRegex(),R0=ce("^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",M0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gi=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,z0=ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Gi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Df=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",Gi).replace("ref",Ll).getRegex(),Lf=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ll).getRegex(),O0=ce("reflink|nolink(?!\\()","g").replace("reflink",Df).replace("nolink",Lf).getRegex(),uh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gl={_backpedal:Hn,anyPunctuation:I0,autolink:P0,blockSkip:b0,br:zf,code:m0,del:Hn,delLDelim:Hn,delRDelim:Hn,emStrongLDelim:v0,emStrongRDelimAst:k0,emStrongRDelimUnd:T0,escape:p0,link:z0,nolink:Lf,punctuation:_0,reflink:Df,reflinkSearch:O0,tag:R0,text:g0,url:Hn},$0={...Gl,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",Gi).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gi).getRegex()},ol={...Gl,emStrongRDelimAst:S0,emStrongLDelim:w0,delLDelim:A0,delRDelim:E0,url:ce(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",uh).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:ce(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",uh).getRegex()},N0={...ol,br:ce(zf).replace("{2,}","*").getRegex(),text:ce(ol.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},pi={normal:Bl,gfm:d0,pedantic:f0},ns={normal:Gl,gfm:ol,breaks:N0,pedantic:$0},D0={"&":"&","<":"<",">":">",'"':""","'":"'"},hh=t=>D0[t];function Wt(t,e){if(e){if(at.escapeTest.test(t))return t.replace(at.escapeReplace,hh)}else if(at.escapeTestNoEncode.test(t))return t.replace(at.escapeReplaceNoEncode,hh);return t}function dh(t){try{t=encodeURI(t).replace(at.percentDecode,"%")}catch{return null}return t}function fh(t,e){var i;let n=t.replace(at.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(at.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(at.slashPipe,"|");return r}function rs(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function L0(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function F0(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function ph(t,e,n,r,s){let i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function B0(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
243
243
|
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
244
|
-
`)}var
|
|
245
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=
|
|
246
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=
|
|
244
|
+
`)}var Zi=class{constructor(t){re(this,"options");re(this,"rules");re(this,"lexer");this.options=t||tr}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:rs(n,`
|
|
245
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=B0(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=rs(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:rs(e[0],`
|
|
246
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=rs(e[0],`
|
|
247
247
|
`).split(`
|
|
248
248
|
`),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=!0;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
249
249
|
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -254,17 +254,17 @@ ${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
254
254
|
`),y=this.blockquote(m);i[i.length-1]=y,r=r.substring(0,r.length-d.raw.length)+y.raw,s=s.substring(0,s.length-d.text.length)+y.text;break}else if((f==null?void 0:f.type)==="list"){let d=f,m=d.raw+`
|
|
255
255
|
`+n.join(`
|
|
256
256
|
`),y=this.list(m);i[i.length-1]=y,r=r.substring(0,r.length-f.raw.length)+y.raw,s=s.substring(0,s.length-d.raw.length)+y.raw,n=m.substring(i.at(-1).raw.length).split(`
|
|
257
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let u=!1,h="",f="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let d=
|
|
257
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let u=!1,h="",f="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let d=F0(e[2].split(`
|
|
258
258
|
`,1)[0],e[1].length),m=t.split(`
|
|
259
259
|
`,1)[0],y=!d.trim(),g=0;if(this.options.pedantic?(g=2,f=d.trimStart()):y?g=e[1].length+1:(g=d.search(this.rules.other.nonSpaceChar),g=g>4?1:g,f=d.slice(g),g+=e[1].length),y&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
260
260
|
`,t=t.substring(m.length+1),u=!0),!u){let x=this.rules.other.nextBulletRegex(g),b=this.rules.other.hrRegex(g),S=this.rules.other.fencesBeginRegex(g),T=this.rules.other.headingBeginRegex(g),I=this.rules.other.htmlBeginRegex(g),A=this.rules.other.blockquoteBeginRegex(g);for(;t;){let E=t.split(`
|
|
261
|
-
`,1)[0],
|
|
262
|
-
`+
|
|
261
|
+
`,1)[0],V;if(m=E,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),V=m):V=m.replace(this.rules.other.tabCharGlobal," "),S.test(m)||T.test(m)||I.test(m)||A.test(m)||x.test(m)||b.test(m))break;if(V.search(this.rules.other.nonSpaceChar)>=g||!m.trim())f+=`
|
|
262
|
+
`+V.slice(g);else{if(y||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(d)||T.test(d)||b.test(d))break;f+=`
|
|
263
263
|
`+m}y=!m.trim(),h+=E+`
|
|
264
|
-
`,t=t.substring(E.length+1),d=
|
|
265
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(
|
|
266
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=
|
|
267
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(
|
|
264
|
+
`,t=t.substring(E.length+1),d=V.slice(g)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(l=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),o.raw+=h}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((n=u.tokens[0])==null?void 0:n.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.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 h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let f={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=f.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}if(!o.loose){let h=u.tokens.filter(d=>d.type==="space"),f=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=f}}if(o.loose)for(let u of o.items){u.loose=!0;for(let h of u.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=fh(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
265
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(fh(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
266
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=rs(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=L0(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),ph(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return ph(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,h=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let d=h.slice(1,-1);return{type:"em",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}let f=h.slice(2,-2);return{type:"strong",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+s);(r=l.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...r[0]][0].length,u=t.slice(0,s+r.index+c+o),h=u.slice(s,-s);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Mt=class al{constructor(e){re(this,"tokens");re(this,"options");re(this,"state");re(this,"inlineQueue");re(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tr,this.options.tokenizer=this.options.tokenizer||new Zi,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 n={other:at,block:pi.normal,inline:ns.normal};this.options.pedantic?(n.block=pi.pedantic,n.inline=ns.pedantic):this.options.gfm&&(n.block=pi.gfm,this.options.breaks?n.inline=ns.breaks:n.inline=ns.gfm),this.tokenizer.rules=n}static get rules(){return{block:pi,inline:ns}}static lex(e,n){return new al(n).lex(e)}static lexInline(e,n){return new al(n).inlineTokens(e)}lex(e){e=e.replace(at.carriageReturn,`
|
|
267
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(at.tabCharGlobal," ").replace(at.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
268
268
|
`:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
269
269
|
`)?"":`
|
|
270
270
|
`)+a.raw,c.text+=`
|
|
@@ -277,9 +277,9 @@ ${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
277
277
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),r=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
278
278
|
`)?"":`
|
|
279
279
|
`)+a.raw,c.text+=`
|
|
280
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var l,c,u,h,f;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let d;if((h=(u=this.options.extensions)==null?void 0:u.inline)!=null&&h.some(y=>(d=y.call({lexer:this},e,n))?(e=e.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.escape(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.tag(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.link(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(d.raw.length);let y=n.at(-1);d.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=d.raw,y.text+=d.text):n.push(d);continue}if(d=this.tokenizer.emStrong(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.codespan(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.br(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.del(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.autolink(e)){e=e.substring(d.raw.length),n.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(e))){e=e.substring(d.raw.length),n.push(d);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let y=1/0,g=e.slice(1),x;this.options.extensions.startInline.forEach(b=>{x=b.call({lexer:this},g),typeof x=="number"&&x>=0&&(y=Math.min(y,x))}),y<1/0&&y>=0&&(m=e.substring(0,y+1))}if(d=this.tokenizer.inlineText(m)){e=e.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(a=d.raw.slice(-1)),o=!0;let y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=d.raw,y.text+=d.text):n.push(d);continue}if(e){let y="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return n}},
|
|
281
|
-
`;return r?'<pre><code class="language-'+
|
|
282
|
-
`:"<pre><code>"+(n?s:
|
|
280
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var l,c,u,h,f;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let d;if((h=(u=this.options.extensions)==null?void 0:u.inline)!=null&&h.some(y=>(d=y.call({lexer:this},e,n))?(e=e.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.escape(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.tag(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.link(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(d.raw.length);let y=n.at(-1);d.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=d.raw,y.text+=d.text):n.push(d);continue}if(d=this.tokenizer.emStrong(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.codespan(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.br(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.del(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.autolink(e)){e=e.substring(d.raw.length),n.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(e))){e=e.substring(d.raw.length),n.push(d);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let y=1/0,g=e.slice(1),x;this.options.extensions.startInline.forEach(b=>{x=b.call({lexer:this},g),typeof x=="number"&&x>=0&&(y=Math.min(y,x))}),y<1/0&&y>=0&&(m=e.substring(0,y+1))}if(d=this.tokenizer.inlineText(m)){e=e.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(a=d.raw.slice(-1)),o=!0;let y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=d.raw,y.text+=d.text):n.push(d);continue}if(e){let y="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return n}},ji=class{constructor(t){re(this,"options");re(this,"parser");this.options=t||tr}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(at.notSpaceStart))==null?void 0:i[0],s=t.replace(at.endingNewline,"")+`
|
|
281
|
+
`;return r?'<pre><code class="language-'+Wt(r)+'">'+(n?s:Wt(s,!0))+`</code></pre>
|
|
282
|
+
`:"<pre><code>"+(n?s:Wt(s,!0))+`</code></pre>
|
|
283
283
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
284
284
|
${this.parser.parse(t)}</blockquote>
|
|
285
285
|
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
@@ -295,10 +295,10 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
295
295
|
`}tablerow({text:t}){return`<tr>
|
|
296
296
|
${t}</tr>
|
|
297
297
|
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
298
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${
|
|
299
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Ht(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Qn=new k0;function _e(t,e){return Qn.parse(t,e)}_e.options=_e.setOptions=function(t){return Qn.setOptions(t),_e.defaults=Qn.defaults,Sf(_e.defaults),_e};_e.getDefaults=zl;_e.defaults=er;_e.use=function(...t){return Qn.use(...t),_e.defaults=Qn.defaults,Sf(_e.defaults),_e};_e.walkTokens=function(t,e){return Qn.walkTokens(t,e)};_e.parseInline=Qn.parseInline;_e.Parser=Mt;_e.parser=Mt.parse;_e.Renderer=Zi;_e.TextRenderer=Ul;_e.Lexer=Pt;_e.lexer=Pt.lex;_e.Tokenizer=Gi;_e.Hooks=cs;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Mt.parse;Pt.lex;_e.setOptions({gfm:!0,breaks:!0,async:!1});const S0="agent-play-preview-chat-display-v1",Of={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function ua(t,e,n){return Math.min(n,Math.max(e,t))}function T0(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.fontSizePx=="number"&&Number.isFinite(n.fontSizePx)&&(r.fontSizePx=n.fontSizePx),typeof n.panelWidthPx=="number"&&Number.isFinite(n.panelWidthPx)&&(r.panelWidthPx=n.panelWidthPx),typeof n.scrollMaxHeightPx=="number"&&Number.isFinite(n.scrollMaxHeightPx)&&(r.scrollMaxHeightPx=n.scrollMaxHeightPx),Object.keys(r).length>0?r:null}catch{return null}}let hh={...Of};function A0(t){return{fontSizePx:ua(Math.round(t.fontSizePx),5,18),panelWidthPx:ua(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:ua(Math.round(t.scrollMaxHeightPx),24,200)}}function C0(){const t=T0(typeof localStorage<"u"?localStorage.getItem(S0):null),e={...Of,...t};return hh=A0(e),{...hh}}typeof localStorage<"u"&&C0();var pi={exports:{}},ha,dh;function E0(){if(dh)return ha;dh=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;ha=function(u,h){h=h||{};var f=typeof u;if(f==="string"&&u.length>0)return o(u);if(f==="number"&&isFinite(u))return h.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(h){var f=parseFloat(h[1]),d=(h[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*s;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(u){var h=Math.abs(u);return h>=r?Math.round(u/r)+"d":h>=n?Math.round(u/n)+"h":h>=e?Math.round(u/e)+"m":h>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var h=Math.abs(u);return h>=r?c(u,h,r,"day"):h>=n?c(u,h,n,"hour"):h>=e?c(u,h,e,"minute"):h>=t?c(u,h,t,"second"):u+" ms"}function c(u,h,f,d){var m=h>=f*1.5;return Math.round(u/f)+" "+d+(m?"s":"")}return ha}var da,fh;function I0(){if(fh)return da;fh=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=E0(),r.destroy=u,Object.keys(e).forEach(h=>{r[h]=e[h]}),r.names=[],r.skips=[],r.formatters={};function n(h){let f=0;for(let d=0;d<h.length;d++)f=(f<<5)-f+h.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=n;function r(h){let f,d=null,m,y;function g(...x){if(!g.enabled)return;const b=g,S=Number(new Date),T=S-(f||S);b.diff=T,b.prev=f,b.curr=S,f=S,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let I=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(E,Z)=>{if(E==="%%")return"%";I++;const Y=r.formatters[Z];if(typeof Y=="function"){const $=x[I];E=Y.call(b,$),x.splice(I,1),I--}return E}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return g.namespace=h,g.useColors=r.useColors(),g.color=r.selectColor(h),g.extend=s,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==r.namespaces&&(m=r.namespaces,y=r.enabled(h)),y),set:x=>{d=x}}),typeof r.init=="function"&&r.init(g),g}function s(h,f){const d=r(this.namespace+(typeof f>"u"?":":f)+h);return d.log=this.log,d}function i(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];const f=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function o(h,f){let d=0,m=0,y=-1,g=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(y=m,g=d,m++):(d++,m++);else if(y!==-1)m=y+1,g++,d=g;else return!1;for(;m<f.length&&f[m]==="*";)m++;return m===f.length}function a(){const h=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),h}function l(h){for(const f of r.skips)if(o(h,f))return!1;for(const f of r.names)if(o(h,f))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return da=t,da}var ph;function P0(){return ph||(ph=1,function(t,e){var n={};e.formatArgs=s,e.save=i,e.load=o,e.useColors=r,e.storage=a(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let h=0,f=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(h++,d==="%c"&&(f=h))}),c.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=I0()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(pi,pi.exports)),pi.exports}var M0=P0();const R0=qh(M0);function z0(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function O0(){try{if(typeof Uh=="function")return Uh()}catch{}return z0()}function $f(){try{const t=ma==null?void 0:ma();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function al(t){const e=$f();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Nf={get disabled(){return O0()||$f().NODE_ENV==="test"?!0:al("OPENAI_AGENTS_DISABLE_TRACING")}},mh={get dontLogModelData(){return al("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return al("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Gl(t="openai-agents"){return{namespace:t,debug:R0(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return mh.dontLogModelData},get dontLogToolData(){return mh.dontLogToolData}}}const Te=Gl("openai-agents:core");var gh;function C(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let h=0;h<u.length;h++){const f=u[h];f in a||(a[f]=c[f].bind(a))}}const s=(n==null?void 0:n.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class wr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Df extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(gh=globalThis).__zod_globalConfig??(gh.__zod_globalConfig={});const Zl=globalThis.__zod_globalConfig;function un(t){return Zl}function Lf(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,s])=>e.indexOf(+r)===-1).map(([r,s])=>s)}function ll(t,e){return typeof e=="bigint"?e.toString():e}function ro(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function jl(t){return t==null}function Vl(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function $0(t,e){const n=t/e,r=Math.round(n),s=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<s?0:n-r}const _h=Symbol("evaluating");function oe(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==_h)return r===void 0&&(r=_h,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function tr(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cn(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function yh(t){return JSON.stringify(t)}function N0(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ff="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function As(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const D0=ro(()=>{var t;if(Zl.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Rr(t){if(As(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(As(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Bf(t){return Rr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const L0=new Set(["string","number","symbol"]);function zr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function En(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function G(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function F0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const B0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function U0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Cn(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return tr(this,"shape",o),o},checks:[]});return En(t,i)}function G0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Cn(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return tr(this,"shape",o),o},checks:[]});return En(t,i)}function Z0(t,e){if(!Rr(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const i=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Cn(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return tr(this,"shape",i),i}});return En(t,s)}function j0(t,e){if(!Rr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Cn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return tr(this,"shape",r),r}});return En(t,n)}function V0(t,e){var r;if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Cn(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e._zod.def.shape};return tr(this,"shape",s),s},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return En(t,n)}function H0(t,e,n){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Cn(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return tr(this,"shape",l),l},checks:[]});return En(e,o)}function W0(t,e,n){const r=Cn(e._zod.def,{get shape(){const s=e._zod.def.shape,i={...s};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new t({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new t({type:"nonoptional",innerType:s[o]});return tr(this,"shape",i),i}});return En(e,r)}function br(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Y0(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function vr(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function mi(t){return typeof t=="string"?t:t==null?void 0:t.message}function hn(t,e,n){var l,c,u,h,f,d;const r=t.message?t.message:mi((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??mi((h=e==null?void 0:e.error)==null?void 0:h.call(e,t))??mi((f=n.customError)==null?void 0:f.call(n,t))??mi((d=n.localeError)==null?void 0:d.call(n,t))??"Invalid input",{inst:s,continue:i,input:o,...a}=t;return a.path??(a.path=[]),a.message=r,e!=null&&e.reportInput&&(a.input=o),a}function Hl(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Cs(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Uf=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,ll,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Gf=C("$ZodError",Uf),Zf=C("$ZodError",Uf,{Parent:Error});function X0(t,e=n=>n.message){const n={},r=[];for(const s of t.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}function q0(t,e=n=>n.message){const n={_errors:[]},r=(s,i=[])=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a},[...i,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...i,...o.path]);else{const a=[...i,...o.path];if(a.length===0)n._errors.push(e(o));else{let l=n,c=0;for(;c<a.length;){const u=a[c];c===a.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(e(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}}};return r(t),n}const Wl=t=>(e,n,r,s)=>{const i=r?{...r,async:!1}:{async:!1},o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new wr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>hn(l,i,un())));throw Ff(a,s==null?void 0:s.callee),a}return o.value},Yl=t=>async(e,n,r,s)=>{const i=r?{...r,async:!0}:{async:!0};let o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>hn(l,i,un())));throw Ff(a,s==null?void 0:s.callee),a}return o.value},so=t=>(e,n,r)=>{const s=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new wr;return i.issues.length?{success:!1,error:new(t??Gf)(i.issues.map(o=>hn(o,s,un())))}:{success:!0,data:i.value}},J0=so(Zf),io=t=>async(e,n,r)=>{const s=r?{...r,async:!0}:{async:!0};let i=e._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(o=>hn(o,s,un())))}:{success:!0,data:i.value}},K0=io(Zf),Q0=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Wl(t)(e,n,s)},ev=t=>(e,n,r)=>Wl(t)(e,n,r),tv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Yl(t)(e,n,s)},nv=t=>async(e,n,r)=>Yl(t)(e,n,r),rv=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return so(t)(e,n,s)},sv=t=>(e,n,r)=>so(t)(e,n,r),iv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return io(t)(e,n,s)},ov=t=>async(e,n,r)=>io(t)(e,n,r),av=/^[cC][0-9a-z]{6,}$/,lv=/^[0-9a-z]+$/,cv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uv=/^[0-9a-vA-V]{20}$/,hv=/^[A-Za-z0-9]{27}$/,dv=/^[a-zA-Z0-9_-]{21}$/,fv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xh=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,mv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _v(){return new RegExp(gv,"u")}const yv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,vv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jf=/^[A-Za-z0-9_-]*$/,kv=/^https?$/,Sv=/^\+[1-9]\d{6,14}$/,Vf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Tv=new RegExp(`^${Vf}$`);function Hf(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Av(t){return new RegExp(`^${Hf(t)}$`)}function Cv(t){const e=Hf({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Vf}T(?:${r})$`)}const Ev=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Iv=/^-?\d+$/,Wf=/^-?\d+(?:\.\d+)?$/,Pv=/^(?:true|false)$/i,Mv=/^[^A-Z]*$/,Rv=/^[^a-z]*$/,dt=C("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Yf={number:"number",bigint:"bigint",object:"date"},Xf=C("$ZodCheckLessThan",(t,e)=>{dt.init(t,e);const n=Yf[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),qf=C("$ZodCheckGreaterThan",(t,e)=>{dt.init(t,e);const n=Yf[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),zv=C("$ZodCheckMultipleOf",(t,e)=>{dt.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):$0(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Ov=C("$ZodCheckNumberFormat",(t,e)=>{var o;dt.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[s,i]=B0[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=s,l.maximum=i,n&&(l.pattern=Iv)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<s&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),$v=C("$ZodCheckMaxLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!jl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const s=r.value;if(s.length<=e.maximum)return;const o=Hl(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Nv=C("$ZodCheckMinLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!jl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const s=r.value;if(s.length>=e.minimum)return;const o=Hl(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Dv=C("$ZodCheckLengthEquals",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!jl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=r=>{const s=r.value,i=s.length;if(i===e.length)return;const o=Hl(s),a=i>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),oo=C("$ZodCheckStringFormat",(t,e)=>{var n,r;dt.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Lv=C("$ZodCheckRegex",(t,e)=>{oo.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Fv=C("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Mv),oo.init(t,e)}),Bv=C("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Rv),oo.init(t,e)}),Uv=C("$ZodCheckIncludes",(t,e)=>{dt.init(t,e);const n=zr(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),Gv=C("$ZodCheckStartsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`^${zr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),Zv=C("$ZodCheckEndsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`.*${zr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),jv=C("$ZodCheckOverwrite",(t,e)=>{dt.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Vv{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
298
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Wt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=dh(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+Wt(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=dh(t);if(s===null)return Wt(n);t=s;let i=`<img src="${t}" alt="${Wt(n)}"`;return e&&(i+=` title="${Wt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Wt(t.text)}},Zl=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Rt=class ll{constructor(e){re(this,"options");re(this,"renderer");re(this,"textRenderer");this.options=e||tr,this.options.renderer=this.options.renderer||new ji,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zl}static parse(e,n){return new ll(n).parse(e)}static parseInline(e,n){return new ll(n).parseInline(e)}parse(e){var r,s;this.renderer.parser=this;let n="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=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 n}parseInline(e,n=this.renderer){var s,i;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},bi,us=(bi=class{constructor(t){re(this,"options");re(this,"block");this.options=t||tr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?Mt.lex:Mt.lexInline}provideParser(t=this.block){return t?Rt.parse:Rt.parseInline}},re(bi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),re(bi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),bi),U0=class{constructor(...t){re(this,"defaults",$l());re(this,"options",this.setOptions);re(this,"parse",this.parseMarkdown(!0));re(this,"parseInline",this.parseMarkdown(!1));re(this,"Parser",Rt);re(this,"Renderer",ji);re(this,"TextRenderer",Zl);re(this,"Lexer",Mt);re(this,"Tokenizer",Zi);re(this,"Hooks",us);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(let i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{let o=i;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new ji(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Zi(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new us;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=s[o];us.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&us.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await a.call(s,c);return l.call(s,h)})();let u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(s,c);return h===!1&&(h=await l.apply(s,c)),h})();let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Mt.lex(t,e??this.defaults)}parser(t,e){return Rt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(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 e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?Mt.lex:Mt.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?Rt.parse:Rt.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?Mt.lex:Mt.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?Rt.parse:Rt.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
299
|
+
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Wt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},er=new U0;function _e(t,e){return er.parse(t,e)}_e.options=_e.setOptions=function(t){return er.setOptions(t),_e.defaults=er.defaults,If(_e.defaults),_e};_e.getDefaults=$l;_e.defaults=tr;_e.use=function(...t){return er.use(...t),_e.defaults=er.defaults,If(_e.defaults),_e};_e.walkTokens=function(t,e){return er.walkTokens(t,e)};_e.parseInline=er.parseInline;_e.Parser=Rt;_e.parser=Rt.parse;_e.Renderer=ji;_e.TextRenderer=Zl;_e.Lexer=Mt;_e.lexer=Mt.lex;_e.Tokenizer=Zi;_e.Hooks=us;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Rt.parse;Mt.lex;_e.setOptions({gfm:!0,breaks:!0,async:!1});const G0="agent-play-preview-chat-display-v1",Ff={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function da(t,e,n){return Math.min(n,Math.max(e,t))}function Z0(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.fontSizePx=="number"&&Number.isFinite(n.fontSizePx)&&(r.fontSizePx=n.fontSizePx),typeof n.panelWidthPx=="number"&&Number.isFinite(n.panelWidthPx)&&(r.panelWidthPx=n.panelWidthPx),typeof n.scrollMaxHeightPx=="number"&&Number.isFinite(n.scrollMaxHeightPx)&&(r.scrollMaxHeightPx=n.scrollMaxHeightPx),Object.keys(r).length>0?r:null}catch{return null}}let mh={...Ff};function j0(t){return{fontSizePx:da(Math.round(t.fontSizePx),5,18),panelWidthPx:da(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:da(Math.round(t.scrollMaxHeightPx),24,200)}}function V0(){const t=Z0(typeof localStorage<"u"?localStorage.getItem(G0):null),e={...Ff,...t};return mh=j0(e),{...mh}}typeof localStorage<"u"&&V0();var mi={exports:{}},fa,gh;function H0(){if(gh)return fa;gh=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;fa=function(u,h){h=h||{};var f=typeof u;if(f==="string"&&u.length>0)return o(u);if(f==="number"&&isFinite(u))return h.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(h){var f=parseFloat(h[1]),d=(h[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*s;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(u){var h=Math.abs(u);return h>=r?Math.round(u/r)+"d":h>=n?Math.round(u/n)+"h":h>=e?Math.round(u/e)+"m":h>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var h=Math.abs(u);return h>=r?c(u,h,r,"day"):h>=n?c(u,h,n,"hour"):h>=e?c(u,h,e,"minute"):h>=t?c(u,h,t,"second"):u+" ms"}function c(u,h,f,d){var m=h>=f*1.5;return Math.round(u/f)+" "+d+(m?"s":"")}return fa}var pa,_h;function W0(){if(_h)return pa;_h=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=H0(),r.destroy=u,Object.keys(e).forEach(h=>{r[h]=e[h]}),r.names=[],r.skips=[],r.formatters={};function n(h){let f=0;for(let d=0;d<h.length;d++)f=(f<<5)-f+h.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=n;function r(h){let f,d=null,m,y;function g(...x){if(!g.enabled)return;const b=g,S=Number(new Date),T=S-(f||S);b.diff=T,b.prev=f,b.curr=S,f=S,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let I=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(E,V)=>{if(E==="%%")return"%";I++;const Y=r.formatters[V];if(typeof Y=="function"){const $=x[I];E=Y.call(b,$),x.splice(I,1),I--}return E}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return g.namespace=h,g.useColors=r.useColors(),g.color=r.selectColor(h),g.extend=s,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==r.namespaces&&(m=r.namespaces,y=r.enabled(h)),y),set:x=>{d=x}}),typeof r.init=="function"&&r.init(g),g}function s(h,f){const d=r(this.namespace+(typeof f>"u"?":":f)+h);return d.log=this.log,d}function i(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];const f=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function o(h,f){let d=0,m=0,y=-1,g=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(y=m,g=d,m++):(d++,m++);else if(y!==-1)m=y+1,g++,d=g;else return!1;for(;m<f.length&&f[m]==="*";)m++;return m===f.length}function a(){const h=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),h}function l(h){for(const f of r.skips)if(o(h,f))return!1;for(const f of r.names)if(o(h,f))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return pa=t,pa}var yh;function Y0(){return yh||(yh=1,function(t,e){var n={};e.formatArgs=s,e.save=i,e.load=o,e.useColors=r,e.storage=a(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let h=0,f=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(h++,d==="%c"&&(f=h))}),c.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=W0()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(mi,mi.exports)),mi.exports}var X0=Y0();const q0=ed(X0);function J0(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function K0(){try{if(typeof Vh=="function")return Vh()}catch{}return J0()}function Bf(){try{const t=_a==null?void 0:_a();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function cl(t){const e=Bf();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Uf={get disabled(){return K0()||Bf().NODE_ENV==="test"?!0:cl("OPENAI_AGENTS_DISABLE_TRACING")}},xh={get dontLogModelData(){return cl("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return cl("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function jl(t="openai-agents"){return{namespace:t,debug:q0(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return xh.dontLogModelData},get dontLogToolData(){return xh.dontLogToolData}}}const Te=jl("openai-agents:core");var bh;function C(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let h=0;h<u.length;h++){const f=u[h];f in a||(a[f]=c[f].bind(a))}}const s=(n==null?void 0:n.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class kr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Gf extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(bh=globalThis).__zod_globalConfig??(bh.__zod_globalConfig={});const Vl=globalThis.__zod_globalConfig;function hn(t){return Vl}function Zf(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,s])=>e.indexOf(+r)===-1).map(([r,s])=>s)}function ul(t,e){return typeof e=="bigint"?e.toString():e}function so(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Hl(t){return t==null}function Wl(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Q0(t,e){const n=t/e,r=Math.round(n),s=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<s?0:n-r}const vh=Symbol("evaluating");function ae(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==vh)return r===void 0&&(r=vh,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function nr(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function En(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function wh(t){return JSON.stringify(t)}function ev(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const jf="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Cs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const tv=so(()=>{var t;if(Vl.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function zr(t){if(Cs(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Cs(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Vf(t){return zr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const nv=new Set(["string","number","symbol"]);function Or(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function In(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function Z(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function rv(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const sv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function iv(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=En(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return nr(this,"shape",o),o},checks:[]});return In(t,i)}function ov(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=En(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return nr(this,"shape",o),o},checks:[]});return In(t,i)}function av(t,e){if(!zr(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const i=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=En(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return nr(this,"shape",i),i}});return In(t,s)}function lv(t,e){if(!zr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=En(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return nr(this,"shape",r),r}});return In(t,n)}function cv(t,e){var r;if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=En(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e._zod.def.shape};return nr(this,"shape",s),s},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return In(t,n)}function uv(t,e,n){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=En(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return nr(this,"shape",l),l},checks:[]});return In(e,o)}function hv(t,e,n){const r=En(e._zod.def,{get shape(){const s=e._zod.def.shape,i={...s};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new t({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new t({type:"nonoptional",innerType:s[o]});return nr(this,"shape",i),i}});return In(e,r)}function vr(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function dv(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function wr(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function gi(t){return typeof t=="string"?t:t==null?void 0:t.message}function dn(t,e,n){var l,c,u,h,f,d;const r=t.message?t.message:gi((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??gi((h=e==null?void 0:e.error)==null?void 0:h.call(e,t))??gi((f=n.customError)==null?void 0:f.call(n,t))??gi((d=n.localeError)==null?void 0:d.call(n,t))??"Invalid input",{inst:s,continue:i,input:o,...a}=t;return a.path??(a.path=[]),a.message=r,e!=null&&e.reportInput&&(a.input=o),a}function Yl(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Es(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Hf=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,ul,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Wf=C("$ZodError",Hf),Yf=C("$ZodError",Hf,{Parent:Error});function fv(t,e=n=>n.message){const n={},r=[];for(const s of t.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}function pv(t,e=n=>n.message){const n={_errors:[]},r=(s,i=[])=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a},[...i,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...i,...o.path]);else{const a=[...i,...o.path];if(a.length===0)n._errors.push(e(o));else{let l=n,c=0;for(;c<a.length;){const u=a[c];c===a.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(e(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}}};return r(t),n}const Xl=t=>(e,n,r,s)=>{const i=r?{...r,async:!1}:{async:!1},o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new kr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>dn(l,i,hn())));throw jf(a,s==null?void 0:s.callee),a}return o.value},ql=t=>async(e,n,r,s)=>{const i=r?{...r,async:!0}:{async:!0};let o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>dn(l,i,hn())));throw jf(a,s==null?void 0:s.callee),a}return o.value},io=t=>(e,n,r)=>{const s=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new kr;return i.issues.length?{success:!1,error:new(t??Wf)(i.issues.map(o=>dn(o,s,hn())))}:{success:!0,data:i.value}},mv=io(Yf),oo=t=>async(e,n,r)=>{const s=r?{...r,async:!0}:{async:!0};let i=e._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(o=>dn(o,s,hn())))}:{success:!0,data:i.value}},gv=oo(Yf),_v=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Xl(t)(e,n,s)},yv=t=>(e,n,r)=>Xl(t)(e,n,r),xv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return ql(t)(e,n,s)},bv=t=>async(e,n,r)=>ql(t)(e,n,r),vv=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return io(t)(e,n,s)},wv=t=>(e,n,r)=>io(t)(e,n,r),kv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return oo(t)(e,n,s)},Sv=t=>async(e,n,r)=>oo(t)(e,n,r),Tv=/^[cC][0-9a-z]{6,}$/,Av=/^[0-9a-z]+$/,Cv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ev=/^[0-9a-vA-V]{20}$/,Iv=/^[A-Za-z0-9]{27}$/,Pv=/^[a-zA-Z0-9_-]{21}$/,Mv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,kh=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,zv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ov="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $v(){return new RegExp(Ov,"u")}const Nv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Lv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Fv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xf=/^[A-Za-z0-9_-]*$/,Uv=/^https?$/,Gv=/^\+[1-9]\d{6,14}$/,qf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zv=new RegExp(`^${qf}$`);function Jf(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jv(t){return new RegExp(`^${Jf(t)}$`)}function Vv(t){const e=Jf({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${qf}T(?:${r})$`)}const Hv=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Wv=/^-?\d+$/,Kf=/^-?\d+(?:\.\d+)?$/,Yv=/^(?:true|false)$/i,Xv=/^[^A-Z]*$/,qv=/^[^a-z]*$/,dt=C("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Qf={number:"number",bigint:"bigint",object:"date"},ep=C("$ZodCheckLessThan",(t,e)=>{dt.init(t,e);const n=Qf[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),tp=C("$ZodCheckGreaterThan",(t,e)=>{dt.init(t,e);const n=Qf[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Jv=C("$ZodCheckMultipleOf",(t,e)=>{dt.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):Q0(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Kv=C("$ZodCheckNumberFormat",(t,e)=>{var o;dt.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[s,i]=sv[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=s,l.maximum=i,n&&(l.pattern=Wv)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<s&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Qv=C("$ZodCheckMaxLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Hl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const s=r.value;if(s.length<=e.maximum)return;const o=Yl(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),ew=C("$ZodCheckMinLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Hl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const s=r.value;if(s.length>=e.minimum)return;const o=Yl(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),tw=C("$ZodCheckLengthEquals",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Hl(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=r=>{const s=r.value,i=s.length;if(i===e.length)return;const o=Yl(s),a=i>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),ao=C("$ZodCheckStringFormat",(t,e)=>{var n,r;dt.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),nw=C("$ZodCheckRegex",(t,e)=>{ao.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),rw=C("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Xv),ao.init(t,e)}),sw=C("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=qv),ao.init(t,e)}),iw=C("$ZodCheckIncludes",(t,e)=>{dt.init(t,e);const n=Or(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),ow=C("$ZodCheckStartsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`^${Or(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),aw=C("$ZodCheckEndsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`.*${Or(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),lw=C("$ZodCheckOverwrite",(t,e)=>{dt.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class cw{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
300
300
|
`).filter(o=>o),s=Math.min(...r.map(o=>o.length-o.trimStart().length)),i=r.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const e=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new e(...n,s.join(`
|
|
301
|
-
`))}}const Hv={major:4,minor:4,patch:3},Ee=C("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Hv;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const o of i._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,l,c)=>{let u=br(a),h;for(const f of l){if(f._zod.def.when){if(Y0(a)||!f._zod.def.when(a))continue}else if(u)continue;const d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&(c==null?void 0:c.async)===!1)throw new wr;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=br(a,d)))});else{if(a.issues.length===d)continue;u||(u=br(a,d))}}return h?h.then(()=>a):a},o=(a,l,c)=>{if(br(a))return a.aborted=!0,a;const u=i(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new wr;return u.then(h=>t._zod.parse(h,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new wr;return c.then(u=>i(u,r,l))}return i(c,r,l)}}oe(t,"~standard",()=>({validate:i=>{var o;try{const a=J0(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return K0(t,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Xl=C("$ZodString",(t,e)=>{var n;Ee.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??Ev(t._zod.bag),t._zod.parse=(r,s)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Pe=C("$ZodStringFormat",(t,e)=>{oo.init(t,e),Xl.init(t,e)}),Wv=C("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=pv),Pe.init(t,e)}),Yv=C("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=xh(r))}else e.pattern??(e.pattern=xh());Pe.init(t,e)}),Xv=C("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=mv),Pe.init(t,e)}),qv=C("$ZodURL",(t,e)=>{Pe.init(t,e),t._zod.check=n=>{var r;try{const s=n.value.trim();if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===kv.source&&!/^https?:\/\//i.test(s)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const i=new URL(s);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=i.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Jv=C("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=_v()),Pe.init(t,e)}),Kv=C("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=dv),Pe.init(t,e)}),Qv=C("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=av),Pe.init(t,e)}),ew=C("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=lv),Pe.init(t,e)}),tw=C("$ZodULID",(t,e)=>{e.pattern??(e.pattern=cv),Pe.init(t,e)}),nw=C("$ZodXID",(t,e)=>{e.pattern??(e.pattern=uv),Pe.init(t,e)}),rw=C("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hv),Pe.init(t,e)}),sw=C("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Cv(e)),Pe.init(t,e)}),iw=C("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Tv),Pe.init(t,e)}),ow=C("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Av(e)),Pe.init(t,e)}),aw=C("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=fv),Pe.init(t,e)}),lw=C("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=yv),Pe.init(t,e),t._zod.bag.format="ipv4"}),cw=C("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=xv),Pe.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),uw=C("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=bv),Pe.init(t,e)}),hw=C("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=vv),Pe.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,i]=r;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Jf(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const dw=C("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=wv),Pe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Jf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function fw(t){if(!jf.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Jf(n)}const pw=C("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=jf),Pe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{fw(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),mw=C("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Sv),Pe.init(t,e)});function gw(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const _w=C("$ZodJWT",(t,e)=>{Pe.init(t,e),t._zod.check=n=>{gw(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Kf=C("$ZodNumber",(t,e)=>{Ee.init(t,e),t._zod.pattern=t._zod.bag.pattern??Wf,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),n}}),yw=C("$ZodNumberFormat",(t,e)=>{Ov.init(t,e),Kf.init(t,e)}),xw=C("$ZodBoolean",(t,e)=>{Ee.init(t,e),t._zod.pattern=Pv,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),n}}),bw=C("$ZodAny",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),vw=C("$ZodUnknown",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),ww=C("$ZodNever",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function bh(t,e,n){t.issues.length&&e.issues.push(...vr(n,t.issues)),e.value[n]=t.value}const kw=C("$ZodArray",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),n;n.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const a=s[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>bh(c,n,o))):bh(l,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function ji(t,e,n,r,s,i){const o=n in r;if(t.issues.length){if(s&&i&&!o)return;e.issues.push(...vr(n,t.issues))}if(!o&&!s){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?o&&(e.value[n]=void 0):e.value[n]=t.value}function Qf(t){var r,s,i,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(i=(s=(r=t.shape)==null?void 0:r[a])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=F0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function ep(t,e,n,r,s,i){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,u=l.optin==="optional",h=l.optout==="optional";for(const f in e){if(f==="__proto__"||a.has(f))continue;if(c==="never"){o.push(f);continue}const d=l.run({value:e[f],issues:[]},r);d instanceof Promise?t.push(d.then(m=>ji(m,n,f,e,u,h))):ji(d,n,f,e,u,h)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}const Sw=C("$ZodObject",(t,e)=>{Ee.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=ro(()=>Qf(e));oe(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const h of u.values)l[c].add(h)}}return l});const s=As,i=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!s(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],h=o.shape;for(const f of o.keys){const d=h[f],m=d._zod.optin==="optional",y=d._zod.optout==="optional",g=d._zod.run({value:c[f],issues:[]},l);g instanceof Promise?u.push(g.then(x=>ji(x,a,f,c,m,y))):ji(g,a,f,c,m,y)}return i?ep(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),Tw=C("$ZodObjectJIT",(t,e)=>{Sw.init(t,e);const n=t._zod.parse,r=ro(()=>Qf(e)),s=f=>{var S,T;const d=new Vv(["shape","payload","ctx"]),m=r.value,y=I=>{const A=yh(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};d.write("const input = payload.value;");const g=Object.create(null);let x=0;for(const I of m.keys)g[I]=`key_${x++}`;d.write("const newResult = {};");for(const I of m.keys){const A=g[I],E=yh(I),Z=f[I],Y=((S=Z==null?void 0:Z._zod)==null?void 0:S.optin)==="optional",$=((T=Z==null?void 0:Z._zod)==null?void 0:T.optout)==="optional";d.write(`const ${A} = ${y(I)};`),Y&&$?d.write(`
|
|
301
|
+
`))}}const uw={major:4,minor:4,patch:3},Ee=C("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=uw;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const o of i._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,l,c)=>{let u=vr(a),h;for(const f of l){if(f._zod.def.when){if(dv(a)||!f._zod.def.when(a))continue}else if(u)continue;const d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&(c==null?void 0:c.async)===!1)throw new kr;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=vr(a,d)))});else{if(a.issues.length===d)continue;u||(u=vr(a,d))}}return h?h.then(()=>a):a},o=(a,l,c)=>{if(vr(a))return a.aborted=!0,a;const u=i(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new kr;return u.then(h=>t._zod.parse(h,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new kr;return c.then(u=>i(u,r,l))}return i(c,r,l)}}ae(t,"~standard",()=>({validate:i=>{var o;try{const a=mv(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return gv(t,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Jl=C("$ZodString",(t,e)=>{var n;Ee.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??Hv(t._zod.bag),t._zod.parse=(r,s)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Pe=C("$ZodStringFormat",(t,e)=>{ao.init(t,e),Jl.init(t,e)}),hw=C("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Rv),Pe.init(t,e)}),dw=C("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=kh(r))}else e.pattern??(e.pattern=kh());Pe.init(t,e)}),fw=C("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=zv),Pe.init(t,e)}),pw=C("$ZodURL",(t,e)=>{Pe.init(t,e),t._zod.check=n=>{var r;try{const s=n.value.trim();if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===Uv.source&&!/^https?:\/\//i.test(s)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const i=new URL(s);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=i.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),mw=C("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=$v()),Pe.init(t,e)}),gw=C("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Pv),Pe.init(t,e)}),_w=C("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Tv),Pe.init(t,e)}),yw=C("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Av),Pe.init(t,e)}),xw=C("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Cv),Pe.init(t,e)}),bw=C("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ev),Pe.init(t,e)}),vw=C("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Iv),Pe.init(t,e)}),ww=C("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Vv(e)),Pe.init(t,e)}),kw=C("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Zv),Pe.init(t,e)}),Sw=C("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=jv(e)),Pe.init(t,e)}),Tw=C("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Mv),Pe.init(t,e)}),Aw=C("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Nv),Pe.init(t,e),t._zod.bag.format="ipv4"}),Cw=C("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Dv),Pe.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Ew=C("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Lv),Pe.init(t,e)}),Iw=C("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Fv),Pe.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,i]=r;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function np(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Pw=C("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Bv),Pe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{np(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Mw(t){if(!Xf.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return np(n)}const Rw=C("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Xf),Pe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Mw(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),zw=C("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Gv),Pe.init(t,e)});function Ow(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const $w=C("$ZodJWT",(t,e)=>{Pe.init(t,e),t._zod.check=n=>{Ow(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),rp=C("$ZodNumber",(t,e)=>{Ee.init(t,e),t._zod.pattern=t._zod.bag.pattern??Kf,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),n}}),Nw=C("$ZodNumberFormat",(t,e)=>{Kv.init(t,e),rp.init(t,e)}),Dw=C("$ZodBoolean",(t,e)=>{Ee.init(t,e),t._zod.pattern=Yv,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),n}}),Lw=C("$ZodAny",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),Fw=C("$ZodUnknown",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),Bw=C("$ZodNever",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function Sh(t,e,n){t.issues.length&&e.issues.push(...wr(n,t.issues)),e.value[n]=t.value}const Uw=C("$ZodArray",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),n;n.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const a=s[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>Sh(c,n,o))):Sh(l,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function Vi(t,e,n,r,s,i){const o=n in r;if(t.issues.length){if(s&&i&&!o)return;e.issues.push(...wr(n,t.issues))}if(!o&&!s){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?o&&(e.value[n]=void 0):e.value[n]=t.value}function sp(t){var r,s,i,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(i=(s=(r=t.shape)==null?void 0:r[a])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=rv(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function ip(t,e,n,r,s,i){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,u=l.optin==="optional",h=l.optout==="optional";for(const f in e){if(f==="__proto__"||a.has(f))continue;if(c==="never"){o.push(f);continue}const d=l.run({value:e[f],issues:[]},r);d instanceof Promise?t.push(d.then(m=>Vi(m,n,f,e,u,h))):Vi(d,n,f,e,u,h)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}const Gw=C("$ZodObject",(t,e)=>{Ee.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=so(()=>sp(e));ae(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const h of u.values)l[c].add(h)}}return l});const s=Cs,i=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!s(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],h=o.shape;for(const f of o.keys){const d=h[f],m=d._zod.optin==="optional",y=d._zod.optout==="optional",g=d._zod.run({value:c[f],issues:[]},l);g instanceof Promise?u.push(g.then(x=>Vi(x,a,f,c,m,y))):Vi(g,a,f,c,m,y)}return i?ip(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),Zw=C("$ZodObjectJIT",(t,e)=>{Gw.init(t,e);const n=t._zod.parse,r=so(()=>sp(e)),s=f=>{var S,T;const d=new cw(["shape","payload","ctx"]),m=r.value,y=I=>{const A=wh(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};d.write("const input = payload.value;");const g=Object.create(null);let x=0;for(const I of m.keys)g[I]=`key_${x++}`;d.write("const newResult = {};");for(const I of m.keys){const A=g[I],E=wh(I),V=f[I],Y=((S=V==null?void 0:V._zod)==null?void 0:S.optin)==="optional",$=((T=V==null?void 0:V._zod)==null?void 0:T.optout)==="optional";d.write(`const ${A} = ${y(I)};`),Y&&$?d.write(`
|
|
302
302
|
if (${A}.issues.length) {
|
|
303
303
|
if (${E} in input) {
|
|
304
304
|
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
@@ -357,6 +357,6 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
`)}d.write("payload.value = newResult;"),d.write("return payload;");const b=d.compile();return(I,A)=>b(f,I,A)};let i;const o=As,a=!Zl.jitless,c=a&&D0.value,u=e.catchall;let h;t._zod.parse=(f,d)=>{h??(h=r.value);const m=f.value;return o(m)?a&&c&&(d==null?void 0:d.async)===!1&&d.jitless!==!0?(i||(i=s(e.shape)),f=i(f,d),u?ep([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function vh(t,e,n,r){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;const s=t.filter(i=>!br(i));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(o=>hn(o,r,un())))}),e)}const tp=C("$ZodUnion",(t,e)=>{Ee.init(t,e),oe(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),oe(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),oe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),oe(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>Vl(s.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,s)=>{if(n)return n(r,s);let i=!1;const o=[];for(const a of e.options){const l=a._zod.run({value:r.value,issues:[]},s);if(l instanceof Promise)o.push(l),i=!0;else{if(l.issues.length===0)return l;o.push(l)}}return i?Promise.all(o).then(a=>vh(a,r,t,s)):vh(o,r,t,s)}}),Aw=C("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,tp.init(t,e);const n=t._zod.parse;oe(t._zod,"propValues",()=>{const s={};for(const i of e.options){const o=i._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[a,l]of Object.entries(o)){s[a]||(s[a]=new Set);for(const c of l)s[a].add(c)}}return s});const r=ro(()=>{var o;const s=e.options,i=new Map;for(const a of s){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(s,i)=>{const o=s.value;if(!As(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(s,i):e.unionFallback||i.direction==="backward"?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:o,path:[e.discriminator],inst:t}),s)}}),Cw=C("$ZodIntersection",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value,i=e.left._zod.run({value:s,issues:[]},r),o=e.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([l,c])=>wh(n,l,c)):wh(n,i,o)}});function cl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Rr(t)&&Rr(e)){const n=Object.keys(e),r=Object.keys(t).filter(i=>n.indexOf(i)!==-1),s={...t,...e};for(const i of r){const o=cl(t[i],e[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const s=t[r],i=e[r],o=cl(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function wh(t,e,n){const r=new Map;let s;for(const a of e.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&s&&t.issues.push({...s,keys:i}),br(t))return t;const o=cl(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const Ew=C("$ZodRecord",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!Rr(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),n;const i=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>hn(d,r,un())),input:c,path:[c],inst:t});continue}const h=u.value,f=e.valueType._zod.run({value:s[c],issues:[]},r);f instanceof Promise?i.push(f.then(d=>{d.issues.length&&n.issues.push(...vr(c,d.issues)),n.value[h]=d.value})):(f.issues.length&&n.issues.push(...vr(c,f.issues)),n.value[h]=f.value)}let l;for(const c in s)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,a))continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Wf.test(a)&&l.issues.length){const h=e.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){e.mode==="loose"?n.value[a]=s[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>hn(h,r,un())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:s[a],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(...vr(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...vr(a,u.issues)),n.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Iw=C("$ZodEnum",(t,e)=>{Ee.init(t,e);const n=Lf(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>L0.has(typeof s)).map(s=>typeof s=="string"?zr(s):s.toString()).join("|")})$`),t._zod.parse=(s,i)=>{const o=s.value;return r.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:t}),s}}),Pw=C("$ZodLiteral",(t,e)=>{if(Ee.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?zr(r):r?zr(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,s)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),r}}),Mw=C("$ZodTransform",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Df(t.constructor.name);const s=e.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(n.value=o,n.fallback=!0,n));if(s instanceof Promise)throw new wr;return n.value=s,n.fallback=!0,n}});function kh(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const np=C("$ZodOptional",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.optout="optional",oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Vl(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const s=n.value,i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>kh(o,s)):kh(i,s)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Rw=C("$ZodExactOptional",(t,e)=>{np.init(t,e),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),zw=C("$ZodNullable",(t,e)=>{Ee.init(t,e),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Vl(n.source)}|null)$`):void 0}),oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Ow=C("$ZodDefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Sh(i,e)):Sh(s,e)}});function Sh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const $w=C("$ZodPrefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Nw=C("$ZodNonOptional",(t,e)=>{Ee.init(t,e),oe(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Th(i,t)):Th(s,t)}});function Th(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Dw=C("$ZodCatch",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(o=>hn(o,r,un()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>hn(i,r,un()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Lw=C("$ZodPipe",(t,e)=>{Ee.init(t,e),oe(t._zod,"values",()=>e.in._zod.values),oe(t._zod,"optin",()=>e.in._zod.optin),oe(t._zod,"optout",()=>e.out._zod.optout),oe(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=e.out._zod.run(n,r);return i instanceof Promise?i.then(o=>gi(o,e.in,r)):gi(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>gi(i,e.out,r)):gi(s,e.out,r)}});function gi(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const Fw=C("$ZodReadonly",(t,e)=>{Ee.init(t,e),oe(t._zod,"propValues",()=>e.innerType._zod.propValues),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),oe(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(Ah):Ah(s)}});function Ah(t){return t.value=Object.freeze(t.value),t}const Bw=C("$ZodLazy",(t,e)=>{Ee.init(t,e),oe(t._zod,"innerType",()=>{const n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),oe(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),oe(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),oe(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),oe(t._zod,"optout",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optout)??void 0}),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),Uw=C("$ZodCustom",(t,e)=>{dt.init(t,e),Ee.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,s=e.fn(r);if(s instanceof Promise)return s.then(i=>Ch(i,n,r,t));Ch(s,n,r,t)}});function Ch(t,e,n,r){if(!t){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),e.issues.push(Cs(s))}}var Eh;class Gw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zw(){return new Gw}(Eh=globalThis).__zod_globalRegistry??(Eh.__zod_globalRegistry=Zw());const us=globalThis.__zod_globalRegistry;function jw(t,e){return new t({type:"string",...G(e)})}function Vw(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...G(e)})}function Ih(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...G(e)})}function Hw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...G(e)})}function Ww(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...G(e)})}function Yw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...G(e)})}function Xw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...G(e)})}function qw(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...G(e)})}function Jw(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...G(e)})}function Kw(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...G(e)})}function Qw(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...G(e)})}function ek(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...G(e)})}function tk(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...G(e)})}function nk(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...G(e)})}function rk(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...G(e)})}function sk(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...G(e)})}function ik(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...G(e)})}function ok(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...G(e)})}function ak(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...G(e)})}function lk(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...G(e)})}function ck(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...G(e)})}function uk(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...G(e)})}function hk(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...G(e)})}function dk(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...G(e)})}function fk(t,e){return new t({type:"string",format:"date",check:"string_format",...G(e)})}function pk(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...G(e)})}function mk(t,e){return new t({type:"string",format:"duration",check:"string_format",...G(e)})}function gk(t,e){return new t({type:"number",checks:[],...G(e)})}function _k(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...G(e)})}function yk(t,e){return new t({type:"boolean",...G(e)})}function xk(t){return new t({type:"any"})}function bk(t){return new t({type:"unknown"})}function vk(t,e){return new t({type:"never",...G(e)})}function Ph(t,e){return new Xf({check:"less_than",...G(e),value:t,inclusive:!1})}function fa(t,e){return new Xf({check:"less_than",...G(e),value:t,inclusive:!0})}function Mh(t,e){return new qf({check:"greater_than",...G(e),value:t,inclusive:!1})}function pa(t,e){return new qf({check:"greater_than",...G(e),value:t,inclusive:!0})}function Rh(t,e){return new zv({check:"multiple_of",...G(e),value:t})}function rp(t,e){return new $v({check:"max_length",...G(e),maximum:t})}function Vi(t,e){return new Nv({check:"min_length",...G(e),minimum:t})}function sp(t,e){return new Dv({check:"length_equals",...G(e),length:t})}function wk(t,e){return new Lv({check:"string_format",format:"regex",...G(e),pattern:t})}function kk(t){return new Fv({check:"string_format",format:"lowercase",...G(t)})}function Sk(t){return new Bv({check:"string_format",format:"uppercase",...G(t)})}function Tk(t,e){return new Uv({check:"string_format",format:"includes",...G(e),includes:t})}function Ak(t,e){return new Gv({check:"string_format",format:"starts_with",...G(e),prefix:t})}function Ck(t,e){return new Zv({check:"string_format",format:"ends_with",...G(e),suffix:t})}function Nr(t){return new jv({check:"overwrite",tx:t})}function Ek(t){return Nr(e=>e.normalize(t))}function Ik(){return Nr(t=>t.trim())}function Pk(){return Nr(t=>t.toLowerCase())}function Mk(){return Nr(t=>t.toUpperCase())}function Rk(){return Nr(t=>N0(t))}function zk(t,e,n){return new t({type:"array",element:e,...G(n)})}function Ok(t,e,n){return new t({type:"custom",check:"custom",fn:e,...G(n)})}function $k(t,e){const n=Nk(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(Cs(s,r.value,n._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Cs(i))}},t(r.value,r)),e);return n}function Nk(t,e){const n=new dt({check:"custom",...G(e)});return n._zod.check=t,n}function ip(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??us,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function $e(t,e,n={path:[],schemaPath:[]}){var u,h;var r;const s=t._zod.def,i=e.seen.get(t);if(i)return i.count++,n.schemaPath.includes(t)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const f={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,f);else{const m=o.schema,y=e.processors[s.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);y(t,e,m,f)}const d=t._zod.parent;d&&(o.ref||(o.ref=d),$e(d,e,f),e.seen.get(d).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&rt(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function op(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const f=r.get(h);if(f&&f!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(h,u[0])}}const s=u=>{var y;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=(y=t.external.registry.get(u[0]))==null?void 0:y.id,x=t.external.uri??(S=>S);if(g)return{ref:x(g)};const b=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=b,{defId:b,ref:`${x("__shared")}#/${h}/${b}`}}if(u[1]===n)return{ref:"#"};const d=`#/${h}/`,m=u[1].schema.id??`__schema${t.counter++}`;return{defId:m,ref:d+m}},i=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:f,defId:d}=s(u);h.def={...h.schema},d&&(h.defId=d);const m=h.schema;for(const y in m)delete m[y];m.$ref=f};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
360
|
+
`)}d.write("payload.value = newResult;"),d.write("return payload;");const b=d.compile();return(I,A)=>b(f,I,A)};let i;const o=Cs,a=!Vl.jitless,c=a&&tv.value,u=e.catchall;let h;t._zod.parse=(f,d)=>{h??(h=r.value);const m=f.value;return o(m)?a&&c&&(d==null?void 0:d.async)===!1&&d.jitless!==!0?(i||(i=s(e.shape)),f=i(f,d),u?ip([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function Th(t,e,n,r){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;const s=t.filter(i=>!vr(i));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(o=>dn(o,r,hn())))}),e)}const op=C("$ZodUnion",(t,e)=>{Ee.init(t,e),ae(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ae(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ae(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ae(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>Wl(s.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,s)=>{if(n)return n(r,s);let i=!1;const o=[];for(const a of e.options){const l=a._zod.run({value:r.value,issues:[]},s);if(l instanceof Promise)o.push(l),i=!0;else{if(l.issues.length===0)return l;o.push(l)}}return i?Promise.all(o).then(a=>Th(a,r,t,s)):Th(o,r,t,s)}}),jw=C("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,op.init(t,e);const n=t._zod.parse;ae(t._zod,"propValues",()=>{const s={};for(const i of e.options){const o=i._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[a,l]of Object.entries(o)){s[a]||(s[a]=new Set);for(const c of l)s[a].add(c)}}return s});const r=so(()=>{var o;const s=e.options,i=new Map;for(const a of s){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(s,i)=>{const o=s.value;if(!Cs(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(s,i):e.unionFallback||i.direction==="backward"?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:o,path:[e.discriminator],inst:t}),s)}}),Vw=C("$ZodIntersection",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value,i=e.left._zod.run({value:s,issues:[]},r),o=e.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([l,c])=>Ah(n,l,c)):Ah(n,i,o)}});function hl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(zr(t)&&zr(e)){const n=Object.keys(e),r=Object.keys(t).filter(i=>n.indexOf(i)!==-1),s={...t,...e};for(const i of r){const o=hl(t[i],e[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const s=t[r],i=e[r],o=hl(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ah(t,e,n){const r=new Map;let s;for(const a of e.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&s&&t.issues.push({...s,keys:i}),vr(t))return t;const o=hl(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const Hw=C("$ZodRecord",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!zr(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),n;const i=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>dn(d,r,hn())),input:c,path:[c],inst:t});continue}const h=u.value,f=e.valueType._zod.run({value:s[c],issues:[]},r);f instanceof Promise?i.push(f.then(d=>{d.issues.length&&n.issues.push(...wr(c,d.issues)),n.value[h]=d.value})):(f.issues.length&&n.issues.push(...wr(c,f.issues)),n.value[h]=f.value)}let l;for(const c in s)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,a))continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Kf.test(a)&&l.issues.length){const h=e.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){e.mode==="loose"?n.value[a]=s[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>dn(h,r,hn())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:s[a],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(...wr(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...wr(a,u.issues)),n.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Ww=C("$ZodEnum",(t,e)=>{Ee.init(t,e);const n=Zf(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>nv.has(typeof s)).map(s=>typeof s=="string"?Or(s):s.toString()).join("|")})$`),t._zod.parse=(s,i)=>{const o=s.value;return r.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:t}),s}}),Yw=C("$ZodLiteral",(t,e)=>{if(Ee.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Or(r):r?Or(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,s)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),r}}),Xw=C("$ZodTransform",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Gf(t.constructor.name);const s=e.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(n.value=o,n.fallback=!0,n));if(s instanceof Promise)throw new kr;return n.value=s,n.fallback=!0,n}});function Ch(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const ap=C("$ZodOptional",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ae(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ae(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Wl(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const s=n.value,i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Ch(o,s)):Ch(i,s)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),qw=C("$ZodExactOptional",(t,e)=>{ap.init(t,e),ae(t._zod,"values",()=>e.innerType._zod.values),ae(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Jw=C("$ZodNullable",(t,e)=>{Ee.init(t,e),ae(t._zod,"optin",()=>e.innerType._zod.optin),ae(t._zod,"optout",()=>e.innerType._zod.optout),ae(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Wl(n.source)}|null)$`):void 0}),ae(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Kw=C("$ZodDefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Eh(i,e)):Eh(s,e)}});function Eh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Qw=C("$ZodPrefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),ek=C("$ZodNonOptional",(t,e)=>{Ee.init(t,e),ae(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Ih(i,t)):Ih(s,t)}});function Ih(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const tk=C("$ZodCatch",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",ae(t._zod,"optout",()=>e.innerType._zod.optout),ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(o=>dn(o,r,hn()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>dn(i,r,hn()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),nk=C("$ZodPipe",(t,e)=>{Ee.init(t,e),ae(t._zod,"values",()=>e.in._zod.values),ae(t._zod,"optin",()=>e.in._zod.optin),ae(t._zod,"optout",()=>e.out._zod.optout),ae(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=e.out._zod.run(n,r);return i instanceof Promise?i.then(o=>_i(o,e.in,r)):_i(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>_i(i,e.out,r)):_i(s,e.out,r)}});function _i(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const rk=C("$ZodReadonly",(t,e)=>{Ee.init(t,e),ae(t._zod,"propValues",()=>e.innerType._zod.propValues),ae(t._zod,"values",()=>e.innerType._zod.values),ae(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ae(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(Ph):Ph(s)}});function Ph(t){return t.value=Object.freeze(t.value),t}const sk=C("$ZodLazy",(t,e)=>{Ee.init(t,e),ae(t._zod,"innerType",()=>{const n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),ae(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),ae(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),ae(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),ae(t._zod,"optout",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optout)??void 0}),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),ik=C("$ZodCustom",(t,e)=>{dt.init(t,e),Ee.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,s=e.fn(r);if(s instanceof Promise)return s.then(i=>Mh(i,n,r,t));Mh(s,n,r,t)}});function Mh(t,e,n,r){if(!t){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),e.issues.push(Es(s))}}var Rh;class ok{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ak(){return new ok}(Rh=globalThis).__zod_globalRegistry??(Rh.__zod_globalRegistry=ak());const hs=globalThis.__zod_globalRegistry;function lk(t,e){return new t({type:"string",...Z(e)})}function ck(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Z(e)})}function zh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Z(e)})}function uk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(e)})}function hk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(e)})}function dk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(e)})}function fk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(e)})}function pk(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Z(e)})}function mk(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(e)})}function gk(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(e)})}function _k(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(e)})}function yk(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(e)})}function xk(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(e)})}function bk(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Z(e)})}function vk(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(e)})}function wk(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(e)})}function kk(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(e)})}function Sk(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(e)})}function Tk(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(e)})}function Ak(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Z(e)})}function Ck(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(e)})}function Ek(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Z(e)})}function Ik(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(e)})}function Pk(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(e)})}function Mk(t,e){return new t({type:"string",format:"date",check:"string_format",...Z(e)})}function Rk(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Z(e)})}function zk(t,e){return new t({type:"string",format:"duration",check:"string_format",...Z(e)})}function Ok(t,e){return new t({type:"number",checks:[],...Z(e)})}function $k(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(e)})}function Nk(t,e){return new t({type:"boolean",...Z(e)})}function Dk(t){return new t({type:"any"})}function Lk(t){return new t({type:"unknown"})}function Fk(t,e){return new t({type:"never",...Z(e)})}function Oh(t,e){return new ep({check:"less_than",...Z(e),value:t,inclusive:!1})}function ma(t,e){return new ep({check:"less_than",...Z(e),value:t,inclusive:!0})}function $h(t,e){return new tp({check:"greater_than",...Z(e),value:t,inclusive:!1})}function ga(t,e){return new tp({check:"greater_than",...Z(e),value:t,inclusive:!0})}function Nh(t,e){return new Jv({check:"multiple_of",...Z(e),value:t})}function lp(t,e){return new Qv({check:"max_length",...Z(e),maximum:t})}function Hi(t,e){return new ew({check:"min_length",...Z(e),minimum:t})}function cp(t,e){return new tw({check:"length_equals",...Z(e),length:t})}function Bk(t,e){return new nw({check:"string_format",format:"regex",...Z(e),pattern:t})}function Uk(t){return new rw({check:"string_format",format:"lowercase",...Z(t)})}function Gk(t){return new sw({check:"string_format",format:"uppercase",...Z(t)})}function Zk(t,e){return new iw({check:"string_format",format:"includes",...Z(e),includes:t})}function jk(t,e){return new ow({check:"string_format",format:"starts_with",...Z(e),prefix:t})}function Vk(t,e){return new aw({check:"string_format",format:"ends_with",...Z(e),suffix:t})}function Dr(t){return new lw({check:"overwrite",tx:t})}function Hk(t){return Dr(e=>e.normalize(t))}function Wk(){return Dr(t=>t.trim())}function Yk(){return Dr(t=>t.toLowerCase())}function Xk(){return Dr(t=>t.toUpperCase())}function qk(){return Dr(t=>ev(t))}function Jk(t,e,n){return new t({type:"array",element:e,...Z(n)})}function Kk(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Z(n)})}function Qk(t,e){const n=eS(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(Es(s,r.value,n._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Es(i))}},t(r.value,r)),e);return n}function eS(t,e){const n=new dt({check:"custom",...Z(e)});return n._zod.check=t,n}function up(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??hs,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function $e(t,e,n={path:[],schemaPath:[]}){var u,h;var r;const s=t._zod.def,i=e.seen.get(t);if(i)return i.count++,n.schemaPath.includes(t)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const f={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,f);else{const m=o.schema,y=e.processors[s.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);y(t,e,m,f)}const d=t._zod.parent;d&&(o.ref||(o.ref=d),$e(d,e,f),e.seen.get(d).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&st(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function hp(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const f=r.get(h);if(f&&f!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(h,u[0])}}const s=u=>{var y;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=(y=t.external.registry.get(u[0]))==null?void 0:y.id,x=t.external.uri??(S=>S);if(g)return{ref:x(g)};const b=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=b,{defId:b,ref:`${x("__shared")}#/${h}/${b}`}}if(u[1]===n)return{ref:"#"};const d=`#/${h}/`,m=u[1].schema.id??`__schema${t.counter++}`;return{defId:m,ref:d+m}},i=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:f,defId:d}=s(u);h.def={...h.schema},d&&(h.defId=d);const m=h.schema;for(const y in m)delete m[y];m.$ref=f};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
361
361
|
|
|
362
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){i(u);continue}if(t.external){const d=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&d){i(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){i(u);continue}if(h.cycle){i(u);continue}if(h.count>1&&t.reused==="ref"){i(u);continue}}}function ap(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const f=t.seen.get(h);if(f.ref===null)return;const d=f.def??f.schema,m={...d},y=f.ref;if(f.ref=null,y){r(y);const x=t.seen.get(y),b=x.schema;if(b.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(b)):Object.assign(d,b),Object.assign(d,m),h._zod.parent===y)for(const T in d)T==="$ref"||T==="allOf"||T in m||delete d[T];if(b.$ref&&x.def)for(const T in d)T==="$ref"||T==="allOf"||T in x.def&&JSON.stringify(d[T])===JSON.stringify(x.def[T])&&delete d[T]}const g=h._zod.parent;if(g&&g!==y){r(g);const x=t.seen.get(g);if(x!=null&&x.schema.$ref&&(d.$ref=x.schema.$ref,x.def))for(const b in d)b==="$ref"||b==="allOf"||b in x.def&&JSON.stringify(d[b])===JSON.stringify(x.def[b])&&delete d[b]}t.override({zodSchema:h,jsonSchema:d,path:f.path??[]})};for(const h of[...t.seen.entries()].reverse())r(h[0]);const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(l=t.external.registry.get(e))==null?void 0:l.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(h)}Object.assign(s,n.def??n.schema);const i=(c=t.metadataRegistry.get(e))==null?void 0:c.id;i!==void 0&&s.id===i&&delete s.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const h of t.seen.entries()){const f=h[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,o[f.defId]=f.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:Hi(e,"input",t.processors),output:Hi(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function rt(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return rt(r.element,n);if(r.type==="set")return rt(r.valueType,n);if(r.type==="lazy")return rt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return rt(r.innerType,n);if(r.type==="intersection")return rt(r.left,n)||rt(r.right,n);if(r.type==="record"||r.type==="map")return rt(r.keyType,n)||rt(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:rt(r.in,n)||rt(r.out,n);if(r.type==="object"){for(const s in r.shape)if(rt(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(rt(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(rt(s,n))return!0;return!!(r.rest&&rt(r.rest,n))}return!1}const Dk=(t,e={})=>n=>{const r=ip({...n,processors:e});return $e(t,r),op(r,t),ap(r,t)},Hi=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=ip({...s??{},target:i,io:e,processors:n});return $e(t,o),op(o,t),ap(o,t)},Lk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fk=(t,e,n,r)=>{const s=n;s.type="string";const{minimum:i,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof o=="number"&&(s.maxLength=o),a&&(s.format=Lk[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),c&&(s.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?s.pattern=u[0].source:u.length>1&&(s.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Bk=(t,e,n,r)=>{const s=n,{minimum:i,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number";const h=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),d=e.target==="draft-04"||e.target==="openapi-3.0";h?d?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u:typeof i=="number"&&(s.minimum=i),f?d?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c:typeof o=="number"&&(s.maximum=o),typeof l=="number"&&(s.multipleOf=l)},Uk=(t,e,n,r)=>{n.type="boolean"},Gk=(t,e,n,r)=>{n.not={}},Zk=(t,e,n,r)=>{},jk=(t,e,n,r)=>{},Vk=(t,e,n,r)=>{const s=t._zod.def,i=Lf(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},Hk=(t,e,n,r)=>{const s=t._zod.def,i=[];for(const o of s.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},Wk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Yk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Xk=(t,e,n,r)=>{const s=n,i=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=$e(i.element,e,{...r,path:[...r.path,"items"]})},qk=(t,e,n,r)=>{var c;const s=n,i=t._zod.def;s.type="object",s.properties={};const o=i.shape;for(const u in o)s.properties[u]=$e(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const h=i.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(s.required=Array.from(l)),((c=i.catchall)==null?void 0:c._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=$e(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Jk=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>$e(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},Kk=(t,e,n,r)=>{const s=t._zod.def,i=$e(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=$e(s.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(i)?i.allOf:[i],...a(o)?o.allOf:[o]];n.allOf=l},Qk=(t,e,n,r)=>{const s=n,i=t._zod.def;s.type="object";const o=i.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(i.mode==="loose"&&l&&l.size>0){const u=$e(i.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const h of l)s.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=$e(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=$e(i.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u)}},eS=(t,e,n,r)=>{const s=t._zod.def,i=$e(s.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},tS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},nS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},rS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},sS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},iS=(t,e,n,r)=>{const s=t._zod.def,i=s.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?i?s.out:s.in:s.out;$e(o,e,r);const a=e.seen.get(t);a.ref=o},oS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},lp=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},aS=(t,e,n,r)=>{const s=t._zod.innerType;$e(s,e,r);const i=e.seen.get(t);i.ref=s},lS=C("ZodISODateTime",(t,e)=>{sw.init(t,e),Me.init(t,e)});function cS(t){return dk(lS,t)}const uS=C("ZodISODate",(t,e)=>{iw.init(t,e),Me.init(t,e)});function hS(t){return fk(uS,t)}const dS=C("ZodISOTime",(t,e)=>{ow.init(t,e),Me.init(t,e)});function fS(t){return pk(dS,t)}const pS=C("ZodISODuration",(t,e)=>{aw.init(t,e),Me.init(t,e)});function mS(t){return mk(pS,t)}const gS=(t,e)=>{Gf.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>q0(t,n)},flatten:{value:n=>X0(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,ll,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,ll,2)}},isEmpty:{get(){return t.issues.length===0}}})},St=C("ZodError",gS,{Parent:Error}),_S=Wl(St),yS=Yl(St),xS=so(St),bS=io(St),vS=Q0(St),wS=ev(St),kS=tv(St),SS=nv(St),TS=rv(St),AS=sv(St),CS=iv(St),ES=ov(St),zh=new WeakMap;function js(t,e,n){const r=Object.getPrototypeOf(t);let s=zh.get(r);if(s||(s=new Set,zh.set(r,s)),!s.has(e)){s.add(e);for(const i in n){const o=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const Ie=C("ZodType",(t,e)=>(Ee.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Hi(t,"input"),output:Hi(t,"output")}}),t.toJSONSchema=Dk(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>_S(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>xS(t,n,r),t.parseAsync=async(n,r)=>yS(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>bS(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>vS(t,n,r),t.decode=(n,r)=>wS(t,n,r),t.encodeAsync=async(n,r)=>kS(t,n,r),t.decodeAsync=async(n,r)=>SS(t,n,r),t.safeEncode=(n,r)=>TS(t,n,r),t.safeDecode=(n,r)=>AS(t,n,r),t.safeEncodeAsync=async(n,r)=>CS(t,n,r),t.safeDecodeAsync=async(n,r)=>ES(t,n,r),js(t,"ZodType",{check(...n){const r=this.def;return this.clone(Cn(r,{checks:[...r.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return En(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(wT(n,r))},superRefine(n,r){return this.check(kT(n,r))},overwrite(n){return this.check(Nr(n))},optional(){return Dh(this)},exactOptional(){return lT(this)},nullable(){return Lh(this)},nullish(){return Dh(Lh(this))},nonoptional(n){return pT(this,n)},array(){return W(this)},or(n){return Ot([this,n])},and(n){return rT(this,n)},transform(n){return Fh(this,oT(n))},default(n){return hT(this,n)},prefault(n){return fT(this,n)},catch(n){return gT(this,n)},pipe(n){return Fh(this,n)},readonly(){return xT(this)},describe(n){const r=this.clone();return us.add(r,{description:n}),r},meta(...n){if(n.length===0)return us.get(this);const r=this.clone();return us.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=us.get(t))==null?void 0:n.description},configurable:!0}),t)),cp=C("_ZodString",(t,e)=>{Xl.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Fk(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,js(t,"_ZodString",{regex(...r){return this.check(wk(...r))},includes(...r){return this.check(Tk(...r))},startsWith(...r){return this.check(Ak(...r))},endsWith(...r){return this.check(Ck(...r))},min(...r){return this.check(Vi(...r))},max(...r){return this.check(rp(...r))},length(...r){return this.check(sp(...r))},nonempty(...r){return this.check(Vi(1,...r))},lowercase(r){return this.check(kk(r))},uppercase(r){return this.check(Sk(r))},trim(){return this.check(Ik())},normalize(...r){return this.check(Ek(...r))},toLowerCase(){return this.check(Pk())},toUpperCase(){return this.check(Mk())},slugify(){return this.check(Rk())}})}),IS=C("ZodString",(t,e)=>{Xl.init(t,e),cp.init(t,e),t.email=n=>t.check(Vw(PS,n)),t.url=n=>t.check(qw(MS,n)),t.jwt=n=>t.check(hk(HS,n)),t.emoji=n=>t.check(Jw(RS,n)),t.guid=n=>t.check(Ih(Oh,n)),t.uuid=n=>t.check(Hw(_i,n)),t.uuidv4=n=>t.check(Ww(_i,n)),t.uuidv6=n=>t.check(Yw(_i,n)),t.uuidv7=n=>t.check(Xw(_i,n)),t.nanoid=n=>t.check(Kw(zS,n)),t.guid=n=>t.check(Ih(Oh,n)),t.cuid=n=>t.check(Qw(OS,n)),t.cuid2=n=>t.check(ek($S,n)),t.ulid=n=>t.check(tk(NS,n)),t.base64=n=>t.check(lk(ZS,n)),t.base64url=n=>t.check(ck(jS,n)),t.xid=n=>t.check(nk(DS,n)),t.ksuid=n=>t.check(rk(LS,n)),t.ipv4=n=>t.check(sk(FS,n)),t.ipv6=n=>t.check(ik(BS,n)),t.cidrv4=n=>t.check(ok(US,n)),t.cidrv6=n=>t.check(ak(GS,n)),t.e164=n=>t.check(uk(VS,n)),t.datetime=n=>t.check(cS(n)),t.date=n=>t.check(hS(n)),t.time=n=>t.check(fS(n)),t.duration=n=>t.check(mS(n))});function p(t){return jw(IS,t)}const Me=C("ZodStringFormat",(t,e)=>{Pe.init(t,e),cp.init(t,e)}),PS=C("ZodEmail",(t,e)=>{Xv.init(t,e),Me.init(t,e)}),Oh=C("ZodGUID",(t,e)=>{Wv.init(t,e),Me.init(t,e)}),_i=C("ZodUUID",(t,e)=>{Yv.init(t,e),Me.init(t,e)}),MS=C("ZodURL",(t,e)=>{qv.init(t,e),Me.init(t,e)}),RS=C("ZodEmoji",(t,e)=>{Jv.init(t,e),Me.init(t,e)}),zS=C("ZodNanoID",(t,e)=>{Kv.init(t,e),Me.init(t,e)}),OS=C("ZodCUID",(t,e)=>{Qv.init(t,e),Me.init(t,e)}),$S=C("ZodCUID2",(t,e)=>{ew.init(t,e),Me.init(t,e)}),NS=C("ZodULID",(t,e)=>{tw.init(t,e),Me.init(t,e)}),DS=C("ZodXID",(t,e)=>{nw.init(t,e),Me.init(t,e)}),LS=C("ZodKSUID",(t,e)=>{rw.init(t,e),Me.init(t,e)}),FS=C("ZodIPv4",(t,e)=>{lw.init(t,e),Me.init(t,e)}),BS=C("ZodIPv6",(t,e)=>{cw.init(t,e),Me.init(t,e)}),US=C("ZodCIDRv4",(t,e)=>{uw.init(t,e),Me.init(t,e)}),GS=C("ZodCIDRv6",(t,e)=>{hw.init(t,e),Me.init(t,e)}),ZS=C("ZodBase64",(t,e)=>{dw.init(t,e),Me.init(t,e)}),jS=C("ZodBase64URL",(t,e)=>{pw.init(t,e),Me.init(t,e)}),VS=C("ZodE164",(t,e)=>{mw.init(t,e),Me.init(t,e)}),HS=C("ZodJWT",(t,e)=>{_w.init(t,e),Me.init(t,e)}),up=C("ZodNumber",(t,e)=>{Kf.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Bk(t,r,s),js(t,"ZodNumber",{gt(r,s){return this.check(Mh(r,s))},gte(r,s){return this.check(pa(r,s))},min(r,s){return this.check(pa(r,s))},lt(r,s){return this.check(Ph(r,s))},lte(r,s){return this.check(fa(r,s))},max(r,s){return this.check(fa(r,s))},int(r){return this.check($h(r))},safe(r){return this.check($h(r))},positive(r){return this.check(Mh(0,r))},nonnegative(r){return this.check(pa(0,r))},negative(r){return this.check(Ph(0,r))},nonpositive(r){return this.check(fa(0,r))},multipleOf(r,s){return this.check(Rh(r,s))},step(r,s){return this.check(Rh(r,s))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function M(t){return gk(up,t)}const WS=C("ZodNumberFormat",(t,e)=>{yw.init(t,e),up.init(t,e)});function $h(t){return _k(WS,t)}const YS=C("ZodBoolean",(t,e)=>{xw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Uk(t,n,r)});function Sn(t){return yk(YS,t)}const XS=C("ZodAny",(t,e)=>{bw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Zk()});function J(){return xk(XS)}const qS=C("ZodUnknown",(t,e)=>{vw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>jk()});function ul(){return bk(qS)}const JS=C("ZodNever",(t,e)=>{ww.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Gk(t,n,r)});function KS(t){return vk(JS,t)}const QS=C("ZodArray",(t,e)=>{kw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Xk(t,n,r,s),t.element=e.element,js(t,"ZodArray",{min(n,r){return this.check(Vi(n,r))},nonempty(n){return this.check(Vi(1,n))},max(n,r){return this.check(rp(n,r))},length(n,r){return this.check(sp(n,r))},unwrap(){return this.element}})});function W(t,e){return zk(QS,t,e)}const eT=C("ZodObject",(t,e)=>{Tw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qk(t,n,r,s),oe(t,"shape",()=>e.shape),js(t,"ZodObject",{keyof(){return Ce(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:ul()})},loose(){return this.clone({...this._zod.def,catchall:ul()})},strict(){return this.clone({...this._zod.def,catchall:KS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Z0(this,n)},safeExtend(n){return j0(this,n)},merge(n){return V0(this,n)},pick(n){return U0(this,n)},omit(n){return G0(this,n)},partial(...n){return H0(dp,this,n[0])},required(...n){return W0(fp,this,n[0])}})});function v(t,e){const n={type:"object",shape:t??{},...G(e)};return new eT(n)}const hp=C("ZodUnion",(t,e)=>{tp.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Jk(t,n,r,s),t.options=e.options});function Ot(t,e){return new hp({type:"union",options:t,...G(e)})}const tT=C("ZodDiscriminatedUnion",(t,e)=>{hp.init(t,e),Aw.init(t,e)});function qe(t,e,n){return new tT({type:"union",options:e,discriminator:t,...G(n)})}const nT=C("ZodIntersection",(t,e)=>{Cw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Kk(t,n,r,s)});function rT(t,e){return new nT({type:"intersection",left:t,right:e})}const Nh=C("ZodRecord",(t,e)=>{Ew.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qk(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function de(t,e,n){return!e||!e._zod?new Nh({type:"record",keyType:p(),valueType:t,...G(e)}):new Nh({type:"record",keyType:t,valueType:e,...G(n)})}const hl=C("ZodEnum",(t,e)=>{Iw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Vk(t,r,s),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,s)=>{const i={};for(const o of r)if(n.has(o))i[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new hl({...e,checks:[],...G(s),entries:i})},t.exclude=(r,s)=>{const i={...e.entries};for(const o of r)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new hl({...e,checks:[],...G(s),entries:i})}});function Ce(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new hl({type:"enum",entries:n,...G(e)})}const sT=C("ZodLiteral",(t,e)=>{Pw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Hk(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new sT({type:"literal",values:Array.isArray(t)?t:[t],...G(e)})}const iT=C("ZodTransform",(t,e)=>{Mw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Yk(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Df(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Cs(i,n.value,e));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Cs(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=s,n.fallback=!0,n)}});function oT(t){return new iT({type:"transform",transform:t})}const dp=C("ZodOptional",(t,e)=>{np.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>lp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Dh(t){return new dp({type:"optional",innerType:t})}const aT=C("ZodExactOptional",(t,e)=>{Rw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>lp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function lT(t){return new aT({type:"optional",innerType:t})}const cT=C("ZodNullable",(t,e)=>{zw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>eS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Lh(t){return new cT({type:"nullable",innerType:t})}const uT=C("ZodDefault",(t,e)=>{Ow.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>nS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function hT(t,e){return new uT({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Bf(e)}})}const dT=C("ZodPrefault",(t,e)=>{$w.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>rS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function fT(t,e){return new dT({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Bf(e)}})}const fp=C("ZodNonOptional",(t,e)=>{Nw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>tS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function pT(t,e){return new fp({type:"nonoptional",innerType:t,...G(e)})}const mT=C("ZodCatch",(t,e)=>{Dw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>sS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function gT(t,e){return new mT({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const _T=C("ZodPipe",(t,e)=>{Lw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>iS(t,n,r,s),t.in=e.in,t.out=e.out});function Fh(t,e){return new _T({type:"pipe",in:t,out:e})}const yT=C("ZodReadonly",(t,e)=>{Fw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>oS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function xT(t){return new yT({type:"readonly",innerType:t})}const bT=C("ZodLazy",(t,e)=>{Bw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>aS(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function vT(t){return new bT({type:"lazy",getter:t})}const pp=C("ZodCustom",(t,e)=>{Uw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Wk(t,n)});function wT(t,e={}){return Ok(pp,t,e)}function kT(t,e){return $k(t,e)}function mp(t,e={}){const n=new pp({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...G(e)});return n._zod.bag.Class=t,n._zod.check=r=>{r.value instanceof t||r.issues.push({code:"invalid_type",expected:t.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}const ST={custom:"custom"};v({name:p(),description:p().optional(),inputSchema:v({type:k("object"),properties:de(p(),J()),required:W(p()),additionalProperties:Sn()})});function ma(){return{}}const gp=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)});class Bh{constructor(){ne(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function Uh(){return!0}class TT{constructor(){}setTimeout(e,n){const r=setTimeout(e,n);return r.ref=typeof r.ref=="function"?r.ref:()=>r,r.unref=typeof r.unref=="function"?r.unref:()=>r,r.hasRef=typeof r.hasRef=="function"?r.hasRef:()=>!0,r.refresh=typeof r.refresh=="function"?r.refresh:()=>r,r}clearTimeout(e){window.clearTimeout(e)}}const AT=new TT,Ue=v({providerData:de(p(),J()).optional()}),ft=Ue.extend({id:p().optional()}),CT=Ue.extend({type:k("refusal"),refusal:p()}),ET=Ue.extend({type:k("output_text"),text:p()}),ql=Ue.extend({type:k("input_text"),text:p()}),IT=Ue.extend({type:k("reasoning_text"),text:p()}),_p=Ue.extend({type:k("input_image"),image:p().or(v({id:p().describe("OpenAI file ID")})).describe("Either base64 encoded image data, a data URL, or an object with a file ID.").optional(),detail:p().optional()}),yp=Ue.extend({type:k("input_file"),file:p().describe("Either base64 encoded file data or a publicly accessible file URL").or(v({id:p().describe("OpenAI file ID")})).or(v({url:p().describe("Publicly accessible file URL")})).describe("Contents of the file or an object with a file ID.").optional(),filename:p().optional()}),xp=Ue.extend({type:k("audio"),audio:p().or(v({id:p()})).describe("Base64 encoded audio data or file id"),format:p().nullable().optional(),transcript:p().nullable().optional()}),PT=Ue.extend({type:k("image"),image:p().describe("Base64 encoded image data")}),MT=Ue.extend({type:k("text"),text:p()}),RT=v({data:Ot([p(),mp(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),zT=v({url:p().describe("Publicly accessible URL pointing to the image content")}),OT=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),$T=Ot([RT,zT,OT]).describe("Inline image data or references to uploaded content."),NT=v({data:Ot([p(),mp(Uint8Array)]).describe("Base64 encoded file data, or raw bytes that will be encoded automatically."),mediaType:p().describe("IANA media type describing the file contents"),filename:p().describe("Filename associated with the inline data")}),DT=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),LT=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),FT=Ot([p().describe("Existing data URL or base64 string"),NT,DT,LT]).describe("Inline data (with metadata) or references pointing to file contents."),BT=(...t)=>p(),UT=Ue.extend({type:k("image"),image:p().or($T).optional(),detail:BT("low","high","auto").optional()}),GT=Ue.extend({type:k("file"),file:FT}),ZT=Ue.extend({type:k("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Gh=qe("type",[v({type:k("screenshot")}),v({type:k("click"),x:M(),y:M(),button:Ce(["left","right","wheel","back","forward"])}),v({type:k("double_click"),x:M(),y:M()}),v({type:k("scroll"),x:M(),y:M(),scroll_x:M(),scroll_y:M()}),v({type:k("type"),text:p()}),v({type:k("wait")}),v({type:k("move"),x:M(),y:M()}),v({type:k("keypress"),keys:W(p())}),v({type:k("drag"),path:W(v({x:M(),y:M()}))})]),jT=qe("type",[ET,CT,xp,PT]),Jl=ft.extend({type:k("message").optional()}),ao=Jl.extend({role:k("assistant"),status:Ce(["in_progress","completed","incomplete"]),content:W(jT)}),VT=qe("type",[ql,_p,yp,xp]),bp=Jl.extend({role:k("user"),content:W(VT).or(p())}),vp=Jl.extend({role:k("system"),content:p()});qe("role",[vp,ao,bp]);const Es=ft.extend({type:k("hosted_tool_call"),name:p().describe("The name of the hosted tool"),arguments:p().describe("The arguments of the hosted tool call").optional(),status:p().optional(),output:p().optional()}),Is=ft.extend({type:k("function_call"),callId:p().describe("The ID of the tool call"),name:p().describe("The name of the function"),namespace:p().optional(),status:Ce(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:k("tool_reference"),functionName:p(),namespace:p().optional()});const HT=de(p(),J()),WT=ul(),Kl=ft.extend({type:k("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),arguments:WT,status:p().optional()}),Ql=ft.extend({type:k("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),status:p().optional(),tools:W(HT)}),YT=qe("type",[MT,UT,GT]),XT=qe("type",[ql,_p,yp]),Wi=ft.extend({type:k("function_call_result"),name:p().describe("The name of the tool"),namespace:p().optional(),callId:p().describe("The ID of the tool call"),status:Ce(["in_progress","completed","incomplete"]),output:Ot([p(),YT,W(XT)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),lo=ft.extend({type:k("computer_call"),callId:p().describe("The ID of the computer call"),status:Ce(["in_progress","completed","incomplete"]),action:Gh.optional(),actions:W(Gh).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:ST.custom,message:"computer_call items must include action or actions.",path:["action"]})}),wp=ft.extend({type:k("computer_call_result"),callId:p().describe("The ID of the computer call"),output:ZT}),qT=v({commands:W(p()),timeoutMs:M().int().min(0).optional(),maxOutputLength:M().int().min(0).optional()}),co=ft.extend({type:k("shell_call"),callId:p(),status:Ce(["in_progress","completed","incomplete"]).optional(),action:qT}),JT=qe("type",[v({type:k("timeout")}),v({type:k("exit"),exitCode:M().int().nullable()})]),KT=v({stdout:p(),stderr:p(),outcome:JT}).passthrough(),ec=ft.extend({type:k("shell_call_output"),callId:p(),maxOutputLength:M().optional(),output:W(KT)}),QT=v({type:k("create_file"),path:p(),diff:p()}),e1=v({type:k("update_file"),path:p(),diff:p()}),t1=v({type:k("delete_file"),path:p()}),n1=qe("type",[QT,e1,t1]),uo=ft.extend({type:k("apply_patch_call"),callId:p(),status:Ce(["in_progress","completed"]),operation:n1}),tc=ft.extend({type:k("apply_patch_call_output"),callId:p(),status:Ce(["completed","failed"]),output:p().optional()}),r1=qe("type",[lo,co,uo,Is,Es]),nc=Ue.extend({id:p().optional(),type:k("reasoning"),content:W(ql),rawContent:W(IT).optional()}),kp=ft.extend({type:k("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),Sp=ft.extend({type:k("unknown")}),Tp=qe("type",[ao,Kl,Ql,Es,Is,lo,co,uo,Wi,ec,tc,nc,kp,Sp]),s1=Ot([bp,ao,vp,Kl,Ql,Es,Is,lo,co,uo,Wi,wp,ec,tc,nc,kp,Sp]),i1=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:de(p(),M()).optional(),outputTokensDetails:de(p(),M()).optional(),endpoint:p().optional()}),o1=v({requests:M().optional(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:Ot([de(p(),M()),W(de(p(),M()))]).optional(),outputTokensDetails:Ot([de(p(),M()),W(de(p(),M()))]).optional(),requestUsageEntries:W(i1).optional()}),a1=Ue.extend({type:k("output_text_delta"),delta:p()}),l1=Ue.extend({type:k("response_started")}),c1=Ue.extend({type:k("response_done"),response:Ue.extend({id:p(),requestId:p().optional(),usage:o1,output:W(Tp)})}),u1=Ue.extend({type:k("model"),event:J().describe("The event from the model")});qe("type",[a1,c1,l1,u1]);const Zh=Symbol.for("openai.agents.core.asyncLocalStorage");let ga;function h1(){try{const t=globalThis,e=t[Zh];if(e)return e;const n=new Bh;return t[Zh]=n,n}catch{return ga||(ga=new Bh),ga}}function Ap(){const t=h1().getStore();if((t==null?void 0:t.active)===!0)return t}function jh(){const t=Ap();return t!=null&&t.trace?t.trace:null}function Vh(){const t=Ap();return t!=null&&t.span?t.span:null}class d1{async export(e){if(Nf.disabled){Te.debug("Tracing is disabled. Skipping export");return}for(const n of e)n.type==="trace"?console.log(`[Exporter] Export trace traceId=${n.traceId} name=${n.name}${n.groupId?` groupId=${n.groupId}`:""}`):console.log(`[Exporter] Export span: ${JSON.stringify(n)}`)}}var Rs,kr,zs,Os,Sr,Je,Qt,yn,xn,Tr,ut,dl,fl,_r;class f1{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){me(this,ut);me(this,Rs);me(this,kr);me(this,zs);me(this,Os);me(this,Sr);me(this,Je,[]);me(this,Qt);me(this,yn,null);me(this,xn,!1);me(this,Tr,null);Q(this,Rs,n),Q(this,kr,r),Q(this,zs,s),Q(this,Os,n*i),Q(this,Sr,e),Q(this,Qt,AT),Te.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){Q(this,Tr,new AbortController),Ct(this,ut,fl).call(this)}async onTraceStart(e){await Ct(this,ut,dl).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await Ct(this,ut,dl).call(this,e)}async shutdown(e){var n;for(e&&z(this,Qt).setTimeout(()=>{var r;(r=z(this,Tr))==null||r.abort()},e),Te.debug("Shutting down gracefully");z(this,Je).length>0;){if(Te.debug(`Waiting for buffer to empty. Items left: ${z(this,Je).length}`),z(this,xn)||await Ct(this,ut,_r).call(this,!0),(n=z(this,Tr))!=null&&n.signal.aborted){Te.debug("Timeout reached, force flushing"),await Ct(this,ut,_r).call(this,!0);break}await new Promise(r=>z(this,Qt).setTimeout(r,500))}Te.debug("Buffer empty. Exiting"),z(this,Qt)&&z(this,yn)&&z(this,Qt).clearTimeout(z(this,yn))}async forceFlush(){z(this,Je).length>0&&await Ct(this,ut,_r).call(this,!0)}}Rs=new WeakMap,kr=new WeakMap,zs=new WeakMap,Os=new WeakMap,Sr=new WeakMap,Je=new WeakMap,Qt=new WeakMap,yn=new WeakMap,xn=new WeakMap,Tr=new WeakMap,ut=new WeakSet,dl=async function(e){if(z(this,Je).length+1>z(this,Rs)){Te.error("Dropping trace because buffer is full");return}z(this,Je).push(e),z(this,Je).length>z(this,Os)&&await Ct(this,ut,_r).call(this)},fl=function(){Q(this,yn,z(this,Qt).setTimeout(async()=>{await Ct(this,ut,_r).call(this),Ct(this,ut,fl).call(this)},z(this,zs))),typeof z(this,yn).unref=="function"&&z(this,yn).unref()},_r=async function(e=!1){if(z(this,Je).length!==0){if(Te.debug(`Exporting batches. Force: ${e}. Buffer size: ${z(this,Je).length}`),e||z(this,Je).length<z(this,kr)){const n=[...z(this,Je)];Q(this,Je,[]),Q(this,xn,!0),await z(this,Sr).export(n),Q(this,xn,!1)}else if(z(this,Je).length>0){const n=z(this,Je).splice(0,z(this,kr));Q(this,xn,!0),await z(this,Sr).export(n),Q(this,xn,!1)}}};var mt;class p1{constructor(){me(this,mt,[])}start(){for(const e of z(this,mt))e.start&&e.start()}addTraceProcessor(e){z(this,mt).push(e)}setProcessors(e){Te.debug("Shutting down old processors");for(const n of z(this,mt))n.shutdown();Q(this,mt,e)}async onTraceStart(e){for(const n of z(this,mt))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of z(this,mt))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of z(this,mt))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of z(this,mt))await n.onSpanEnd(e)}async shutdown(e){for(const n of z(this,mt))await n.shutdown(e)}async forceFlush(){for(const e of z(this,mt))await e.forceFlush()}}mt=new WeakMap;let _a=null,ya=null;function m1(){return _a||(_a=new d1),_a}function Cp(){return ya||(ya=new f1(m1())),ya}function Hh(){return new Date().toISOString()}function Ep(){return`trace_${gp().replace(/-/g,"")}`}function g1(){return`span_${gp().replace(/-/g,"").slice(0,24)}`}function _1(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var $s,Ns,Ds,Ls,Fs,Hn,bn,vn,Wn,Ar,Bs;const rc=class rc{constructor(e,n){ne(this,"type","trace.span");me(this,$s);me(this,Ns);me(this,Ds);me(this,Ls);me(this,Fs);me(this,Hn);me(this,bn);me(this,vn);me(this,Wn);me(this,Ar);me(this,Bs);Q(this,Ns,e.traceId),Q(this,Ds,e.spanId??g1()),Q(this,$s,e.data),Q(this,Hn,n),Q(this,Ls,e.parentId??null),Q(this,Fs,e.traceMetadata),Q(this,Wn,e.error??null),Q(this,bn,e.startedAt??null),Q(this,vn,e.endedAt??null),Q(this,Ar,e.tracingApiKey)}get traceId(){return z(this,Ns)}get spanData(){return z(this,$s)}get traceMetadata(){return z(this,Fs)}get spanId(){return z(this,Ds)}get parentId(){return z(this,Ls)}get previousSpan(){return z(this,Bs)}set previousSpan(e){Q(this,Bs,e)}start(){if(z(this,bn)){Te.warn("Span already started");return}Q(this,bn,Hh()),z(this,Hn).onSpanStart(this)}end(){if(z(this,vn)){Te.debug("Span already finished",this.spanData);return}Q(this,vn,Hh()),z(this,Hn).onSpanEnd(this)}setError(e){Q(this,Wn,e)}get error(){return z(this,Wn)}get startedAt(){return z(this,bn)}get endedAt(){return z(this,vn)}get tracingApiKey(){return z(this,Ar)}clone(){var n;const e=new rc({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:z(this,bn)??void 0,endedAt:z(this,vn)??void 0,error:z(this,Wn)??void 0,tracingApiKey:z(this,Ar)},z(this,Hn));return e.previousSpan=(n=this.previousSpan)==null?void 0:n.clone(),e}toJSON(){return{object:this.type,id:this.spanId,trace_id:this.traceId,parent_id:this.parentId,started_at:this.startedAt,ended_at:this.endedAt,span_data:_1(this.spanData),error:this.error}}};$s=new WeakMap,Ns=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,Fs=new WeakMap,Hn=new WeakMap,bn=new WeakMap,vn=new WeakMap,Wn=new WeakMap,Ar=new WeakMap,Bs=new WeakMap;let Ps=rc;class mn extends Ps{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var Cr,en;const sc=class sc{constructor(e,n){ne(this,"type","trace");ne(this,"traceId");ne(this,"name");ne(this,"groupId",null);ne(this,"metadata");ne(this,"tracingApiKey");me(this,Cr);me(this,en);this.traceId=e.traceId??Ep(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,Q(this,Cr,n??Cp()),Q(this,en,e.started??!1)}async start(){z(this,en)||(Q(this,en,!0),await z(this,Cr).onTraceStart(this))}async end(){z(this,en)&&(Q(this,en,!1),await z(this,Cr).onTraceEnd(this))}clone(){return new sc({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:z(this,en),tracingApiKey:this.tracingApiKey})}toJSON(e){const n={object:this.type,id:this.traceId,workflow_name:this.name,group_id:this.groupId,metadata:this.metadata};return e!=null&&e.includeTracingApiKey&&this.tracingApiKey&&(n.tracing_api_key=this.tracingApiKey),n}};Cr=new WeakMap,en=new WeakMap;let Ms=sc;class xa extends Ms{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var We,Yn,tn,Yi,Pp;class Ip{constructor(){me(this,Yi);me(this,We);me(this,Yn);me(this,tn);Q(this,We,new p1),Q(this,Yn,Nf.disabled),Q(this,tn,null),Ct(this,Yi,Pp).call(this)}registerProcessor(e){Q(this,tn,null),z(this,We).addTraceProcessor(e)}setProcessors(e){Q(this,tn,null),z(this,We).setProcessors(e)}getCurrentTrace(){return jh()}getCurrentSpan(){return Vh()}setDisabled(e){Q(this,Yn,e)}startExportLoop(){z(this,We).start()}createTrace(e){if(z(this,Yn))return Te.debug("Tracing is disabled, Not creating trace %o",e),new xa;const n=e.traceId??Ep(),r=e.name??"Agent workflow";return Te.debug("Creating trace %s with name %s",n,r),new Ms({...e,name:r,traceId:n},z(this,We))}createSpan(e,n){if(z(this,Yn)||e.disabled)return Te.debug("Tracing is disabled, Not creating span %o",e),new mn(e.data,z(this,We));let r,s,i,o;if(n){if(n instanceof Ms){if(n instanceof xa)return Te.debug("Parent trace is no-op, returning NoopSpan"),new mn(e.data,z(this,We));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof Ps){if(n instanceof mn)return Te.debug("Parent span is no-op, returning NoopSpan"),new mn(e.data,z(this,We));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=jh(),l=Vh();if(!a)return Te.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new mn(e.data,z(this,We));if(l instanceof mn||a instanceof xa)return Te.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new mn(e.data,z(this,We));s=a.traceId,i=a.tracingApiKey,o=a.metadata,l?(Te.debug("Using parent span %s",l.spanId),r=l.spanId):Te.debug("No parent span, using current trace %s",a.traceId)}return s?(Te.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new Ps({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},z(this,We))):(Te.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new mn(e.data,z(this,We)))}async shutdown(e){z(this,tn)||Q(this,tn,(async()=>{try{Te.debug("Shutting down tracing provider"),await z(this,We).shutdown(e)}catch(n){Te.error("Error shutting down tracing provider %o",n)}})()),await z(this,tn)}async forceFlush(){await z(this,We).forceFlush()}}We=new WeakMap,Yn=new WeakMap,tn=new WeakMap,Yi=new WeakSet,Pp=function(){if(typeof process<"u"&&typeof process.on=="function"){const e=async()=>{const n=setTimeout(()=>{console.warn("Cleanup timeout, forcing exit"),process.exit(1)},5e3);try{await this.shutdown()}finally{clearTimeout(n)}};process.once("beforeExit",e),process.on("SIGINT",async()=>{await e(),Wh("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Wh("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{Te.error("Unhandled rejection",n,r),await e(),y1("unhandledRejection")||process.exit(1)})}};let ba;function Wh(t){return process.listeners(t).length>1}function y1(t){return process.listeners(t).length>1}function x1(){const t=Symbol.for("openai.agents.core.traceProvider");try{const e=globalThis,n=e[t];if(n)return n;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.writable===!1&&r.configurable===!1&&!r.set)return yi();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return yi()}try{const s=new Ip;return e[t]=s,s}catch{return yi()}}catch{return yi()}}function yi(){return ba||(ba=new Ip),ba}function b1(t){x1().registerProcessor(t)}const v1=qe("type",[v({type:k("next_step_handoff"),newAgent:J()}),v({type:k("next_step_final_output"),output:p()}),v({type:k("next_step_run_again")}),v({type:k("next_step_interruption"),data:de(p(),J())})]),w1="1.8",k1=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",w1],S1=Ce(k1),vt=v({name:p()}),T1=v({object:k("trace.span"),id:p(),trace_id:p(),parent_id:p().nullable(),started_at:p().nullable(),ended_at:p().nullable(),error:v({message:p(),data:de(p(),J()).optional()}).nullable(),span_data:de(p(),J())}),Mp=T1.extend({previous_span:vT(()=>Mp).optional()}),A1=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:de(p(),M()).optional(),outputTokensDetails:de(p(),M()).optional(),endpoint:p().optional()}),Rp=v({requests:M(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:W(de(p(),M())).optional(),outputTokensDetails:W(de(p(),M())).optional(),requestUsageEntries:W(A1).optional()}),Yh=v({usage:Rp,output:W(Tp),responseId:p().optional(),requestId:p().optional(),providerData:de(p(),J()).optional()}),zp=qe("type",[v({type:k("message_output_item"),rawItem:ao,agent:vt}),v({type:k("tool_search_call_item"),rawItem:Kl,agent:vt}),v({type:k("tool_search_output_item"),rawItem:Ql,agent:vt}),v({type:k("tool_call_item"),rawItem:r1.or(Es),agent:vt}),v({type:k("tool_call_output_item"),rawItem:Wi.or(wp).or(ec).or(tc),agent:vt,output:p()}),v({type:k("reasoning_item"),rawItem:nc,agent:vt}),v({type:k("handoff_call_item"),rawItem:Is,agent:vt}),v({type:k("handoff_output_item"),rawItem:Wi,sourceAgent:vt,targetAgent:vt}),v({type:k("tool_approval_item"),rawItem:Is.or(Es).or(lo).or(co).or(uo),agent:vt,toolName:p().optional()})]),C1=v({object:k("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:de(p(),J()),tracing_api_key:p().optional().nullable()}),E1=v({newItems:W(zp),toolsUsed:W(p()),handoffs:W(v({toolCall:J(),handoff:J()})),functions:W(v({toolCall:J(),tool:J()})),computerActions:W(v({toolCall:J(),computer:J()})),shellActions:W(v({toolCall:J(),shell:J()})).optional(),applyPatchActions:W(v({toolCall:J(),applyPatch:J()})).optional(),mcpApprovalRequests:W(v({requestItem:v({rawItem:v({type:k("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:de(p(),J()).nullable().optional()})}),mcpTool:v({type:k("hosted_tool"),name:k("hosted_mcp"),providerData:de(p(),J())})})).optional()}),Op=v({tripwireTriggered:Sn(),outputInfo:J()}),I1=qe("type",[v({type:k("allow")}),v({type:k("rejectContent"),message:p()}),v({type:k("throwException")})]),$p=v({outputInfo:J().optional(),behavior:I1}),Np=v({type:Ot([k("tool_input"),k("tool_output")]),name:p()}),P1=v({guardrail:v({type:k("input"),name:p()}),output:Op}),M1=v({guardrail:v({type:k("output"),name:p()}),agentOutput:J(),agent:vt,output:Op}),R1=v({guardrail:Np.extend({type:k("tool_input")}),output:$p}),z1=v({guardrail:Np.extend({type:k("tool_output")}),output:$p});v({$schemaVersion:S1,currentTurn:M(),currentAgent:vt,originalInput:p().or(W(s1)),modelResponses:W(Yh),context:v({usage:Rp,approvals:de(p(),v({approved:W(p()).or(Sn()),rejected:W(p()).or(Sn()),messages:de(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:de(p(),J()),toolInput:J().optional()}),toolUseTracker:de(p(),W(p())),maxTurns:M(),currentAgentSpan:Mp.nullable().optional(),noActiveAgentRun:Sn(),inputGuardrailResults:W(P1),outputGuardrailResults:W(M1),toolInputGuardrailResults:W(R1).optional().default([]),toolOutputGuardrailResults:W(z1).optional().default([]),currentTurnInProgress:Sn().optional(),currentStep:v1.optional(),lastModelResponse:Yh.optional(),generatedItems:W(zp),pendingAgentToolRuns:de(p(),p()).optional().default({}),lastProcessedResponse:E1.optional(),currentTurnPersistedItemCount:M().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:Ce(["preserve","omit"]).optional(),trace:C1.nullable()});v({input:p()});Gl("openai-agents:mcp-servers");b1(Cp());v({itemId:p()});qe("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("system"),content:W(v({type:k("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("user"),status:Ce(["in_progress","completed"]),content:W(v({type:k("input_text"),text:p()}).or(v({type:k("input_audio"),audio:p().nullable().optional(),transcript:p().nullable()})))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("assistant"),status:Ce(["in_progress","completed","incomplete"]),content:W(v({type:k("output_text"),text:p()}).or(v({type:k("output_audio"),audio:p().nullable().optional(),transcript:p().nullable().optional()})))})]);v({itemId:p(),previousItemId:p().nullable().optional(),type:k("function_call"),status:Ce(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:Ce(["mcp_call","mcp_tool_call"]),status:Ce(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:k("mcp_approval_request"),serverLabel:p(),name:p(),arguments:de(p(),J()),approved:Sn().optional().nullable()});Gl("openai-agents:realtime");const Dp=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:M().or(k("inf")).optional().nullable(),metadata:de(p(),J()).optional().nullable(),output_modalities:W(p()).optional().nullable(),object:k("realtime.response").optional().nullable(),output:W(J()).optional().nullable(),audio:v({output:v({format:J().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:Ce(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:de(p(),J()).optional().nullable(),usage:v({input_tokens:M().optional(),input_token_details:de(p(),J()).optional().nullable(),output_tokens:M().optional(),output_token_details:de(p(),J()).optional().nullable()}).optional().nullable()}),O1=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Ot([k("input_text"),k("input_audio"),k("item_reference"),k("output_text"),k("output_audio")])}),Dr=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:W(O1).optional(),name:p().optional(),output:p().nullable().optional(),role:Ce(["user","assistant","system"]).optional(),status:Ce(["completed","incomplete","in_progress"]).optional(),type:Ce(["message","function_call","function_call_output","mcp_list_tools","mcp_tool_call","mcp_call","mcp_approval_request","mcp_approval_response"]).optional(),approval_request_id:p().nullable().optional(),approve:Sn().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:J().nullable().optional(),tools:W(v({name:p(),description:p(),input_schema:de(p(),J()).optional()}).passthrough()).optional()}).passthrough(),$1=v({type:k("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:k("realtime.conversation").optional()})}),N1=v({type:k("conversation.item.added"),event_id:p(),item:Dr,previous_item_id:p().nullable().optional()}),D1=v({type:k("conversation.item.done"),event_id:p(),item:Dr,previous_item_id:p().nullable().optional()}),L1=v({type:k("conversation.item.deleted"),event_id:p(),item_id:p()}),F1=v({type:k("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),logprobs:W(J()).nullable().optional(),usage:v({type:k("tokens"),total_tokens:M(),input_tokens:M(),input_token_details:v({text_tokens:M(),audio_tokens:M()}),output_tokens:M()}).optional()}),B1=v({type:k("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:M().optional(),delta:p().optional(),logprobs:W(J()).nullable().optional()}),U1=v({type:k("conversation.item.input_audio_transcription.failed"),event_id:p(),item_id:p(),content_index:M(),error:v({code:p().optional(),message:p().optional(),param:p().optional(),type:p().optional()})}),G1=v({type:k("conversation.item.retrieved"),event_id:p(),item:Dr}),Z1=v({type:k("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:M(),content_index:M()}),j1=v({type:k("conversation.item.create"),item:Dr,event_id:p().optional(),previous_item_id:p().nullable().optional()}),V1=v({type:k("conversation.item.delete"),item_id:p(),event_id:p().optional()}),H1=v({type:k("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),W1=v({type:k("conversation.item.truncate"),item_id:p(),audio_end_ms:M(),content_index:M(),event_id:p().optional()}),Y1=v({type:k("error"),event_id:p().optional(),error:J().optional()}),X1=v({type:k("input_audio_buffer.cleared"),event_id:p()}),q1=v({type:k("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),J1=v({type:k("input_audio_buffer.clear"),event_id:p().optional()}),K1=v({type:k("input_audio_buffer.commit"),event_id:p().optional()}),Q1=v({type:k("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),eA=v({type:k("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:M()}),tA=v({type:k("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:M()}),nA=v({type:k("output_audio_buffer.started"),event_id:p()}).passthrough(),rA=v({type:k("output_audio_buffer.stopped"),event_id:p()}).passthrough(),sA=v({type:k("output_audio_buffer.cleared"),event_id:p()}),iA=v({type:k("rate_limits.updated"),event_id:p(),rate_limits:W(v({limit:M().optional(),name:Ce(["requests","tokens"]).optional(),remaining:M().optional(),reset_seconds:M().optional()}))}),oA=v({type:k("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),aA=v({type:k("response.output_audio.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p()}),lA=v({type:k("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),cA=v({type:k("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),output_index:M(),response_id:p()}),uA=v({type:k("response.content_part.added"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),hA=v({type:k("response.content_part.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),dA=v({type:k("response.created"),event_id:p(),response:Dp}),fA=v({type:k("response.done"),event_id:p(),response:Dp}),pA=v({type:k("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:M(),response_id:p()}),mA=v({type:k("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:M(),response_id:p()}),gA=v({type:k("response.output_item.added"),event_id:p(),item:Dr,output_index:M(),response_id:p()}),_A=v({type:k("response.output_item.done"),event_id:p(),item:Dr,output_index:M(),response_id:p()}),yA=v({type:k("response.output_text.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),xA=v({type:k("response.output_text.done"),event_id:p(),item_id:p(),content_index:M(),text:p(),output_index:M(),response_id:p()}),bA=v({type:k("session.created"),event_id:p(),session:J()}),vA=v({type:k("session.updated"),event_id:p(),session:J()}),wA=v({type:k("response.cancel"),event_id:p().optional(),response_id:p().optional()}),kA=v({type:k("response.create"),event_id:p().optional(),response:J().optional()}),SA=v({type:k("session.update"),event_id:p().optional(),session:J()}),TA=v({type:k("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),AA=v({type:k("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),CA=v({type:k("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),delta:p(),obfuscation:p()}),EA=v({type:k("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),arguments:p()}),IA=v({type:k("response.mcp_call.in_progress"),event_id:p(),output_index:M(),item_id:p()}),PA=v({type:k("response.mcp_call.completed"),event_id:p(),output_index:M(),item_id:p()}),MA=v({type:k("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();qe("type",[$1,N1,D1,L1,F1,B1,U1,G1,Z1,Y1,X1,Q1,eA,tA,nA,rA,sA,iA,oA,aA,lA,cA,uA,hA,dA,fA,pA,mA,gA,_A,yA,xA,bA,vA,TA,AA,MA,CA,EA,IA,PA]);qe("type",[j1,V1,H1,W1,q1,J1,K1,wA,kA,SA]);const va={};var nn={};const RA=typeof process<"u"&&typeof(nn==null?void 0:nn.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?nn.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(nn==null?void 0:nn.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&nn.NEXT_PUBLIC_PLAY_API_BASE.length>0?nn.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(va==null?void 0:va.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");Ky({});new Xt;new Ci;new Xt;new Xt;new Xt;new Xt;export{zt as B,Xt as C,Us as D,ve as E,qi as G,ae as M,et as P,Pa as R,xl as S,oi as T,Ca as U,An as a,Fd as b,zd as c,an as d,yt as e,ml as f,xe as g,pd as h,Dd as i,vi as j,be as k,p_ as l,Ic as n,Mm as r,_t as w};
|
|
362
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){i(u);continue}if(t.external){const d=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&d){i(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){i(u);continue}if(h.cycle){i(u);continue}if(h.count>1&&t.reused==="ref"){i(u);continue}}}function dp(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const f=t.seen.get(h);if(f.ref===null)return;const d=f.def??f.schema,m={...d},y=f.ref;if(f.ref=null,y){r(y);const x=t.seen.get(y),b=x.schema;if(b.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(b)):Object.assign(d,b),Object.assign(d,m),h._zod.parent===y)for(const T in d)T==="$ref"||T==="allOf"||T in m||delete d[T];if(b.$ref&&x.def)for(const T in d)T==="$ref"||T==="allOf"||T in x.def&&JSON.stringify(d[T])===JSON.stringify(x.def[T])&&delete d[T]}const g=h._zod.parent;if(g&&g!==y){r(g);const x=t.seen.get(g);if(x!=null&&x.schema.$ref&&(d.$ref=x.schema.$ref,x.def))for(const b in d)b==="$ref"||b==="allOf"||b in x.def&&JSON.stringify(d[b])===JSON.stringify(x.def[b])&&delete d[b]}t.override({zodSchema:h,jsonSchema:d,path:f.path??[]})};for(const h of[...t.seen.entries()].reverse())r(h[0]);const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(l=t.external.registry.get(e))==null?void 0:l.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(h)}Object.assign(s,n.def??n.schema);const i=(c=t.metadataRegistry.get(e))==null?void 0:c.id;i!==void 0&&s.id===i&&delete s.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const h of t.seen.entries()){const f=h[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,o[f.defId]=f.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:Wi(e,"input",t.processors),output:Wi(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function st(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return st(r.element,n);if(r.type==="set")return st(r.valueType,n);if(r.type==="lazy")return st(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return st(r.innerType,n);if(r.type==="intersection")return st(r.left,n)||st(r.right,n);if(r.type==="record"||r.type==="map")return st(r.keyType,n)||st(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:st(r.in,n)||st(r.out,n);if(r.type==="object"){for(const s in r.shape)if(st(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(st(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(st(s,n))return!0;return!!(r.rest&&st(r.rest,n))}return!1}const tS=(t,e={})=>n=>{const r=up({...n,processors:e});return $e(t,r),hp(r,t),dp(r,t)},Wi=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=up({...s??{},target:i,io:e,processors:n});return $e(t,o),hp(o,t),dp(o,t)},nS={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rS=(t,e,n,r)=>{const s=n;s.type="string";const{minimum:i,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof o=="number"&&(s.maxLength=o),a&&(s.format=nS[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),c&&(s.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?s.pattern=u[0].source:u.length>1&&(s.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},sS=(t,e,n,r)=>{const s=n,{minimum:i,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number";const h=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),d=e.target==="draft-04"||e.target==="openapi-3.0";h?d?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u:typeof i=="number"&&(s.minimum=i),f?d?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c:typeof o=="number"&&(s.maximum=o),typeof l=="number"&&(s.multipleOf=l)},iS=(t,e,n,r)=>{n.type="boolean"},oS=(t,e,n,r)=>{n.not={}},aS=(t,e,n,r)=>{},lS=(t,e,n,r)=>{},cS=(t,e,n,r)=>{const s=t._zod.def,i=Zf(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},uS=(t,e,n,r)=>{const s=t._zod.def,i=[];for(const o of s.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},hS=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dS=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},fS=(t,e,n,r)=>{const s=n,i=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=$e(i.element,e,{...r,path:[...r.path,"items"]})},pS=(t,e,n,r)=>{var c;const s=n,i=t._zod.def;s.type="object",s.properties={};const o=i.shape;for(const u in o)s.properties[u]=$e(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const h=i.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(s.required=Array.from(l)),((c=i.catchall)==null?void 0:c._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=$e(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},mS=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>$e(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},gS=(t,e,n,r)=>{const s=t._zod.def,i=$e(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=$e(s.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(i)?i.allOf:[i],...a(o)?o.allOf:[o]];n.allOf=l},_S=(t,e,n,r)=>{const s=n,i=t._zod.def;s.type="object";const o=i.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(i.mode==="loose"&&l&&l.size>0){const u=$e(i.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const h of l)s.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=$e(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=$e(i.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u)}},yS=(t,e,n,r)=>{const s=t._zod.def,i=$e(s.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},bS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},vS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},wS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},kS=(t,e,n,r)=>{const s=t._zod.def,i=s.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?i?s.out:s.in:s.out;$e(o,e,r);const a=e.seen.get(t);a.ref=o},SS=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},fp=(t,e,n,r)=>{const s=t._zod.def;$e(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},TS=(t,e,n,r)=>{const s=t._zod.innerType;$e(s,e,r);const i=e.seen.get(t);i.ref=s},AS=C("ZodISODateTime",(t,e)=>{ww.init(t,e),Me.init(t,e)});function CS(t){return Pk(AS,t)}const ES=C("ZodISODate",(t,e)=>{kw.init(t,e),Me.init(t,e)});function IS(t){return Mk(ES,t)}const PS=C("ZodISOTime",(t,e)=>{Sw.init(t,e),Me.init(t,e)});function MS(t){return Rk(PS,t)}const RS=C("ZodISODuration",(t,e)=>{Tw.init(t,e),Me.init(t,e)});function zS(t){return zk(RS,t)}const OS=(t,e)=>{Wf.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>pv(t,n)},flatten:{value:n=>fv(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,ul,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,ul,2)}},isEmpty:{get(){return t.issues.length===0}}})},Tt=C("ZodError",OS,{Parent:Error}),$S=Xl(Tt),NS=ql(Tt),DS=io(Tt),LS=oo(Tt),FS=_v(Tt),BS=yv(Tt),US=xv(Tt),GS=bv(Tt),ZS=vv(Tt),jS=wv(Tt),VS=kv(Tt),HS=Sv(Tt),Dh=new WeakMap;function Vs(t,e,n){const r=Object.getPrototypeOf(t);let s=Dh.get(r);if(s||(s=new Set,Dh.set(r,s)),!s.has(e)){s.add(e);for(const i in n){const o=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const Ie=C("ZodType",(t,e)=>(Ee.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Wi(t,"input"),output:Wi(t,"output")}}),t.toJSONSchema=tS(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>$S(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>DS(t,n,r),t.parseAsync=async(n,r)=>NS(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>LS(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>FS(t,n,r),t.decode=(n,r)=>BS(t,n,r),t.encodeAsync=async(n,r)=>US(t,n,r),t.decodeAsync=async(n,r)=>GS(t,n,r),t.safeEncode=(n,r)=>ZS(t,n,r),t.safeDecode=(n,r)=>jS(t,n,r),t.safeEncodeAsync=async(n,r)=>VS(t,n,r),t.safeDecodeAsync=async(n,r)=>HS(t,n,r),Vs(t,"ZodType",{check(...n){const r=this.def;return this.clone(En(r,{checks:[...r.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return In(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(BT(n,r))},superRefine(n,r){return this.check(UT(n,r))},overwrite(n){return this.check(Dr(n))},optional(){return Uh(this)},exactOptional(){return AT(this)},nullable(){return Gh(this)},nullish(){return Uh(Gh(this))},nonoptional(n){return RT(this,n)},array(){return W(this)},or(n){return Ot([this,n])},and(n){return vT(this,n)},transform(n){return Zh(this,ST(n))},default(n){return IT(this,n)},prefault(n){return MT(this,n)},catch(n){return OT(this,n)},pipe(n){return Zh(this,n)},readonly(){return DT(this)},describe(n){const r=this.clone();return hs.add(r,{description:n}),r},meta(...n){if(n.length===0)return hs.get(this);const r=this.clone();return hs.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=hs.get(t))==null?void 0:n.description},configurable:!0}),t)),pp=C("_ZodString",(t,e)=>{Jl.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>rS(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Vs(t,"_ZodString",{regex(...r){return this.check(Bk(...r))},includes(...r){return this.check(Zk(...r))},startsWith(...r){return this.check(jk(...r))},endsWith(...r){return this.check(Vk(...r))},min(...r){return this.check(Hi(...r))},max(...r){return this.check(lp(...r))},length(...r){return this.check(cp(...r))},nonempty(...r){return this.check(Hi(1,...r))},lowercase(r){return this.check(Uk(r))},uppercase(r){return this.check(Gk(r))},trim(){return this.check(Wk())},normalize(...r){return this.check(Hk(...r))},toLowerCase(){return this.check(Yk())},toUpperCase(){return this.check(Xk())},slugify(){return this.check(qk())}})}),WS=C("ZodString",(t,e)=>{Jl.init(t,e),pp.init(t,e),t.email=n=>t.check(ck(YS,n)),t.url=n=>t.check(pk(XS,n)),t.jwt=n=>t.check(Ik(uT,n)),t.emoji=n=>t.check(mk(qS,n)),t.guid=n=>t.check(zh(Lh,n)),t.uuid=n=>t.check(uk(yi,n)),t.uuidv4=n=>t.check(hk(yi,n)),t.uuidv6=n=>t.check(dk(yi,n)),t.uuidv7=n=>t.check(fk(yi,n)),t.nanoid=n=>t.check(gk(JS,n)),t.guid=n=>t.check(zh(Lh,n)),t.cuid=n=>t.check(_k(KS,n)),t.cuid2=n=>t.check(yk(QS,n)),t.ulid=n=>t.check(xk(eT,n)),t.base64=n=>t.check(Ak(aT,n)),t.base64url=n=>t.check(Ck(lT,n)),t.xid=n=>t.check(bk(tT,n)),t.ksuid=n=>t.check(vk(nT,n)),t.ipv4=n=>t.check(wk(rT,n)),t.ipv6=n=>t.check(kk(sT,n)),t.cidrv4=n=>t.check(Sk(iT,n)),t.cidrv6=n=>t.check(Tk(oT,n)),t.e164=n=>t.check(Ek(cT,n)),t.datetime=n=>t.check(CS(n)),t.date=n=>t.check(IS(n)),t.time=n=>t.check(MS(n)),t.duration=n=>t.check(zS(n))});function p(t){return lk(WS,t)}const Me=C("ZodStringFormat",(t,e)=>{Pe.init(t,e),pp.init(t,e)}),YS=C("ZodEmail",(t,e)=>{fw.init(t,e),Me.init(t,e)}),Lh=C("ZodGUID",(t,e)=>{hw.init(t,e),Me.init(t,e)}),yi=C("ZodUUID",(t,e)=>{dw.init(t,e),Me.init(t,e)}),XS=C("ZodURL",(t,e)=>{pw.init(t,e),Me.init(t,e)}),qS=C("ZodEmoji",(t,e)=>{mw.init(t,e),Me.init(t,e)}),JS=C("ZodNanoID",(t,e)=>{gw.init(t,e),Me.init(t,e)}),KS=C("ZodCUID",(t,e)=>{_w.init(t,e),Me.init(t,e)}),QS=C("ZodCUID2",(t,e)=>{yw.init(t,e),Me.init(t,e)}),eT=C("ZodULID",(t,e)=>{xw.init(t,e),Me.init(t,e)}),tT=C("ZodXID",(t,e)=>{bw.init(t,e),Me.init(t,e)}),nT=C("ZodKSUID",(t,e)=>{vw.init(t,e),Me.init(t,e)}),rT=C("ZodIPv4",(t,e)=>{Aw.init(t,e),Me.init(t,e)}),sT=C("ZodIPv6",(t,e)=>{Cw.init(t,e),Me.init(t,e)}),iT=C("ZodCIDRv4",(t,e)=>{Ew.init(t,e),Me.init(t,e)}),oT=C("ZodCIDRv6",(t,e)=>{Iw.init(t,e),Me.init(t,e)}),aT=C("ZodBase64",(t,e)=>{Pw.init(t,e),Me.init(t,e)}),lT=C("ZodBase64URL",(t,e)=>{Rw.init(t,e),Me.init(t,e)}),cT=C("ZodE164",(t,e)=>{zw.init(t,e),Me.init(t,e)}),uT=C("ZodJWT",(t,e)=>{$w.init(t,e),Me.init(t,e)}),mp=C("ZodNumber",(t,e)=>{rp.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>sS(t,r,s),Vs(t,"ZodNumber",{gt(r,s){return this.check($h(r,s))},gte(r,s){return this.check(ga(r,s))},min(r,s){return this.check(ga(r,s))},lt(r,s){return this.check(Oh(r,s))},lte(r,s){return this.check(ma(r,s))},max(r,s){return this.check(ma(r,s))},int(r){return this.check(Fh(r))},safe(r){return this.check(Fh(r))},positive(r){return this.check($h(0,r))},nonnegative(r){return this.check(ga(0,r))},negative(r){return this.check(Oh(0,r))},nonpositive(r){return this.check(ma(0,r))},multipleOf(r,s){return this.check(Nh(r,s))},step(r,s){return this.check(Nh(r,s))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function M(t){return Ok(mp,t)}const hT=C("ZodNumberFormat",(t,e)=>{Nw.init(t,e),mp.init(t,e)});function Fh(t){return $k(hT,t)}const dT=C("ZodBoolean",(t,e)=>{Dw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>iS(t,n,r)});function Tn(t){return Nk(dT,t)}const fT=C("ZodAny",(t,e)=>{Lw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>aS()});function K(){return Dk(fT)}const pT=C("ZodUnknown",(t,e)=>{Fw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>lS()});function dl(){return Lk(pT)}const mT=C("ZodNever",(t,e)=>{Bw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>oS(t,n,r)});function gT(t){return Fk(mT,t)}const _T=C("ZodArray",(t,e)=>{Uw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>fS(t,n,r,s),t.element=e.element,Vs(t,"ZodArray",{min(n,r){return this.check(Hi(n,r))},nonempty(n){return this.check(Hi(1,n))},max(n,r){return this.check(lp(n,r))},length(n,r){return this.check(cp(n,r))},unwrap(){return this.element}})});function W(t,e){return Jk(_T,t,e)}const yT=C("ZodObject",(t,e)=>{Zw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>pS(t,n,r,s),ae(t,"shape",()=>e.shape),Vs(t,"ZodObject",{keyof(){return Ce(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:dl()})},loose(){return this.clone({...this._zod.def,catchall:dl()})},strict(){return this.clone({...this._zod.def,catchall:gT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return av(this,n)},safeExtend(n){return lv(this,n)},merge(n){return cv(this,n)},pick(n){return iv(this,n)},omit(n){return ov(this,n)},partial(...n){return uv(_p,this,n[0])},required(...n){return hv(yp,this,n[0])}})});function v(t,e){const n={type:"object",shape:t??{},...Z(e)};return new yT(n)}const gp=C("ZodUnion",(t,e)=>{op.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>mS(t,n,r,s),t.options=e.options});function Ot(t,e){return new gp({type:"union",options:t,...Z(e)})}const xT=C("ZodDiscriminatedUnion",(t,e)=>{gp.init(t,e),jw.init(t,e)});function qe(t,e,n){return new xT({type:"union",options:e,discriminator:t,...Z(n)})}const bT=C("ZodIntersection",(t,e)=>{Vw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>gS(t,n,r,s)});function vT(t,e){return new bT({type:"intersection",left:t,right:e})}const Bh=C("ZodRecord",(t,e)=>{Hw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>_S(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function fe(t,e,n){return!e||!e._zod?new Bh({type:"record",keyType:p(),valueType:t,...Z(e)}):new Bh({type:"record",keyType:t,valueType:e,...Z(n)})}const fl=C("ZodEnum",(t,e)=>{Ww.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>cS(t,r,s),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,s)=>{const i={};for(const o of r)if(n.has(o))i[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new fl({...e,checks:[],...Z(s),entries:i})},t.exclude=(r,s)=>{const i={...e.entries};for(const o of r)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new fl({...e,checks:[],...Z(s),entries:i})}});function Ce(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new fl({type:"enum",entries:n,...Z(e)})}const wT=C("ZodLiteral",(t,e)=>{Yw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>uS(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new wT({type:"literal",values:Array.isArray(t)?t:[t],...Z(e)})}const kT=C("ZodTransform",(t,e)=>{Xw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>dS(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Gf(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Es(i,n.value,e));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Es(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=s,n.fallback=!0,n)}});function ST(t){return new kT({type:"transform",transform:t})}const _p=C("ZodOptional",(t,e)=>{ap.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>fp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Uh(t){return new _p({type:"optional",innerType:t})}const TT=C("ZodExactOptional",(t,e)=>{qw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>fp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function AT(t){return new TT({type:"optional",innerType:t})}const CT=C("ZodNullable",(t,e)=>{Jw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>yS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Gh(t){return new CT({type:"nullable",innerType:t})}const ET=C("ZodDefault",(t,e)=>{Kw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>bS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IT(t,e){return new ET({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Vf(e)}})}const PT=C("ZodPrefault",(t,e)=>{Qw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>vS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function MT(t,e){return new PT({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Vf(e)}})}const yp=C("ZodNonOptional",(t,e)=>{ek.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>xS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function RT(t,e){return new yp({type:"nonoptional",innerType:t,...Z(e)})}const zT=C("ZodCatch",(t,e)=>{tk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>wS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OT(t,e){return new zT({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const $T=C("ZodPipe",(t,e)=>{nk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>kS(t,n,r,s),t.in=e.in,t.out=e.out});function Zh(t,e){return new $T({type:"pipe",in:t,out:e})}const NT=C("ZodReadonly",(t,e)=>{rk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>SS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function DT(t){return new NT({type:"readonly",innerType:t})}const LT=C("ZodLazy",(t,e)=>{sk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>TS(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function FT(t){return new LT({type:"lazy",getter:t})}const xp=C("ZodCustom",(t,e)=>{ik.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>hS(t,n)});function BT(t,e={}){return Kk(xp,t,e)}function UT(t,e){return Qk(t,e)}function bp(t,e={}){const n=new xp({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...Z(e)});return n._zod.bag.Class=t,n._zod.check=r=>{r.value instanceof t||r.issues.push({code:"invalid_type",expected:t.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}const GT={custom:"custom"};v({name:p(),description:p().optional(),inputSchema:v({type:k("object"),properties:fe(p(),K()),required:W(p()),additionalProperties:Tn()})});function _a(){return{}}const vp=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)});class jh{constructor(){re(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function Vh(){return!0}class ZT{constructor(){}setTimeout(e,n){const r=setTimeout(e,n);return r.ref=typeof r.ref=="function"?r.ref:()=>r,r.unref=typeof r.unref=="function"?r.unref:()=>r,r.hasRef=typeof r.hasRef=="function"?r.hasRef:()=>!0,r.refresh=typeof r.refresh=="function"?r.refresh:()=>r,r}clearTimeout(e){window.clearTimeout(e)}}const jT=new ZT,Ue=v({providerData:fe(p(),K()).optional()}),ft=Ue.extend({id:p().optional()}),VT=Ue.extend({type:k("refusal"),refusal:p()}),HT=Ue.extend({type:k("output_text"),text:p()}),Kl=Ue.extend({type:k("input_text"),text:p()}),WT=Ue.extend({type:k("reasoning_text"),text:p()}),wp=Ue.extend({type:k("input_image"),image:p().or(v({id:p().describe("OpenAI file ID")})).describe("Either base64 encoded image data, a data URL, or an object with a file ID.").optional(),detail:p().optional()}),kp=Ue.extend({type:k("input_file"),file:p().describe("Either base64 encoded file data or a publicly accessible file URL").or(v({id:p().describe("OpenAI file ID")})).or(v({url:p().describe("Publicly accessible file URL")})).describe("Contents of the file or an object with a file ID.").optional(),filename:p().optional()}),Sp=Ue.extend({type:k("audio"),audio:p().or(v({id:p()})).describe("Base64 encoded audio data or file id"),format:p().nullable().optional(),transcript:p().nullable().optional()}),YT=Ue.extend({type:k("image"),image:p().describe("Base64 encoded image data")}),XT=Ue.extend({type:k("text"),text:p()}),qT=v({data:Ot([p(),bp(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),JT=v({url:p().describe("Publicly accessible URL pointing to the image content")}),KT=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),QT=Ot([qT,JT,KT]).describe("Inline image data or references to uploaded content."),e1=v({data:Ot([p(),bp(Uint8Array)]).describe("Base64 encoded file data, or raw bytes that will be encoded automatically."),mediaType:p().describe("IANA media type describing the file contents"),filename:p().describe("Filename associated with the inline data")}),t1=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),n1=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),r1=Ot([p().describe("Existing data URL or base64 string"),e1,t1,n1]).describe("Inline data (with metadata) or references pointing to file contents."),s1=(...t)=>p(),i1=Ue.extend({type:k("image"),image:p().or(QT).optional(),detail:s1("low","high","auto").optional()}),o1=Ue.extend({type:k("file"),file:r1}),a1=Ue.extend({type:k("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Hh=qe("type",[v({type:k("screenshot")}),v({type:k("click"),x:M(),y:M(),button:Ce(["left","right","wheel","back","forward"])}),v({type:k("double_click"),x:M(),y:M()}),v({type:k("scroll"),x:M(),y:M(),scroll_x:M(),scroll_y:M()}),v({type:k("type"),text:p()}),v({type:k("wait")}),v({type:k("move"),x:M(),y:M()}),v({type:k("keypress"),keys:W(p())}),v({type:k("drag"),path:W(v({x:M(),y:M()}))})]),l1=qe("type",[HT,VT,Sp,YT]),Ql=ft.extend({type:k("message").optional()}),lo=Ql.extend({role:k("assistant"),status:Ce(["in_progress","completed","incomplete"]),content:W(l1)}),c1=qe("type",[Kl,wp,kp,Sp]),Tp=Ql.extend({role:k("user"),content:W(c1).or(p())}),Ap=Ql.extend({role:k("system"),content:p()});qe("role",[Ap,lo,Tp]);const Is=ft.extend({type:k("hosted_tool_call"),name:p().describe("The name of the hosted tool"),arguments:p().describe("The arguments of the hosted tool call").optional(),status:p().optional(),output:p().optional()}),Ps=ft.extend({type:k("function_call"),callId:p().describe("The ID of the tool call"),name:p().describe("The name of the function"),namespace:p().optional(),status:Ce(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:k("tool_reference"),functionName:p(),namespace:p().optional()});const u1=fe(p(),K()),h1=dl(),ec=ft.extend({type:k("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),arguments:h1,status:p().optional()}),tc=ft.extend({type:k("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),status:p().optional(),tools:W(u1)}),d1=qe("type",[XT,i1,o1]),f1=qe("type",[Kl,wp,kp]),Yi=ft.extend({type:k("function_call_result"),name:p().describe("The name of the tool"),namespace:p().optional(),callId:p().describe("The ID of the tool call"),status:Ce(["in_progress","completed","incomplete"]),output:Ot([p(),d1,W(f1)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),co=ft.extend({type:k("computer_call"),callId:p().describe("The ID of the computer call"),status:Ce(["in_progress","completed","incomplete"]),action:Hh.optional(),actions:W(Hh).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:GT.custom,message:"computer_call items must include action or actions.",path:["action"]})}),Cp=ft.extend({type:k("computer_call_result"),callId:p().describe("The ID of the computer call"),output:a1}),p1=v({commands:W(p()),timeoutMs:M().int().min(0).optional(),maxOutputLength:M().int().min(0).optional()}),uo=ft.extend({type:k("shell_call"),callId:p(),status:Ce(["in_progress","completed","incomplete"]).optional(),action:p1}),m1=qe("type",[v({type:k("timeout")}),v({type:k("exit"),exitCode:M().int().nullable()})]),g1=v({stdout:p(),stderr:p(),outcome:m1}).passthrough(),nc=ft.extend({type:k("shell_call_output"),callId:p(),maxOutputLength:M().optional(),output:W(g1)}),_1=v({type:k("create_file"),path:p(),diff:p()}),y1=v({type:k("update_file"),path:p(),diff:p()}),x1=v({type:k("delete_file"),path:p()}),b1=qe("type",[_1,y1,x1]),ho=ft.extend({type:k("apply_patch_call"),callId:p(),status:Ce(["in_progress","completed"]),operation:b1}),rc=ft.extend({type:k("apply_patch_call_output"),callId:p(),status:Ce(["completed","failed"]),output:p().optional()}),v1=qe("type",[co,uo,ho,Ps,Is]),sc=Ue.extend({id:p().optional(),type:k("reasoning"),content:W(Kl),rawContent:W(WT).optional()}),Ep=ft.extend({type:k("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),Ip=ft.extend({type:k("unknown")}),Pp=qe("type",[lo,ec,tc,Is,Ps,co,uo,ho,Yi,nc,rc,sc,Ep,Ip]),w1=Ot([Tp,lo,Ap,ec,tc,Is,Ps,co,uo,ho,Yi,Cp,nc,rc,sc,Ep,Ip]),k1=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:fe(p(),M()).optional(),outputTokensDetails:fe(p(),M()).optional(),endpoint:p().optional()}),S1=v({requests:M().optional(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:Ot([fe(p(),M()),W(fe(p(),M()))]).optional(),outputTokensDetails:Ot([fe(p(),M()),W(fe(p(),M()))]).optional(),requestUsageEntries:W(k1).optional()}),T1=Ue.extend({type:k("output_text_delta"),delta:p()}),A1=Ue.extend({type:k("response_started")}),C1=Ue.extend({type:k("response_done"),response:Ue.extend({id:p(),requestId:p().optional(),usage:S1,output:W(Pp)})}),E1=Ue.extend({type:k("model"),event:K().describe("The event from the model")});qe("type",[T1,C1,A1,E1]);const Wh=Symbol.for("openai.agents.core.asyncLocalStorage");let ya;function I1(){try{const t=globalThis,e=t[Wh];if(e)return e;const n=new jh;return t[Wh]=n,n}catch{return ya||(ya=new jh),ya}}function Mp(){const t=I1().getStore();if((t==null?void 0:t.active)===!0)return t}function Yh(){const t=Mp();return t!=null&&t.trace?t.trace:null}function Xh(){const t=Mp();return t!=null&&t.span?t.span:null}class P1{async export(e){if(Uf.disabled){Te.debug("Tracing is disabled. Skipping export");return}for(const n of e)n.type==="trace"?console.log(`[Exporter] Export trace traceId=${n.traceId} name=${n.name}${n.groupId?` groupId=${n.groupId}`:""}`):console.log(`[Exporter] Export span: ${JSON.stringify(n)}`)}}var zs,Sr,Os,$s,Tr,Je,en,xn,bn,Ar,ut,pl,ml,yr;class M1{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ge(this,ut);ge(this,zs);ge(this,Sr);ge(this,Os);ge(this,$s);ge(this,Tr);ge(this,Je,[]);ge(this,en);ge(this,xn,null);ge(this,bn,!1);ge(this,Ar,null);te(this,zs,n),te(this,Sr,r),te(this,Os,s),te(this,$s,n*i),te(this,Tr,e),te(this,en,jT),Te.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){te(this,Ar,new AbortController),Et(this,ut,ml).call(this)}async onTraceStart(e){await Et(this,ut,pl).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await Et(this,ut,pl).call(this,e)}async shutdown(e){var n;for(e&&z(this,en).setTimeout(()=>{var r;(r=z(this,Ar))==null||r.abort()},e),Te.debug("Shutting down gracefully");z(this,Je).length>0;){if(Te.debug(`Waiting for buffer to empty. Items left: ${z(this,Je).length}`),z(this,bn)||await Et(this,ut,yr).call(this,!0),(n=z(this,Ar))!=null&&n.signal.aborted){Te.debug("Timeout reached, force flushing"),await Et(this,ut,yr).call(this,!0);break}await new Promise(r=>z(this,en).setTimeout(r,500))}Te.debug("Buffer empty. Exiting"),z(this,en)&&z(this,xn)&&z(this,en).clearTimeout(z(this,xn))}async forceFlush(){z(this,Je).length>0&&await Et(this,ut,yr).call(this,!0)}}zs=new WeakMap,Sr=new WeakMap,Os=new WeakMap,$s=new WeakMap,Tr=new WeakMap,Je=new WeakMap,en=new WeakMap,xn=new WeakMap,bn=new WeakMap,Ar=new WeakMap,ut=new WeakSet,pl=async function(e){if(z(this,Je).length+1>z(this,zs)){Te.error("Dropping trace because buffer is full");return}z(this,Je).push(e),z(this,Je).length>z(this,$s)&&await Et(this,ut,yr).call(this)},ml=function(){te(this,xn,z(this,en).setTimeout(async()=>{await Et(this,ut,yr).call(this),Et(this,ut,ml).call(this)},z(this,Os))),typeof z(this,xn).unref=="function"&&z(this,xn).unref()},yr=async function(e=!1){if(z(this,Je).length!==0){if(Te.debug(`Exporting batches. Force: ${e}. Buffer size: ${z(this,Je).length}`),e||z(this,Je).length<z(this,Sr)){const n=[...z(this,Je)];te(this,Je,[]),te(this,bn,!0),await z(this,Tr).export(n),te(this,bn,!1)}else if(z(this,Je).length>0){const n=z(this,Je).splice(0,z(this,Sr));te(this,bn,!0),await z(this,Tr).export(n),te(this,bn,!1)}}};var mt;class R1{constructor(){ge(this,mt,[])}start(){for(const e of z(this,mt))e.start&&e.start()}addTraceProcessor(e){z(this,mt).push(e)}setProcessors(e){Te.debug("Shutting down old processors");for(const n of z(this,mt))n.shutdown();te(this,mt,e)}async onTraceStart(e){for(const n of z(this,mt))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of z(this,mt))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of z(this,mt))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of z(this,mt))await n.onSpanEnd(e)}async shutdown(e){for(const n of z(this,mt))await n.shutdown(e)}async forceFlush(){for(const e of z(this,mt))await e.forceFlush()}}mt=new WeakMap;let xa=null,ba=null;function z1(){return xa||(xa=new P1),xa}function Rp(){return ba||(ba=new M1(z1())),ba}function qh(){return new Date().toISOString()}function zp(){return`trace_${vp().replace(/-/g,"")}`}function O1(){return`span_${vp().replace(/-/g,"").slice(0,24)}`}function $1(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var Ns,Ds,Ls,Fs,Bs,Wn,vn,wn,Yn,Cr,Us;const ic=class ic{constructor(e,n){re(this,"type","trace.span");ge(this,Ns);ge(this,Ds);ge(this,Ls);ge(this,Fs);ge(this,Bs);ge(this,Wn);ge(this,vn);ge(this,wn);ge(this,Yn);ge(this,Cr);ge(this,Us);te(this,Ds,e.traceId),te(this,Ls,e.spanId??O1()),te(this,Ns,e.data),te(this,Wn,n),te(this,Fs,e.parentId??null),te(this,Bs,e.traceMetadata),te(this,Yn,e.error??null),te(this,vn,e.startedAt??null),te(this,wn,e.endedAt??null),te(this,Cr,e.tracingApiKey)}get traceId(){return z(this,Ds)}get spanData(){return z(this,Ns)}get traceMetadata(){return z(this,Bs)}get spanId(){return z(this,Ls)}get parentId(){return z(this,Fs)}get previousSpan(){return z(this,Us)}set previousSpan(e){te(this,Us,e)}start(){if(z(this,vn)){Te.warn("Span already started");return}te(this,vn,qh()),z(this,Wn).onSpanStart(this)}end(){if(z(this,wn)){Te.debug("Span already finished",this.spanData);return}te(this,wn,qh()),z(this,Wn).onSpanEnd(this)}setError(e){te(this,Yn,e)}get error(){return z(this,Yn)}get startedAt(){return z(this,vn)}get endedAt(){return z(this,wn)}get tracingApiKey(){return z(this,Cr)}clone(){var n;const e=new ic({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:z(this,vn)??void 0,endedAt:z(this,wn)??void 0,error:z(this,Yn)??void 0,tracingApiKey:z(this,Cr)},z(this,Wn));return e.previousSpan=(n=this.previousSpan)==null?void 0:n.clone(),e}toJSON(){return{object:this.type,id:this.spanId,trace_id:this.traceId,parent_id:this.parentId,started_at:this.startedAt,ended_at:this.endedAt,span_data:$1(this.spanData),error:this.error}}};Ns=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,Fs=new WeakMap,Bs=new WeakMap,Wn=new WeakMap,vn=new WeakMap,wn=new WeakMap,Yn=new WeakMap,Cr=new WeakMap,Us=new WeakMap;let Ms=ic;class gn extends Ms{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var Er,tn;const oc=class oc{constructor(e,n){re(this,"type","trace");re(this,"traceId");re(this,"name");re(this,"groupId",null);re(this,"metadata");re(this,"tracingApiKey");ge(this,Er);ge(this,tn);this.traceId=e.traceId??zp(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,te(this,Er,n??Rp()),te(this,tn,e.started??!1)}async start(){z(this,tn)||(te(this,tn,!0),await z(this,Er).onTraceStart(this))}async end(){z(this,tn)&&(te(this,tn,!1),await z(this,Er).onTraceEnd(this))}clone(){return new oc({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:z(this,tn),tracingApiKey:this.tracingApiKey})}toJSON(e){const n={object:this.type,id:this.traceId,workflow_name:this.name,group_id:this.groupId,metadata:this.metadata};return e!=null&&e.includeTracingApiKey&&this.tracingApiKey&&(n.tracing_api_key=this.tracingApiKey),n}};Er=new WeakMap,tn=new WeakMap;let Rs=oc;class va extends Rs{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var We,Xn,nn,Xi,$p;class Op{constructor(){ge(this,Xi);ge(this,We);ge(this,Xn);ge(this,nn);te(this,We,new R1),te(this,Xn,Uf.disabled),te(this,nn,null),Et(this,Xi,$p).call(this)}registerProcessor(e){te(this,nn,null),z(this,We).addTraceProcessor(e)}setProcessors(e){te(this,nn,null),z(this,We).setProcessors(e)}getCurrentTrace(){return Yh()}getCurrentSpan(){return Xh()}setDisabled(e){te(this,Xn,e)}startExportLoop(){z(this,We).start()}createTrace(e){if(z(this,Xn))return Te.debug("Tracing is disabled, Not creating trace %o",e),new va;const n=e.traceId??zp(),r=e.name??"Agent workflow";return Te.debug("Creating trace %s with name %s",n,r),new Rs({...e,name:r,traceId:n},z(this,We))}createSpan(e,n){if(z(this,Xn)||e.disabled)return Te.debug("Tracing is disabled, Not creating span %o",e),new gn(e.data,z(this,We));let r,s,i,o;if(n){if(n instanceof Rs){if(n instanceof va)return Te.debug("Parent trace is no-op, returning NoopSpan"),new gn(e.data,z(this,We));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof Ms){if(n instanceof gn)return Te.debug("Parent span is no-op, returning NoopSpan"),new gn(e.data,z(this,We));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=Yh(),l=Xh();if(!a)return Te.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new gn(e.data,z(this,We));if(l instanceof gn||a instanceof va)return Te.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new gn(e.data,z(this,We));s=a.traceId,i=a.tracingApiKey,o=a.metadata,l?(Te.debug("Using parent span %s",l.spanId),r=l.spanId):Te.debug("No parent span, using current trace %s",a.traceId)}return s?(Te.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new Ms({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},z(this,We))):(Te.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new gn(e.data,z(this,We)))}async shutdown(e){z(this,nn)||te(this,nn,(async()=>{try{Te.debug("Shutting down tracing provider"),await z(this,We).shutdown(e)}catch(n){Te.error("Error shutting down tracing provider %o",n)}})()),await z(this,nn)}async forceFlush(){await z(this,We).forceFlush()}}We=new WeakMap,Xn=new WeakMap,nn=new WeakMap,Xi=new WeakSet,$p=function(){if(typeof process<"u"&&typeof process.on=="function"){const e=async()=>{const n=setTimeout(()=>{console.warn("Cleanup timeout, forcing exit"),process.exit(1)},5e3);try{await this.shutdown()}finally{clearTimeout(n)}};process.once("beforeExit",e),process.on("SIGINT",async()=>{await e(),Jh("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Jh("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{Te.error("Unhandled rejection",n,r),await e(),N1("unhandledRejection")||process.exit(1)})}};let wa;function Jh(t){return process.listeners(t).length>1}function N1(t){return process.listeners(t).length>1}function D1(){const t=Symbol.for("openai.agents.core.traceProvider");try{const e=globalThis,n=e[t];if(n)return n;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.writable===!1&&r.configurable===!1&&!r.set)return xi();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return xi()}try{const s=new Op;return e[t]=s,s}catch{return xi()}}catch{return xi()}}function xi(){return wa||(wa=new Op),wa}function L1(t){D1().registerProcessor(t)}const F1=qe("type",[v({type:k("next_step_handoff"),newAgent:K()}),v({type:k("next_step_final_output"),output:p()}),v({type:k("next_step_run_again")}),v({type:k("next_step_interruption"),data:fe(p(),K())})]),B1="1.8",U1=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",B1],G1=Ce(U1),vt=v({name:p()}),Z1=v({object:k("trace.span"),id:p(),trace_id:p(),parent_id:p().nullable(),started_at:p().nullable(),ended_at:p().nullable(),error:v({message:p(),data:fe(p(),K()).optional()}).nullable(),span_data:fe(p(),K())}),Np=Z1.extend({previous_span:FT(()=>Np).optional()}),j1=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:fe(p(),M()).optional(),outputTokensDetails:fe(p(),M()).optional(),endpoint:p().optional()}),Dp=v({requests:M(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:W(fe(p(),M())).optional(),outputTokensDetails:W(fe(p(),M())).optional(),requestUsageEntries:W(j1).optional()}),Kh=v({usage:Dp,output:W(Pp),responseId:p().optional(),requestId:p().optional(),providerData:fe(p(),K()).optional()}),Lp=qe("type",[v({type:k("message_output_item"),rawItem:lo,agent:vt}),v({type:k("tool_search_call_item"),rawItem:ec,agent:vt}),v({type:k("tool_search_output_item"),rawItem:tc,agent:vt}),v({type:k("tool_call_item"),rawItem:v1.or(Is),agent:vt}),v({type:k("tool_call_output_item"),rawItem:Yi.or(Cp).or(nc).or(rc),agent:vt,output:p()}),v({type:k("reasoning_item"),rawItem:sc,agent:vt}),v({type:k("handoff_call_item"),rawItem:Ps,agent:vt}),v({type:k("handoff_output_item"),rawItem:Yi,sourceAgent:vt,targetAgent:vt}),v({type:k("tool_approval_item"),rawItem:Ps.or(Is).or(co).or(uo).or(ho),agent:vt,toolName:p().optional()})]),V1=v({object:k("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:fe(p(),K()),tracing_api_key:p().optional().nullable()}),H1=v({newItems:W(Lp),toolsUsed:W(p()),handoffs:W(v({toolCall:K(),handoff:K()})),functions:W(v({toolCall:K(),tool:K()})),computerActions:W(v({toolCall:K(),computer:K()})),shellActions:W(v({toolCall:K(),shell:K()})).optional(),applyPatchActions:W(v({toolCall:K(),applyPatch:K()})).optional(),mcpApprovalRequests:W(v({requestItem:v({rawItem:v({type:k("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:fe(p(),K()).nullable().optional()})}),mcpTool:v({type:k("hosted_tool"),name:k("hosted_mcp"),providerData:fe(p(),K())})})).optional()}),Fp=v({tripwireTriggered:Tn(),outputInfo:K()}),W1=qe("type",[v({type:k("allow")}),v({type:k("rejectContent"),message:p()}),v({type:k("throwException")})]),Bp=v({outputInfo:K().optional(),behavior:W1}),Up=v({type:Ot([k("tool_input"),k("tool_output")]),name:p()}),Y1=v({guardrail:v({type:k("input"),name:p()}),output:Fp}),X1=v({guardrail:v({type:k("output"),name:p()}),agentOutput:K(),agent:vt,output:Fp}),q1=v({guardrail:Up.extend({type:k("tool_input")}),output:Bp}),J1=v({guardrail:Up.extend({type:k("tool_output")}),output:Bp});v({$schemaVersion:G1,currentTurn:M(),currentAgent:vt,originalInput:p().or(W(w1)),modelResponses:W(Kh),context:v({usage:Dp,approvals:fe(p(),v({approved:W(p()).or(Tn()),rejected:W(p()).or(Tn()),messages:fe(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:fe(p(),K()),toolInput:K().optional()}),toolUseTracker:fe(p(),W(p())),maxTurns:M(),currentAgentSpan:Np.nullable().optional(),noActiveAgentRun:Tn(),inputGuardrailResults:W(Y1),outputGuardrailResults:W(X1),toolInputGuardrailResults:W(q1).optional().default([]),toolOutputGuardrailResults:W(J1).optional().default([]),currentTurnInProgress:Tn().optional(),currentStep:F1.optional(),lastModelResponse:Kh.optional(),generatedItems:W(Lp),pendingAgentToolRuns:fe(p(),p()).optional().default({}),lastProcessedResponse:H1.optional(),currentTurnPersistedItemCount:M().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:Ce(["preserve","omit"]).optional(),trace:V1.nullable()});v({input:p()});jl("openai-agents:mcp-servers");L1(Rp());v({itemId:p()});qe("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("system"),content:W(v({type:k("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("user"),status:Ce(["in_progress","completed"]),content:W(v({type:k("input_text"),text:p()}).or(v({type:k("input_audio"),audio:p().nullable().optional(),transcript:p().nullable()})))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("assistant"),status:Ce(["in_progress","completed","incomplete"]),content:W(v({type:k("output_text"),text:p()}).or(v({type:k("output_audio"),audio:p().nullable().optional(),transcript:p().nullable().optional()})))})]);v({itemId:p(),previousItemId:p().nullable().optional(),type:k("function_call"),status:Ce(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:Ce(["mcp_call","mcp_tool_call"]),status:Ce(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:k("mcp_approval_request"),serverLabel:p(),name:p(),arguments:fe(p(),K()),approved:Tn().optional().nullable()});jl("openai-agents:realtime");const Gp=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:M().or(k("inf")).optional().nullable(),metadata:fe(p(),K()).optional().nullable(),output_modalities:W(p()).optional().nullable(),object:k("realtime.response").optional().nullable(),output:W(K()).optional().nullable(),audio:v({output:v({format:K().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:Ce(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:fe(p(),K()).optional().nullable(),usage:v({input_tokens:M().optional(),input_token_details:fe(p(),K()).optional().nullable(),output_tokens:M().optional(),output_token_details:fe(p(),K()).optional().nullable()}).optional().nullable()}),K1=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Ot([k("input_text"),k("input_audio"),k("item_reference"),k("output_text"),k("output_audio")])}),Lr=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:W(K1).optional(),name:p().optional(),output:p().nullable().optional(),role:Ce(["user","assistant","system"]).optional(),status:Ce(["completed","incomplete","in_progress"]).optional(),type:Ce(["message","function_call","function_call_output","mcp_list_tools","mcp_tool_call","mcp_call","mcp_approval_request","mcp_approval_response"]).optional(),approval_request_id:p().nullable().optional(),approve:Tn().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:K().nullable().optional(),tools:W(v({name:p(),description:p(),input_schema:fe(p(),K()).optional()}).passthrough()).optional()}).passthrough(),Q1=v({type:k("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:k("realtime.conversation").optional()})}),eA=v({type:k("conversation.item.added"),event_id:p(),item:Lr,previous_item_id:p().nullable().optional()}),tA=v({type:k("conversation.item.done"),event_id:p(),item:Lr,previous_item_id:p().nullable().optional()}),nA=v({type:k("conversation.item.deleted"),event_id:p(),item_id:p()}),rA=v({type:k("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),logprobs:W(K()).nullable().optional(),usage:v({type:k("tokens"),total_tokens:M(),input_tokens:M(),input_token_details:v({text_tokens:M(),audio_tokens:M()}),output_tokens:M()}).optional()}),sA=v({type:k("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:M().optional(),delta:p().optional(),logprobs:W(K()).nullable().optional()}),iA=v({type:k("conversation.item.input_audio_transcription.failed"),event_id:p(),item_id:p(),content_index:M(),error:v({code:p().optional(),message:p().optional(),param:p().optional(),type:p().optional()})}),oA=v({type:k("conversation.item.retrieved"),event_id:p(),item:Lr}),aA=v({type:k("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:M(),content_index:M()}),lA=v({type:k("conversation.item.create"),item:Lr,event_id:p().optional(),previous_item_id:p().nullable().optional()}),cA=v({type:k("conversation.item.delete"),item_id:p(),event_id:p().optional()}),uA=v({type:k("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),hA=v({type:k("conversation.item.truncate"),item_id:p(),audio_end_ms:M(),content_index:M(),event_id:p().optional()}),dA=v({type:k("error"),event_id:p().optional(),error:K().optional()}),fA=v({type:k("input_audio_buffer.cleared"),event_id:p()}),pA=v({type:k("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),mA=v({type:k("input_audio_buffer.clear"),event_id:p().optional()}),gA=v({type:k("input_audio_buffer.commit"),event_id:p().optional()}),_A=v({type:k("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),yA=v({type:k("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:M()}),xA=v({type:k("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:M()}),bA=v({type:k("output_audio_buffer.started"),event_id:p()}).passthrough(),vA=v({type:k("output_audio_buffer.stopped"),event_id:p()}).passthrough(),wA=v({type:k("output_audio_buffer.cleared"),event_id:p()}),kA=v({type:k("rate_limits.updated"),event_id:p(),rate_limits:W(v({limit:M().optional(),name:Ce(["requests","tokens"]).optional(),remaining:M().optional(),reset_seconds:M().optional()}))}),SA=v({type:k("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),TA=v({type:k("response.output_audio.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p()}),AA=v({type:k("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),CA=v({type:k("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),output_index:M(),response_id:p()}),EA=v({type:k("response.content_part.added"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),IA=v({type:k("response.content_part.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),PA=v({type:k("response.created"),event_id:p(),response:Gp}),MA=v({type:k("response.done"),event_id:p(),response:Gp}),RA=v({type:k("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:M(),response_id:p()}),zA=v({type:k("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:M(),response_id:p()}),OA=v({type:k("response.output_item.added"),event_id:p(),item:Lr,output_index:M(),response_id:p()}),$A=v({type:k("response.output_item.done"),event_id:p(),item:Lr,output_index:M(),response_id:p()}),NA=v({type:k("response.output_text.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),DA=v({type:k("response.output_text.done"),event_id:p(),item_id:p(),content_index:M(),text:p(),output_index:M(),response_id:p()}),LA=v({type:k("session.created"),event_id:p(),session:K()}),FA=v({type:k("session.updated"),event_id:p(),session:K()}),BA=v({type:k("response.cancel"),event_id:p().optional(),response_id:p().optional()}),UA=v({type:k("response.create"),event_id:p().optional(),response:K().optional()}),GA=v({type:k("session.update"),event_id:p().optional(),session:K()}),ZA=v({type:k("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),jA=v({type:k("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),VA=v({type:k("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),delta:p(),obfuscation:p()}),HA=v({type:k("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),arguments:p()}),WA=v({type:k("response.mcp_call.in_progress"),event_id:p(),output_index:M(),item_id:p()}),YA=v({type:k("response.mcp_call.completed"),event_id:p(),output_index:M(),item_id:p()}),XA=v({type:k("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();qe("type",[Q1,eA,tA,nA,rA,sA,iA,oA,aA,dA,fA,_A,yA,xA,bA,vA,wA,kA,SA,TA,AA,CA,EA,IA,PA,MA,RA,zA,OA,$A,NA,DA,LA,FA,ZA,jA,XA,VA,HA,WA,YA]);qe("type",[lA,cA,uA,hA,pA,mA,gA,BA,UA,GA]);const ka={};var rn={};const qA=typeof process<"u"&&typeof(rn==null?void 0:rn.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?rn.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(rn==null?void 0:rn.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&rn.NEXT_PUBLIC_PLAY_API_BASE.length>0?rn.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(ka==null?void 0:ka.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");rx({});new Nt;new Ii;new Nt;new Nt;new Nt;new Nt;new Nt;export{zt as B,Nt as C,Gs as D,ve as E,Ji as G,le as M,et as P,Ra as R,vl as S,ai as T,Ia as U,Cn as a,Zd as b,Dd as c,ln as d,yt as e,_l as f,xe as g,yd as h,Ud as i,wi as j,be as k,x_ as l,Mc as n,Nm as r,_t as w};
|