@agent-play/play-ui 3.8.1 → 3.8.2
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 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"&&!
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-04XVSoQu.js","assets/webworkerAll-CFmFu_5o.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var am=Object.defineProperty;var Ec=t=>{throw TypeError(t)};var lm=(t,e,n)=>e in t?am(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var se=(t,e,n)=>lm(t,typeof e!="symbol"?e+"":e,n),zo=(t,e,n)=>e.has(t)||Ec("Cannot "+n);var O=(t,e,n)=>(zo(t,e,"read from private field"),n?n.call(t):e.get(t)),ge=(t,e,n)=>e.has(t)?Ec("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),re=(t,e,n,r)=>(zo(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Pt=(t,e,n)=>(zo(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 cm="modulepreload",um=function(t){return"/agent-play/"+t},Ic={},td=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=um(c),c in Ic)return;Ic[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":cm,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 Aa=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},ri=(t,e)=>Aa(t).priority??e,bt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Aa).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(Aa).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)=>ri(o.value,n)-ri(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)=>ri(i,n)-ri(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))}},hm={extension:{type:ve.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await td(()=>import("./browserAll-04XVSoQu.js"),__vite__mapDeps([0,1]))}},dm={extension:{type:ve.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await td(()=>import("./webworkerAll-CFmFu_5o.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 nd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Oo={exports:{}},Pc;function fm(){return Pc||(Pc=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 _=this._events[y],x=arguments.length,b,S;if(_.fn){switch(_.once&&this.removeListener(c,_.fn,void 0,!0),x){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,u),!0;case 3:return _.fn.call(_.context,u,h),!0;case 4:return _.fn.call(_.context,u,h,f),!0;case 5:return _.fn.call(_.context,u,h,f,d),!0;case 6:return _.fn.call(_.context,u,h,f,d,m),!0}for(S=1,b=new Array(x-1);S<x;S++)b[S-1]=arguments[S];_.fn.apply(_.context,b)}else{var T=_.length,I;for(S=0;S<T;S++)switch(_[S].once&&this.removeListener(c,_[S].fn,void 0,!0),x){case 1:_[S].fn.call(_[S].context);break;case 2:_[S].fn.call(_[S].context,u);break;case 3:_[S].fn.call(_[S].context,u,h);break;case 4:_[S].fn.call(_[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];_[S].fn.apply(_[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,_=[],x=m.length;y<x;y++)(m[y].fn!==u||f&&!m[y].once||h&&m[y].context!==h)&&_.push(m[y]);_.length?this._events[d]=_.length===1?_[0]:_: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}(Oo)),Oo.exports}var pm=fm();const In=nd(pm),mm=Math.PI*2,gm=180/Math.PI,_m=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 $o.x=0,$o.y=0,$o}}const $o=new et;class ce{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(mm-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 ce;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 xm.identity()}static get shared(){return ym.identity()}}const ym=new ce,xm=new ce,Zn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],jn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Vn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Hn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ca=[],rd=[],si=Math.sign;function bm(){for(let t=0;t<16;t++){const e=[];Ca.push(e);for(let n=0;n<16;n++){const r=si(Zn[t]*Zn[n]+Vn[t]*jn[n]),s=si(jn[t]*Zn[n]+Hn[t]*jn[n]),i=si(Zn[t]*Vn[n]+Vn[t]*Hn[n]),o=si(jn[t]*Vn[n]+Hn[t]*Hn[n]);for(let a=0;a<16;a++)if(Zn[a]===r&&jn[a]===s&&Vn[a]===i&&Hn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new ce;e.set(Zn[t],jn[t],Vn[t],Hn[t],0,0),rd.push(e)}}bm();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=>Zn[t],uY:t=>jn[t],vX:t=>Vn[t],vY:t=>Hn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Ca[t][e],sub:(t,e)=>Ca[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=rd[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,_=t.d;t.a=a*d+l*y,t.b=a*m+l*_,t.c=c*d+u*y,t.d=c*m+u*_,t.tx=h*d+f*y+t.tx,t.ty=h*m+f*_+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)}},ii=[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,_=a+i-u,x=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>y&&e<_&&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=ii[0].set(e.left,e.top),l=ii[1].set(e.left,e.bottom),c=ii[2].set(e.right,e.top),u=ii[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,_=f*r+d*o,x=f*s+d*o;if(Math.max(m,y,_,x)<=f*a.x+d*a.y||Math.min(m,y,_,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 No={default:-1};function Fe(t="default"){return No[t]===void 0&&(No[t]=-1),++No[t]}const Mc=new Set,Qe="8.0.0",vm="8.3.4",wr={quiet:!1,noColor:!1},Ae=(t,e,n=3)=>{if(wr.quiet||Mc.has(e))return;let r=new Error().stack;const s=`${e}
|
|
3
|
+
Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!wr.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))),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;",""),`
|
|
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))),Mc.add(e)};Object.defineProperties(Ae,{quiet:{get:()=>wr.quiet,set:t=>{wr.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>wr.noColor,set:t=>{wr.noColor=t},enumerable:!0,configurable:!1}});const sd=()=>{};function Rc(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 zc(t){return!(t&t-1)&&!!t}function id(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Oc=Object.create(null);function wm(t){const e=Oc[t];return e===void 0&&(Oc[t]=Fe("resource")),e}const od=class ad extends In{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...ad.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=wm(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};od.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ld=od;const cd=class ud extends In{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={...ud.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 ld(id(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=zc(this.pixelWidth)&&zc(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};cd.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Dt=cd;class yl extends Dt{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}}yl.extension=ve.TextureSource;const $c=new ce;class km{constructor(e,n){this.mapCoord=new ce,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&&($c.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append($c));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 In{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 Dt,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 km(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 Dt({label:"EMPTY"})});be.EMPTY.destroy=sd;be.WHITE=new be({source:new yl({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});be.WHITE.destroy=sd;function Sm(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 Nc=new ce;class $t{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=Nc,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=Nc,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,_=o*e+l*n+u,x=a*e+c*n+h;_<f&&(f=_),x<d&&(d=x),_>m&&(m=_),x>y&&(y=x),_=o*r+l*n+u,x=a*r+c*n+h,_<f&&(f=_),x<d&&(d=x),_>m&&(m=_),x>y&&(y=x),_=o*e+l*s+u,x=a*e+c*s+h,_<f&&(f=_),x<d&&(d=x),_>m&&(m=_),x>y&&(y=x),_=o*r+l*s+u,x=a*r+c*s+h,_<f&&(f=_),x<d&&(d=x),_>m&&(m=_),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 $t(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 _=e[y],x=e[y+1],b=c*_+h*x+d,S=u*_+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 Tm={grad:.9,turn:360,rad:360/(2*Math.PI)},Qt=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},kt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},hd=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Dc=function(t){return{r:kt(t.r,0,255),g:kt(t.g,0,255),b:kt(t.b,0,255),a:kt(t.a)}},Do=function(t){return{r:je(t.r),g:je(t.g),b:je(t.b),a:je(t.a,3)}},Am=/^#([0-9a-f]{3,8})$/i,oi=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},dd=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}},fd=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}},Lc=function(t){return{h:hd(t.h),s:kt(t.s,0,100),l:kt(t.l,0,100),a:kt(t.a)}},Fc=function(t){return{h:je(t.h),s:je(t.s),l:je(t.l),a:je(t.a,3)}},Bc=function(t){return fd((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},fs=function(t){return{h:(e=dd(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},Cm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Em=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Im=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ea={string:[[function(t){var e=Am.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=Im.exec(t)||Pm.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Dc({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=Cm.exec(t)||Em.exec(t);if(!e)return null;var n,r,s=Lc({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Tm[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Bc(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 Qt(e)&&Qt(n)&&Qt(r)?Dc({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(!Qt(e)||!Qt(n)||!Qt(r))return null;var o=Lc({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Bc(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Qt(e)||!Qt(n)||!Qt(r))return null;var o=function(a){return{h:hd(a.h),s:kt(a.s,0,100),v:kt(a.v,0,100),a:kt(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return fd(o)},"hsv"]]},Uc=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]},Mm=function(t){return typeof t=="string"?Uc(t.trim(),Ea.string):typeof t=="object"&&t!==null?Uc(t,Ea.object):[null,void 0]},Lo=function(t,e){var n=fs(t);return{h:n.h,s:kt(n.s+100*e,0,100),l:n.l,a:n.a}},Fo=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Gc=function(t,e){var n=fs(t);return{h:n.h,s:n.s,l:kt(n.l+100*e,0,100),a:n.a}},Ia=function(){function t(e){this.parsed=Mm(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(Fo(this.rgba),2)},t.prototype.isDark=function(){return Fo(this.rgba)<.5},t.prototype.isLight=function(){return Fo(this.rgba)>=.5},t.prototype.toHex=function(){return e=Do(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?oi(je(255*i)):"","#"+oi(n)+oi(r)+oi(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return Do(this.rgba)},t.prototype.toRgbString=function(){return e=Do(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 Fc(fs(this.rgba))},t.prototype.toHslString=function(){return e=Fc(fs(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=dd(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 Ht({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),Ht(Lo(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ht(Lo(this.rgba,-e))},t.prototype.grayscale=function(){return Ht(Lo(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Ht(Gc(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Ht(Gc(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"?Ht({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=fs(this.rgba);return typeof e=="number"?Ht({h:e,s:n.s,l:n.l,a:n.a}):je(n.h)},t.prototype.isEqual=function(e){return this.toHex()===Ht(e).toHex()},t}(),Ht=function(t){return t instanceof Ia?t:new Ia(t)},Zc=[],Rm=function(t){t.forEach(function(e){Zc.indexOf(e)<0&&(e(Ia,Ea),Zc.push(e))})};function zm(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"])}Rm([zm]);const Rr=class is{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 is)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]=is._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=is.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Ht(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 is||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}};Rr.shared=new Rr;Rr._temp=new Rr;Rr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let cn=Rr;const Om={cullArea:null,cullable:!1,cullableChildren:!0};let Bo=0;const jc=500;function xt(...t){Bo!==jc&&(Bo++,Bo===jc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const xl={_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 $m{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 Nm{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 $m(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 dt=new Nm;xl.register(dt);const Dm={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 Lm(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 Fm={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)}Lm(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)}},Bm={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 Vc{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 Um{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 dt.get(r.maskClass,e)}return e}returnMaskEffect(e){dt.return(e)}}const Pa=new Um;bt.handleByList(ve.MaskEffect,Pa._effectClasses);const Gm={_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),Pa.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Pa.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 Vc);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 Vc),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},Zm={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=dt.getPool(ce),on=dt.getPool($t),jm=new ce,Vm={getFastGlobalBounds(t,e){e||(e=new $t),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=on.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(jm).invert()),e.addBounds(r),on.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),on.return(r))}};function pd(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=ot.get().identity(),r=bl(t,s)):r=ce.IDENTITY,md(t,n,r,e),s&&ot.return(s),n.isValid||n.set(0,0,0,0),n}function md(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=on.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++)md(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,ce.IDENTITY),on.return(e)}r||ot.return(s)}function bl(t,e){const n=t.parent;return n&&(bl(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function gd(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 Hc=16777215;function Wc(t,e){return t===Hc?e:e===Hc?t:gd(t,e)}function ki(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const Hm={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 ce,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=bl(this,ot.get().identity());return t.appendFrom(this.localTransform,n),ot.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?ki(this.renderGroup.worldColor):this.parentRenderGroup?ki(Wc(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=Wc(e,n.localColor),n=n.parent;return ki(e)}};function _d(t,e,n){return e.clear(),n||(n=ce.IDENTITY),yd(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function yd(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=on.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++)yd(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,ce.IDENTITY),on.return(e)}ot.return(i)}function xd(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&&xd(s,e)}return e.didChange}const Wm=new ce,Ym={_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 $t});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),xd(this,t),t.didChange&&_d(this,t.localBounds,Wm),t.localBounds},getBounds(t,e){return pd(this,t,e||new $t)}},Xm={_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}},qm={_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 Km={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 vl{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 Qm=0;class eg{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new ld(this.textureOptions)}createTexture(e,n,r,s){const i=new Dt({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new be({source:i,label:`texturePool_${Qm++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Rc(o),a=Rc(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 bd=new eg;xl.register(bd);class tg{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ce,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 vl,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&&(bd.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 ce),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new ce),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 ce),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 ng(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Uo=new Ke(null),ai=new Ke(null),Go=new Ke(null,1,1),li=new Ke(null),Yc=1,rg=2,Zo=4;class Lt extends In{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 ce,this.relativeGroupTransform=new ce,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ke(this,0,0),this._scale=Go,this._pivot=ai,this._origin=li,this._skew=Uo,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=[],ng(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."),bt.mixin(Lt,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=dt.get(tg,this),this.groupTransform=ce.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),dt.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 ce),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*gm}set angle(e){this.rotation=e*_m}get pivot(){return this._pivot===ai&&(this._pivot=new Ke(this,0,0)),this._pivot}set pivot(e){this._pivot===ai&&(this._pivot=new Ke(this,0,0),this._origin!==li&&xt("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===Uo&&(this._skew=new Ke(this,0,0)),this._skew}set skew(e){this._skew===Uo&&(this._skew=new Ke(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Go&&(this._scale=new Ke(this,1,1)),this._scale}set scale(e){this._scale===Go&&(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===li&&(this._origin=new Ke(this,0,0)),this._origin}set origin(e){this._origin===li&&(this._origin=new Ke(this,0,0),this._pivot!==ai&&xt("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|=Yc,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=cn.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Yc,this._onUpdate())}get tint(){return ki(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rg,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|=Zo,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|=Zo,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|=Zo,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}}bt.mixin(Lt,Fm,Vm,Km,Xm,Ym,Gm,Zm,qm,Om,Dm,Hm,Bm);class vd extends Lt{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 $t(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 ys extends vd{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 ys(e):new ys(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 Sm(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 sg=new $t;function wd(t,e,n){const r=sg;t.measurable=!0,pd(t,n,r),e.addBoundsMask(r),t.measurable=!1}function kd(t,e,n){const r=on.get();t.measurable=!0;const s=ot.get().identity(),i=Sd(t,n,s);_d(t,r,i),t.measurable=!1,e.addBoundsMask(r),ot.return(s),on.return(r)}function Sd(t,e,n){return t?(t!==e&&(Sd(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(xt("Mask bounds, renderable is not inside the root container"),n)}class Td{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 ys),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||wd(this.mask,e,n)}addLocalBounds(e,n){kd(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof ys}}Td.extension=ve.MaskEffect;class Ad{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"}}Ad.extension=ve.MaskEffect;class Cd{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){wd(this.mask,e,n)}addLocalBounds(e,n){kd(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Lt}}Cd.extension=ve.MaskEffect;const ig={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 Xc=ig;const Zs={get(){return Xc},set(t){Xc=t}};class Ed extends Dt{constructor(e){e.resource||(e.resource=Zs.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"))}}Ed.extension=ve.TextureSource;class Ci extends Dt{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}}Ci.extension=ve.TextureSource;var Ma=(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))(Ma||{});class jo{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 Id=class gt{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 jo(null,null,1/0),this.deltaMS=1/gt.targetFPMS,this.elapsedMS=1/gt.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=Ma.NORMAL){return this._addListener(new jo(e,n,r))}addOnce(e,n,r=Ma.NORMAL){return this._addListener(new jo(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*gt.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,gt.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(!gt._shared){const e=gt._shared=new gt;e.autoStart=!0,e._protected=!0}return gt._shared}static get system(){if(!gt._system){const e=gt._system=new gt;e.autoStart=!0,e._protected=!0}return gt._system}};Id.targetFPMS=.06;let ci=Id,Vo;async function og(){return Vo??(Vo=(async()=>{var o;const e=Zs.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"})()),Vo}const Ki=class Pd extends Dt{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Pd.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=ci.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 og(),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&&(ci.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||(ci.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ci.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Ki.extension=ve.TextureSource;Ki.defaultOptions={...Dt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ki.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let ag=Ki;const _r=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class lg{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||xt(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=_r(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&&xt("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){xt(`[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 yr=new lg,Ra=[];bt.handleByList(ve.TextureSource,Ra);function Md(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<Ra.length;s++){const i=Ra[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function cg(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&yr.has(r))return yr.get(r);const i=new be({source:Md(s)});return i.on("destroy",()=>{yr.has(r)&&yr.remove(r)}),e||yr.set(r,i),i}function ug(t,e=!1){return typeof t=="string"?yr.get(t):t instanceof Dt?new be({source:t}):cg(t,e)}be.from=ug;Dt.from=Md;bt.add(Td,Ad,Cd,ag,Ci,Ed,yl);var Rd=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Rd||{});function Mt(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Hr(t){return t.split("?")[0].split("#")[0]}function hg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dg(t,e,n){return t.replace(new RegExp(hg(e),"g"),n)}function fg(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 xs={toPosix(t){return dg(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){Mt(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(Mt(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=Hr(this.toPosix(e??Zs.get().getBaseUrl())),s=Hr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?xs.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Mt(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=fg(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return Mt(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(Mt(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(Mt(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){Mt(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){Mt(t),e&&Mt(e),t=Hr(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){Mt(t),t=Hr(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){Mt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Hr(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 zd(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?zd(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function pg(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)}),zd(t,s,0,n,r)}else r.push(t);return r}const qc=t=>!Array.isArray(t);class Od{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 _r(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&&xt("[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)&&xt(`[Resolver] already has key: ${i} overwriting`)},_r(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=_r(o).map(y=>typeof y=="string"?pg(y):Array.isArray(y)?y:[y]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=y=>{const _=this._parsers.find(x=>x.test(y));return{src:y,..._==null?void 0:_.parse(y)}};h.forEach(y=>{y.forEach(_=>{let x={};if(typeof _!="object"?x=m(_):(a=_.data??a,l=_.format??l,(_.loadParser||_.parser)&&(c=_.loadParser??c,u=_.parser??u),x={...m(_.src),..._}),!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=qc(e);e=_r(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=qc(e);e=_r(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=xs.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??mg(e.src),l!==void 0&&(e.progressSize=l),e}}Od.RETINA_PREFIX=/@([0-9\.]+)x/;function mg(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Jc=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},$d=class os{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof Dt&&(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<=os.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:os.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*os.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*os.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=[]}};$d.BATCH_SIZE=1e3;let Kc=$d;const gg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Nd(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=xs.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Nd([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const _g={extension:ve.Asset,cache:{test:t=>t instanceof Kc,getCacheableAssets:(t,e)=>Nd(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"&&gg.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Od.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:Rd.Normal,name:"spritesheetLoader"},async testParse(t,e){return xs.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=xs.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof be)l=r;else{const d=Jc(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new Kc({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 _=a+y;(f=e.data)!=null&&f.ignoreMultiPack||(_=Jc(_,e.src),d.push(n.load({src:_,data:{textureOptions:i,ignoreMultiPack:!0}})))}const m=await Promise.all(d);c.linkedSheets=m,m.forEach(y=>{y.linkedSheets=[c].concat(c.linkedSheets.filter(_=>_!==y))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};bt.add(_g);const Ho=Object.create(null),Qc=Object.create(null);function wl(t,e){let n=Qc[t];return n===void 0&&(Ho[e]===void 0&&(Ho[e]=1),Qc[t]=n=Ho[e]++),n}let dr;function Dd(){return(!dr||dr!=null&&dr.isContextLost())&&(dr=Zs.get().createCanvas().getContext("webgl",{})),dr}let ui;function yg(){if(!ui){ui="mediump";const t=Dd();t&&t.getShaderPrecisionFormat&&(ui=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return ui}function xg(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"&&!xr.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 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
|
|
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(`
|
|
20
|
+
`}function bg(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 vg(t,e){return e?`#version 300 es
|
|
22
|
+
${t}`:t}const wg={},kg={};function Sg(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-"),e+=n?"-fragment":"-vertex";const r=n?wg:kg;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 Tg(t,e){return e?t.replace("#version 300 es",""):t}const Wo={stripVersion:Tg,ensurePrecision:bg,addProgramDefines:xg,setProgramName:Sg,insertVersion:vg},Wr=Object.create(null),Ld=class za{constructor(e){e={...za.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:yg()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(Wo).forEach(o=>{const a=r[o];s=Wo[o](s,a,!0),i=Wo[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=wl(`${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,Wr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return Wr[n]||(Wr[n]=new za(e),Wr[n]._cacheKey=n),Wr[n]}};Ld.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Fd=Ld;const eu={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 Ag(t){return eu[t]??eu.float32}const Cg={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"},tu=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function nu(t,e){let n;for(;(n=tu.exec(t))!==null;){const r=Cg[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:Ag(r).stride,offset:0,instance:!1,start:0}}tu.lastIndex=0}function Eg(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Ig({source:t,entryPoint:e}){const n={},r=Eg(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(nu(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&&nu(u[1],n)}}return n}function Yo(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((_,x)=>{const[b,S]=x.split(":");return _[b.trim()]=S.trim(),_},{});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 Wn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(Wn||{});function Pg({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:Wn.VERTEX|Wn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:Wn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:Wn.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:Wn.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:Wn.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function Mg({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 Rg(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 Yr=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=Yo(n.source);this.structsAndGroups=c}else{const c=Yo(r.source),u=Yo(n.source);this.structsAndGroups=Rg(c,u)}this.layout=s??Mg(this.structsAndGroups),this.gpuLayout=i??Pg(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=wl(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ig(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Yr[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Yr[n]||(Yr[n]=new Qi(e),Yr[n]._cacheKey=n),Yr[n]}}const Bd=["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>"],zg=Bd.reduce((t,e)=>(t[e]=!0,t),{});function Og(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 Ud=class Gd{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={...Gd.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,!zg[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: ${Bd.join(", ")}`)}i.value??(i.value=Og(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=wl(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Ud.defaultOptions={ubo:!1,isStatic:!1};let Zd=Ud;class Si{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 Oa=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Oa||{});class kl extends In{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|=Oa.WEBGPU),r&&(o|=Oa.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 Si,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 Zd(f));const d=l[h];d&&(s[d.group]||(s[d.group]=new Si,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 Si,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=Fd.from(r)),new kl({gpuProgram:i,glProgram:o,...s})}}const $g={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},Xo=0,qo=1,Jo=2,Ko=3,Qo=4,ea=5,$a=class jd{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Xo)}set blend(e){!!(this.data&1<<Xo)!==e&&(this.data^=1<<Xo)}get offsets(){return!!(this.data&1<<qo)}set offsets(e){!!(this.data&1<<qo)!==e&&(this.data^=1<<qo)}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<<Jo)}set culling(e){!!(this.data&1<<Jo)!==e&&(this.data^=1<<Jo)}get depthTest(){return!!(this.data&1<<Ko)}set depthTest(e){!!(this.data&1<<Ko)!==e&&(this.data^=1<<Ko)}get depthMask(){return!!(this.data&1<<ea)}set depthMask(e){!!(this.data&1<<ea)!==e&&(this.data^=1<<ea)}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=$g[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 jd;return e.depthTest=!1,e.blend=!0,e}};$a.default2d=$a.for2d();let Vd=$a;const bs=new Set;let Na=!1;function ru(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;bs.size&&bs.clear();let i=Hd(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=Bg(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 Da(i,o,a,l,c),o}function Hd(t,e,n,r,s){let i=null;if(s===Qg(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=ou(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=ou(o/r|0,t[o],t[o+1],i);return i&&vs(i,i.next)&&(ks(i),i=i.next),i}function Kn(t,e=t){const n=e===t;let r=t,s;do s=!1,r!==r.next&&(bs.size===0||!bs.has(r))&&(vs(r,r.next)||De(r.prev,r,r.next)===0)?((n||r===e)&&(e=r.prev),Na=!0,ks(r),r=r.prev,s=!0):(n||r!==e)&&(r=r.next,s=!n);while(s||r!==e);return e}function Da(t,e,n,r,s){s&&Wg(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?Dg(t,n,r,s):Ng(t))){e.push(a.i,t.i,l.i),ks(t),t=l,i=l;continue}if(t=l,t===i){if(Na=!1,t=Kn(t),Na){i=t;continue}if(!o){t=Lg(t,e),i=t,o=!0;continue}Fg(t,e,n,r,s);break}}}function Ng(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)&&Ii(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 Dg(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),_=Math.max(u,h,f),x=Ua(d,m,e,n,r),b=Ua(y,_,e,n,r);let S=t.prevZ;for(;S&&S.z>=x;){if(S.x>=d&&S.x<=y&&S.y>=m&&S.y<=_&&S!==o&&!(a===S.x&&u===S.y)&&Ii(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<=_&&T!==o&&!(a===T.x&&u===T.y)&&Ii(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 Lg(t,e){let n=t,r=!1;do{const s=n.prev,i=n.next.next;Xd(s,n,n.next,i,!1)&&ws(s,i)&&ws(i,s)&&(e.push(s.i,n.i,i.i),ks(n),ks(n.next),n=t=i,r=!0),n=n.next}while(n!==t);return r?Kn(n):n}function Fg(t,e,n,r,s){let i=t;do{let o=i.next.next;for(;o!==i.prev;){if(i.i!==o.i&&qg(i,o)){let a=qd(i,o);i=Kn(i,i.next),a=Kn(a,a.next),Da(i,e,n,r,s),Da(a,e,n,r,s);return}o=o.next}i=i.next}while(i!==t)}let La=!1;function Bg(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=Hd(t,a,l,r,!1);c===c.next&&bs.add(c),s.push(Xg(c))}s.sort(Ug),Zg(t.length/r,e.length),Yd(n,n),La=!0;for(let i=0;i<s.length;i++)n=Gg(s[i],n);return La=!1,Kn(n)}function Ug(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 Gg(t,e){const n=Vg(t,e);if(!n)return e;const r=qd(n,t),s=r.next;return Yd(n,s.next),Kn(r,r.next),Kn(n,n.next)}const Wd=16;let $e=new Float64Array(0),Ei=0;const Fa=[],Ba=[];function Zg(t,e){const n=Math.ceil((t+2*e)/Wd)+e+2;$e.length<n*4&&($e=new Float64Array(n*4)),Ei=0}function Yd(t,e){let n=t;do{const r=Ei++;Fa[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<Wd&&n!==e);Ba[r]=n;const c=r*4;$e[c]=s,$e[c+1]=i,$e[c+2]=o,$e[c+3]=a}while(n!==e)}function jg(t,e){const n=t.z*4;e.x<$e[n]&&($e[n]=e.x),e.y<$e[n+1]&&($e[n+1]=e.y),e.x>$e[n+2]&&($e[n+2]=e.x),e.y>$e[n+3]&&($e[n+3]=e.y)}function su(t){let e=Ba[t];for(;e.prev.next!==e;)e=e.next;return Ba[t]=e,e}function iu(t){let e=Fa[t];for(;e.prev.next!==e;)e=e.next;return Fa[t]=e,e}function Vg(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(vs(t,n))return n;for(let f=0,d=0;f<Ei;f++,d+=4){if(s<$e[d+1]||s>$e[d+3]||$e[d]>r||$e[d+2]<=i)continue;const m=su(f);n=iu(f);do{if(n.prev.next===n){if(vs(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<Ei;f++,d+=4){if($e[d+2]<a||$e[d]>r||$e[d+3]<c||$e[d+1]>u)continue;const m=su(f);n=iu(f);do{if(n.prev.next===n&&r>=n.x&&n.x>=a&&r!==n.x&&Ii(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);(ws(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&&Hg(o,n)))&&(o=n,h=y)}n=n.next}while(n!==m)}return o}function Hg(t,e){return De(t.prev,t,e.prev)<0&&De(e.next,t,t.next)<0}const vt=[];let Xr=[],Bn=new Uint32Array(0),qr=new Uint32Array(0);const Jr=new Uint32Array(256);function Wg(t,e,n,r){let s=t,i=0;do s.z=Ua(s.x,s.y,e,n,r),vt[i++]=s,s=s.next;while(s!==t);Yg(i);let o=null;for(let a=0;a<i;a++){const l=vt[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Yg(t){if(t<=32){for(let e=1;e<t;e++){const n=vt[e],r=n.z;let s=e-1;for(;s>=0&&vt[s].z>r;)vt[s+1]=vt[s],s--;vt[s+1]=n}return}Bn.length<t&&(Bn=new Uint32Array(t),qr=new Uint32Array(t),Xr=new Array(t));for(let e=0;e<t;e++)Bn[e]=vt[e].z;hi(t,vt,Bn,Xr,qr,0),hi(t,Xr,qr,vt,Bn,8),hi(t,vt,Bn,Xr,qr,16),hi(t,Xr,qr,vt,Bn,24)}function hi(t,e,n,r,s,i){Jr.fill(0);for(let a=0;a<t;a++)Jr[n[a]>>>i&255]++;let o=0;for(let a=0;a<256;a++){const l=Jr[a];Jr[a]=o,o+=l}for(let a=0;a<t;a++){const l=n[a],c=Jr[l>>>i&255]++;r[c]=e[a],s[c]=l}}function Ua(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 Xg(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 Ii(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 qg(t,e){const n=vs(t,e)&&De(t.prev,t,t.next)>0&&De(e.prev,e,e.next)>0;return t.next.i!==e.i&&(n||ws(t,e)&&ws(e,t)&&(De(t.prev,t,e.prev)!==0||De(t,e.prev,e)!==0))&&!Jg(t,e)&&(n||Kg(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 vs(t,e){return t.x===e.x&&t.y===e.y}function Xd(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&&di(t,n,e)||o===0&&di(t,r,e)||a===0&&di(n,t,r)||l===0&&di(n,e,r)):!1}function di(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&&Xd(o,a,t,e))return!0;o=a}while(o!==t);return!1}function ws(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 Kg(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 qd(t,e){const n=Ga(t.i,t.x,t.y),r=Ga(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 ou(t,e,n,r){const s=Ga(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 ks(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),La&&jg(t.prev,t.next)}function Ga(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Qg(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 e_=ru.default||ru,ta={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t_=/([astvzqmhlc])([^astvzqmhlc]*)/gi,n_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function r_(t){const e=[];return t.replace(t_,(n,r,s)=>{let i=r.toLowerCase(),o=r;const a=s_(s);for(i==="m"&&a.length>2&&(e.push([o,...a.splice(0,2)]),i="l",o=o==="m"?"l":"L");;){if(a.length===ta[i])return e.push([o,...a]),"";if(a.length<ta[i])throw new Error("malformed path data");e.push([o,...a.splice(0,ta[i])])}}),e}function s_(t){const e=t.match(n_);return e?e.map(Number):[]}function i_(t,e){const n=r_(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:xt(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class Sl{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new Sl(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 Tl{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 Tl(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),_=d*d/(h*h)+m*m/(f*f);return y>1&&_<=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 o_(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,_=e-m;return y*y+_*_}let a_,l_;class ps{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(a_),r=e.getBounds(l_);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 ps(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=o_(e,n,h,f,d,m),_=Math.sign((d-h)*(n-f)-(m-f)*(e-h));if(y<=(_<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 fi=(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 Al{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 Al(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,_=i+a,x=o+l;return(e>=i-u&&e<=i+h||e>=_-h&&e<=_+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&&fi(e,n,f,d,c,h,u)||e>_-c&&n<d&&fi(e,n,_-c,d,c,h,u)||e>_-c&&n>x-c&&fi(e,n,_-c,x-c,c,h,u)||e<f&&n>x-c&&fi(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 Jd={};function c_(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 Jd[r]||u_(t,e,r,n)}function u_(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 Si(s);return Jd[n]=o,o}class au{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 lu(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 h_={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function cu(t,e){return e.alphaMode==="no-premultiply-alpha"&&h_[t]||t}const d_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
+
`);function f_(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 p_(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=d_.replace(/%forloop%/gi,f_(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 fr=null;function m_(){var e;if(fr)return fr;const t=Dd();return fr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),fr=p_(fr,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),fr}class g_{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 __{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new g_,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 ms=[];let Pi=0;xl.register({clear:()=>{if(ms.length>0)for(const t of ms)t&&t.destroy();ms.length=0,Pi=0}});function uu(){return Pi>0?ms[--Pi]:new __}function hu(t){t.elements=null,ms[Pi++]=t}let Kr=0;const Kd=class Qd{constructor(e){this.uid=Fe("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Qd.defaultOptions,...e},e.maxTextures||(Ae("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=m_());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new au(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++)hu(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=uu(),s=r.textures;s.clear();const i=n[this.elementStart];let o=cu(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 _=this.elementStart;_<this.elementSize;++_){const x=n[_];n[_]=null;const S=x.texture._source,T=cu(x.blendMode,S),I=o!==T||a!==x.topology;if(S._batchTick===Kr&&!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=Kr,(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=uu(),s=r.textures,s.clear(),m=[],++Kr),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,++Kr),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,++Kr,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 au(n);lu(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 lu(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++)hu(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}}};Kd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let y_=Kd;var ut=(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))(ut||{});class Ss extends In{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&ut.STATIC)}set static(e){e?this.descriptor.usage|=ut.STATIC:this.descriptor.usage&=~ut.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 ef(t,e){if(!(t instanceof Ss)){let n=e?ut.INDEX:ut.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=ut.INDEX|ut.COPY_DST):(t=new Float32Array(t),n=ut.VERTEX|ut.COPY_DST)),t=new Ss({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function x_(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 b_(t){return(t instanceof Ss||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=ef(t.buffer,!1),t}class v_ extends In{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 $t,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=b_(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=ef(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,x_(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 w_=new Float32Array(1),k_=new Uint32Array(1);class S_ extends v_{constructor(){const n=new Ss({data:w_,label:"attribute-batch-buffer",usage:ut.VERTEX|ut.COPY_DST,shrinkToFit:!1}),r=new Ss({data:k_,label:"index-batch-buffer",usage:ut.INDEX|ut.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 du(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 xt(`${r} placement hook does not exist in shader`)}}const T_=/\{\{(.*?)\}\}/g;function fu(t){var r;const e={};return(((r=t.match(T_))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function pu(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function mu(t,e,n=!1){const r=[];pu(e,r),t.forEach(a=>{a.header&&pu(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 gu(t,e){let n;const r=/@out\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function A_(t){const n=/\b(\w+)\s*:/g.exec(t);return n?n[1]:""}function C_(t){const e=/@.*?\s+/g;return t.replace(e,"")}function E_(t,e){const n=[];gu(e,n),t.forEach(l=>{l.header&&gu(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 ${C_(l)};`).join(`
|
|
30
30
|
`),o=`return VSOutput(
|
|
31
|
-
${n.sort().map(l=>` ${
|
|
31
|
+
${n.sort().map(l=>` ${A_(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 _u(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 Tn=Object.create(null),na=new Map;let I_=0;function P_({template:t,bits:e}){const n=tf(t,e);if(Tn[n])return Tn[n];const{vertex:r,fragment:s}=R_(t,e);return Tn[n]=nf(r,s,e),Tn[n]}function M_({template:t,bits:e}){const n=tf(t,e);return Tn[n]||(Tn[n]=nf(t.vertex,t.fragment,e)),Tn[n]}function R_(t,e){const n=e.map(o=>o.vertex).filter(o=>!!o),r=e.map(o=>o.fragment).filter(o=>!!o);let s=mu(n,t.vertex,!0);s=E_(n,s);const i=mu(r,t.fragment,!0);return{vertex:s,fragment:i}}function tf(t,e){return e.map(n=>(na.has(n)||na.set(n,I_++),na.get(n))).sort((n,r)=>n-r).join("-")+t.vertex+t.fragment}function nf(t,e,n){const r=fu(t),s=fu(e);return n.forEach(i=>{du(i.vertex,r,i.name),du(i.fragment,s,i.name)}),{vertex:_u(t,r),fragment:_u(e,s)}}const z_=`
|
|
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
|
+
`,O_=`
|
|
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
|
+
`,$_=`
|
|
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
|
+
`,N_=`
|
|
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
|
+
`,D_={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
|
+
`}},L_={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 F_({bits:t,name:e}){const n=P_({template:{fragment:O_,vertex:z_},bits:[D_,...t]});return Qi.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function B_({bits:t,name:e}){return new Fd({name:e,...M_({template:{vertex:$_,fragment:N_},bits:[L_,...t]})})}const U_={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
|
+
`}},G_={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
|
+
`}},ra={};function Z_(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 j_(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 V_(t){return ra[t]||(ra[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
|
+
${Z_(t)}
|
|
204
204
|
`,main:`
|
|
205
205
|
var uvDx = dpdx(vUV);
|
|
206
206
|
var uvDy = dpdy(vUV);
|
|
207
207
|
|
|
208
|
-
${
|
|
209
|
-
`}}),
|
|
210
|
-
`)}function
|
|
208
|
+
${j_(t)}
|
|
209
|
+
`}}),ra[t]}const sa={};function H_(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 W_(t){return sa[t]||(sa[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
|
+
${H_(t)}
|
|
229
|
+
`}}),sa[t]}const Y_={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
|
+
`}},X_={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
|
-
`}},_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
|
-
`+
|
|
242
|
-
]`).replace("lheading",
|
|
239
|
+
`}},yu={};function q_(t){let e=yu[t];if(e)return e;const n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=r;return e=yu[t]=new Zd({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}class xu extends kl{constructor(e){const n=B_({name:"batch",bits:[G_,W_(e),X_]}),r=F_({name:"batch",bits:[U_,V_(e),Y_]});super({glProgram:n,gpuProgram:r,resources:{batchSamplers:q_(e)}}),this.maxTextures=e}}let Qr=null;const rf=class sf extends y_{constructor(e){super(e),this.geometry=new S_,this.name=sf.extension.name,this.vertexSize=6,Qr??(Qr=new xu(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,_=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++]=_,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,_=m.minX,x=m.maxY,b=m.minY,S=o.uvs,T=e.color,I=i<<16|e.roundPixels&65535;n[s+0]=l*_+u*b+f,n[s+1]=h*b+c*_+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*_+u*x+f,n[s+19]=h*x+c*_+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 xu(e),this.shader=Qr)}destroy(){this.shader=null,super.destroy()}};rf.extension={type:[ve.Batcher],name:"default"};let J_=rf;class eo{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 K_(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],_=t[n+1];r[s]=c*y+h*_+d,r[s+1]=u*y+f*_+m,s+=i,n+=e,l++}}function Q_(t,e,n,r){let s=0;for(e*=n;s<r;)t[e]=0,t[e+1]=0,e+=n,s++}function of(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 ey=new ce;class Cl{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?gd(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)||ey}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 Ts={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,_=n+m,x=n-m,b=r+y;if(e[u++]=_,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]=_}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,X=n-A,$=r+E,F=r-E;e[u++]=V,e[u++]=$,e[--h]=$,e[--h]=X,e[f++]=X,e[f++]=F,e[--d]=F,e[--d]=V}m=s,y=i+a,_=n+m,x=n-m,b=r+y;const S=r-y;return e[u++]=_,e[u++]=b,e[--d]=S,e[--d]=_,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}},ty={...Ts,extension:{...Ts.extension,name:"ellipse"}},ny={...Ts,extension:{...Ts.extension,name:"roundedRectangle"}},af=1e-4,bu=1e-4;function ry(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 vu(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,_=u+f,x=h+d;return a.push(m,y),a.push(_,x),2}function Un(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),_=(15*m*Math.sqrt(y)/Math.PI>>0)+1,x=d/_;if(f+=x,a){o.push(t,e),o.push(n,r);for(let b=1,S=f;b<_;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<_;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 _*2}function sy(t,e,n,r,s,i){const o=af;if(t.length===0)return;const a=e;let l=a.alignment;if(e.alignment!==.5){let he=ry(t);l=(l-.5)*he+.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 he=(c.x+u.x)*.5,Ft=(u.y+c.y)*.5;t.unshift(he,Ft),t.push(he,Ft)}const d=s,m=t.length/2;let y=t.length;const _=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,X=0,$=-(I-E),F=T-A,oe=0,ke=0,Se=Math.sqrt($*$+F*F);$/=Se,F/=Se,$*=x,F*=x;const Ct=l,L=(1-Ct)*2,H=Ct*2;h||(a.cap==="round"?y+=Un(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+=vu(T,I,$,F,L,H,!0,d))),d.push(T-$*L,I-F*L),d.push(T+$*H,I+F*H);for(let he=1;he<m-1;++he){T=t[(he-1)*2],I=t[(he-1)*2+1],A=t[he*2],E=t[he*2+1],V=t[(he+1)*2],X=t[(he+1)*2+1],$=-(I-E),F=T-A,Se=Math.sqrt($*$+F*F),$/=Se,F/=Se,$*=x,F*=x,oe=-(E-X),ke=A-V,Se=Math.sqrt(oe*oe+ke*ke),oe/=Se,ke/=Se,oe*=x,ke*=x;const Ft=A-T,ye=I-E,zn=A-V,On=X-E,Ws=Ft*zn+ye*On,ir=ye*zn-On*Ft,$n=ir<0;if(Math.abs(ir)<.001*Math.abs(Ws)){d.push(A-$*L,E-F*L),d.push(A+$*H,E+F*H),Ws>=0&&(a.join==="round"?y+=Un(A,E,A-$*L,E-F*L,A-oe*L,E-ke*L,d,!1)+4:y+=2,d.push(A-oe*H,E-ke*H),d.push(A+oe*L,E+ke*L));continue}const Ys=(-$+T)*(-F+E)-(-$+A)*(-F+I),Gr=(-oe+V)*(-ke+E)-(-oe+A)*(-ke+X),or=(Ft*Gr-zn*Ys)/ir,Nn=(On*Ys-ye*Gr)/ir,we=(or-A)*(or-A)+(Nn-E)*(Nn-E),Bt=A+(or-A)*L,pe=E+(Nn-E)*L,Ut=A-(or-A)*H,me=E-(Nn-E)*H,Dn=Math.min(Ft*Ft+ye*ye,zn*zn+On*On),Zr=$n?L:H,Gt=Dn+Zr*Zr*b;we<=Gt?a.join==="bevel"||we/b>S?($n?(d.push(Bt,pe),d.push(A+$*H,E+F*H),d.push(Bt,pe),d.push(A+oe*H,E+ke*H)):(d.push(A-$*L,E-F*L),d.push(Ut,me),d.push(A-oe*L,E-ke*L),d.push(Ut,me)),y+=2):a.join==="round"?$n?(d.push(Bt,pe),d.push(A+$*H,E+F*H),y+=Un(A,E,A+$*H,E+F*H,A+oe*H,E+ke*H,d,!0)+4,d.push(Bt,pe),d.push(A+oe*H,E+ke*H)):(d.push(A-$*L,E-F*L),d.push(Ut,me),y+=Un(A,E,A-$*L,E-F*L,A-oe*L,E-ke*L,d,!1)+4,d.push(A-oe*L,E-ke*L),d.push(Ut,me)):(d.push(Bt,pe),d.push(Ut,me)):(d.push(A-$*L,E-F*L),d.push(A+$*H,E+F*H),a.join==="round"?$n?y+=Un(A,E,A+$*H,E+F*H,A+oe*H,E+ke*H,d,!0)+2:y+=Un(A,E,A-$*L,E-F*L,A-oe*L,E-ke*L,d,!1)+2:a.join==="miter"&&we/b<=S&&($n?(d.push(Ut,me),d.push(Ut,me)):(d.push(Bt,pe),d.push(Bt,pe)),y+=2),d.push(A-oe*L,E-ke*L),d.push(A+oe*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+=Un(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+=vu(A,E,$,F,L,H,!1,d)));const Rn=bu*bu;for(let he=_;he<y+_-2;++he)T=d[he*2],I=d[he*2+1],A=d[(he+1)*2],E=d[(he+1)*2+1],V=d[(he+2)*2],X=d[(he+2)*2+1],!(Math.abs(T*(E-X)+A*(X-I)+V*(I-E))<Rn)&&i.push(he,he+1,he+2)}function iy(t,e,n,r){const s=af;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 lf(t,e,n,r,s,i,o){const a=e_(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 oy=[],ay={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){lf(t,oy,e,n,r,s,i)}},ly={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}},cy={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}},wu=[{offset:0,color:"white"},{offset:1,color:"black"}],El=class Za{constructor(...e){this.uid=Fe("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=uy(e);n={...n.type==="radial"?Za.defaultRadialOptions:Za.defaultLinearOptions,...id(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:cn.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 _=e;e=r,r=_,i*=-1}if(o<0){const _=n;n=s,s=_,o*=-1}}const l=this.colorStops.length?this.colorStops:wu,c=this._textureSize,{canvas:u,context:h}=Su(c,1),f=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);ku(f,l),h.fillStyle=f,h.fillRect(0,0,c,1),this.texture=new be({source:new Ci({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(i*i+o*o),m=Math.atan2(o,i),y=new ce;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:wu,n=this._textureSize,{canvas:r,context:s}=Su(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,_=s.createRadialGradient(m,y,c*d,(a-h)*d,(l-f)*d,u*d);ku(_,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,n,n),s.fillStyle=_,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 Ci({resource:r,addressMode:this._wrapMode})});const x=new ce;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}`}};El.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};El.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 js=El;function ku(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function Su(t,e){const n=Zs.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}function uy(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]??js.defaultLinearOptions.textureSize}),e}const hy=new ce,dy=new Ve;function fy(t,e,n,r){const s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const o=n.getBounds(dy);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,_=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*_+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 js)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),r&&s.append(hy.copyFrom(r).invert()),s}const to={};bt.handleByMap(ve.ShapeBuilder,to);bt.add(ly,ay,cy,Ts,ty,ny);const py=new Ve,my=new ce;function gy(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")_y(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&&Tu(c.shapePath,l,!0,r,n),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),Tu(a,l,o,r,n)}}}function _y(t,e,n){const r=[],s=to.rectangle,i=py;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&&of(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=dt.get(Cl);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 Tu(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=to[l.type];if(!f.build(l,h))return;const d=a.length,m=i.length/2;let y="triangle-list";if(c&&of(h,c),n){const S=l.closePath??!0,T=e;T.pixelLine?(iy(h,S,i,a),y="line-list"):sy(h,T,!1,S,i,a)}else if(u){const S=[],T=h.slice();yy(u).forEach(A=>{S.push(T.length/2),T.push(...A)}),lf(T,S,i,2,m,a,d)}else f.triangulate(h,i,2,m,a,d);const _=o.length/2,x=e.texture;if(x!==be.WHITE){const S=fy(my,e,l,c);K_(i,2,m,o,_,2,i.length/2-m,S)}else Q_(o,_,2,i.length/2-m);const b=dt.get(Cl);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 yy(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,s=[];to[r.type].build(r,s)&&e.push(s)}return e}class xy{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{dt.return(e)}),this.graphicsData&&dt.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 by{constructor(){this.instructions=new vl}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(vm,"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 Il=class ja{constructor(e){this._renderer=e,this._managedContexts=new eo({renderer:e,type:"resource",name:"graphicsContext"})}init(e){ja.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??ja.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(),gy(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=dt.get(by,{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=c_(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return n}_initContext(e){const n=new xy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Il.extension={type:[ve.WebGLSystem,ve.WebGPUSystem],name:"graphicsContext"};Il.defaultOptions={bezierSmoothness:.5};let Pl=Il;const vy=8,pi=11920929e-14,wy=1;function cf(t,e,n,r,s,i,o,a,l,c){const h=Math.min(.99,Math.max(0,c??Pl.defaultOptions.bezierSmoothness));let f=(wy-h)/1;return f*=f,ky(e,n,r,s,i,o,a,l,t,f),t}function ky(t,e,n,r,s,i,o,a,l,c){Va(t,e,n,r,s,i,o,a,l,c,0),l.push(o,a)}function Va(t,e,n,r,s,i,o,a,l,c,u){if(u>vy)return;const h=(t+n)/2,f=(e+r)/2,d=(n+s)/2,m=(r+i)/2,y=(s+o)/2,_=(i+a)/2,x=(h+d)/2,b=(f+m)/2,S=(d+y)/2,T=(m+_)/2,I=(x+S)/2,A=(b+T)/2;if(u>0){let E=o-t,V=a-e;const X=Math.abs((n-o)*V-(r-a)*E),$=Math.abs((s-o)*V-(i-a)*E);if(X>pi&&$>pi){if((X+$)*(X+$)<=c*(E*E+V*V)){l.push(I,A);return}}else if(X>pi){if(X*X<=c*(E*E+V*V)){l.push(I,A);return}}else if($>pi){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}}Va(t,e,h,f,x,b,I,A,l,c,u+1),Va(I,A,S,T,y,_,o,a,l,c,u+1)}const Sy=8,Ty=11920929e-14,Ay=1;function Cy(t,e,n,r,s,i,o,a){const c=Math.min(.99,Math.max(0,a??Pl.defaultOptions.bezierSmoothness));let u=(Ay-c)/1;return u*=u,Ey(e,n,r,s,i,o,t,u),t}function Ey(t,e,n,r,s,i,o,a){Ha(o,t,e,n,r,s,i,a,0),o.push(s,i)}function Ha(t,e,n,r,s,i,o,a,l){if(l>Sy)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,_=o-n;const x=Math.abs((r-i)*_-(s-o)*y);if(x>Ty){if(x*x<=a*(y*y+_*_)){t.push(d,m);return}}else if(y=d-(e+i)/2,_=m-(n+o)/2,y*y+_*_<=a){t.push(d,m);return}Ha(t,e,n,c,u,d,m,a,l+1),Ha(t,d,m,h,f,i,o,a,l+1)}function uf(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 Iy(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,_=i*Math.sqrt(d)/f,x=i*Math.sqrt(m)/f,b=_*y/d,S=x*y/m,T=_*h+x*c,I=_*u+x*l,A=c*(x+b),E=l*(x+b),V=h*(_+S),X=u*(_+S),$=Math.atan2(E-I,A-T),F=Math.atan2(X-I,V-T);uf(t,T+e,I+n,i,$,F,c*u>h*l)}const gs=Math.PI*2,ia={centerX:0,centerY:0,ang1:0,ang2:0},oa=({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 Py(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 Au=(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)},My=(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),_=Math.pow(h,2);let x=d*m-d*_-m*y;x<0&&(x=0),x/=d*_+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,X=(-h-S)/i,$=Au(1,0,A,E);let F=Au(A,E,V,X);a===0&&F>0&&(F-=gs),a===1&&F<0&&(F+=gs),f.centerX=T,f.centerY=I,f.ang1=$,f.ang2=F};function Ry(t,e,n,r,s,i,o,a=0,l=0,c=0){if(i===0||o===0)return;const u=Math.sin(a*gs/360),h=Math.cos(a*gs/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)),My(e,n,r,s,i,o,l,c,u,h,f,d,ia);let{ang1:y,ang2:_}=ia;const{centerX:x,centerY:b}=ia;let S=Math.abs(_)/(gs/4);Math.abs(1-S)<1e-7&&(S=1);const T=Math.max(Math.ceil(S),1);_/=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 X=Py(y,_),{x:$,y:F}=oa(X[0],i,o,h,u,x,b,E),{x:oe,y:ke}=oa(X[1],i,o,h,u,x,b,E),{x:Se,y:Ct}=oa(X[2],i,o,h,u,x,b,E);cf(t,I,A,$,F,oe,ke,Se,Ct),I=Se,A=Ct,y+=_}}function zy(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 _,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),_=Math.abs(x*Math.sin(y)/Math.cos(y))):_=l;const b=a.x+h.nx*x+-h.ny*_*d,S=a.y+h.ny*x+h.nx*_*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)*_,S+Math.sin(T)*_),t.arc(b,S,_,T,I,m),i=a}}function Oy(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 _=Math.min(f/2,c);d=i(l,u,_/f)}const m=s(h,l);let y;if(m<1e-4)y=l;else{const _=Math.min(m/2,c);y=i(l,h,_/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 $y=new Ve;class Ny{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new $t,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 uf(a,e,n,r,s,i,o),this}arcTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly.points;return Iy(o,e,n,r,s,i),this}arcToSvg(e,n,r,s,i,o,a){const l=this._currentPoly.points;return Ry(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 cf(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 Cy(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 Sl(e,n,r),s),this}poly(e,n,r){const s=new ps(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),_=d+Math.PI+h,x=d-Math.PI-h,b=m+i*Math.cos(_),S=y+i*Math.sin(_),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?Oy(this,e,n,s):zy(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 Tl(e,n,r,s),i),this}roundRect(e,n,r,s,i,o){return this.drawShape(new Al(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 ps,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 ps,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($y);s.transform?e.addRect(i,s.transform):e.addRect(i)}return e}}class an{constructor(e,n=!1){this.instructions=[],this.uid=Fe("graphicsPath"),this._dirty=!0,this.checkForHoles=n,typeof e=="string"?i_(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ny(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 an;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 _=0;_<this.instructions.length;_++){const x=this.instructions[_],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]=pr(b[3],e);break;case"rect":b[4]=pr(b[4],e);break;case"ellipse":b[8]=pr(b[8],e);break;case"roundRect":b[5]=pr(b[5],e);break;case"addPath":b[0].transform(e);break;case"poly":b[2]=pr(b[2],e);break;case"regularPoly":case"chamferRect":b[5]=pr(b[5],e);break;case"closePath":break;default:xt("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 pr(t,e){return t?t.prepend(e):e.clone()}function Oe(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function Dy(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]=Ly(o);break;case"radialgradient":e.defs[o.id]=Fy();break}}}}function Ly(t){const e=Oe(t,"x1",0),n=Oe(t,"y1",0),r=Oe(t,"x2",1),s=Oe(t,"y2",0),i=t.getAttribute("gradientUnits")||"objectBoundingBox",o=new js(e,n,r,s,i==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){const l=t.children[a],c=Oe(l,"offset",0),u=cn.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(c,u)}return o}function Fy(t){return xt("[SVG Parser] Radial gradients are not yet supported"),new js(0,0,1,0)}function Cu(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Eu={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 hf(t,e){const n=t.getAttribute("style"),r={},s={},i={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(const o in Eu){const a=t.getAttribute(o);a&&Iu(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(":");Eu[c]&&Iu(e,i,c,u.trim())}}return{strokeStyle:i.useStroke?r:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function Iu(t,e,n,r){switch(n){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const s=Cu(r);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=cn.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=Cu(r);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=cn.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 By(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 Uy(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function Gy(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 Pu(t,e){const n=new an(t,!1);for(const r of n.instructions)e.instructions.push(r)}function Zy(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 an};Dy(t,n);const r=t.children,{fillStyle:s,strokeStyle:i}=hf(t,n);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&df(a,n,s,i)}return e}function df(t,e,n,r){const s=t.children,{fillStyle:i,strokeStyle:o}=hf(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,_,x,b,S,T,I,A,E,V;switch(t.nodeName.toLowerCase()){case"path":{I=t.getAttribute("d");const X=t.getAttribute("fill-rule"),$=Uy(I),F=X==="evenodd",oe=$.length>1;if(F&&oe){const Se=$.map(L=>({path:L,area:Gy(L)}));if(Se.sort((L,H)=>H.area-L.area),$.length>3||!By(Se))for(let L=0;L<Se.length;L++){const H=Se[L],Rn=L===0;e.context.beginPath();const he=new an(void 0,!0);Pu(H.path,he),e.context.path(he),Rn?(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],Rn=L%2===1;e.context.beginPath();const he=new an(void 0,!0);Pu(H.path,he),e.context.path(he),Rn?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{const Se=X?X==="evenodd":!0;A=new an(I,Se),e.context.path(A),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=Oe(t,"cx",0),y=Oe(t,"cy",0),_=Oe(t,"r",0),e.context.ellipse(m,y,_,_),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=Oe(t,"x",0),c=Oe(t,"y",0),E=Oe(t,"width",0),V=Oe(t,"height",0),x=Oe(t,"rx",0),b=Oe(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=Oe(t,"cx",0),y=Oe(t,"cy",0),x=Oe(t,"rx",0),b=Oe(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=Oe(t,"x1",0),h=Oe(t,"y1",0),f=Oe(t,"x2",0),d=Oe(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(X=>parseInt(X,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(X=>parseInt(X,10)),e.context.poly(S,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{xt(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(n=null);for(let X=0;X<s.length;X++)df(s[X],e,n,r)}function jy(t){return t.texture!==void 0}const Mu={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 Vy{constructor(e,n){this.uid=Fe("fillPattern"),this._tick=0,this.transform=new ce;const r=jy(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=Mu[s].addressModeU,this.texture.source.style.addressModeV=Mu[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 Hy(t){return cn.isColorLike(t)}function Ru(t){return t instanceof Vy}function zu(t){return t instanceof js}function Wy(t){return t instanceof be}function Yy(t,e,n){const r=cn.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 Xy(t,e,n){return t.texture=e,{...n,...t}}function Ou(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 $u(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 qy(t,e){const n={...e,...t},r=cn.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function as(t,e){if(t==null)return null;const n={},r=t;return Hy(t)?Yy(n,t,e):Wy(t)?Xy(n,t,e):Ru(t)?Ou(n,t,e):zu(t)?$u(n,t,e):r.fill&&Ru(r.fill)?Ou(r,r.fill,e):r.fill&&zu(r.fill)?$u(r,r.fill,e):qy(r,e)}function Nu(t,e){const{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...l}=e,c=as(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],_=o[h],x=o[h+1],b=f-m,S=d-y,T=_-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 oe=Math.min(1/F,e);oe>n&&(n=oe)}}return n}const Ky=new et,Du=new ce,Ml=class Wt extends In{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 an,this._transform=new ce,this._fillStyle={...Wt.defaultFillStyle},this._strokeStyle={...Wt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new $t,this._boundsDirty=!0}clone(){const e=new Wt;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=as(e,Wt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Nu(e,Wt.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=as(e,Wt.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=as(e,Wt.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?cn.shared.setValue(n).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new an,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=as(e,Wt.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=Nu(e,Wt.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++,Zy(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 ce?(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 ce?(this._transform.append(e),this):(Du.set(e,n,r,s,i,o),this._transform.append(Du),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,Ky):e;if(o.action==="fill")r=f.contains(m.x,m.y);else{const _=c;r=f.strokeContains(m.x,m.y,_.width,_.alignment)}const y=a.hole;if(y){const _=(s=y.shapePath)==null?void 0:s.shapePrimitives;if(_)for(let x=0;x<_.length;x++)_[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}};Ml.defaultFillStyle={color:16777215,alpha:1,texture:be.WHITE,matrix:null,fill:null,textureSpace:"local"};Ml.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 es=Ml;class Qy{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class ex{constructor(){this.instructions=new vl}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Rl=class Wa{constructor(e){this._renderer=e,this._managedContexts=new eo({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Wa.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Wa.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 ex,r=this.getGpuContext(e);return r.graphicsData=n,n.init(),n}_initContext(e){const n=new Qy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Rl.extension={type:[ve.CanvasSystem],name:"graphicsContext"};Rl.defaultOptions={bezierSmoothness:.5};let tx=Rl;class ff{constructor(e,n){this.state=Vd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new eo({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}}ff.extension={type:[ve.CanvasPipes],name:"graphics"};function nx(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 rx{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{dt.return(e)}),this.batches.length=0}}class pf{constructor(e,n){this.state=Vd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new eo({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,nx(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 rx;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=dt.get(Cl);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}}pf.extension={type:[ve.WebGLPipes,ve.WebGPUPipes],name:"graphics"};bt.add(ff);bt.add(pf);bt.add(tx);bt.add(Pl);class Mi extends vd{constructor(e){e instanceof es&&(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 es,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 Mi(this._context.clone()):(this._ownedContext=null,new Mi(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!==es.defaultStrokeStyle.width||e.color!==es.defaultStrokeStyle.color||e.alpha!==es.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)}}bt.add(hm,dm);const sx={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 ix(t){return{...sx,...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 Lu;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Lu||(Lu={}));const D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xn=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}},M=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 un 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 un))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()}}un.create=t=>new un(t);const Ya=(t,e)=>{let n;switch(t.code){case M.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case M.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case M.invalid_union:n="Invalid input";break;case M.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case M.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case M.invalid_arguments:n="Invalid function arguments";break;case M.invalid_return_type:n="Invalid function return type";break;case M.invalid_date:n="Invalid date";break;case M.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 M.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 M.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 M.custom:n="Invalid input";break;case M.invalid_intersection_types:n="Intersection results could not be merged";break;case M.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case M.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}};let ox=Ya;function ax(){return ox}const lx=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=ax(),r=lx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ya?void 0:Ya].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 q;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 q;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 q=Object.freeze({status:"aborted"}),ls=t=>({status:"dirty",value:t}),Tt=t=>({status:"valid",value:t}),Fu=t=>t.status==="aborted",Bu=t=>t.status==="dirty",zr=t=>t.status==="valid",Ri=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 qt{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 Uu=(t,e)=>{if(zr(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 un(t.common.issues);return this._error=n,this._error}}};function ne(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 ie=class{get description(){return this._def.description}_getType(e){return xn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:xn(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:xn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ri(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:xn(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Uu(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:xn(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return zr(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=>zr(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:xn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ri(s)?s:Promise.resolve(s));return Uu(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:M.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 er({schema:this,typeName:J.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 ln.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this)}promise(){return Fi.create(this,this._def)}or(e){return Ni.create([this,e],this._def)}and(e){return Di.create(this,e,this._def)}transform(e){return new er({...ne(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Bi({...ne(this._def),innerType:this,defaultValue:n,typeName:J.ZodDefault})}brand(){return new xf({typeName:J.ZodBranded,type:this,...ne(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Ui({...ne(this._def),innerType:this,catchValue:n,typeName:J.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return zl.create(this,e)}readonly(){return Gi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const cx=/^c[^\s-]{8,}$/i,ux=/^[0-9a-z]+$/,hx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dx=/^[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,fx=/^[a-z0-9_-]{21}$/i,px=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mx=/^[-+]?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)?)??$/,gx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_x="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let aa;const yx=/^(?:(?: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])$/,xx=/^(?:(?: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])$/,bx=/^(([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]))$/,vx=/^(([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])$/,wx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mf="((\\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])))",Sx=new RegExp(`^${mf}$`);function gf(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 Tx(t){return new RegExp(`^${gf(t)}$`)}function Ax(t){let e=`${mf}T${gf(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 Cx(t,e){return!!((e==="v4"||!e)&&yx.test(t)||(e==="v6"||!e)&&bx.test(t))}function Ex(t,e){if(!px.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 Ix(t,e){return!!((e==="v4"||!e)&&xx.test(t)||(e==="v6"||!e)&&vx.test(t))}let zi=class cs extends ie{_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:M.invalid_type,expected:D.string,received:i.parsedType}),q}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:M.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:M.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:M.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(s,{code:M.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")gx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")aa||(aa=new RegExp(_x,"u")),aa.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")dx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")fx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"nanoid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")cx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")ux.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")hx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:M.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:M.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:M.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:M.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:M.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:M.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ax(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:M.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Sx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:M.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Tx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:M.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?mx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"duration",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Cx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Ex(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"jwt",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ix(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cidr",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?wx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?kx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64url",code:M.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:M.invalid_string,...U.errToObj(r)})}_addCheck(e){return new cs({...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 cs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cs({...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}};zi.create=t=>new zi({checks:[],typeName:J.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ne(t)});function Px(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 Xa=class qa extends ie{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:M.invalid_type,expected:D.number,received:i.parsedType}),q}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:M.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:M.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:M.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Px(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),N(r,{code:M.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:M.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 qa({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new qa({...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)}};Xa.create=t=>new Xa({checks:[],typeName:J.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ne(t)});class As extends ie{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:M.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:M.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:M.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:M.invalid_type,expected:D.bigint,received:n.parsedType}),q}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 As({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new As({...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}}As.create=t=>new As({checks:[],typeName:J.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ne(t)});let Ja=class extends ie{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.boolean,received:r.parsedType}),q}return Tt(e.data)}};Ja.create=t=>new Ja({typeName:J.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ne(t)});class Oi extends ie{_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:M.invalid_type,expected:D.date,received:i.parsedType}),q}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return N(i,{code:M.invalid_date}),q}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:M.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:M.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 Oi({...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}}Oi.create=t=>new Oi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:J.ZodDate,...ne(t)});class Gu extends ie{_parse(e){if(this._getType(e)!==D.symbol){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.symbol,received:r.parsedType}),q}return Tt(e.data)}}Gu.create=t=>new Gu({typeName:J.ZodSymbol,...ne(t)});class Ka extends ie{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.undefined,received:r.parsedType}),q}return Tt(e.data)}}Ka.create=t=>new Ka({typeName:J.ZodUndefined,...ne(t)});class $i extends ie{_parse(e){if(this._getType(e)!==D.null){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.null,received:r.parsedType}),q}return Tt(e.data)}}$i.create=t=>new $i({typeName:J.ZodNull,...ne(t)});let Zu=class extends ie{constructor(){super(...arguments),this._any=!0}_parse(e){return Tt(e.data)}};Zu.create=t=>new Zu({typeName:J.ZodAny,...ne(t)});let Qa=class extends ie{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tt(e.data)}};Qa.create=t=>new Qa({typeName:J.ZodUnknown,...ne(t)});let En=class extends ie{_parse(e){const n=this._getOrReturnCtx(e);return N(n,{code:M.invalid_type,expected:D.never,received:n.parsedType}),q}};En.create=t=>new En({typeName:J.ZodNever,...ne(t)});class ju extends ie{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.void,received:r.parsedType}),q}return Tt(e.data)}}ju.create=t=>new ju({typeName:J.ZodVoid,...ne(t)});let Or=class Ti extends ie{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==D.array)return N(n,{code:M.invalid_type,expected:D.array,received:n.parsedType}),q;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?M.too_big:M.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:M.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:M.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 qt(n,o,n.path,a)))).then(o=>lt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new qt(n,o,n.path,a)));return lt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Ti({...this._def,minLength:{value:e,message:U.toString(n)}})}max(e,n){return new Ti({...this._def,maxLength:{value:e,message:U.toString(n)}})}length(e,n){return new Ti({...this._def,exactLength:{value:e,message:U.toString(n)}})}nonempty(e){return this.min(1,e)}};Or.create=(t,e)=>new Or({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ne(e)});function xr(t){if(t instanceof hn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ln.create(xr(r))}return new hn({...t._def,shape:()=>e})}else return t instanceof Or?new Or({...t._def,type:xr(t.element)}):t instanceof ln?ln.create(xr(t.unwrap())):t instanceof tr?tr.create(xr(t.unwrap())):t instanceof Qn?Qn.create(t.items.map(e=>xr(e))):t}let hn=class Rt extends ie{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:M.invalid_type,expected:D.object,received:c.parsedType}),q}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof En&&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 qt(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof En){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:M.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 qt(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 Rt({...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 Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Rt({...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 Rt({...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 Rt({...this._def,shape:()=>n})}deepPartial(){return xr(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 Rt({...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 ln;)i=i._def.innerType;n[r]=i}return new Rt({...this._def,shape:()=>n})}keyof(){return yf(de.objectKeys(this.shape))}};hn.create=(t,e)=>new hn({shape:()=>t,unknownKeys:"strip",catchall:En.create(),typeName:J.ZodObject,...ne(e)});hn.strictCreate=(t,e)=>new hn({shape:()=>t,unknownKeys:"strict",catchall:En.create(),typeName:J.ZodObject,...ne(e)});hn.lazycreate=(t,e)=>new hn({shape:t,unknownKeys:"strip",catchall:En.create(),typeName:J.ZodObject,...ne(e)});let Ni=class extends ie{_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 un(a.ctx.common.issues));return N(n,{code:M.invalid_union,unionErrors:o}),q}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 un(l));return N(n,{code:M.invalid_union,unionErrors:a}),q}}get options(){return this._def.options}};Ni.create=(t,e)=>new Ni({options:t,typeName:J.ZodUnion,...ne(e)});const en=t=>t instanceof nl?en(t.schema):t instanceof er?en(t.innerType()):t instanceof Li?[t.value]:t instanceof no?t.options:t instanceof sl?de.objectValues(t.enum):t instanceof Bi?en(t._def.innerType):t instanceof Ka?[void 0]:t instanceof $i?[null]:t instanceof ln?[void 0,...en(t.unwrap())]:t instanceof tr?[null,...en(t.unwrap())]:t instanceof xf||t instanceof Gi?en(t.unwrap()):t instanceof Ui?en(t._def.innerType):[];let Mx=class _f extends ie{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return N(n,{code:M.invalid_type,expected:D.object,received:n.parsedType}),q;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:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),q)}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=en(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 _f({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ne(r)})}};function el(t,e){const n=xn(t),r=xn(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=el(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=el(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 Di=class extends ie{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Fu(i)||Fu(o))return q;const a=el(i.value,o.value);return a.valid?((Bu(i)||Bu(o))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:M.invalid_intersection_types}),q)};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}))}};Di.create=(t,e,n)=>new Di({left:t,right:e,typeName:J.ZodIntersection,...ne(n)});class Qn extends ie{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return N(r,{code:M.invalid_type,expected:D.array,received:r.parsedType}),q;if(r.data.length<this._def.items.length)return N(r,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:M.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 qt(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 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:J.ZodTuple,rest:null,...ne(e)})};let Rx=class tl extends ie{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:M.invalid_type,expected:D.object,received:r.parsedType}),q;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new qt(r,a,r.path,a)),value:o._parse(new qt(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 ie?new tl({keyType:e,valueType:n,typeName:J.ZodRecord,...ne(r)}):new tl({keyType:zi.create(),valueType:e,typeName:J.ZodRecord,...ne(n)})}};class Vu extends ie{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:M.invalid_type,expected:D.map,received:r.parsedType}),q;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new qt(r,a,r.path,[c,"key"])),value:i._parse(new qt(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 q;(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 q;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Vu.create=(t,e,n)=>new Vu({valueType:e,keyType:t,typeName:J.ZodMap,...ne(n)});class Cs extends ie{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return N(r,{code:M.invalid_type,expected:D.set,received:r.parsedType}),q;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(N(r,{code:M.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:M.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 q;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 qt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Cs({...this._def,minSize:{value:e,message:U.toString(n)}})}max(e,n){return new Cs({...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)}}Cs.create=(t,e)=>new Cs({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,...ne(e)});let nl=class extends ie{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})}};nl.create=(t,e)=>new nl({getter:t,typeName:J.ZodLazy,...ne(e)});let Li=class extends ie{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return N(n,{received:n.data,code:M.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:e.data}}get value(){return this._def.value}};Li.create=(t,e)=>new Li({value:t,typeName:J.ZodLiteral,...ne(e)});function yf(t,e){return new no({values:t,typeName:J.ZodEnum,...ne(e)})}let no=class rl extends ie{_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:M.invalid_type}),q}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:M.invalid_enum_value,options:r}),q}return Tt(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 rl.create(e,{...this._def,...n})}exclude(e,n=this._def){return rl.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};no.create=yf;class sl extends ie{_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:M.invalid_type}),q}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:M.invalid_enum_value,options:s}),q}return Tt(e.data)}get enum(){return this._def.values}}sl.create=(t,e)=>new sl({values:t,typeName:J.ZodNativeEnum,...ne(e)});class Fi extends ie{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:M.invalid_type,expected:D.promise,received:n.parsedType}),q;const r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return Tt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Fi.create=(t,e)=>new Fi({type:t,typeName:J.ZodPromise,...ne(e)});class er extends ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.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 q;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?q:l.status==="dirty"||n.value==="dirty"?ls(l.value):l});{if(n.value==="aborted")return q;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?q:a.status==="dirty"||n.value==="dirty"?ls(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"?q:(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"?q:(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(!zr(o))return q;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=>zr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):q);de.assertNever(s)}}er.create=(t,e,n)=>new er({schema:t,typeName:J.ZodEffects,effect:e,...ne(n)});er.createWithPreprocess=(t,e,n)=>new er({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,...ne(n)});let ln=class extends ie{_parse(e){return this._getType(e)===D.undefined?Tt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ln.create=(t,e)=>new ln({innerType:t,typeName:J.ZodOptional,...ne(e)});let tr=class extends ie{_parse(e){return this._getType(e)===D.null?Tt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tr.create=(t,e)=>new tr({innerType:t,typeName:J.ZodNullable,...ne(e)});let Bi=class extends ie{_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}};Bi.create=(t,e)=>new Bi({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ne(e)});let Ui=class extends ie{_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 Ri(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new un(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new un(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ui.create=(t,e)=>new Ui({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ne(e)});class Hu extends ie{_parse(e){if(this._getType(e)!==D.nan){const r=this._getOrReturnCtx(e);return N(r,{code:M.invalid_type,expected:D.nan,received:r.parsedType}),q}return{status:"valid",value:e.data}}}Hu.create=t=>new Hu({typeName:J.ZodNaN,...ne(t)});class xf extends ie{_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 zl extends ie{_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"?q:i.status==="dirty"?(n.dirty(),ls(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"?q: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 zl({in:e,out:n,typeName:J.ZodPipeline})}}let Gi=class extends ie{_parse(e){const n=this._def.innerType._parse(e),r=s=>(zr(s)&&(s.value=Object.freeze(s.value)),s);return Ri(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Gi.create=(t,e)=>new Gi({innerType:t,typeName:J.ZodReadonly,...ne(e)});var J;(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"})(J||(J={}));const G=zi.create,j=Xa.create,yt=Ja.create,il=$i.create,Ol=Qa.create;En.create;const $r=Or.create,Q=hn.create,Jt=Ni.create,zx=Mx.create;Di.create;Qn.create;const St=Rx.create,te=Li.create,nt=no.create;Fi.create;ln.create;tr.create;const tt=G().trim().min(1),Lr=G().trim().min(1),ro=j().finite().positive(),$l=Q({status:nt(["available","sold"]),soldToPlayerId:tt.optional(),soldAt:Lr.optional()});Q({id:tt,spaceId:tt,type:nt(["book","music","coffee"]),name:tt,description:G(),priceUsd:ro,createdAt:Lr,sale:$l});Q({id:tt,spaceId:tt,row:Jt([te(1),te(2),te(3),te(4)]),column:Jt([te(1),te(2),te(3),te(4),te(5)]),name:tt,description:G(),priceUsd:ro,createdAt:Lr,sale:$l});const Ox=G().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color");Q({id:tt,spaceId:tt,slot:Jt([te(1),te(2),te(3),te(4),te(5),te(6),te(7),te(8),te(9)]),name:tt,model:tt,year:j().int().min(1900).max(3e3),priceUsd:ro,colorHex:Ox,createdAt:Lr,sale:$l});Q({playerId:tt,balanceUsd:j().finite().nonnegative(),currency:te("USD"),updatedAt:Lr,powerUps:j().int().nonnegative().default(0)});const $x=Q({id:tt,playerId:tt,spaceId:tt,amenityKind:nt(["shop","supermarket","car_wash","parking","house","talk_time","wallet_bundle","apu_credit","apu_debit"]),itemRef:Q({kind:nt(["shop","supermarket","carwash","parking","house","game","apu","talk","bundle"]),id:tt}),priceUsd:ro.optional(),at:Lr,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:te("APU").optional()}),Ai=G().trim().min(1),Wu=G().trim().min(1),Nx=j().finite().positive(),Dx=G().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color"),bf=nt(["1h","12h","1d","3d","7d","1mo","3mo","1y","forever"]),Lx=Jt([te(1),te(2),te(3),te(4)]),Fx=Jt([te(1),te(2)]),Bx=Q({nodeId:Ai,carPurchaseId:Ai,displayNick:G().trim().min(1).max(24),colorHex:Dx,model:Ai,tier:bf,purchasedAt:Wu,expiresAt:Wu.nullable()}),Ux=Q({id:Ai,bay:Lx,layer:Fx,occupant:Bx.nullable()});Q({spots:$r(Ux).length(8),rates:St(bf,Nx)});const la=G().trim().min(1),Gx=G().trim().min(1),Zx=j().finite().positive(),jx=G().trim().min(1).max(40),Vx=G().trim().min(1).max(8),Hx=G().trim().min(1).max(24),Yu=Jt([te(1),te(2),te(3),te(4)]),Wx=Jt([te(1),te(2),te(3),te(4)]),Yx=Q({id:la,houseId:Yu,bay:Wx,worldX:j().finite(),priceUsd:Zx,layoutId:Yu,layoutLabel:la,ownerNodeId:la.nullable(),ownerDisplayName:Hx.nullable(),ownerName:jx.nullable(),ownerSignature:Vx.nullable(),purchasedAt:Gx.nullable()});Q({houses:$r(Yx).length(4)});const Xx=new Set(["hidden-gems","map-recall","price-check","signal-hunt","delivery-dash","lease-locker","talk-timer","daily-rotator"]),qx=t=>Xx.has(t),Jx=zx("type",[Q({type:te("chest_open"),correct:yt(),tutorial:yt().optional()}),Q({type:te("sequence_step"),correct:yt(),tutorial:yt().optional()}),Q({type:te("price_guess"),correct:yt(),round:j().int().min(1)}),Q({type:te("signal_pick"),correct:yt()}),Q({type:te("delivery_finish"),band:nt(["fast","ok","slow"]),hits:j().int().min(0)}),Q({type:te("door_pick"),correct:yt()}),Q({type:te("talk_release"),success:yt(),round:j().int().min(1).max(3)})]);Q({gameId:G().refine(qx,"invalid gameId"),roundId:G().min(1),events:$r(Jx).min(1)});const Kx=Q({plays:j().int().min(0),bestNetPu:j().int()});Q({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:yt(),perGame:St(G(),Kx)});const An=G().trim().min(1),Kt=G().trim().min(1),Qx=nt(["purchase","redeemWalletBundle","applyGameOutcome","talkTick","talkStop","talkStart","walletSeeded"]),eb=$x.extend({hostId:An,indexedAt:Kt,op:Qx,blockRev:j().int().nonnegative().optional(),merkleRootHex:G().optional()});Q({rev:j().int().nonnegative(),merkleRootHex:G(),merkleLeafCount:j().int().nonnegative(),at:Kt,occupantCount:j().int().nonnegative().optional(),leafDeltaCount:j().int().nonnegative().optional(),label:G().optional()});const vf=nt(["pending","running","completed","failed"]);Q({status:vf,cursor:G(),totalIndexed:j().int().nonnegative(),startedAt:Kt,completedAt:Kt.optional(),error:G().optional()});Q({playerId:An,balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),updatedAt:Kt});Q({generatedAt:Kt,hostId:An,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:vf});const tb=nt(["main","agent","unknown"]),nb=Q({balanceUsd:j().finite().nonnegative(),powerUps:j().int().nonnegative(),currency:te("USD"),updatedAt:Kt}),rb=Q({txCount:j().int().nonnegative(),usdSpent:j().finite().nonnegative(),apuMinted:j().int().nonnegative(),apuBurned:j().int().nonnegative(),lastTxAt:Kt.nullable()}),sb=Q({byAmenityKind:St(G(),j().int().nonnegative()),bySpaceId:St(G(),j().int().nonnegative()),byToken:Q({usd:j().finite().nonnegative(),apu:j().int().nonnegative()})}),ib=Q({eventsLast24h:j().int().nonnegative(),topEvents:$r(Q({event:An,count:j().int().nonnegative()}))});Q({nodeId:An,kind:tb,generatedAt:Kt,wallet:nb.nullable(),ledger:rb,breakdown:sb,txs:$r(eb),txsNextCursor:G().nullable(),gameStats:Q({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:yt(),perGame:St(G(),Q({plays:j().int().min(0),bestNetPu:j().int()}))}).nullable(),analyticsEvents:$r(Q({messageId:An,event:An,distinctId:An,timestamp:Kt,properties:St(Jt([G(),j(),yt(),il()]))})),analyticsEventsNextCursor:G().nullable(),analytics:ib,traits:St(Jt([G(),j(),yt(),il()]))});const _s=G().trim().min(1),Zi=G().trim().min(1),wf=Jt([G(),j(),yt(),il()]),ob=Q({hostId:_s,sid:G().optional(),snapshotRev:j().int().nonnegative().optional(),library:nt(["agent-play-server","agent-play-client"])});Q({messageId:_s,event:_s,distinctId:_s,timestamp:Zi,properties:St(wf),context:ob.optional()});Q({distinctId:_s,traits:St(wf),timestamp:Zi});const ab=nt(["pending","running","completed","failed"]);Q({status:ab,cursor:G(),totalIndexed:j().int().nonnegative(),startedAt:Zi,completedAt:Zi.optional(),error:G().optional()});function lb(){return["park","new_york","tokyo"]}const cb="agent-play-preview-view-settings-v2",ub="agent-play-deep-logs",hb=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function db(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function fb(){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 kf(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 pb(){if(typeof window>"u")return;const e=new URL(window.location.href).searchParams.get("deepLogs");if(e!==null)return kf(e)}function mb(){if(typeof localStorage>"u")return;const t=localStorage.getItem(ub);if(!(t===null||t.length===0))return kf(t)}function gb(){const t=pb();return t!==void 0?t:mb()}function Sf(t){return t==="default"||t==="ember"||t==="forest"}function Tf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function Af(t){return hb.includes(t)}function kr(){return{themeId:"park",showChatUi:!0,debugMode:db(),debugOccupancyQuartiles:!1,debugOccupancyFreeGrids:!1,worldGeographyEnabled:!1,joystickEnabled:!0,stationaryPanels:!1,p2aEnabled:!1,deepLogsEnabled:fb(),profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function Cf(t){return lb().includes(t)}function _b(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"&&Cf(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"&&Sf(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&Tf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&Af(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Xu=kr();function yb(t){const e=Cf(t.themeId)?t.themeId:kr().themeId,n=Sf(t.profileAvatarPresetId)?t.profileAvatarPresetId:kr().profileAvatarPresetId,r=Tf(t.profileGender)?t.profileGender:kr().profileGender,s=Af(t.language)?t.language:kr().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 xb(){const t=_b(typeof localStorage<"u"?localStorage.getItem(cb):null),e={...kr(),...t},n=gb();return Xu=yb({...e,...n!==void 0?{deepLogsEnabled:n}:{}}),{...Xu}}typeof localStorage<"u"&&xb();var bb=/^[a-z][a-z0-9-]*$/;function vb(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(!bb.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 wb(t){return vb(t).value}var Le=G().trim().min(1),Nl=G().trim().transform(t=>(wb(t),t)),kb=Q({requestId:Le,mainNodeId:Le,fromPlayerId:Le,toPlayerId:Le,kind:nt(["assist","chat","realtime"]),toolName:G().optional(),args:St(G(),Ol()).optional(),text:G().optional(),intercomAddress:Nl.optional()}).superRefine((t,e)=>{t.kind==="assist"&&(t.toolName??"").trim().length===0&&e.addIssue({code:M.custom,path:["toolName"],message:"toolName is required for assist"}),t.kind==="chat"&&(t.text??"").trim().length===0&&e.addIssue({code:M.custom,path:["text"],message:"text is required for chat"})});Q({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:St(G(),Ol()).optional(),error:G().nullable().optional(),ts:Le,channelKey:G().optional(),intercomAddress:Nl.optional(),command:kb.optional()});Q({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:St(G(),Ol()).optional(),error:G().nullable().optional(),ts:Le,intercomAddress:Nl.optional()}).superRefine((t,e)=>{t.status==="failed"&&(t.error??"").trim().length===0&&e.addIssue({code:M.custom,path:["error"],message:"error is required when status is failed"})});Q({consent:te(!0),nodeId:Le,passwHash:Le}).strict();Q({requestId:Le,mainNodeId:Le,fromPlayerId:Le,message:Le}).strict();new TextEncoder;/*! @license DOMPurify 3.4.12 | (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.12/LICENSE */function qu(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 Tb(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 Ab(){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 Cb(t,e){return Sb(t)||Tb(t,e)||Eb(t,e)||Ab()}function Eb(t,e){if(t){if(typeof t=="string")return qu(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)?qu(t,e):void 0}}const Ef=Object.entries,Ju=Object.setPrototypeOf,Ib=Object.isFrozen,Pb=Object.getPrototypeOf,Mb=Object.getOwnPropertyDescriptor;let We=Object.freeze,Ye=Object.seal,br=Object.create,If=typeof Reflect<"u"&&Reflect,ol=If.apply,al=If.construct;We||(We=function(e){return e});Ye||(Ye=function(e){return e});ol||(ol=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)});al||(al=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 mr=Be(Array.prototype.forEach),Rb=Be(Array.prototype.lastIndexOf),Ku=Be(Array.prototype.pop),gr=Be(Array.prototype.push),zb=Be(Array.prototype.splice),bn=Array.isArray,us=Be(String.prototype.toLowerCase),ca=Be(String.prototype.toString),Qu=Be(String.prototype.match),ts=Be(String.prototype.replace),eh=Be(String.prototype.indexOf),Ob=Be(String.prototype.trim),$b=Be(Number.prototype.toString),Nb=Be(Boolean.prototype.toString),th=typeof BigInt>"u"?null:Be(BigInt.prototype.toString),nh=typeof Symbol>"u"?null:Be(Symbol.prototype.toString),Ze=Be(Object.prototype.hasOwnProperty),ns=Be(Object.prototype.toString),Ge=Be(RegExp.prototype.test),Gn=Db(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 ol(t,e,r)}}function Db(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return al(t,n)}}function ae(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:us;if(Ju&&Ju(t,null),!bn(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(Ib(e)||(e[r]=i),s=i)}t[s]=!0}return t}function Lb(t){for(let e=0;e<t.length;e++)Ze(t,e)||(t[e]=null);return t}function it(t){const e=br(null);for(const r of Ef(t)){var n=Cb(r,2);const s=n[0],i=n[1];Ze(t,s)&&(bn(i)?e[s]=Lb(i):i&&typeof i=="object"&&i.constructor===Object?e[s]=it(i):e[s]=i)}return e}function Fb(t){switch(typeof t){case"string":return t;case"number":return $b(t);case"boolean":return Nb(t);case"bigint":return th?th(t):"0";case"symbol":return nh?nh(t):"Symbol()";case"undefined":return ns(t);case"function":case"object":{if(t===null)return ns(t);const e=t,n=Yt(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:ns(r)}return ns(t)}default:return ns(t)}}function Yt(t,e){for(;t!==null;){const r=Mb(t,e);if(r){if(r.get)return Be(r.get);if(typeof r.value=="function")return Be(r.value)}t=Pb(t)}function n(){return null}return n}function Bb(t){try{return Ge(t,""),!0}catch{return!1}}const rh=We(["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"]),ua=We(["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"]),ha=We(["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"]),Ub=We(["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"]),da=We(["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"]),Gb=We(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sh=We(["#text"]),ih=We(["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"]),fa=We(["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","dominant-baseline","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-orientation","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"]),oh=We(["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"]),mi=We(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Zb=Ye(/{{[\w\W]*|^[\w\W]*}}/g),jb=Ye(/<%[\w\W]*|^[\w\W]*%>/g),Vb=Ye(/\${[\w\W]*/g),Hb=Ye(/^data-[\-\w.\u00B7-\uFFFF]+$/),Wb=Ye(/^aria-[\-\w]+$/),ah=Ye(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yb=Ye(/^(?:\w+script|data):/i),Xb=Ye(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qb=Ye(/^html$/i),Jb=Ye(/^[a-z][.\w]*(-[.\w]+)+$/i),lh=Ye(/<[/\w!]/g),ch=Ye(/<[/\w]/g),Kb=Ye(/<\/no(script|embed|frames)/i),Qb=Ye(/\/>/i),mt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},e0=function(){return typeof window>"u"?null:window},t0=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}},uh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_n=function(e,n,r,s){return Ze(e,n)&&bn(e[n])?ae(s.base?it(s.base):{},e[n],s.transform):r};function Pf(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e0();const e=z=>Pf(z);if(e.version="3.4.12",e.removed=[],!t||!t.document||t.document.nodeType!==mt.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=Yt(f,"cloneNode"),m=Yt(f,"remove"),y=Yt(f,"nextSibling"),_=Yt(f,"childNodes"),x=Yt(f,"parentNode"),b=Yt(f,"shadowRoot"),S=Yt(f,"attributes"),T=o&&o.prototype?Yt(o.prototype,"nodeType"):null,I=o&&o.prototype?Yt(o.prototype,"nodeName"):null;if(typeof i=="function"){const z=n.createElement("template");z.content&&z.content.ownerDocument&&(n=z.content.ownerDocument)}let A,E="",V,X=!1,$=0;const F=function(){if($>0)throw Gn('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.')},oe=function(g){F(),$++;try{return A.createHTML(g)}finally{$--}},ke=function(g){F(),$++;try{return A.createScriptURL(g)}finally{$--}},Se=function(){return X||(V=t0(h,s),X=!0),V},Ct=n,L=Ct.implementation,H=Ct.createNodeIterator,Rn=Ct.createDocumentFragment,he=Ct.getElementsByTagName,Ft=r.importNode;let ye=uh();e.isSupported=typeof Ef=="function"&&typeof x=="function"&&L&&L.createHTMLDocument!==void 0;const zn=Zb,On=jb,Ws=Vb,ir=Hb,$n=Wb,Ys=Yb,Gr=Xb,or=Jb;let Nn=ah,we=null;const Bt=ae({},[...rh,...ua,...ha,...da,...sh]);let pe=null;const Ut=ae({},[...ih,...fa,...oh,...mi]);let me=Object.seal(br(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}})),Dn=null,Zr=null;const Gt=Object.seal(br(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let mo=!0,go=!0,cc=!1,uc=!0,pn=!1,mn=!0,Ln=!1,_o=!1,yo=null,xo=null,bo=!1,ar=!1,Xs=!1,qs=!1,hc=!0,dc=!1;const fc="user-content-";let vo=!0,wo=!1,lr={},Zt=null;const ko=ae({},["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 pc=null;const mc=ae({},["audio","video","img","source","image","track"]);let So=null;const gc=ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Js="http://www.w3.org/1998/Math/MathML",Ks="http://www.w3.org/2000/svg",jt="http://www.w3.org/1999/xhtml";let cr=jt,To=!1,Ao=null;const Vp=ae({},[Js,Ks,jt],ca),_c=We(["mi","mo","mn","ms","mtext"]);let Co=ae({},_c);const yc=We(["annotation-xml"]);let Eo=ae({},yc);const Hp=ae({},["title","style","font","a","script"]);let jr=null;const Wp=["application/xhtml+xml","text/html"],Yp="text/html";let Me=null,ur=null;const Xp=n.createElement("form"),xc=function(g){return g instanceof RegExp||g instanceof Function},Io=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ur&&ur===g)return;(!g||typeof g!="object")&&(g={}),g=it(g),jr=Wp.indexOf(g.PARSER_MEDIA_TYPE)===-1?Yp:g.PARSER_MEDIA_TYPE,Me=jr==="application/xhtml+xml"?ca:us,we=_n(g,"ALLOWED_TAGS",Bt,{transform:Me}),pe=_n(g,"ALLOWED_ATTR",Ut,{transform:Me}),Ao=_n(g,"ALLOWED_NAMESPACES",Vp,{transform:ca}),So=_n(g,"ADD_URI_SAFE_ATTR",gc,{transform:Me,base:gc}),pc=_n(g,"ADD_DATA_URI_TAGS",mc,{transform:Me,base:mc}),Zt=_n(g,"FORBID_CONTENTS",ko,{transform:Me}),Dn=_n(g,"FORBID_TAGS",it({}),{transform:Me}),Zr=_n(g,"FORBID_ATTR",it({}),{transform:Me}),lr=Ze(g,"USE_PROFILES")?g.USE_PROFILES&&typeof g.USE_PROFILES=="object"?it(g.USE_PROFILES):g.USE_PROFILES:!1,mo=g.ALLOW_ARIA_ATTR!==!1,go=g.ALLOW_DATA_ATTR!==!1,cc=g.ALLOW_UNKNOWN_PROTOCOLS||!1,uc=g.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pn=g.SAFE_FOR_TEMPLATES||!1,mn=g.SAFE_FOR_XML!==!1,Ln=g.WHOLE_DOCUMENT||!1,ar=g.RETURN_DOM||!1,Xs=g.RETURN_DOM_FRAGMENT||!1,qs=g.RETURN_TRUSTED_TYPE||!1,bo=g.FORCE_BODY||!1,hc=g.SANITIZE_DOM!==!1,dc=g.SANITIZE_NAMED_PROPS||!1,vo=g.KEEP_CONTENT!==!1,wo=g.IN_PLACE||!1,Nn=Bb(g.ALLOWED_URI_REGEXP)?g.ALLOWED_URI_REGEXP:ah,cr=typeof g.NAMESPACE=="string"?g.NAMESPACE:jt,Co=Ze(g,"MATHML_TEXT_INTEGRATION_POINTS")&&g.MATHML_TEXT_INTEGRATION_POINTS&&typeof g.MATHML_TEXT_INTEGRATION_POINTS=="object"?it(g.MATHML_TEXT_INTEGRATION_POINTS):ae({},_c),Eo=Ze(g,"HTML_INTEGRATION_POINTS")&&g.HTML_INTEGRATION_POINTS&&typeof g.HTML_INTEGRATION_POINTS=="object"?it(g.HTML_INTEGRATION_POINTS):ae({},yc);const w=Ze(g,"CUSTOM_ELEMENT_HANDLING")&&g.CUSTOM_ELEMENT_HANDLING&&typeof g.CUSTOM_ELEMENT_HANDLING=="object"?it(g.CUSTOM_ELEMENT_HANDLING):br(null);if(me=br(null),Ze(w,"tagNameCheck")&&xc(w.tagNameCheck)&&(me.tagNameCheck=w.tagNameCheck),Ze(w,"attributeNameCheck")&&xc(w.attributeNameCheck)&&(me.attributeNameCheck=w.attributeNameCheck),Ze(w,"allowCustomizedBuiltInElements")&&typeof w.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=w.allowCustomizedBuiltInElements),Ye(me),pn&&(go=!1),Xs&&(ar=!0),lr&&(we=ae({},sh),pe=br(null),lr.html===!0&&(ae(we,rh),ae(pe,ih)),lr.svg===!0&&(ae(we,ua),ae(pe,fa),ae(pe,mi)),lr.svgFilters===!0&&(ae(we,ha),ae(pe,fa),ae(pe,mi)),lr.mathMl===!0&&(ae(we,da),ae(pe,oh),ae(pe,mi))),Gt.tagCheck=null,Gt.attributeCheck=null,Ze(g,"ADD_TAGS")&&(typeof g.ADD_TAGS=="function"?Gt.tagCheck=g.ADD_TAGS:bn(g.ADD_TAGS)&&(we===Bt&&(we=it(we)),ae(we,g.ADD_TAGS,Me))),Ze(g,"ADD_ATTR")&&(typeof g.ADD_ATTR=="function"?Gt.attributeCheck=g.ADD_ATTR:bn(g.ADD_ATTR)&&(pe===Ut&&(pe=it(pe)),ae(pe,g.ADD_ATTR,Me))),Ze(g,"ADD_URI_SAFE_ATTR")&&bn(g.ADD_URI_SAFE_ATTR)&&ae(So,g.ADD_URI_SAFE_ATTR,Me),Ze(g,"FORBID_CONTENTS")&&bn(g.FORBID_CONTENTS)&&(Zt===ko&&(Zt=it(Zt)),ae(Zt,g.FORBID_CONTENTS,Me)),Ze(g,"ADD_FORBID_CONTENTS")&&bn(g.ADD_FORBID_CONTENTS)&&(Zt===ko&&(Zt=it(Zt)),ae(Zt,g.ADD_FORBID_CONTENTS,Me)),vo&&(we["#text"]=!0),Ln&&ae(we,["html","head","body"]),we.table&&(ae(we,["tbody"]),delete Dn.tbody),g.TRUSTED_TYPES_POLICY){if(typeof g.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof g.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const P=A;A=g.TRUSTED_TYPES_POLICY;try{E=oe("")}catch(B){throw A=P,B}}else g.TRUSTED_TYPES_POLICY===null?(A=void 0,E=""):(A===void 0&&(A=Se()),A&&typeof E=="string"&&(E=oe("")));We&&We(g),ur=g},bc=ae({},[...ua,...ha,...Ub]),vc=ae({},[...da,...Gb]),qp=function(g,w,P){return w.namespaceURI===jt?g==="svg":w.namespaceURI===Js?g==="svg"&&(P==="annotation-xml"||Co[P]):!!bc[g]},Jp=function(g,w,P){return w.namespaceURI===jt?g==="math":w.namespaceURI===Ks?g==="math"&&Eo[P]:!!vc[g]},Kp=function(g,w,P){return w.namespaceURI===Ks&&!Eo[P]||w.namespaceURI===Js&&!Co[P]?!1:!vc[g]&&(Hp[g]||!bc[g])},Qp=function(g){let w=x(g);(!w||!w.tagName)&&(w={namespaceURI:cr,tagName:"template"});const P=us(g.tagName),B=us(w.tagName);return Ao[g.namespaceURI]?g.namespaceURI===Ks?qp(P,w,B):g.namespaceURI===Js?Jp(P,w,B):g.namespaceURI===jt?Kp(P,w,B):!!(jr==="application/xhtml+xml"&&Ao[g.namespaceURI]):!1},gn=function(g){gr(e.removed,{element:g});try{x(g).removeChild(g)}catch{if(m(g),!x(g))throw Gn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Qs=function(g){Po(g);const w=_(g);if(w){const B=[];mr(w,W=>{gr(B,W)}),mr(B,W=>{try{m(W)}catch{}})}const P=S(g);if(P)for(let B=P.length-1;B>=0;--B){const W=P[B],K=W&&W.name;if(typeof K=="string")try{g.removeAttribute(K)}catch{}}},Fn=function(g,w){try{gr(e.removed,{attribute:w.getAttributeNode(g),from:w})}catch{gr(e.removed,{attribute:null,from:w})}if(w.removeAttribute(g),g==="is")if(ar||Xs)try{gn(w)}catch{}else try{w.setAttribute(g,"")}catch{}},em=function(g){const w=S(g);if(w)for(let P=w.length-1;P>=0;--P){const B=w[P],W=B&&B.name;if(!(typeof W!="string"||pe[Me(W)]))try{g.removeAttribute(W)}catch{}}},Po=function(g){const w=[g];for(;w.length>0;){const P=w.pop();(T?T(P):P.nodeType)===mt.element&&em(P);const W=_(P);if(W)for(let K=W.length-1;K>=0;--K)w.push(W[K])}},tm=function(g){if(!mn)return;const w=[g];for(;w.length>0;){const P=w.pop(),B=T?T(P):P.nodeType;if(B===mt.processingInstruction||B===mt.comment&&Ge(ch,P.data)){try{m(P)}catch{}continue}if(B===mt.element){const K=P,ze=Me(I?I(P):P.nodeName);try{K.hasAttribute&&K.hasAttribute("patchsrc")&&K.removeAttribute("patchsrc"),K.hasAttribute&&K.hasAttribute("for")&&ze!=="label"&&ze!=="output"&&K.removeAttribute("for")}catch{}}const W=_(P);if(W)for(let K=W.length-1;K>=0;--K)w.push(W[K])}},wc=function(g){let w=null,P=null;if(bo)g="<remove></remove>"+g;else{const K=Qu(g,/^[\r\n\t ]+/);P=K&&K[0]}jr==="application/xhtml+xml"&&cr===jt&&(g='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+g+"</body></html>");const B=A?oe(g):g;if(cr===jt)try{w=new u().parseFromString(B,jr)}catch{}if(!w||!w.documentElement){w=L.createDocument(cr,"template",null);try{w.documentElement.innerHTML=To?E:B}catch{}}const W=w.body||w.documentElement;return g&&P&&W.insertBefore(n.createTextNode(P),W.childNodes[0]||null),cr===jt?he.call(w,Ln?"html":"body")[0]:Ln?w.documentElement:W},kc=function(g){return H.call(g.ownerDocument||g,g,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},ei=function(g){return g=ts(g,zn," "),g=ts(g,On," "),g=ts(g,Ws," "),g},Mo=function(g){var w;g.normalize();const P=H.call(g.ownerDocument||g,g,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let B=P.nextNode();for(;B;)B.data=ei(B.data),B=P.nextNode();const W=(w=g.querySelectorAll)===null||w===void 0?void 0:w.call(g,"template");W&&mr(W,K=>{hr(K.content)&&Mo(K.content)})},ti=function(g){const w=I?I(g):null;return typeof w!="string"||Me(w)!=="form"?!1:typeof g.nodeName!="string"||typeof g.textContent!="string"||typeof g.removeChild!="function"||g.attributes!==S(g)||typeof g.removeAttribute!="function"||typeof g.setAttribute!="function"||typeof g.namespaceURI!="string"||typeof g.insertBefore!="function"||typeof g.hasChildNodes!="function"||g.nodeType!==T(g)||g.childNodes!==_(g)},hr=function(g){if(!T||typeof g!="object"||g===null)return!1;try{return T(g)===mt.documentFragment}catch{return!1}},Vr=function(g){if(!T||typeof g!="object"||g===null)return!1;try{return typeof T(g)=="number"}catch{return!1}};function Vt(z,g,w){z.length!==0&&mr(z,P=>{P.call(e,g,w,ur)})}const nm=function(g,w){return!!(mn&&g.hasChildNodes()&&!Vr(g.firstElementChild)&&Ge(lh,g.textContent)&&Ge(lh,g.innerHTML)||mn&&g.namespaceURI===jt&&w==="style"&&Vr(g.firstElementChild)||g.nodeType===mt.processingInstruction||mn&&g.nodeType===mt.comment&&Ge(ch,g.data))},rm=function(g,w){if(!Dn[w]&&Ac(w)&&(me.tagNameCheck instanceof RegExp&&Ge(me.tagNameCheck,w)||me.tagNameCheck instanceof Function&&me.tagNameCheck(w)))return!1;if(vo&&!Zt[w]){const P=x(g),B=_(g);if(B&&P){const W=B.length;for(let K=W-1;K>=0;--K){const ze=wo?B[K]:d(B[K],!0);P.insertBefore(ze,y(g))}}}return gn(g),!0},Sc=function(g,w){if(Vt(ye.beforeSanitizeElements,g,null),g!==w&&x(g)===null)return!0;if(ti(g))return gn(g),!0;const P=Me(I?I(g):g.nodeName);if(Vt(ye.uponSanitizeElement,g,{tagName:P,allowedTags:we}),g!==w&&x(g)===null)return!0;if(nm(g,P))return gn(g),!0;if(Dn[P]||!(Gt.tagCheck instanceof Function&&Gt.tagCheck(P))&&!we[P]){const W=rm(g,P);return W===!1&&Vt(ye.afterSanitizeElements,g,null),W}if((T?T(g):g.nodeType)===mt.element&&!Qp(g)||(P==="noscript"||P==="noembed"||P==="noframes")&&Ge(Kb,g.innerHTML))return gn(g),!0;if(pn&&g.nodeType===mt.text){const W=ei(g.textContent);g.textContent!==W&&(gr(e.removed,{element:g.cloneNode()}),g.textContent=W)}return Vt(ye.afterSanitizeElements,g,null),!1},Tc=function(g,w,P){if(Zr[w]||mn&&w==="patchsrc"||mn&&w==="for"&&g!=="label"&&g!=="output"||hc&&(w==="id"||w==="name")&&(P in n||P in Xp))return!1;const B=pe[w]||Gt.attributeCheck instanceof Function&&Gt.attributeCheck(w,g);if(!(go&&Ge(ir,w))){if(!(mo&&Ge($n,w))){if(B){if(!So[w]){if(!Ge(Nn,ts(P,Gr,""))){if(!((w==="src"||w==="xlink:href"||w==="href")&&g!=="script"&&eh(P,"data:")===0&&pc[g])){if(!(cc&&!Ge(Ys,ts(P,Gr,"")))){if(P)return!1}}}}}else if(!(Ac(g)&&(me.tagNameCheck instanceof RegExp&&Ge(me.tagNameCheck,g)||me.tagNameCheck instanceof Function&&me.tagNameCheck(g))&&(me.attributeNameCheck instanceof RegExp&&Ge(me.attributeNameCheck,w)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(w,g))||w==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&Ge(me.tagNameCheck,P)||me.tagNameCheck instanceof Function&&me.tagNameCheck(P))))return!1}}return!0},sm=ae({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ac=function(g){return!sm[us(g)]&&Ge(or,g)},im=function(g,w,P,B){if(A&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!P)switch(h.getAttributeType(g,w)){case"TrustedHTML":return oe(B);case"TrustedScriptURL":return ke(B)}return B},om=function(g,w,P,B){try{P?g.setAttributeNS(P,w,B):g.setAttribute(w,B),ti(g)?gn(g):Ku(e.removed)}catch{Fn(w,g)}},Cc=function(g){Vt(ye.beforeSanitizeAttributes,g,null);const w=g.attributes;if(!w||ti(g))return;const P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pe,forceKeepAttr:void 0};let B=w.length;const W=Me(g.nodeName);for(;B--;){const K=w[B],ze=K.name,qe=K.namespaceURI,Et=K.value,ct=Me(ze),It=Et;let rt=ze==="value"?It:Ob(It);if(P.attrName=ct,P.attrValue=rt,P.keepAttr=!0,P.forceKeepAttr=void 0,Vt(ye.uponSanitizeAttribute,g,P),rt=P.attrValue,dc&&(ct==="id"||ct==="name")&&eh(rt,fc)!==0&&(Fn(ze,g),rt=fc+rt),mn&&Ge(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,rt)){Fn(ze,g);continue}if(ct==="attributename"&&Qu(rt,"href")){Fn(ze,g);continue}if(!P.forceKeepAttr){if(!P.keepAttr){Fn(ze,g);continue}if(!uc&&Ge(Qb,rt)){Fn(ze,g);continue}if(pn&&(rt=ei(rt)),!Tc(W,ct,rt)){Fn(ze,g);continue}rt=im(W,ct,qe,rt),rt!==It&&om(g,ze,qe,rt)}}Vt(ye.afterSanitizeAttributes,g,null)},ni=function(g){let w=null;const P=kc(g);for(Vt(ye.beforeSanitizeShadowDOM,g,null);w=P.nextNode();)if(Vt(ye.uponSanitizeShadowNode,w,null),Sc(w,g),Cc(w),hr(w.content)&&ni(w.content),(T?T(w):w.nodeType)===mt.element){const W=b(w);hr(W)&&(Ro(W),ni(W))}Vt(ye.afterSanitizeShadowDOM,g,null)},Ro=function(g){const w=[{node:g,shadow:null}];for(;w.length>0;){const P=w.pop();if(P.shadow){ni(P.shadow);continue}const B=P.node,K=(T?T(B):B.nodeType)===mt.element,ze=_(B);if(ze)for(let qe=ze.length-1;qe>=0;--qe)w.push({node:ze[qe],shadow:null});if(K){const qe=I?I(B):null;if(typeof qe=="string"&&Me(qe)==="template"){const Et=B.content;hr(Et)&&w.push({node:Et,shadow:null})}}if(K){const qe=b(B);hr(qe)&&w.push({node:null,shadow:qe},{node:qe,shadow:null})}}};return e.sanitize=function(z){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,P=null,B=null,W=null;if(To=!z,To&&(z="<!-->"),typeof z!="string"&&!Vr(z)&&(z=Fb(z),typeof z!="string"))throw Gn("dirty is not a string, aborting");if(!e.isSupported)return z;_o?(we=yo,pe=xo):Io(g),(ye.uponSanitizeElement.length>0||ye.uponSanitizeAttribute.length>0)&&(we=it(we)),ye.uponSanitizeAttribute.length>0&&(pe=it(pe)),e.removed=[];const K=wo&&typeof z!="string"&&Vr(z);if(K){tm(z);const ct=I?I(z):z.nodeName;if(typeof ct=="string"){const It=Me(ct);if(!we[It]||Dn[It])throw Qs(z),Gn("root node is forbidden and cannot be sanitized in-place")}if(ti(z))throw Qs(z),Gn("root node is clobbered and cannot be sanitized in-place");try{Ro(z)}catch(It){throw Qs(z),It}}else if(Vr(z))w=wc("<!---->"),P=w.ownerDocument.importNode(z,!0),P.nodeType===mt.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?w=P:w.appendChild(P),Ro(P);else{if(!ar&&!pn&&!Ln&&z.indexOf("<")===-1)return A&&qs?oe(z):z;if(w=wc(z),!w)return ar?null:qs?E:""}w&&bo&&gn(w.firstChild);const ze=K?z:w,qe=kc(ze);try{for(;B=qe.nextNode();)Sc(B,ze),Cc(B),hr(B.content)&&ni(B.content)}catch(ct){throw K&&(Qs(z),mr(e.removed,It=>{It.element&&Po(It.element)})),ct}if(K)return mr(e.removed,ct=>{ct.element&&Po(ct.element)}),pn&&Mo(z),z;if(ar){if(pn&&Mo(w),Xs)for(W=Rn.call(w.ownerDocument);w.firstChild;)W.appendChild(w.firstChild);else W=w;return(pe.shadowroot||pe.shadowrootmode)&&(W=Ft.call(r,W,!0)),W}let Et=Ln?w.outerHTML:w.innerHTML;return Ln&&we["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&Ge(qb,w.ownerDocument.doctype.name)&&(Et="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
|
|
241
|
+
`+Et),pn&&(Et=ei(Et)),A&&qs?oe(Et):Et},e.setConfig=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Io(z),_o=!0,yo=we,xo=pe},e.clearConfig=function(){ur=null,_o=!1,yo=null,xo=null,A=V,E=""},e.isValidAttribute=function(z,g,w){ur||Io({});const P=Me(z),B=Me(g);return Tc(P,B,w)},e.addHook=function(z,g){typeof g=="function"&&Ze(ye,z)&&gr(ye[z],g)},e.removeHook=function(z,g){if(Ze(ye,z)){if(g!==void 0){const w=Rb(ye[z],g);return w===-1?void 0:zb(ye[z],w,1)[0]}return Ku(ye[z])}},e.removeHooks=function(z){Ze(ye,z)&&(ye[z]=[])},e.removeAllHooks=function(){ye=uh()},e}Pf();function Dl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rr=Dl();function Mf(t){rr=t}var Yn={exec:()=>null};function ue(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 n0=(()=>{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)}}>`)},r0=/^(?:[ \t]*(?:\n|$))+/,s0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,i0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,o0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ll=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Rf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,zf=ue(Rf).replace(/bull/g,Ll).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(),a0=ue(Rf).replace(/bull/g,Ll).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(),Fl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,l0=/^[^\n]+/,Bl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,c0=ue(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Bl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),u0=ue(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ll).getRegex(),so="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",Ul=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,h0=ue("^ {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",Ul).replace("tag",so).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Of=ue(Fl).replace("hr",Vs).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",so).getRegex(),d0=ue(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Of).getRegex(),Gl={blockquote:d0,code:s0,def:c0,fences:i0,heading:o0,hr:Vs,html:h0,lheading:zf,list:u0,newline:r0,paragraph:Of,table:Yn,text:l0},hh=ue("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vs).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",so).getRegex(),f0={...Gl,lheading:a0,table:hh,paragraph:ue(Fl).replace("hr",Vs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",hh).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",so).getRegex()},p0={...Gl,html:ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ul).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:Yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ue(Fl).replace("hr",Vs).replace("heading",` *#{1,6} *[^
|
|
242
|
+
]`).replace("lheading",zf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},m0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,g0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$f=/^( {2,}|\\)\n(?!\s*$)/,_0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fr=/[\p{P}\p{S}]/u,io=/[\s\p{P}\p{S}]/u,Zl=/[^\s\p{P}\p{S}]/u,y0=ue(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,io).getRegex(),Nf=/(?!~)[\p{P}\p{S}]/u,x0=/(?!~)[\s\p{P}\p{S}]/u,b0=/(?:[^\s\p{P}\p{S}]|~)/u,v0=ue(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",n0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Df=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,w0=ue(Df,"u").replace(/punct/g,Fr).getRegex(),k0=ue(Df,"u").replace(/punct/g,Nf).getRegex(),Lf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",S0=ue(Lf,"gu").replace(/notPunctSpace/g,Zl).replace(/punctSpace/g,io).replace(/punct/g,Fr).getRegex(),T0=ue(Lf,"gu").replace(/notPunctSpace/g,b0).replace(/punctSpace/g,x0).replace(/punct/g,Nf).getRegex(),A0=ue("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zl).replace(/punctSpace/g,io).replace(/punct/g,Fr).getRegex(),C0=ue(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fr).getRegex(),E0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",I0=ue(E0,"gu").replace(/notPunctSpace/g,Zl).replace(/punctSpace/g,io).replace(/punct/g,Fr).getRegex(),P0=ue(/\\(punct)/,"gu").replace(/punct/g,Fr).getRegex(),M0=ue(/^<(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(),R0=ue(Ul).replace("(?:-->|$)","-->").getRegex(),z0=ue("^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",R0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ji=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,O0=ue(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ji).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ff=ue(/^!?\[(label)\]\[(ref)\]/).replace("label",ji).replace("ref",Bl).getRegex(),Bf=ue(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bl).getRegex(),$0=ue("reflink|nolink(?!\\()","g").replace("reflink",Ff).replace("nolink",Bf).getRegex(),dh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jl={_backpedal:Yn,anyPunctuation:P0,autolink:M0,blockSkip:v0,br:$f,code:g0,del:Yn,delLDelim:Yn,delRDelim:Yn,emStrongLDelim:w0,emStrongRDelimAst:S0,emStrongRDelimUnd:A0,escape:m0,link:O0,nolink:Bf,punctuation:y0,reflink:Ff,reflinkSearch:$0,tag:z0,text:_0,url:Yn},N0={...jl,link:ue(/^!?\[(label)\]\((.*?)\)/).replace("label",ji).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ji).getRegex()},ll={...jl,emStrongRDelimAst:T0,emStrongLDelim:k0,delLDelim:C0,delRDelim:I0,url:ue(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dh).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:ue(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",dh).getRegex()},D0={...ll,br:ue($f).replace("{2,}","*").getRegex(),text:ue(ll.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},gi={normal:Gl,gfm:f0,pedantic:p0},rs={normal:jl,gfm:ll,breaks:D0,pedantic:N0},L0={"&":"&","<":"<",">":">",'"':""","'":"'"},fh=t=>L0[t];function Xt(t,e){if(e){if(at.escapeTest.test(t))return t.replace(at.escapeReplace,fh)}else if(at.escapeTestNoEncode.test(t))return t.replace(at.escapeReplaceNoEncode,fh);return t}function ph(t){try{t=encodeURI(t).replace(at.percentDecode,"%")}catch{return null}return t}function mh(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 ss(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 F0(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 B0(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 gh(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 U0(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 Vi=class{constructor(t){se(this,"options");se(this,"rules");se(this,"lexer");this.options=t||rr}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:ss(n,`
|
|
245
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=U0(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=ss(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:ss(e[0],`
|
|
246
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=ss(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,16 +254,16 @@ ${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=B0(e[2].split(`
|
|
258
258
|
`,1)[0],e[1].length),m=t.split(`
|
|
259
|
-
`,1)[0],y=!d.trim(),
|
|
260
|
-
`,t=t.substring(m.length+1),u=!0),!u){let x=this.rules.other.nextBulletRegex(
|
|
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)>=
|
|
262
|
-
`+V.slice(
|
|
259
|
+
`,1)[0],y=!d.trim(),_=0;if(this.options.pedantic?(_=2,f=d.trimStart()):y?_=e[1].length+1:(_=d.search(this.rules.other.nonSpaceChar),_=_>4?1:_,f=d.slice(_),_+=e[1].length),y&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
260
|
+
`,t=t.substring(m.length+1),u=!0),!u){let x=this.rules.other.nextBulletRegex(_),b=this.rules.other.hrRegex(_),S=this.rules.other.fencesBeginRegex(_),T=this.rules.other.headingBeginRegex(_),I=this.rules.other.htmlBeginRegex(_),A=this.rules.other.blockquoteBeginRegex(_);for(;t;){let E=t.split(`
|
|
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)>=_||!m.trim())f+=`
|
|
262
|
+
`+V.slice(_);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=V.slice(
|
|
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=
|
|
264
|
+
`,t=t.substring(E.length+1),d=V.slice(_)}}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=mh(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(mh(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=ss(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=F0(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)),gh(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 gh(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}}}},zt=class cl{constructor(e){se(this,"tokens");se(this,"options");se(this,"state");se(this,"inlineQueue");se(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rr,this.options.tokenizer=this.options.tokenizer||new Vi,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:gi.normal,inline:rs.normal};this.options.pedantic?(n.block=gi.pedantic,n.inline=rs.pedantic):this.options.gfm&&(n.block=gi.gfm,this.options.breaks?n.inline=rs.breaks:n.inline=rs.gfm),this.tokenizer.rules=n}static get rules(){return{block:gi,inline:rs}}static lex(e,n){return new cl(n).lex(e)}static lexInline(e,n){return new cl(n).inlineTokens(e)}lex(e){e=e.replace(at.carriageReturn,`
|
|
267
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
|
`)?"":`
|
|
@@ -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,
|
|
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,_=e.slice(1),x;this.options.extensions.startInline.forEach(b=>{x=b.call({lexer:this},_),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}},Hi=class{constructor(t){se(this,"options");se(this,"parser");this.options=t||rr}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-'+Xt(r)+'">'+(n?s:Xt(s,!0))+`</code></pre>
|
|
282
|
+
`:"<pre><code>"+(n?s:Xt(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>"+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(`
|
|
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>${Xt(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=ph(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+Xt(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=ph(t);if(s===null)return Xt(n);t=s;let i=`<img src="${t}" alt="${Xt(n)}"`;return e&&(i+=` title="${Xt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Xt(t.text)}},Vl=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}},Ot=class ul{constructor(e){se(this,"options");se(this,"renderer");se(this,"textRenderer");this.options=e||rr,this.options.renderer=this.options.renderer||new Hi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vl}static parse(e,n){return new ul(n).parse(e)}static parseInline(e,n){return new ul(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}},wi,hs=(wi=class{constructor(t){se(this,"options");se(this,"block");this.options=t||rr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?zt.lex:zt.lexInline}provideParser(t=this.block){return t?Ot.parse:Ot.parseInline}},se(wi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),se(wi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wi),G0=class{constructor(...t){se(this,"defaults",Dl());se(this,"options",this.setOptions);se(this,"parse",this.parseMarkdown(!0));se(this,"parseInline",this.parseMarkdown(!1));se(this,"Parser",Ot);se(this,"Renderer",Hi);se(this,"TextRenderer",Vl);se(this,"Lexer",zt);se(this,"Tokenizer",Vi);se(this,"Hooks",hs);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 Hi(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 Vi(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 hs;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];hs.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&hs.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 zt.lex(t,e??this.defaults)}parser(t,e){return Ot.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?zt.lex:zt.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?Ot.parse:Ot.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?zt.lex:zt.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?Ot.parse:Ot.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>"+Xt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},nr=new G0;function _e(t,e){return nr.parse(t,e)}_e.options=_e.setOptions=function(t){return nr.setOptions(t),_e.defaults=nr.defaults,Mf(_e.defaults),_e};_e.getDefaults=Dl;_e.defaults=rr;_e.use=function(...t){return nr.use(...t),_e.defaults=nr.defaults,Mf(_e.defaults),_e};_e.walkTokens=function(t,e){return nr.walkTokens(t,e)};_e.parseInline=nr.parseInline;_e.Parser=Ot;_e.parser=Ot.parse;_e.Renderer=Hi;_e.TextRenderer=Vl;_e.Lexer=zt;_e.lexer=zt.lex;_e.Tokenizer=Vi;_e.Hooks=hs;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Ot.parse;zt.lex;_e.setOptions({gfm:!0,breaks:!0,async:!1});const Z0="agent-play-preview-chat-display-v1",Uf={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function pa(t,e,n){return Math.min(n,Math.max(e,t))}function j0(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 _h={...Uf};function V0(t){return{fontSizePx:pa(Math.round(t.fontSizePx),5,18),panelWidthPx:pa(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:pa(Math.round(t.scrollMaxHeightPx),24,200)}}function H0(){const t=j0(typeof localStorage<"u"?localStorage.getItem(Z0):null),e={...Uf,...t};return _h=V0(e),{..._h}}typeof localStorage<"u"&&H0();var _i={exports:{}},ma,yh;function W0(){if(yh)return ma;yh=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;ma=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 ma}var ga,xh;function Y0(){if(xh)return ga;xh=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=W0(),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 _(...x){if(!_.enabled)return;const b=_,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 X=r.formatters[V];if(typeof X=="function"){const $=x[I];E=X.call(b,$),x.splice(I,1),I--}return E}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return _.namespace=h,_.useColors=r.useColors(),_.color=r.selectColor(h),_.extend=s,_.destroy=r.destroy,Object.defineProperty(_,"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(_),_}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,_=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(y=m,_=d,m++):(d++,m++);else if(y!==-1)m=y+1,_++,d=_;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 ga=t,ga}var bh;function X0(){return bh||(bh=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=Y0()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(_i,_i.exports)),_i.exports}var q0=X0();const J0=nd(q0);function K0(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function Q0(){try{if(typeof Wh=="function")return Wh()}catch{}return K0()}function Gf(){try{const t=xa==null?void 0:xa();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function hl(t){const e=Gf();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Zf={get disabled(){return Q0()||Gf().NODE_ENV==="test"?!0:hl("OPENAI_AGENTS_DISABLE_TRACING")}},vh={get dontLogModelData(){return hl("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return hl("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Hl(t="openai-agents"){return{namespace:t,debug:J0(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return vh.dontLogModelData},get dontLogToolData(){return vh.dontLogToolData}}}const Te=Hl("openai-agents:core");var wh;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 Ar extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class jf extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(wh=globalThis).__zod_globalConfig??(wh.__zod_globalConfig={});const Wl=globalThis.__zod_globalConfig;function dn(t){return Wl}function Vf(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 dl(t,e){return typeof e=="bigint"?e.toString():e}function oo(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Yl(t){return t==null}function Xl(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function ev(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 kh=Symbol("evaluating");function le(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==kh)return r===void 0&&(r=kh,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function sr(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pn(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function Sh(t){return JSON.stringify(t)}function tv(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Hf="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Es(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const nv=oo(()=>{var t;if(Wl.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 Nr(t){if(Es(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Es(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Wf(t){return Nr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const rv=new Set(["string","number","symbol"]);function Dr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mn(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 sv(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const iv={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 ov(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=Pn(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 sr(this,"shape",o),o},checks:[]});return Mn(t,i)}function av(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=Pn(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 sr(this,"shape",o),o},checks:[]});return Mn(t,i)}function lv(t,e){if(!Nr(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=Pn(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return sr(this,"shape",i),i}});return Mn(t,s)}function cv(t,e){if(!Nr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Pn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return sr(this,"shape",r),r}});return Mn(t,n)}function uv(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=Pn(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e._zod.def.shape};return sr(this,"shape",s),s},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Mn(t,n)}function hv(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=Pn(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 sr(this,"shape",l),l},checks:[]});return Mn(e,o)}function dv(t,e,n){const r=Pn(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 sr(this,"shape",i),i}});return Mn(e,r)}function Sr(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 fv(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 Tr(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function yi(t){return typeof t=="string"?t:t==null?void 0:t.message}function fn(t,e,n){var l,c,u,h,f,d;const r=t.message?t.message:yi((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??yi((h=e==null?void 0:e.error)==null?void 0:h.call(e,t))??yi((f=n.customError)==null?void 0:f.call(n,t))??yi((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 ql(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Is(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Yf=(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,dl,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Xf=C("$ZodError",Yf),qf=C("$ZodError",Yf,{Parent:Error});function pv(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 mv(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 Jl=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 Ar;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>fn(l,i,dn())));throw Hf(a,s==null?void 0:s.callee),a}return o.value},Kl=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=>fn(l,i,dn())));throw Hf(a,s==null?void 0:s.callee),a}return o.value},ao=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 Ar;return i.issues.length?{success:!1,error:new(t??Xf)(i.issues.map(o=>fn(o,s,dn())))}:{success:!0,data:i.value}},gv=ao(qf),lo=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=>fn(o,s,dn())))}:{success:!0,data:i.value}},_v=lo(qf),yv=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Jl(t)(e,n,s)},xv=t=>(e,n,r)=>Jl(t)(e,n,r),bv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Kl(t)(e,n,s)},vv=t=>async(e,n,r)=>Kl(t)(e,n,r),wv=t=>(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return ao(t)(e,n,s)},kv=t=>(e,n,r)=>ao(t)(e,n,r),Sv=t=>async(e,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return lo(t)(e,n,s)},Tv=t=>async(e,n,r)=>lo(t)(e,n,r),Av=/^[cC][0-9a-z]{6,}$/,Cv=/^[0-9a-z]+$/,Ev=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Iv=/^[0-9a-vA-V]{20}$/,Pv=/^[A-Za-z0-9]{27}$/,Mv=/^[a-zA-Z0-9_-]{21}$/,Rv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zv=/^([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})$/,Th=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)$/,Ov=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$v="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nv(){return new RegExp($v,"u")}const Dv=/^(?:(?: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])$/,Lv=/^(([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}|:))$/,Fv=/^((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])$/,Bv=/^(([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])$/,Uv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jf=/^[A-Za-z0-9_-]*$/,Gv=/^https?$/,Zv=/^\+[1-9]\d{6,14}$/,Kf="(?:(?:\\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])))",jv=new RegExp(`^${Kf}$`);function Qf(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 Vv(t){return new RegExp(`^${Qf(t)}$`)}function Hv(t){const e=Qf({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(`^${Kf}T(?:${r})$`)}const Wv=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}$`)},Yv=/^-?\d+$/,ep=/^-?\d+(?:\.\d+)?$/,Xv=/^(?:true|false)$/i,qv=/^[^A-Z]*$/,Jv=/^[^a-z]*$/,ft=C("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),tp={number:"number",bigint:"bigint",object:"date"},np=C("$ZodCheckLessThan",(t,e)=>{ft.init(t,e);const n=tp[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})}}),rp=C("$ZodCheckGreaterThan",(t,e)=>{ft.init(t,e);const n=tp[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})}}),Kv=C("$ZodCheckMultipleOf",(t,e)=>{ft.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):ev(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})}}),Qv=C("$ZodCheckNumberFormat",(t,e)=>{var o;ft.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]=iv[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=Yv)}),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})}}),ew=C("$ZodCheckMaxLength",(t,e)=>{var n;ft.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Yl(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=ql(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),tw=C("$ZodCheckMinLength",(t,e)=>{var n;ft.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Yl(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=ql(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),nw=C("$ZodCheckLengthEquals",(t,e)=>{var n;ft.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Yl(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=ql(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})}}),co=C("$ZodCheckStringFormat",(t,e)=>{var n,r;ft.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=()=>{})}),rw=C("$ZodCheckRegex",(t,e)=>{co.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})}}),sw=C("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=qv),co.init(t,e)}),iw=C("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Jv),co.init(t,e)}),ow=C("$ZodCheckIncludes",(t,e)=>{ft.init(t,e);const n=Dr(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})}}),aw=C("$ZodCheckStartsWith",(t,e)=>{ft.init(t,e);const n=new RegExp(`^${Dr(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})}}),lw=C("$ZodCheckEndsWith",(t,e)=>{ft.init(t,e);const n=new RegExp(`.*${Dr(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})}}),cw=C("$ZodCheckOverwrite",(t,e)=>{ft.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class uw{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 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(`
|
|
301
|
+
`))}}const hw={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=hw;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=Sr(a),h;for(const f of l){if(f._zod.def.when){if(fv(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 Ar;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=Sr(a,d)))});else{if(a.issues.length===d)continue;u||(u=Sr(a,d))}}return h?h.then(()=>a):a},o=(a,l,c)=>{if(Sr(a))return a.aborted=!0,a;const u=i(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Ar;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 Ar;return c.then(u=>i(u,r,l))}return i(c,r,l)}}le(t,"~standard",()=>({validate:i=>{var o;try{const a=gv(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return _v(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}))}),Ql=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()??Wv(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)=>{co.init(t,e),Ql.init(t,e)}),dw=C("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=zv),Pe.init(t,e)}),fw=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=Th(r))}else e.pattern??(e.pattern=Th());Pe.init(t,e)}),pw=C("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ov),Pe.init(t,e)}),mw=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)===Gv.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})}}}),gw=C("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Nv()),Pe.init(t,e)}),_w=C("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Mv),Pe.init(t,e)}),yw=C("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Av),Pe.init(t,e)}),xw=C("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Cv),Pe.init(t,e)}),bw=C("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ev),Pe.init(t,e)}),vw=C("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Iv),Pe.init(t,e)}),ww=C("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Pv),Pe.init(t,e)}),kw=C("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Hv(e)),Pe.init(t,e)}),Sw=C("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=jv),Pe.init(t,e)}),Tw=C("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Vv(e)),Pe.init(t,e)}),Aw=C("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Rv),Pe.init(t,e)}),Cw=C("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Dv),Pe.init(t,e),t._zod.bag.format="ipv4"}),Ew=C("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Lv),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})}}}),Iw=C("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Fv),Pe.init(t,e)}),Pw=C("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Bv),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 sp(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Mw=C("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Uv),Pe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{sp(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Rw(t){if(!Jf.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return sp(n)}const zw=C("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Jf),Pe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Rw(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Ow=C("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Zv),Pe.init(t,e)});function $w(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 Nw=C("$ZodJWT",(t,e)=>{Pe.init(t,e),t._zod.check=n=>{$w(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),ip=C("$ZodNumber",(t,e)=>{Ee.init(t,e),t._zod.pattern=t._zod.bag.pattern??ep,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}}),Dw=C("$ZodNumberFormat",(t,e)=>{Qv.init(t,e),ip.init(t,e)}),Lw=C("$ZodBoolean",(t,e)=>{Ee.init(t,e),t._zod.pattern=Xv,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}}),Fw=C("$ZodAny",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),Bw=C("$ZodUnknown",(t,e)=>{Ee.init(t,e),t._zod.parse=n=>n}),Uw=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 Ah(t,e,n){t.issues.length&&e.issues.push(...Tr(n,t.issues)),e.value[n]=t.value}const Gw=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=>Ah(c,n,o))):Ah(l,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function Wi(t,e,n,r,s,i){const o=n in r;if(t.issues.length){if(s&&i&&!o)return;e.issues.push(...Tr(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 op(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=sv(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function ap(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=>Wi(m,n,f,e,u,h))):Wi(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 Zw=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=oo(()=>op(e));le(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=Es,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",_=d._zod.run({value:c[f],issues:[]},l);_ instanceof Promise?u.push(_.then(x=>Wi(x,a,f,c,m,y))):Wi(_,a,f,c,m,y)}return i?ap(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),jw=C("$ZodObjectJIT",(t,e)=>{Zw.init(t,e);const n=t._zod.parse,r=oo(()=>op(e)),s=f=>{var S,T;const d=new uw(["shape","payload","ctx"]),m=r.value,y=I=>{const A=Sh(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};d.write("const input = payload.value;");const _=Object.create(null);let x=0;for(const I of m.keys)_[I]=`key_${x++}`;d.write("const newResult = {};");for(const I of m.keys){const A=_[I],E=Sh(I),V=f[I],X=((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)};`),X&&$?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 => ({
|
|
@@ -316,7 +316,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
316
316
|
newResult[${E}] = ${A}.value;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
`):
|
|
319
|
+
`):X?d.write(`
|
|
320
320
|
if (${A}.issues.length) {
|
|
321
321
|
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
322
322
|
...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=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>
|
|
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=Es,a=!Wl.jitless,c=a&&nv.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?ap([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function Ch(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=>!Sr(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=>fn(o,r,dn())))}),e)}const lp=C("$ZodUnion",(t,e)=>{Ee.init(t,e),le(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),le(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),le(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),le(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=>Xl(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=>Ch(a,r,t,s)):Ch(o,r,t,s)}}),Vw=C("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,lp.init(t,e);const n=t._zod.parse;le(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=oo(()=>{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(!Es(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)}}),Hw=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])=>Eh(n,l,c)):Eh(n,i,o)}});function fl(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(Nr(t)&&Nr(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=fl(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=fl(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 Eh(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}),Sr(t))return t;const o=fl(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 Ww=C("$ZodRecord",(t,e)=>{Ee.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!Nr(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=>fn(d,r,dn())),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(...Tr(c,d.issues)),n.value[h]=d.value})):(f.issues.length&&n.issues.push(...Tr(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"&&ep.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=>fn(h,r,dn())),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(...Tr(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...Tr(a,u.issues)),n.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Yw=C("$ZodEnum",(t,e)=>{Ee.init(t,e);const n=Vf(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>rv.has(typeof s)).map(s=>typeof s=="string"?Dr(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}}),Xw=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"?Dr(r):r?Dr(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}}),qw=C("$ZodTransform",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new jf(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 Ar;return n.value=s,n.fallback=!0,n}});function Ih(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const cp=C("$ZodOptional",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",t._zod.optout="optional",le(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),le(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Xl(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=>Ih(o,s)):Ih(i,s)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Jw=C("$ZodExactOptional",(t,e)=>{cp.init(t,e),le(t._zod,"values",()=>e.innerType._zod.values),le(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Kw=C("$ZodNullable",(t,e)=>{Ee.init(t,e),le(t._zod,"optin",()=>e.innerType._zod.optin),le(t._zod,"optout",()=>e.innerType._zod.optout),le(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Xl(n.source)}|null)$`):void 0}),le(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)}),Qw=C("$ZodDefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",le(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=>Ph(i,e)):Ph(s,e)}});function Ph(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const ek=C("$ZodPrefault",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",le(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))}),tk=C("$ZodNonOptional",(t,e)=>{Ee.init(t,e),le(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=>Mh(i,t)):Mh(s,t)}});function Mh(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 nk=C("$ZodCatch",(t,e)=>{Ee.init(t,e),t._zod.optin="optional",le(t._zod,"optout",()=>e.innerType._zod.optout),le(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=>fn(o,r,dn()))},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=>fn(i,r,dn()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),rk=C("$ZodPipe",(t,e)=>{Ee.init(t,e),le(t._zod,"values",()=>e.in._zod.values),le(t._zod,"optin",()=>e.in._zod.optin),le(t._zod,"optout",()=>e.out._zod.optout),le(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=>xi(o,e.in,r)):xi(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>xi(i,e.out,r)):xi(s,e.out,r)}});function xi(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 sk=C("$ZodReadonly",(t,e)=>{Ee.init(t,e),le(t._zod,"propValues",()=>e.innerType._zod.propValues),le(t._zod,"values",()=>e.innerType._zod.values),le(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),le(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(Rh):Rh(s)}});function Rh(t){return t.value=Object.freeze(t.value),t}const ik=C("$ZodLazy",(t,e)=>{Ee.init(t,e),le(t._zod,"innerType",()=>{const n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),le(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),le(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),le(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),le(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)}),ok=C("$ZodCustom",(t,e)=>{ft.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=>zh(i,n,r,t));zh(s,n,r,t)}});function zh(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(Is(s))}}var Oh;class ak{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 lk(){return new ak}(Oh=globalThis).__zod_globalRegistry??(Oh.__zod_globalRegistry=lk());const ds=globalThis.__zod_globalRegistry;function ck(t,e){return new t({type:"string",...Z(e)})}function uk(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Z(e)})}function $h(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Z(e)})}function hk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(e)})}function dk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(e)})}function fk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(e)})}function pk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(e)})}function mk(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Z(e)})}function gk(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(e)})}function _k(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(e)})}function yk(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(e)})}function xk(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(e)})}function bk(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(e)})}function vk(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Z(e)})}function wk(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(e)})}function kk(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(e)})}function Sk(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(e)})}function Tk(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(e)})}function Ak(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(e)})}function Ck(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Z(e)})}function Ek(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(e)})}function Ik(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Z(e)})}function Pk(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(e)})}function Mk(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(e)})}function Rk(t,e){return new t({type:"string",format:"date",check:"string_format",...Z(e)})}function zk(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Z(e)})}function Ok(t,e){return new t({type:"string",format:"duration",check:"string_format",...Z(e)})}function $k(t,e){return new t({type:"number",checks:[],...Z(e)})}function Nk(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(e)})}function Dk(t,e){return new t({type:"boolean",...Z(e)})}function Lk(t){return new t({type:"any"})}function Fk(t){return new t({type:"unknown"})}function Bk(t,e){return new t({type:"never",...Z(e)})}function Nh(t,e){return new np({check:"less_than",...Z(e),value:t,inclusive:!1})}function _a(t,e){return new np({check:"less_than",...Z(e),value:t,inclusive:!0})}function Dh(t,e){return new rp({check:"greater_than",...Z(e),value:t,inclusive:!1})}function ya(t,e){return new rp({check:"greater_than",...Z(e),value:t,inclusive:!0})}function Lh(t,e){return new Kv({check:"multiple_of",...Z(e),value:t})}function up(t,e){return new ew({check:"max_length",...Z(e),maximum:t})}function Yi(t,e){return new tw({check:"min_length",...Z(e),minimum:t})}function hp(t,e){return new nw({check:"length_equals",...Z(e),length:t})}function Uk(t,e){return new rw({check:"string_format",format:"regex",...Z(e),pattern:t})}function Gk(t){return new sw({check:"string_format",format:"lowercase",...Z(t)})}function Zk(t){return new iw({check:"string_format",format:"uppercase",...Z(t)})}function jk(t,e){return new ow({check:"string_format",format:"includes",...Z(e),includes:t})}function Vk(t,e){return new aw({check:"string_format",format:"starts_with",...Z(e),prefix:t})}function Hk(t,e){return new lw({check:"string_format",format:"ends_with",...Z(e),suffix:t})}function Br(t){return new cw({check:"overwrite",tx:t})}function Wk(t){return Br(e=>e.normalize(t))}function Yk(){return Br(t=>t.trim())}function Xk(){return Br(t=>t.toLowerCase())}function qk(){return Br(t=>t.toUpperCase())}function Jk(){return Br(t=>tv(t))}function Kk(t,e,n){return new t({type:"array",element:e,...Z(n)})}function Qk(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Z(n)})}function eS(t,e){const n=tS(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(Is(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(Is(i))}},t(r.value,r)),e);return n}function tS(t,e){const n=new ft({check:"custom",...Z(e)});return n._zod.check=t,n}function dp(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)??ds,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 Ne(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),Ne(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 fp(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 _=(y=t.external.registry.get(u[0]))==null?void 0:y.id,x=t.external.uri??(S=>S);if(_)return{ref:x(_)};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 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};
|
|
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 pp(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 _=h._zod.parent;if(_&&_!==y){r(_);const x=t.seen.get(_);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:Xi(e,"input",t.processors),output:Xi(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 nS=(t,e={})=>n=>{const r=dp({...n,processors:e});return Ne(t,r),fp(r,t),pp(r,t)},Xi=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=dp({...s??{},target:i,io:e,processors:n});return Ne(t,o),fp(o,t),pp(o,t)},rS={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sS=(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=rS[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}))])}},iS=(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)},oS=(t,e,n,r)=>{n.type="boolean"},aS=(t,e,n,r)=>{n.not={}},lS=(t,e,n,r)=>{},cS=(t,e,n,r)=>{},uS=(t,e,n,r)=>{const s=t._zod.def,i=Vf(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},hS=(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},dS=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fS=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},pS=(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=Ne(i.element,e,{...r,path:[...r.path,"items"]})},mS=(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]=Ne(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=Ne(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},gS=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>Ne(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},_S=(t,e,n,r)=>{const s=t._zod.def,i=Ne(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ne(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},yS=(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=Ne(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=Ne(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Ne(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)}},xS=(t,e,n,r)=>{const s=t._zod.def,i=Ne(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"}]},bS=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},vS=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},wS=(t,e,n,r)=>{const s=t._zod.def;Ne(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)))},kS=(t,e,n,r)=>{const s=t._zod.def;Ne(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},SS=(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;Ne(o,e,r);const a=e.seen.get(t);a.ref=o},TS=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},mp=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},AS=(t,e,n,r)=>{const s=t._zod.innerType;Ne(s,e,r);const i=e.seen.get(t);i.ref=s},CS=C("ZodISODateTime",(t,e)=>{kw.init(t,e),Re.init(t,e)});function ES(t){return Mk(CS,t)}const IS=C("ZodISODate",(t,e)=>{Sw.init(t,e),Re.init(t,e)});function PS(t){return Rk(IS,t)}const MS=C("ZodISOTime",(t,e)=>{Tw.init(t,e),Re.init(t,e)});function RS(t){return zk(MS,t)}const zS=C("ZodISODuration",(t,e)=>{Aw.init(t,e),Re.init(t,e)});function OS(t){return Ok(zS,t)}const $S=(t,e)=>{Xf.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>mv(t,n)},flatten:{value:n=>pv(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,dl,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,dl,2)}},isEmpty:{get(){return t.issues.length===0}}})},At=C("ZodError",$S,{Parent:Error}),NS=Jl(At),DS=Kl(At),LS=ao(At),FS=lo(At),BS=yv(At),US=xv(At),GS=bv(At),ZS=vv(At),jS=wv(At),VS=kv(At),HS=Sv(At),WS=Tv(At),Fh=new WeakMap;function Hs(t,e,n){const r=Object.getPrototypeOf(t);let s=Fh.get(r);if(s||(s=new Set,Fh.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:Xi(t,"input"),output:Xi(t,"output")}}),t.toJSONSchema=nS(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>NS(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>LS(t,n,r),t.parseAsync=async(n,r)=>DS(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>FS(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>BS(t,n,r),t.decode=(n,r)=>US(t,n,r),t.encodeAsync=async(n,r)=>GS(t,n,r),t.decodeAsync=async(n,r)=>ZS(t,n,r),t.safeEncode=(n,r)=>jS(t,n,r),t.safeDecode=(n,r)=>VS(t,n,r),t.safeEncodeAsync=async(n,r)=>HS(t,n,r),t.safeDecodeAsync=async(n,r)=>WS(t,n,r),Hs(t,"ZodType",{check(...n){const r=this.def;return this.clone(Pn(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 Mn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(UT(n,r))},superRefine(n,r){return this.check(GT(n,r))},overwrite(n){return this.check(Br(n))},optional(){return Zh(this)},exactOptional(){return CT(this)},nullable(){return jh(this)},nullish(){return Zh(jh(this))},nonoptional(n){return zT(this,n)},array(){return Y(this)},or(n){return Nt([this,n])},and(n){return wT(this,n)},transform(n){return Vh(this,TT(n))},default(n){return PT(this,n)},prefault(n){return RT(this,n)},catch(n){return $T(this,n)},pipe(n){return Vh(this,n)},readonly(){return LT(this)},describe(n){const r=this.clone();return ds.add(r,{description:n}),r},meta(...n){if(n.length===0)return ds.get(this);const r=this.clone();return ds.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=ds.get(t))==null?void 0:n.description},configurable:!0}),t)),gp=C("_ZodString",(t,e)=>{Ql.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>sS(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Hs(t,"_ZodString",{regex(...r){return this.check(Uk(...r))},includes(...r){return this.check(jk(...r))},startsWith(...r){return this.check(Vk(...r))},endsWith(...r){return this.check(Hk(...r))},min(...r){return this.check(Yi(...r))},max(...r){return this.check(up(...r))},length(...r){return this.check(hp(...r))},nonempty(...r){return this.check(Yi(1,...r))},lowercase(r){return this.check(Gk(r))},uppercase(r){return this.check(Zk(r))},trim(){return this.check(Yk())},normalize(...r){return this.check(Wk(...r))},toLowerCase(){return this.check(Xk())},toUpperCase(){return this.check(qk())},slugify(){return this.check(Jk())}})}),YS=C("ZodString",(t,e)=>{Ql.init(t,e),gp.init(t,e),t.email=n=>t.check(uk(XS,n)),t.url=n=>t.check(mk(qS,n)),t.jwt=n=>t.check(Pk(hT,n)),t.emoji=n=>t.check(gk(JS,n)),t.guid=n=>t.check($h(Bh,n)),t.uuid=n=>t.check(hk(bi,n)),t.uuidv4=n=>t.check(dk(bi,n)),t.uuidv6=n=>t.check(fk(bi,n)),t.uuidv7=n=>t.check(pk(bi,n)),t.nanoid=n=>t.check(_k(KS,n)),t.guid=n=>t.check($h(Bh,n)),t.cuid=n=>t.check(yk(QS,n)),t.cuid2=n=>t.check(xk(eT,n)),t.ulid=n=>t.check(bk(tT,n)),t.base64=n=>t.check(Ck(lT,n)),t.base64url=n=>t.check(Ek(cT,n)),t.xid=n=>t.check(vk(nT,n)),t.ksuid=n=>t.check(wk(rT,n)),t.ipv4=n=>t.check(kk(sT,n)),t.ipv6=n=>t.check(Sk(iT,n)),t.cidrv4=n=>t.check(Tk(oT,n)),t.cidrv6=n=>t.check(Ak(aT,n)),t.e164=n=>t.check(Ik(uT,n)),t.datetime=n=>t.check(ES(n)),t.date=n=>t.check(PS(n)),t.time=n=>t.check(RS(n)),t.duration=n=>t.check(OS(n))});function p(t){return ck(YS,t)}const Re=C("ZodStringFormat",(t,e)=>{Pe.init(t,e),gp.init(t,e)}),XS=C("ZodEmail",(t,e)=>{pw.init(t,e),Re.init(t,e)}),Bh=C("ZodGUID",(t,e)=>{dw.init(t,e),Re.init(t,e)}),bi=C("ZodUUID",(t,e)=>{fw.init(t,e),Re.init(t,e)}),qS=C("ZodURL",(t,e)=>{mw.init(t,e),Re.init(t,e)}),JS=C("ZodEmoji",(t,e)=>{gw.init(t,e),Re.init(t,e)}),KS=C("ZodNanoID",(t,e)=>{_w.init(t,e),Re.init(t,e)}),QS=C("ZodCUID",(t,e)=>{yw.init(t,e),Re.init(t,e)}),eT=C("ZodCUID2",(t,e)=>{xw.init(t,e),Re.init(t,e)}),tT=C("ZodULID",(t,e)=>{bw.init(t,e),Re.init(t,e)}),nT=C("ZodXID",(t,e)=>{vw.init(t,e),Re.init(t,e)}),rT=C("ZodKSUID",(t,e)=>{ww.init(t,e),Re.init(t,e)}),sT=C("ZodIPv4",(t,e)=>{Cw.init(t,e),Re.init(t,e)}),iT=C("ZodIPv6",(t,e)=>{Ew.init(t,e),Re.init(t,e)}),oT=C("ZodCIDRv4",(t,e)=>{Iw.init(t,e),Re.init(t,e)}),aT=C("ZodCIDRv6",(t,e)=>{Pw.init(t,e),Re.init(t,e)}),lT=C("ZodBase64",(t,e)=>{Mw.init(t,e),Re.init(t,e)}),cT=C("ZodBase64URL",(t,e)=>{zw.init(t,e),Re.init(t,e)}),uT=C("ZodE164",(t,e)=>{Ow.init(t,e),Re.init(t,e)}),hT=C("ZodJWT",(t,e)=>{Nw.init(t,e),Re.init(t,e)}),_p=C("ZodNumber",(t,e)=>{ip.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>iS(t,r,s),Hs(t,"ZodNumber",{gt(r,s){return this.check(Dh(r,s))},gte(r,s){return this.check(ya(r,s))},min(r,s){return this.check(ya(r,s))},lt(r,s){return this.check(Nh(r,s))},lte(r,s){return this.check(_a(r,s))},max(r,s){return this.check(_a(r,s))},int(r){return this.check(Uh(r))},safe(r){return this.check(Uh(r))},positive(r){return this.check(Dh(0,r))},nonnegative(r){return this.check(ya(0,r))},negative(r){return this.check(Nh(0,r))},nonpositive(r){return this.check(_a(0,r))},multipleOf(r,s){return this.check(Lh(r,s))},step(r,s){return this.check(Lh(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 R(t){return $k(_p,t)}const dT=C("ZodNumberFormat",(t,e)=>{Dw.init(t,e),_p.init(t,e)});function Uh(t){return Nk(dT,t)}const fT=C("ZodBoolean",(t,e)=>{Lw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>oS(t,n,r)});function Cn(t){return Dk(fT,t)}const pT=C("ZodAny",(t,e)=>{Fw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>lS()});function ee(){return Lk(pT)}const mT=C("ZodUnknown",(t,e)=>{Bw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>cS()});function pl(){return Fk(mT)}const gT=C("ZodNever",(t,e)=>{Uw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>aS(t,n,r)});function _T(t){return Bk(gT,t)}const yT=C("ZodArray",(t,e)=>{Gw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>pS(t,n,r,s),t.element=e.element,Hs(t,"ZodArray",{min(n,r){return this.check(Yi(n,r))},nonempty(n){return this.check(Yi(1,n))},max(n,r){return this.check(up(n,r))},length(n,r){return this.check(hp(n,r))},unwrap(){return this.element}})});function Y(t,e){return Kk(yT,t,e)}const xT=C("ZodObject",(t,e)=>{jw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>mS(t,n,r,s),le(t,"shape",()=>e.shape),Hs(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:pl()})},loose(){return this.clone({...this._zod.def,catchall:pl()})},strict(){return this.clone({...this._zod.def,catchall:_T()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return lv(this,n)},safeExtend(n){return cv(this,n)},merge(n){return uv(this,n)},pick(n){return ov(this,n)},omit(n){return av(this,n)},partial(...n){return hv(xp,this,n[0])},required(...n){return dv(bp,this,n[0])}})});function v(t,e){const n={type:"object",shape:t??{},...Z(e)};return new xT(n)}const yp=C("ZodUnion",(t,e)=>{lp.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>gS(t,n,r,s),t.options=e.options});function Nt(t,e){return new yp({type:"union",options:t,...Z(e)})}const bT=C("ZodDiscriminatedUnion",(t,e)=>{yp.init(t,e),Vw.init(t,e)});function Xe(t,e,n){return new bT({type:"union",options:e,discriminator:t,...Z(n)})}const vT=C("ZodIntersection",(t,e)=>{Hw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>_S(t,n,r,s)});function wT(t,e){return new vT({type:"intersection",left:t,right:e})}const Gh=C("ZodRecord",(t,e)=>{Ww.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>yS(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function fe(t,e,n){return!e||!e._zod?new Gh({type:"record",keyType:p(),valueType:t,...Z(e)}):new Gh({type:"record",keyType:t,valueType:e,...Z(n)})}const ml=C("ZodEnum",(t,e)=>{Yw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,s,i)=>uS(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 ml({...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 ml({...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 ml({type:"enum",entries:n,...Z(e)})}const kT=C("ZodLiteral",(t,e)=>{Xw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>hS(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 kT({type:"literal",values:Array.isArray(t)?t:[t],...Z(e)})}const ST=C("ZodTransform",(t,e)=>{qw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>fS(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new jf(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Is(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(Is(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 TT(t){return new ST({type:"transform",transform:t})}const xp=C("ZodOptional",(t,e)=>{cp.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>mp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Zh(t){return new xp({type:"optional",innerType:t})}const AT=C("ZodExactOptional",(t,e)=>{Jw.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>mp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function CT(t){return new AT({type:"optional",innerType:t})}const ET=C("ZodNullable",(t,e)=>{Kw.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 jh(t){return new ET({type:"nullable",innerType:t})}const IT=C("ZodDefault",(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,t.removeDefault=t.unwrap});function PT(t,e){return new IT({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Wf(e)}})}const MT=C("ZodPrefault",(t,e)=>{ek.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>wS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function RT(t,e){return new MT({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Wf(e)}})}const bp=C("ZodNonOptional",(t,e)=>{tk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>bS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function zT(t,e){return new bp({type:"nonoptional",innerType:t,...Z(e)})}const OT=C("ZodCatch",(t,e)=>{nk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>kS(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function $T(t,e){return new OT({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const NT=C("ZodPipe",(t,e)=>{rk.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>SS(t,n,r,s),t.in=e.in,t.out=e.out});function Vh(t,e){return new NT({type:"pipe",in:t,out:e})}const DT=C("ZodReadonly",(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.innerType});function LT(t){return new DT({type:"readonly",innerType:t})}const FT=C("ZodLazy",(t,e)=>{ik.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 BT(t){return new FT({type:"lazy",getter:t})}const vp=C("ZodCustom",(t,e)=>{ok.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(n,r,s)=>dS(t,n)});function UT(t,e={}){return Qk(vp,t,e)}function GT(t,e){return eS(t,e)}function wp(t,e={}){const n=new vp({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 ZT={custom:"custom"};v({name:p(),description:p().optional(),inputSchema:v({type:k("object"),properties:fe(p(),ee()),required:Y(p()),additionalProperties:Cn()})});function xa(){return{}}const kp=()=>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 Hh{constructor(){se(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function Wh(){return!0}class jT{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 VT=new jT,Ue=v({providerData:fe(p(),ee()).optional()}),pt=Ue.extend({id:p().optional()}),HT=Ue.extend({type:k("refusal"),refusal:p()}),WT=Ue.extend({type:k("output_text"),text:p()}),ec=Ue.extend({type:k("input_text"),text:p()}),YT=Ue.extend({type:k("reasoning_text"),text:p()}),Sp=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()}),Tp=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()}),Ap=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()}),XT=Ue.extend({type:k("image"),image:p().describe("Base64 encoded image data")}),qT=Ue.extend({type:k("text"),text:p()}),JT=v({data:Nt([p(),wp(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),KT=v({url:p().describe("Publicly accessible URL pointing to the image content")}),QT=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),e1=Nt([JT,KT,QT]).describe("Inline image data or references to uploaded content."),t1=v({data:Nt([p(),wp(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")}),n1=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),r1=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),s1=Nt([p().describe("Existing data URL or base64 string"),t1,n1,r1]).describe("Inline data (with metadata) or references pointing to file contents."),i1=(...t)=>p(),o1=Ue.extend({type:k("image"),image:p().or(e1).optional(),detail:i1("low","high","auto").optional()}),a1=Ue.extend({type:k("file"),file:s1}),l1=Ue.extend({type:k("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Yh=Xe("type",[v({type:k("screenshot")}),v({type:k("click"),x:R(),y:R(),button:Ce(["left","right","wheel","back","forward"])}),v({type:k("double_click"),x:R(),y:R()}),v({type:k("scroll"),x:R(),y:R(),scroll_x:R(),scroll_y:R()}),v({type:k("type"),text:p()}),v({type:k("wait")}),v({type:k("move"),x:R(),y:R()}),v({type:k("keypress"),keys:Y(p())}),v({type:k("drag"),path:Y(v({x:R(),y:R()}))})]),c1=Xe("type",[WT,HT,Ap,XT]),tc=pt.extend({type:k("message").optional()}),uo=tc.extend({role:k("assistant"),status:Ce(["in_progress","completed","incomplete"]),content:Y(c1)}),u1=Xe("type",[ec,Sp,Tp,Ap]),Cp=tc.extend({role:k("user"),content:Y(u1).or(p())}),Ep=tc.extend({role:k("system"),content:p()});Xe("role",[Ep,uo,Cp]);const Ps=pt.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()}),Ms=pt.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 h1=fe(p(),ee()),d1=pl(),nc=pt.extend({type:k("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),arguments:d1,status:p().optional()}),rc=pt.extend({type:k("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ce(["client","server"]).optional(),status:p().optional(),tools:Y(h1)}),f1=Xe("type",[qT,o1,a1]),p1=Xe("type",[ec,Sp,Tp]),qi=pt.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:Nt([p(),f1,Y(p1)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),ho=pt.extend({type:k("computer_call"),callId:p().describe("The ID of the computer call"),status:Ce(["in_progress","completed","incomplete"]),action:Yh.optional(),actions:Y(Yh).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:ZT.custom,message:"computer_call items must include action or actions.",path:["action"]})}),Ip=pt.extend({type:k("computer_call_result"),callId:p().describe("The ID of the computer call"),output:l1}),m1=v({commands:Y(p()),timeoutMs:R().int().min(0).optional(),maxOutputLength:R().int().min(0).optional()}),fo=pt.extend({type:k("shell_call"),callId:p(),status:Ce(["in_progress","completed","incomplete"]).optional(),action:m1}),g1=Xe("type",[v({type:k("timeout")}),v({type:k("exit"),exitCode:R().int().nullable()})]),_1=v({stdout:p(),stderr:p(),outcome:g1}).passthrough(),sc=pt.extend({type:k("shell_call_output"),callId:p(),maxOutputLength:R().optional(),output:Y(_1)}),y1=v({type:k("create_file"),path:p(),diff:p()}),x1=v({type:k("update_file"),path:p(),diff:p()}),b1=v({type:k("delete_file"),path:p()}),v1=Xe("type",[y1,x1,b1]),po=pt.extend({type:k("apply_patch_call"),callId:p(),status:Ce(["in_progress","completed"]),operation:v1}),ic=pt.extend({type:k("apply_patch_call_output"),callId:p(),status:Ce(["completed","failed"]),output:p().optional()}),w1=Xe("type",[ho,fo,po,Ms,Ps]),oc=Ue.extend({id:p().optional(),type:k("reasoning"),content:Y(ec),rawContent:Y(YT).optional()}),Pp=pt.extend({type:k("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),Mp=pt.extend({type:k("unknown")}),Rp=Xe("type",[uo,nc,rc,Ps,Ms,ho,fo,po,qi,sc,ic,oc,Pp,Mp]),k1=Nt([Cp,uo,Ep,nc,rc,Ps,Ms,ho,fo,po,qi,Ip,sc,ic,oc,Pp,Mp]),S1=v({inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:fe(p(),R()).optional(),outputTokensDetails:fe(p(),R()).optional(),endpoint:p().optional()}),T1=v({requests:R().optional(),inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:Nt([fe(p(),R()),Y(fe(p(),R()))]).optional(),outputTokensDetails:Nt([fe(p(),R()),Y(fe(p(),R()))]).optional(),requestUsageEntries:Y(S1).optional()}),A1=Ue.extend({type:k("output_text_delta"),delta:p()}),C1=Ue.extend({type:k("response_started")}),E1=Ue.extend({type:k("response_done"),response:Ue.extend({id:p(),requestId:p().optional(),usage:T1,output:Y(Rp)})}),I1=Ue.extend({type:k("model"),event:ee().describe("The event from the model")});Xe("type",[A1,E1,C1,I1]);const Xh=Symbol.for("openai.agents.core.asyncLocalStorage");let ba;function P1(){try{const t=globalThis,e=t[Xh];if(e)return e;const n=new Hh;return t[Xh]=n,n}catch{return ba||(ba=new Hh),ba}}function zp(){const t=P1().getStore();if((t==null?void 0:t.active)===!0)return t}function qh(){const t=zp();return t!=null&&t.trace?t.trace:null}function Jh(){const t=zp();return t!=null&&t.span?t.span:null}class M1{async export(e){if(Zf.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 Os,Cr,$s,Ns,Er,Je,tn,vn,wn,Ir,ht,gl,_l,vr;class R1{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ge(this,ht);ge(this,Os);ge(this,Cr);ge(this,$s);ge(this,Ns);ge(this,Er);ge(this,Je,[]);ge(this,tn);ge(this,vn,null);ge(this,wn,!1);ge(this,Ir,null);re(this,Os,n),re(this,Cr,r),re(this,$s,s),re(this,Ns,n*i),re(this,Er,e),re(this,tn,VT),Te.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){re(this,Ir,new AbortController),Pt(this,ht,_l).call(this)}async onTraceStart(e){await Pt(this,ht,gl).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await Pt(this,ht,gl).call(this,e)}async shutdown(e){var n;for(e&&O(this,tn).setTimeout(()=>{var r;(r=O(this,Ir))==null||r.abort()},e),Te.debug("Shutting down gracefully");O(this,Je).length>0;){if(Te.debug(`Waiting for buffer to empty. Items left: ${O(this,Je).length}`),O(this,wn)||await Pt(this,ht,vr).call(this,!0),(n=O(this,Ir))!=null&&n.signal.aborted){Te.debug("Timeout reached, force flushing"),await Pt(this,ht,vr).call(this,!0);break}await new Promise(r=>O(this,tn).setTimeout(r,500))}Te.debug("Buffer empty. Exiting"),O(this,tn)&&O(this,vn)&&O(this,tn).clearTimeout(O(this,vn))}async forceFlush(){O(this,Je).length>0&&await Pt(this,ht,vr).call(this,!0)}}Os=new WeakMap,Cr=new WeakMap,$s=new WeakMap,Ns=new WeakMap,Er=new WeakMap,Je=new WeakMap,tn=new WeakMap,vn=new WeakMap,wn=new WeakMap,Ir=new WeakMap,ht=new WeakSet,gl=async function(e){if(O(this,Je).length+1>O(this,Os)){Te.error("Dropping trace because buffer is full");return}O(this,Je).push(e),O(this,Je).length>O(this,Ns)&&await Pt(this,ht,vr).call(this)},_l=function(){re(this,vn,O(this,tn).setTimeout(async()=>{await Pt(this,ht,vr).call(this),Pt(this,ht,_l).call(this)},O(this,$s))),typeof O(this,vn).unref=="function"&&O(this,vn).unref()},vr=async function(e=!1){if(O(this,Je).length!==0){if(Te.debug(`Exporting batches. Force: ${e}. Buffer size: ${O(this,Je).length}`),e||O(this,Je).length<O(this,Cr)){const n=[...O(this,Je)];re(this,Je,[]),re(this,wn,!0),await O(this,Er).export(n),re(this,wn,!1)}else if(O(this,Je).length>0){const n=O(this,Je).splice(0,O(this,Cr));re(this,wn,!0),await O(this,Er).export(n),re(this,wn,!1)}}};var _t;class z1{constructor(){ge(this,_t,[])}start(){for(const e of O(this,_t))e.start&&e.start()}addTraceProcessor(e){O(this,_t).push(e)}setProcessors(e){Te.debug("Shutting down old processors");for(const n of O(this,_t))n.shutdown();re(this,_t,e)}async onTraceStart(e){for(const n of O(this,_t))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of O(this,_t))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of O(this,_t))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of O(this,_t))await n.onSpanEnd(e)}async shutdown(e){for(const n of O(this,_t))await n.shutdown(e)}async forceFlush(){for(const e of O(this,_t))await e.forceFlush()}}_t=new WeakMap;let va=null,wa=null;function O1(){return va||(va=new M1),va}function Op(){return wa||(wa=new R1(O1())),wa}function Kh(){return new Date().toISOString()}function $p(){return`trace_${kp().replace(/-/g,"")}`}function $1(){return`span_${kp().replace(/-/g,"").slice(0,24)}`}function N1(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var Ds,Ls,Fs,Bs,Us,Xn,kn,Sn,qn,Pr,Gs;const ac=class ac{constructor(e,n){se(this,"type","trace.span");ge(this,Ds);ge(this,Ls);ge(this,Fs);ge(this,Bs);ge(this,Us);ge(this,Xn);ge(this,kn);ge(this,Sn);ge(this,qn);ge(this,Pr);ge(this,Gs);re(this,Ls,e.traceId),re(this,Fs,e.spanId??$1()),re(this,Ds,e.data),re(this,Xn,n),re(this,Bs,e.parentId??null),re(this,Us,e.traceMetadata),re(this,qn,e.error??null),re(this,kn,e.startedAt??null),re(this,Sn,e.endedAt??null),re(this,Pr,e.tracingApiKey)}get traceId(){return O(this,Ls)}get spanData(){return O(this,Ds)}get traceMetadata(){return O(this,Us)}get spanId(){return O(this,Fs)}get parentId(){return O(this,Bs)}get previousSpan(){return O(this,Gs)}set previousSpan(e){re(this,Gs,e)}start(){if(O(this,kn)){Te.warn("Span already started");return}re(this,kn,Kh()),O(this,Xn).onSpanStart(this)}end(){if(O(this,Sn)){Te.debug("Span already finished",this.spanData);return}re(this,Sn,Kh()),O(this,Xn).onSpanEnd(this)}setError(e){re(this,qn,e)}get error(){return O(this,qn)}get startedAt(){return O(this,kn)}get endedAt(){return O(this,Sn)}get tracingApiKey(){return O(this,Pr)}clone(){var n;const e=new ac({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:O(this,kn)??void 0,endedAt:O(this,Sn)??void 0,error:O(this,qn)??void 0,tracingApiKey:O(this,Pr)},O(this,Xn));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:N1(this.spanData),error:this.error}}};Ds=new WeakMap,Ls=new WeakMap,Fs=new WeakMap,Bs=new WeakMap,Us=new WeakMap,Xn=new WeakMap,kn=new WeakMap,Sn=new WeakMap,qn=new WeakMap,Pr=new WeakMap,Gs=new WeakMap;let Rs=ac;class yn extends Rs{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var Mr,nn;const lc=class lc{constructor(e,n){se(this,"type","trace");se(this,"traceId");se(this,"name");se(this,"groupId",null);se(this,"metadata");se(this,"tracingApiKey");ge(this,Mr);ge(this,nn);this.traceId=e.traceId??$p(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,re(this,Mr,n??Op()),re(this,nn,e.started??!1)}async start(){O(this,nn)||(re(this,nn,!0),await O(this,Mr).onTraceStart(this))}async end(){O(this,nn)&&(re(this,nn,!1),await O(this,Mr).onTraceEnd(this))}clone(){return new lc({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:O(this,nn),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}};Mr=new WeakMap,nn=new WeakMap;let zs=lc;class ka extends zs{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var He,Jn,rn,Ji,Dp;class Np{constructor(){ge(this,Ji);ge(this,He);ge(this,Jn);ge(this,rn);re(this,He,new z1),re(this,Jn,Zf.disabled),re(this,rn,null),Pt(this,Ji,Dp).call(this)}registerProcessor(e){re(this,rn,null),O(this,He).addTraceProcessor(e)}setProcessors(e){re(this,rn,null),O(this,He).setProcessors(e)}getCurrentTrace(){return qh()}getCurrentSpan(){return Jh()}setDisabled(e){re(this,Jn,e)}startExportLoop(){O(this,He).start()}createTrace(e){if(O(this,Jn))return Te.debug("Tracing is disabled, Not creating trace %o",e),new ka;const n=e.traceId??$p(),r=e.name??"Agent workflow";return Te.debug("Creating trace %s with name %s",n,r),new zs({...e,name:r,traceId:n},O(this,He))}createSpan(e,n){if(O(this,Jn)||e.disabled)return Te.debug("Tracing is disabled, Not creating span %o",e),new yn(e.data,O(this,He));let r,s,i,o;if(n){if(n instanceof zs){if(n instanceof ka)return Te.debug("Parent trace is no-op, returning NoopSpan"),new yn(e.data,O(this,He));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof Rs){if(n instanceof yn)return Te.debug("Parent span is no-op, returning NoopSpan"),new yn(e.data,O(this,He));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=qh(),l=Jh();if(!a)return Te.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new yn(e.data,O(this,He));if(l instanceof yn||a instanceof ka)return Te.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new yn(e.data,O(this,He));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 Rs({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},O(this,He))):(Te.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new yn(e.data,O(this,He)))}async shutdown(e){O(this,rn)||re(this,rn,(async()=>{try{Te.debug("Shutting down tracing provider"),await O(this,He).shutdown(e)}catch(n){Te.error("Error shutting down tracing provider %o",n)}})()),await O(this,rn)}async forceFlush(){await O(this,He).forceFlush()}}He=new WeakMap,Jn=new WeakMap,rn=new WeakMap,Ji=new WeakSet,Dp=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(),Qh("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Qh("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{Te.error("Unhandled rejection",n,r),await e(),D1("unhandledRejection")||process.exit(1)})}};let Sa;function Qh(t){return process.listeners(t).length>1}function D1(t){return process.listeners(t).length>1}function L1(){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 vi();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return vi()}try{const s=new Np;return e[t]=s,s}catch{return vi()}}catch{return vi()}}function vi(){return Sa||(Sa=new Np),Sa}function F1(t){L1().registerProcessor(t)}const B1=Xe("type",[v({type:k("next_step_handoff"),newAgent:ee()}),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(),ee())})]),U1="1.8",G1=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",U1],Z1=Ce(G1),wt=v({name:p()}),j1=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(),ee()).optional()}).nullable(),span_data:fe(p(),ee())}),Lp=j1.extend({previous_span:BT(()=>Lp).optional()}),V1=v({inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:fe(p(),R()).optional(),outputTokensDetails:fe(p(),R()).optional(),endpoint:p().optional()}),Fp=v({requests:R(),inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:Y(fe(p(),R())).optional(),outputTokensDetails:Y(fe(p(),R())).optional(),requestUsageEntries:Y(V1).optional()}),ed=v({usage:Fp,output:Y(Rp),responseId:p().optional(),requestId:p().optional(),providerData:fe(p(),ee()).optional()}),Bp=Xe("type",[v({type:k("message_output_item"),rawItem:uo,agent:wt}),v({type:k("tool_search_call_item"),rawItem:nc,agent:wt}),v({type:k("tool_search_output_item"),rawItem:rc,agent:wt}),v({type:k("tool_call_item"),rawItem:w1.or(Ps),agent:wt}),v({type:k("tool_call_output_item"),rawItem:qi.or(Ip).or(sc).or(ic),agent:wt,output:p()}),v({type:k("reasoning_item"),rawItem:oc,agent:wt}),v({type:k("handoff_call_item"),rawItem:Ms,agent:wt}),v({type:k("handoff_output_item"),rawItem:qi,sourceAgent:wt,targetAgent:wt}),v({type:k("tool_approval_item"),rawItem:Ms.or(Ps).or(ho).or(fo).or(po),agent:wt,toolName:p().optional()})]),H1=v({object:k("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:fe(p(),ee()),tracing_api_key:p().optional().nullable()}),W1=v({newItems:Y(Bp),toolsUsed:Y(p()),handoffs:Y(v({toolCall:ee(),handoff:ee()})),functions:Y(v({toolCall:ee(),tool:ee()})),computerActions:Y(v({toolCall:ee(),computer:ee()})),shellActions:Y(v({toolCall:ee(),shell:ee()})).optional(),applyPatchActions:Y(v({toolCall:ee(),applyPatch:ee()})).optional(),mcpApprovalRequests:Y(v({requestItem:v({rawItem:v({type:k("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:fe(p(),ee()).nullable().optional()})}),mcpTool:v({type:k("hosted_tool"),name:k("hosted_mcp"),providerData:fe(p(),ee())})})).optional()}),Up=v({tripwireTriggered:Cn(),outputInfo:ee()}),Y1=Xe("type",[v({type:k("allow")}),v({type:k("rejectContent"),message:p()}),v({type:k("throwException")})]),Gp=v({outputInfo:ee().optional(),behavior:Y1}),Zp=v({type:Nt([k("tool_input"),k("tool_output")]),name:p()}),X1=v({guardrail:v({type:k("input"),name:p()}),output:Up}),q1=v({guardrail:v({type:k("output"),name:p()}),agentOutput:ee(),agent:wt,output:Up}),J1=v({guardrail:Zp.extend({type:k("tool_input")}),output:Gp}),K1=v({guardrail:Zp.extend({type:k("tool_output")}),output:Gp});v({$schemaVersion:Z1,currentTurn:R(),currentAgent:wt,originalInput:p().or(Y(k1)),modelResponses:Y(ed),context:v({usage:Fp,approvals:fe(p(),v({approved:Y(p()).or(Cn()),rejected:Y(p()).or(Cn()),messages:fe(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:fe(p(),ee()),toolInput:ee().optional()}),toolUseTracker:fe(p(),Y(p())),maxTurns:R(),currentAgentSpan:Lp.nullable().optional(),noActiveAgentRun:Cn(),inputGuardrailResults:Y(X1),outputGuardrailResults:Y(q1),toolInputGuardrailResults:Y(J1).optional().default([]),toolOutputGuardrailResults:Y(K1).optional().default([]),currentTurnInProgress:Cn().optional(),currentStep:B1.optional(),lastModelResponse:ed.optional(),generatedItems:Y(Bp),pendingAgentToolRuns:fe(p(),p()).optional().default({}),lastProcessedResponse:W1.optional(),currentTurnPersistedItemCount:R().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:Ce(["preserve","omit"]).optional(),trace:H1.nullable()});v({input:p()});Hl("openai-agents:mcp-servers");F1(Op());v({itemId:p()});Xe("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:k("message"),role:k("system"),content:Y(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:Y(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:Y(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(),ee()),approved:Cn().optional().nullable()});Hl("openai-agents:realtime");const jp=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:R().or(k("inf")).optional().nullable(),metadata:fe(p(),ee()).optional().nullable(),output_modalities:Y(p()).optional().nullable(),object:k("realtime.response").optional().nullable(),output:Y(ee()).optional().nullable(),audio:v({output:v({format:ee().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:Ce(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:fe(p(),ee()).optional().nullable(),usage:v({input_tokens:R().optional(),input_token_details:fe(p(),ee()).optional().nullable(),output_tokens:R().optional(),output_token_details:fe(p(),ee()).optional().nullable()}).optional().nullable()}),Q1=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Nt([k("input_text"),k("input_audio"),k("item_reference"),k("output_text"),k("output_audio")])}),Ur=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:Y(Q1).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:Cn().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:ee().nullable().optional(),tools:Y(v({name:p(),description:p(),input_schema:fe(p(),ee()).optional()}).passthrough()).optional()}).passthrough(),eA=v({type:k("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:k("realtime.conversation").optional()})}),tA=v({type:k("conversation.item.added"),event_id:p(),item:Ur,previous_item_id:p().nullable().optional()}),nA=v({type:k("conversation.item.done"),event_id:p(),item:Ur,previous_item_id:p().nullable().optional()}),rA=v({type:k("conversation.item.deleted"),event_id:p(),item_id:p()}),sA=v({type:k("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:R(),transcript:p(),logprobs:Y(ee()).nullable().optional(),usage:v({type:k("tokens"),total_tokens:R(),input_tokens:R(),input_token_details:v({text_tokens:R(),audio_tokens:R()}),output_tokens:R()}).optional()}),iA=v({type:k("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:R().optional(),delta:p().optional(),logprobs:Y(ee()).nullable().optional()}),oA=v({type:k("conversation.item.input_audio_transcription.failed"),event_id:p(),item_id:p(),content_index:R(),error:v({code:p().optional(),message:p().optional(),param:p().optional(),type:p().optional()})}),aA=v({type:k("conversation.item.retrieved"),event_id:p(),item:Ur}),lA=v({type:k("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:R(),content_index:R()}),cA=v({type:k("conversation.item.create"),item:Ur,event_id:p().optional(),previous_item_id:p().nullable().optional()}),uA=v({type:k("conversation.item.delete"),item_id:p(),event_id:p().optional()}),hA=v({type:k("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),dA=v({type:k("conversation.item.truncate"),item_id:p(),audio_end_ms:R(),content_index:R(),event_id:p().optional()}),fA=v({type:k("error"),event_id:p().optional(),error:ee().optional()}),pA=v({type:k("input_audio_buffer.cleared"),event_id:p()}),mA=v({type:k("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),gA=v({type:k("input_audio_buffer.clear"),event_id:p().optional()}),_A=v({type:k("input_audio_buffer.commit"),event_id:p().optional()}),yA=v({type:k("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),xA=v({type:k("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:R()}),bA=v({type:k("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:R()}),vA=v({type:k("output_audio_buffer.started"),event_id:p()}).passthrough(),wA=v({type:k("output_audio_buffer.stopped"),event_id:p()}).passthrough(),kA=v({type:k("output_audio_buffer.cleared"),event_id:p()}),SA=v({type:k("rate_limits.updated"),event_id:p(),rate_limits:Y(v({limit:R().optional(),name:Ce(["requests","tokens"]).optional(),remaining:R().optional(),reset_seconds:R().optional()}))}),TA=v({type:k("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),AA=v({type:k("response.output_audio.done"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p()}),CA=v({type:k("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),EA=v({type:k("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:R(),transcript:p(),output_index:R(),response_id:p()}),IA=v({type:k("response.content_part.added"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),PA=v({type:k("response.content_part.done"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ce(["text","audio"]).optional()})}),MA=v({type:k("response.created"),event_id:p(),response:jp}),RA=v({type:k("response.done"),event_id:p(),response:jp}),zA=v({type:k("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:R(),response_id:p()}),OA=v({type:k("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:R(),response_id:p()}),$A=v({type:k("response.output_item.added"),event_id:p(),item:Ur,output_index:R(),response_id:p()}),NA=v({type:k("response.output_item.done"),event_id:p(),item:Ur,output_index:R(),response_id:p()}),DA=v({type:k("response.output_text.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),LA=v({type:k("response.output_text.done"),event_id:p(),item_id:p(),content_index:R(),text:p(),output_index:R(),response_id:p()}),FA=v({type:k("session.created"),event_id:p(),session:ee()}),BA=v({type:k("session.updated"),event_id:p(),session:ee()}),UA=v({type:k("response.cancel"),event_id:p().optional(),response_id:p().optional()}),GA=v({type:k("response.create"),event_id:p().optional(),response:ee().optional()}),ZA=v({type:k("session.update"),event_id:p().optional(),session:ee()}),jA=v({type:k("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),VA=v({type:k("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),HA=v({type:k("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:R(),delta:p(),obfuscation:p()}),WA=v({type:k("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:R(),arguments:p()}),YA=v({type:k("response.mcp_call.in_progress"),event_id:p(),output_index:R(),item_id:p()}),XA=v({type:k("response.mcp_call.completed"),event_id:p(),output_index:R(),item_id:p()}),qA=v({type:k("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();Xe("type",[eA,tA,nA,rA,sA,iA,oA,aA,lA,fA,pA,yA,xA,bA,vA,wA,kA,SA,TA,AA,CA,EA,IA,PA,MA,RA,zA,OA,$A,NA,DA,LA,FA,BA,jA,VA,qA,HA,WA,YA,XA]);Xe("type",[cA,uA,hA,dA,mA,gA,_A,UA,GA,ZA]);const Ta={};var sn={};const JA=typeof process<"u"&&typeof(sn==null?void 0:sn.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?sn.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(sn==null?void 0:sn.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&sn.NEXT_PUBLIC_PLAY_API_BASE.length>0?sn.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(Ta==null?void 0:Ta.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");ix({});new Lt;new Mi;new Lt;new Lt;new Lt;new Lt;new Lt;export{$t as B,Lt as C,Zs as D,ve as E,Qi as G,ce as M,et as P,Oa as R,kl as S,ci as T,Ma as U,In as a,Vd as b,Fd as c,cn as d,bt as e,xl as f,xe as g,bd as h,Zd as i,Si as j,be as k,v_ as l,Rc as n,Lm as r,xt as w};
|