@agent-play/play-ui 3.7.0 → 3.7.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 Zf=Object.defineProperty;var Al=t=>{throw TypeError(t)};var Uf=(t,e,n)=>e in t?Zf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var K=(t,e,n)=>Uf(t,typeof e!="symbol"?e+"":e,n),Fi=(t,e,n)=>e.has(t)||Al("Cannot "+n);var R=(t,e,n)=>(Fi(t,e,"read from private field"),n?n.call(t):e.get(t)),ae=(t,e,n)=>e.has(t)?Al("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),q=(t,e,n,r)=>(Fi(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(Fi(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 Gf="modulepreload",jf=function(t){return"/agent-play/"+t},Cl={},qu=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=jf(c),c in Cl)return;Cl[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":Gf,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 fe=(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.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(fe||{});const Mo=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},As=(t,e)=>Mo(t).priority??e,dt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Mo).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(Mo).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)=>As(o.value,n)-As(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)=>As(i,n)-As(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))}},Vf={extension:{type:fe.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await qu(()=>import("./browserAll-BZyjHeSn.js"),__vite__mapDeps([0,1]))}},Hf={extension:{type:fe.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await qu(()=>import("./webworkerAll-3mQFh81r.js"),[])}};class Ge{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Ge(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 ga(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Li={exports:{}},El;function Wf(){return El||(El=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 _=n?n+c:c;if(!this._events[_])return!1;var g=this._events[_],x=arguments.length,b,w;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(w=1,b=new Array(x-1);w<x;w++)b[w-1]=arguments[w];g.fn.apply(g.context,b)}else{var k=g.length,I;for(w=0;w<k;w++)switch(g[w].once&&this.removeListener(c,g[w].fn,void 0,!0),x){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,u);break;case 3:g[w].fn.call(g[w].context,u,h);break;case 4:g[w].fn.call(g[w].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[w].fn.apply(g[w].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 _=0,g=[],x=m.length;_<x;_++)(m[_].fn!==u||f&&!m[_].once||h&&m[_].context!==h)&&g.push(m[_]);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})(Li)),Li.exports}var Yf=Wf();const mn=ga(Yf),Xf=Math.PI*2,qf=180/Math.PI,Jf=Math.PI/180;class Ve{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new Ve(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 Bi.x=0,Bi.y=0,Bi}}const Bi=new Ve;class te{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 Ve;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 Ve;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(Xf-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 te;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 Qf.identity()}static get shared(){return Kf.identity()}}const Kf=new te,Qf=new te,wn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],kn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Sn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Tn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ro=[],Ju=[],Cs=Math.sign;function ep(){for(let t=0;t<16;t++){const e=[];Ro.push(e);for(let n=0;n<16;n++){const r=Cs(wn[t]*wn[n]+Sn[t]*kn[n]),s=Cs(kn[t]*wn[n]+Tn[t]*kn[n]),i=Cs(wn[t]*Sn[n]+Sn[t]*Tn[n]),o=Cs(kn[t]*Sn[n]+Tn[t]*Tn[n]);for(let a=0;a<16;a++)if(wn[a]===r&&kn[a]===s&&Sn[a]===i&&Tn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new te;e.set(wn[t],kn[t],Sn[t],Tn[t],0,0),Ju.push(e)}}ep();const he={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=>wn[t],uY:t=>kn[t],vX:t=>Sn[t],vY:t=>Tn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Ro[t][e],sub:(t,e)=>Ro[t][he.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?he.S:he.N:Math.abs(e)*2<=Math.abs(t)?t>0?he.E:he.W:e>0?t>0?he.SE:he.SW:t>0?he.NE:he.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=Ju[he.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,_=t.c,g=t.d;t.a=a*d+l*_,t.b=a*m+l*g,t.c=c*d+u*_,t.d=c*m+u*g,t.tx=h*d+f*_+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===he.E?(r.set(s+l,i+c,o,a),r):n===he.S?r.set(u-i-a+l,s+c,a,o):n===he.W?r.set(u-s-o+l,h-i-a+c,o,a):n===he.N?r.set(i+l,h-s-o+c,a,o):r.set(s+l,i+c,o,a)}},Es=[new Ve,new Ve,new Ve,new Ve];class Ne{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 Ne(0,0,0,0)}clone(){return new Ne(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,_=a+u,g=a+i-u,x=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>_&&e<g&&n>x&&n<b)}intersects(e,n){if(!n){const j=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=j)return!1;const O=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>O}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=Es[0].set(e.left,e.top),l=Es[1].set(e.left,e.bottom),c=Es[2].set(e.right,e.top),u=Es[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,_=f*s+d*i,g=f*r+d*o,x=f*s+d*o;if(Math.max(m,_,g,x)<=f*a.x+d*a.y||Math.min(m,_,g,x)>=f*u.x+d*u.y)return!1;const b=h*(a.y-c.y),w=h*(c.x-a.x),k=b*r+w*i,I=b*s+w*i,A=b*r+w*o,C=b*s+w*o;return!(Math.max(k,I,A,C)<=b*a.x+w*a.y||Math.min(k,I,A,C)>=b*u.x+w*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 Ne),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 Zi={default:-1};function Pe(t="default"){return Zi[t]===void 0&&(Zi[t]=-1),++Zi[t]}const Il=new Set,je="8.0.0",tp="8.3.4",Jn={quiet:!1,noColor:!1},ge=((t,e,n=3)=>{if(Jn.quiet||Il.has(e))return;let r=new Error().stack;const s=`${e}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-C510BE1v.js","assets/webworkerAll-C6QOfU5B.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Zf=Object.defineProperty;var Al=t=>{throw TypeError(t)};var Uf=(t,e,n)=>e in t?Zf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var K=(t,e,n)=>Uf(t,typeof e!="symbol"?e+"":e,n),Fi=(t,e,n)=>e.has(t)||Al("Cannot "+n);var R=(t,e,n)=>(Fi(t,e,"read from private field"),n?n.call(t):e.get(t)),ae=(t,e,n)=>e.has(t)?Al("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),q=(t,e,n,r)=>(Fi(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(Fi(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 Gf="modulepreload",jf=function(t){return"/agent-play/"+t},Cl={},qu=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=jf(c),c in Cl)return;Cl[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":Gf,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 fe=(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.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(fe||{});const Mo=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},As=(t,e)=>Mo(t).priority??e,dt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Mo).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(Mo).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)=>As(o.value,n)-As(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)=>As(i,n)-As(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))}},Vf={extension:{type:fe.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await qu(()=>import("./browserAll-C510BE1v.js"),__vite__mapDeps([0,1]))}},Hf={extension:{type:fe.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await qu(()=>import("./webworkerAll-C6QOfU5B.js"),[])}};class Ge{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Ge(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 ga(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Li={exports:{}},El;function Wf(){return El||(El=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 _=n?n+c:c;if(!this._events[_])return!1;var g=this._events[_],x=arguments.length,b,w;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(w=1,b=new Array(x-1);w<x;w++)b[w-1]=arguments[w];g.fn.apply(g.context,b)}else{var k=g.length,I;for(w=0;w<k;w++)switch(g[w].once&&this.removeListener(c,g[w].fn,void 0,!0),x){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,u);break;case 3:g[w].fn.call(g[w].context,u,h);break;case 4:g[w].fn.call(g[w].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[w].fn.apply(g[w].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 _=0,g=[],x=m.length;_<x;_++)(m[_].fn!==u||f&&!m[_].once||h&&m[_].context!==h)&&g.push(m[_]);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}(Li)),Li.exports}var Yf=Wf();const mn=ga(Yf),Xf=Math.PI*2,qf=180/Math.PI,Jf=Math.PI/180;class Ve{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new Ve(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 Bi.x=0,Bi.y=0,Bi}}const Bi=new Ve;class te{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 Ve;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 Ve;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(Xf-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 te;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 Qf.identity()}static get shared(){return Kf.identity()}}const Kf=new te,Qf=new te,wn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],kn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Sn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Tn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ro=[],Ju=[],Cs=Math.sign;function ep(){for(let t=0;t<16;t++){const e=[];Ro.push(e);for(let n=0;n<16;n++){const r=Cs(wn[t]*wn[n]+Sn[t]*kn[n]),s=Cs(kn[t]*wn[n]+Tn[t]*kn[n]),i=Cs(wn[t]*Sn[n]+Sn[t]*Tn[n]),o=Cs(kn[t]*Sn[n]+Tn[t]*Tn[n]);for(let a=0;a<16;a++)if(wn[a]===r&&kn[a]===s&&Sn[a]===i&&Tn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new te;e.set(wn[t],kn[t],Sn[t],Tn[t],0,0),Ju.push(e)}}ep();const he={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=>wn[t],uY:t=>kn[t],vX:t=>Sn[t],vY:t=>Tn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Ro[t][e],sub:(t,e)=>Ro[t][he.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?he.S:he.N:Math.abs(e)*2<=Math.abs(t)?t>0?he.E:he.W:e>0?t>0?he.SE:he.SW:t>0?he.NE:he.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=Ju[he.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,_=t.c,g=t.d;t.a=a*d+l*_,t.b=a*m+l*g,t.c=c*d+u*_,t.d=c*m+u*g,t.tx=h*d+f*_+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===he.E?(r.set(s+l,i+c,o,a),r):n===he.S?r.set(u-i-a+l,s+c,a,o):n===he.W?r.set(u-s-o+l,h-i-a+c,o,a):n===he.N?r.set(i+l,h-s-o+c,a,o):r.set(s+l,i+c,o,a)}},Es=[new Ve,new Ve,new Ve,new Ve];class Ne{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 Ne(0,0,0,0)}clone(){return new Ne(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,_=a+u,g=a+i-u,x=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>_&&e<g&&n>x&&n<b)}intersects(e,n){if(!n){const j=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=j)return!1;const O=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>O}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=Es[0].set(e.left,e.top),l=Es[1].set(e.left,e.bottom),c=Es[2].set(e.right,e.top),u=Es[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,_=f*s+d*i,g=f*r+d*o,x=f*s+d*o;if(Math.max(m,_,g,x)<=f*a.x+d*a.y||Math.min(m,_,g,x)>=f*u.x+d*u.y)return!1;const b=h*(a.y-c.y),w=h*(c.x-a.x),k=b*r+w*i,I=b*s+w*i,A=b*r+w*o,C=b*s+w*o;return!(Math.max(k,I,A,C)<=b*a.x+w*a.y||Math.min(k,I,A,C)>=b*u.x+w*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 Ne),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 Zi={default:-1};function Pe(t="default"){return Zi[t]===void 0&&(Zi[t]=-1),++Zi[t]}const Il=new Set,je="8.0.0",tp="8.3.4",Jn={quiet:!1,noColor:!1},ge=(t,e,n=3)=>{if(Jn.quiet||Il.has(e))return;let r=new Error().stack;const s=`${e}
|
|
3
3
|
Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!Jn.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))),Il.add(e)});Object.defineProperties(ge,{quiet:{get:()=>Jn.quiet,set:t=>{Jn.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>Jn.noColor,set:t=>{Jn.noColor=t},enumerable:!0,configurable:!1}});const Ku=()=>{};function Pl(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 Ml(t){return!(t&t-1)&&!!t}function Qu(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Rl=Object.create(null);function np(t){const e=Rl[t];return e===void 0&&(Rl[t]=Pe("resource")),e}const eh=class th extends mn{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...th.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){ge(je,"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=np(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};eh.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let nh=eh;const rh=class sh extends mn{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Pe("textureSource"),this._resourceType="textureSource",this._resourceId=Pe("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...sh.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.alphaMode=e.alphaMode,this.style=new nh(Qu(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=Pe("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=Pe("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=Ml(this.pixelWidth)&&Ml(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};rh.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 Mt=rh;class _a extends Mt{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}}_a.extension=fe.TextureSource;const zl=new te;class rp{constructor(e,n){this.mapCoord=new te,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&&(zl.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(zl));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 de extends mn{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Pe("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ne,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new Mt,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 rp(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=he.add(c,he.NW),e.x0=f+u*he.uX(c),e.y0=d+h*he.uY(c),c=he.add(c,2),e.x1=f+u*he.uX(c),e.y1=d+h*he.uY(c),c=he.add(c,2),e.x2=f+u*he.uX(c),e.y2=d+h*he.uY(c),c=he.add(c,2),e.x3=f+u*he.uX(c),e.y3=d+h*he.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 ge(je,"Texture.baseTexture is now Texture.source"),this._source}}de.EMPTY=new de({label:"EMPTY",source:new Mt({label:"EMPTY"})});de.EMPTY.destroy=Ku;de.WHITE=new de({source:new _a({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});de.WHITE.destroy=Ku;function sp(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 Ol=new te;class It{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=Ol,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 Ne);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=Ol,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,_=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>_&&(_=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>_&&(_=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>_&&(_=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>_&&(_=x),this.minX=f,this.minY=d,this.maxX=m,this.maxY=_}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 It(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 _=n;_<r;_+=2){const g=e[_],x=e[_+1],b=c*g+h*x+d,w=u*g+f*x+m;i=b<i?b:i,o=w<o?w:o,a=b>a?b:a,l=w>l?w: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 ip={grad:.9,turn:360,rad:360/(2*Math.PI)},Bt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},De=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},mt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},ih=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},$l=function(t){return{r:mt(t.r,0,255),g:mt(t.g,0,255),b:mt(t.b,0,255),a:mt(t.a)}},Ui=function(t){return{r:De(t.r),g:De(t.g),b:De(t.b),a:De(t.a,3)}},op=/^#([0-9a-f]{3,8})$/i,Is=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},oh=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}},ah=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}},Dl=function(t){return{h:ih(t.h),s:mt(t.s,0,100),l:mt(t.l,0,100),a:mt(t.a)}},Nl=function(t){return{h:De(t.h),s:De(t.s),l:De(t.l),a:De(t.a,3)}},Fl=function(t){return ah((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},jr=function(t){return{h:(e=oh(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},ap=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lp=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cp=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,up=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zo={string:[[function(t){var e=op.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?De(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?De(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=cp.exec(t)||up.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:$l({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=ap.exec(t)||lp.exec(t);if(!e)return null;var n,r,s=Dl({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(ip[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Fl(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 Bt(e)&&Bt(n)&&Bt(r)?$l({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(!Bt(e)||!Bt(n)||!Bt(r))return null;var o=Dl({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Fl(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Bt(e)||!Bt(n)||!Bt(r))return null;var o=(function(a){return{h:ih(a.h),s:mt(a.s,0,100),v:mt(a.v,0,100),a:mt(a.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return ah(o)},"hsv"]]},Ll=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]},hp=function(t){return typeof t=="string"?Ll(t.trim(),zo.string):typeof t=="object"&&t!==null?Ll(t,zo.object):[null,void 0]},Gi=function(t,e){var n=jr(t);return{h:n.h,s:mt(n.s+100*e,0,100),l:n.l,a:n.a}},ji=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Bl=function(t,e){var n=jr(t);return{h:n.h,s:n.s,l:mt(n.l+100*e,0,100),a:n.a}},Oo=(function(){function t(e){this.parsed=hp(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 De(ji(this.rgba),2)},t.prototype.isDark=function(){return ji(this.rgba)<.5},t.prototype.isLight=function(){return ji(this.rgba)>=.5},t.prototype.toHex=function(){return e=Ui(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?Is(De(255*i)):"","#"+Is(n)+Is(r)+Is(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return Ui(this.rgba)},t.prototype.toRgbString=function(){return e=Ui(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 Nl(jr(this.rgba))},t.prototype.toHslString=function(){return e=Nl(jr(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=oh(this.rgba),{h:De(e.h),s:De(e.s),v:De(e.v),a:De(e.a,3)};var e},t.prototype.invert=function(){return $t({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),$t(Gi(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),$t(Gi(this.rgba,-e))},t.prototype.grayscale=function(){return $t(Gi(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),$t(Bl(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),$t(Bl(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"?$t({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):De(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=jr(this.rgba);return typeof e=="number"?$t({h:e,s:n.s,l:n.l,a:n.a}):De(n.h)},t.prototype.isEqual=function(e){return this.toHex()===$t(e).toHex()},t})(),$t=function(t){return t instanceof Oo?t:new Oo(t)},Zl=[],dp=function(t){t.forEach(function(e){Zl.indexOf(e)<0&&(e(Oo,zo),Zl.push(e))})};function fp(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 _=(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));_<h&&(h=_,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"])}dp([fp]);const ar=class $r{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 $r)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]=$r._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=$r.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=$t(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 $r||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}};ar.shared=new ar;ar._temp=new ar;ar.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Wt=ar;const pp={cullArea:null,cullable:!1,cullableChildren:!0};let Vi=0;const Ul=500;function ht(...t){Vi!==Ul&&(Vi++,Vi===Ul?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const ya={_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 mp{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 gp{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 mp(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 it=new gp;ya.register(it);const _p={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){ge("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function yp(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 xp={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)}yp(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||ge(je,"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)}},bp={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 Gl{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 vp{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 it.get(r.maskClass,e)}return e}returnMaskEffect(e){it.return(e)}}const $o=new vp;dt.handleByList(fe.MaskEffect,$o._effectClasses);const wp={_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),$o.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=$o.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 Gl);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 Gl),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},kp={label:null,get name(){return ge(je,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){ge(je,"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}},qe=it.getPool(te),Vt=it.getPool(It),Sp=new te,Tp={getFastGlobalBounds(t,e){e||(e=new It),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=Vt.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(Sp).invert()),e.addBounds(r),Vt.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),Vt.return(r))}};function lh(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=qe.get().identity(),r=xa(t,s)):r=te.IDENTITY,ch(t,n,r,e),s&&qe.return(s),n.isValid||n.set(0,0,0,0),n}function ch(t,e,n,r){var a,l;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=qe.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=Vt.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++)ch(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,te.IDENTITY),Vt.return(e)}r||qe.return(s)}function xa(t,e){const n=t.parent;return n&&(xa(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function uh(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 jl=16777215;function Vl(t,e){return t===jl?e:e===jl?t:uh(t,e)}function Ws(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const Ap={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 te,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=xa(this,qe.get().identity());return t.appendFrom(this.localTransform,n),qe.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?Ws(this.renderGroup.worldColor):this.parentRenderGroup?Ws(Vl(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=Vl(e,n.localColor),n=n.parent;return Ws(e)}};function hh(t,e,n){return e.clear(),n||(n=te.IDENTITY),dh(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function dh(t,e,n,r,s){var l,c;let i;if(s)i=qe.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=qe.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=Vt.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++)dh(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,te.IDENTITY),Vt.return(e)}qe.return(i)}function fh(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&&fh(s,e)}return e.didChange}const Cp=new te,Ep={_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 It});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),fh(this,t),t.didChange&&hh(this,t.localBounds,Cp),t.localBounds},getBounds(t,e){return lh(this,t,e||new It)}},Ip={_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}},Pp={_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(Mp))}};function Mp(t,e){return t._zIndex-e._zIndex}const Rp={getGlobalPosition(t=new Ve,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(qe.get(),n);return e=r.apply(t,e),qe.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(qe.get(),r);return n=s.applyInverse(t,n),qe.return(s),n}};class ba{constructor(){this.uid=Pe("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 zp=0;class Op{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new nh(this.textureOptions)}createTexture(e,n,r,s){const i=new Mt({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new de({source:i,label:`texturePool_${zp++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Pl(o),a=Pl(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 ph=new Op;ya.register(ph);class $p{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new te,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 ba,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&&(ph.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 te),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new te),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 te),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 Dp(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Hi=new Ge(null),Ps=new Ge(null),Wi=new Ge(null,1,1),Ms=new Ge(null),Hl=1,Np=2,Yi=4;class qt extends mn{constructor(e={}){var n,r;super(),this.uid=Pe("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 te,this.relativeGroupTransform=new te,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ge(this,0,0),this._scale=Wi,this._pivot=Ps,this._origin=Ms,this._skew=Hi,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=[],Dp(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){ge("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),dt.mixin(qt,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||ge(je,"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=it.get($p,this),this.groupTransform=te.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),it.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 te),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*qf}set angle(e){this.rotation=e*Jf}get pivot(){return this._pivot===Ps&&(this._pivot=new Ge(this,0,0)),this._pivot}set pivot(e){this._pivot===Ps&&(this._pivot=new Ge(this,0,0),this._origin!==Ms&&ht("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===Hi&&(this._skew=new Ge(this,0,0)),this._skew}set skew(e){this._skew===Hi&&(this._skew=new Ge(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Wi&&(this._scale=new Ge(this,1,1)),this._scale}set scale(e){this._scale===Wi&&(this._scale=new Ge(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===Ms&&(this._origin=new Ge(this,0,0)),this._origin}set origin(e){this._origin===Ms&&(this._origin=new Ge(this,0,0),this._pivot!==Ps&&ht("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||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1: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|=Hl,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=Wt.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Hl,this._onUpdate())}get tint(){return Ws(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Np,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|=Yi,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|=Yi,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|=Yi,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}}dt.mixin(qt,xp,Tp,Rp,Ip,Ep,wp,kp,Pp,pp,_p,Ap,bp);class mh extends qt{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 It(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 Yr extends mh{constructor(e=de.EMPTY){e instanceof de&&(e={texture:e});const{texture:n=de.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 Ge({_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 de?new Yr(e):new Yr(de.from(e,n))}set texture(e){e||(e=de.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 sp(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ge("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 Fp=new It;function gh(t,e,n){const r=Fp;t.measurable=!0,lh(t,n,r),e.addBoundsMask(r),t.measurable=!1}function _h(t,e,n){const r=Vt.get();t.measurable=!0;const s=qe.get().identity(),i=yh(t,n,s);hh(t,r,i),t.measurable=!1,e.addBoundsMask(r),qe.return(s),Vt.return(r)}function yh(t,e,n){return t?(t!==e&&(yh(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(ht("Mask bounds, renderable is not inside the root container"),n)}class xh{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 Yr),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||gh(this.mask,e,n)}addLocalBounds(e,n){_h(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Yr}}xh.extension=fe.MaskEffect;class bh{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"}}bh.extension=fe.MaskEffect;class vh{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){gh(this.mask,e,n)}addLocalBounds(e,n){_h(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof qt}}vh.extension=fe.MaskEffect;const Lp={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 Wl=Lp;const xs={get(){return Wl},set(t){Wl=t}};class wh extends Mt{constructor(e){e.resource||(e.resource=xs.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"))}}wh.extension=fe.TextureSource;class qs extends Mt{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}}qs.extension=fe.TextureSource;var Do=(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))(Do||{});class Xi{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 kh=class ct{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 Xi(null,null,1/0),this.deltaMS=1/ct.targetFPMS,this.elapsedMS=1/ct.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=Do.NORMAL){return this._addListener(new Xi(e,n,r))}addOnce(e,n,r=Do.NORMAL){return this._addListener(new Xi(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*ct.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,ct.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(!ct._shared){const e=ct._shared=new ct;e.autoStart=!0,e._protected=!0}return ct._shared}static get system(){if(!ct._system){const e=ct._system=new ct;e.autoStart=!0,e._protected=!0}return ct._system}};kh.targetFPMS=.06;let Rs=kh,qi;async function Bp(){return qi??(qi=(async()=>{var o;const e=xs.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"})()),qi}const fi=class Sh extends Mt{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Sh.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=Rs.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 Bp(),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&&(Rs.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||(Rs.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Rs.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};fi.extension=fe.TextureSource;fi.defaultOptions={...Mt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};fi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zp=fi;const Vn=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class Up{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||ht(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=Vn(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&&ht("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){ht(`[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 Hn=new Up,No=[];dt.handleByList(fe.TextureSource,No);function Th(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<No.length;s++){const i=No[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Gp(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&Hn.has(r))return Hn.get(r);const i=new de({source:Th(s)});return i.on("destroy",()=>{Hn.has(r)&&Hn.remove(r)}),e||Hn.set(r,i),i}function jp(t,e=!1){return typeof t=="string"?Hn.get(t):t instanceof Mt?new de({source:t}):Gp(t,e)}de.from=jp;Mt.from=Th;dt.add(xh,bh,vh,Zp,qs,wh,_a);var Ah=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ah||{});function Tt(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function kr(t){return t.split("?")[0].split("#")[0]}function Vp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hp(t,e,n){return t.replace(new RegExp(Vp(e),"g"),n)}function Wp(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 Xr={toPosix(t){return Hp(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){Tt(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(Tt(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=kr(this.toPosix(e??xs.get().getBaseUrl())),s=kr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?Xr.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Tt(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=Wp(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return Tt(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(Tt(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(Tt(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){Tt(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){Tt(t),e&&Tt(e),t=kr(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){Tt(t),t=kr(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){Tt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=kr(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 Ch(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?Ch(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function Yp(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)}),Ch(t,s,0,n,r)}else r.push(t);return r}const Yl=t=>!Array.isArray(t);class Eh{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 Vn(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&&ht("[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)&&ht(`[Resolver] already has key: ${i} overwriting`)},Vn(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=Vn(o).map(_=>typeof _=="string"?Yp(_):Array.isArray(_)?_:[_]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=_=>{const g=this._parsers.find(x=>x.test(_));return{src:_,...g==null?void 0:g.parse(_)}};h.forEach(_=>{_.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(_=>{this._assetMap[_]=d})})}resolveBundle(e){const n=Yl(e);e=Vn(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=Yl(e);e=Vn(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=Xr.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??Xp(e.src),l!==void 0&&(e.progressSize=l),e}}Eh.RETINA_PREFIX=/@([0-9\.]+)x/;function Xp(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Xl=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},Ih=class Dr{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof Mt&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof de?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<=Dr.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:Dr.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 Ne(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?l=new Ne(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 Ne(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 Ne(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 de({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*Dr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Dr.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=[]}};Ih.BATCH_SIZE=1e3;let ql=Ih;const qp=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Ph(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=Xr.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Ph([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const Jp={extension:fe.Asset,cache:{test:t=>t instanceof ql,getCacheableAssets:(t,e)=>Ph(t,e,!1)},resolver:{extension:{type:fe.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&qp.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Eh.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:fe.LoadParser,priority:Ah.Normal,name:"spritesheetLoader"},async testParse(t,e){return Xr.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=Xr.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof de)l=r;else{const d=Xl(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new ql({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 _ of u){if(typeof _!="string")continue;let g=a+_;(f=e.data)!=null&&f.ignoreMultiPack||(g=Xl(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(_=>{_.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==_))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};dt.add(Jp);const Ji=Object.create(null),Jl=Object.create(null);function va(t,e){let n=Jl[t];return n===void 0&&(Ji[e]===void 0&&(Ji[e]=1),Jl[t]=n=Ji[e]++),n}let Zn;function Mh(){return(!Zn||Zn!=null&&Zn.isContextLost())&&(Zn=xs.get().createCanvas().getContext("webgl",{})),Zn}let zs;function Kp(){if(!zs){zs="mediump";const t=Mh();t&&t.getShaderPrecisionFormat&&(zs=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return zs}function Qp(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))),Il.add(e)};Object.defineProperties(ge,{quiet:{get:()=>Jn.quiet,set:t=>{Jn.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>Jn.noColor,set:t=>{Jn.noColor=t},enumerable:!0,configurable:!1}});const Ku=()=>{};function Pl(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 Ml(t){return!(t&t-1)&&!!t}function Qu(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Rl=Object.create(null);function np(t){const e=Rl[t];return e===void 0&&(Rl[t]=Pe("resource")),e}const eh=class th extends mn{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...th.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){ge(je,"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=np(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};eh.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let nh=eh;const rh=class sh extends mn{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Pe("textureSource"),this._resourceType="textureSource",this._resourceId=Pe("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...sh.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.alphaMode=e.alphaMode,this.style=new nh(Qu(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=Pe("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=Pe("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=Ml(this.pixelWidth)&&Ml(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};rh.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 Mt=rh;class _a extends Mt{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}}_a.extension=fe.TextureSource;const zl=new te;class rp{constructor(e,n){this.mapCoord=new te,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&&(zl.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(zl));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 de extends mn{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Pe("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ne,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new Mt,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 rp(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=he.add(c,he.NW),e.x0=f+u*he.uX(c),e.y0=d+h*he.uY(c),c=he.add(c,2),e.x1=f+u*he.uX(c),e.y1=d+h*he.uY(c),c=he.add(c,2),e.x2=f+u*he.uX(c),e.y2=d+h*he.uY(c),c=he.add(c,2),e.x3=f+u*he.uX(c),e.y3=d+h*he.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 ge(je,"Texture.baseTexture is now Texture.source"),this._source}}de.EMPTY=new de({label:"EMPTY",source:new Mt({label:"EMPTY"})});de.EMPTY.destroy=Ku;de.WHITE=new de({source:new _a({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});de.WHITE.destroy=Ku;function sp(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 Ol=new te;class It{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=Ol,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 Ne);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=Ol,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,_=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>_&&(_=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>_&&(_=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>_&&(_=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>_&&(_=x),this.minX=f,this.minY=d,this.maxX=m,this.maxY=_}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 It(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 _=n;_<r;_+=2){const g=e[_],x=e[_+1],b=c*g+h*x+d,w=u*g+f*x+m;i=b<i?b:i,o=w<o?w:o,a=b>a?b:a,l=w>l?w: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 ip={grad:.9,turn:360,rad:360/(2*Math.PI)},Bt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},De=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},mt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},ih=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},$l=function(t){return{r:mt(t.r,0,255),g:mt(t.g,0,255),b:mt(t.b,0,255),a:mt(t.a)}},Ui=function(t){return{r:De(t.r),g:De(t.g),b:De(t.b),a:De(t.a,3)}},op=/^#([0-9a-f]{3,8})$/i,Is=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},oh=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}},ah=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}},Dl=function(t){return{h:ih(t.h),s:mt(t.s,0,100),l:mt(t.l,0,100),a:mt(t.a)}},Nl=function(t){return{h:De(t.h),s:De(t.s),l:De(t.l),a:De(t.a,3)}},Fl=function(t){return ah((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},jr=function(t){return{h:(e=oh(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},ap=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lp=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cp=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,up=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zo={string:[[function(t){var e=op.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?De(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?De(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=cp.exec(t)||up.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:$l({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=ap.exec(t)||lp.exec(t);if(!e)return null;var n,r,s=Dl({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(ip[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Fl(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 Bt(e)&&Bt(n)&&Bt(r)?$l({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(!Bt(e)||!Bt(n)||!Bt(r))return null;var o=Dl({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Fl(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Bt(e)||!Bt(n)||!Bt(r))return null;var o=function(a){return{h:ih(a.h),s:mt(a.s,0,100),v:mt(a.v,0,100),a:mt(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return ah(o)},"hsv"]]},Ll=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]},hp=function(t){return typeof t=="string"?Ll(t.trim(),zo.string):typeof t=="object"&&t!==null?Ll(t,zo.object):[null,void 0]},Gi=function(t,e){var n=jr(t);return{h:n.h,s:mt(n.s+100*e,0,100),l:n.l,a:n.a}},ji=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Bl=function(t,e){var n=jr(t);return{h:n.h,s:n.s,l:mt(n.l+100*e,0,100),a:n.a}},Oo=function(){function t(e){this.parsed=hp(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 De(ji(this.rgba),2)},t.prototype.isDark=function(){return ji(this.rgba)<.5},t.prototype.isLight=function(){return ji(this.rgba)>=.5},t.prototype.toHex=function(){return e=Ui(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?Is(De(255*i)):"","#"+Is(n)+Is(r)+Is(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return Ui(this.rgba)},t.prototype.toRgbString=function(){return e=Ui(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 Nl(jr(this.rgba))},t.prototype.toHslString=function(){return e=Nl(jr(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=oh(this.rgba),{h:De(e.h),s:De(e.s),v:De(e.v),a:De(e.a,3)};var e},t.prototype.invert=function(){return $t({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),$t(Gi(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),$t(Gi(this.rgba,-e))},t.prototype.grayscale=function(){return $t(Gi(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),$t(Bl(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),$t(Bl(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"?$t({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):De(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=jr(this.rgba);return typeof e=="number"?$t({h:e,s:n.s,l:n.l,a:n.a}):De(n.h)},t.prototype.isEqual=function(e){return this.toHex()===$t(e).toHex()},t}(),$t=function(t){return t instanceof Oo?t:new Oo(t)},Zl=[],dp=function(t){t.forEach(function(e){Zl.indexOf(e)<0&&(e(Oo,zo),Zl.push(e))})};function fp(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 _=(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));_<h&&(h=_,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"])}dp([fp]);const ar=class $r{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 $r)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]=$r._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=$r.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=$t(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 $r||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}};ar.shared=new ar;ar._temp=new ar;ar.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Wt=ar;const pp={cullArea:null,cullable:!1,cullableChildren:!0};let Vi=0;const Ul=500;function ht(...t){Vi!==Ul&&(Vi++,Vi===Ul?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const ya={_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 mp{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 gp{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 mp(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 it=new gp;ya.register(it);const _p={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){ge("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function yp(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 xp={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)}yp(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||ge(je,"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)}},bp={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 Gl{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 vp{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 it.get(r.maskClass,e)}return e}returnMaskEffect(e){it.return(e)}}const $o=new vp;dt.handleByList(fe.MaskEffect,$o._effectClasses);const wp={_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),$o.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=$o.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 Gl);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 Gl),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},kp={label:null,get name(){return ge(je,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){ge(je,"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}},qe=it.getPool(te),Vt=it.getPool(It),Sp=new te,Tp={getFastGlobalBounds(t,e){e||(e=new It),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=Vt.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(Sp).invert()),e.addBounds(r),Vt.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),Vt.return(r))}};function lh(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=qe.get().identity(),r=xa(t,s)):r=te.IDENTITY,ch(t,n,r,e),s&&qe.return(s),n.isValid||n.set(0,0,0,0),n}function ch(t,e,n,r){var a,l;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=qe.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=Vt.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++)ch(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,te.IDENTITY),Vt.return(e)}r||qe.return(s)}function xa(t,e){const n=t.parent;return n&&(xa(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function uh(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 jl=16777215;function Vl(t,e){return t===jl?e:e===jl?t:uh(t,e)}function Ws(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const Ap={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 te,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=xa(this,qe.get().identity());return t.appendFrom(this.localTransform,n),qe.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?Ws(this.renderGroup.worldColor):this.parentRenderGroup?Ws(Vl(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=Vl(e,n.localColor),n=n.parent;return Ws(e)}};function hh(t,e,n){return e.clear(),n||(n=te.IDENTITY),dh(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function dh(t,e,n,r,s){var l,c;let i;if(s)i=qe.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=qe.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=Vt.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++)dh(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,te.IDENTITY),Vt.return(e)}qe.return(i)}function fh(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&&fh(s,e)}return e.didChange}const Cp=new te,Ep={_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 It});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),fh(this,t),t.didChange&&hh(this,t.localBounds,Cp),t.localBounds},getBounds(t,e){return lh(this,t,e||new It)}},Ip={_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}},Pp={_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(Mp))}};function Mp(t,e){return t._zIndex-e._zIndex}const Rp={getGlobalPosition(t=new Ve,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(qe.get(),n);return e=r.apply(t,e),qe.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(qe.get(),r);return n=s.applyInverse(t,n),qe.return(s),n}};class ba{constructor(){this.uid=Pe("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 zp=0;class Op{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new nh(this.textureOptions)}createTexture(e,n,r,s){const i=new Mt({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new de({source:i,label:`texturePool_${zp++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Pl(o),a=Pl(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 ph=new Op;ya.register(ph);class $p{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new te,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 ba,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&&(ph.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 te),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new te),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 te),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 Dp(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Hi=new Ge(null),Ps=new Ge(null),Wi=new Ge(null,1,1),Ms=new Ge(null),Hl=1,Np=2,Yi=4;class qt extends mn{constructor(e={}){var n,r;super(),this.uid=Pe("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 te,this.relativeGroupTransform=new te,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ge(this,0,0),this._scale=Wi,this._pivot=Ps,this._origin=Ms,this._skew=Hi,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=[],Dp(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){ge("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),dt.mixin(qt,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||ge(je,"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=it.get($p,this),this.groupTransform=te.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),it.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 te),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*qf}set angle(e){this.rotation=e*Jf}get pivot(){return this._pivot===Ps&&(this._pivot=new Ge(this,0,0)),this._pivot}set pivot(e){this._pivot===Ps&&(this._pivot=new Ge(this,0,0),this._origin!==Ms&&ht("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===Hi&&(this._skew=new Ge(this,0,0)),this._skew}set skew(e){this._skew===Hi&&(this._skew=new Ge(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Wi&&(this._scale=new Ge(this,1,1)),this._scale}set scale(e){this._scale===Wi&&(this._scale=new Ge(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===Ms&&(this._origin=new Ge(this,0,0)),this._origin}set origin(e){this._origin===Ms&&(this._origin=new Ge(this,0,0),this._pivot!==Ps&&ht("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||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1: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|=Hl,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=Wt.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Hl,this._onUpdate())}get tint(){return Ws(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Np,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|=Yi,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|=Yi,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|=Yi,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}}dt.mixin(qt,xp,Tp,Rp,Ip,Ep,wp,kp,Pp,pp,_p,Ap,bp);class mh extends qt{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 It(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 Yr extends mh{constructor(e=de.EMPTY){e instanceof de&&(e={texture:e});const{texture:n=de.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 Ge({_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 de?new Yr(e):new Yr(de.from(e,n))}set texture(e){e||(e=de.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 sp(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ge("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 Fp=new It;function gh(t,e,n){const r=Fp;t.measurable=!0,lh(t,n,r),e.addBoundsMask(r),t.measurable=!1}function _h(t,e,n){const r=Vt.get();t.measurable=!0;const s=qe.get().identity(),i=yh(t,n,s);hh(t,r,i),t.measurable=!1,e.addBoundsMask(r),qe.return(s),Vt.return(r)}function yh(t,e,n){return t?(t!==e&&(yh(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(ht("Mask bounds, renderable is not inside the root container"),n)}class xh{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 Yr),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||gh(this.mask,e,n)}addLocalBounds(e,n){_h(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Yr}}xh.extension=fe.MaskEffect;class bh{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"}}bh.extension=fe.MaskEffect;class vh{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){gh(this.mask,e,n)}addLocalBounds(e,n){_h(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof qt}}vh.extension=fe.MaskEffect;const Lp={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 Wl=Lp;const xs={get(){return Wl},set(t){Wl=t}};class wh extends Mt{constructor(e){e.resource||(e.resource=xs.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"))}}wh.extension=fe.TextureSource;class qs extends Mt{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}}qs.extension=fe.TextureSource;var Do=(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))(Do||{});class Xi{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 kh=class ct{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 Xi(null,null,1/0),this.deltaMS=1/ct.targetFPMS,this.elapsedMS=1/ct.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=Do.NORMAL){return this._addListener(new Xi(e,n,r))}addOnce(e,n,r=Do.NORMAL){return this._addListener(new Xi(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*ct.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,ct.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(!ct._shared){const e=ct._shared=new ct;e.autoStart=!0,e._protected=!0}return ct._shared}static get system(){if(!ct._system){const e=ct._system=new ct;e.autoStart=!0,e._protected=!0}return ct._system}};kh.targetFPMS=.06;let Rs=kh,qi;async function Bp(){return qi??(qi=(async()=>{var o;const e=xs.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"})()),qi}const fi=class Sh extends Mt{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Sh.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=Rs.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 Bp(),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&&(Rs.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||(Rs.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Rs.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};fi.extension=fe.TextureSource;fi.defaultOptions={...Mt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};fi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zp=fi;const Vn=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class Up{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||ht(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=Vn(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&&ht("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){ht(`[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 Hn=new Up,No=[];dt.handleByList(fe.TextureSource,No);function Th(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<No.length;s++){const i=No[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Gp(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&Hn.has(r))return Hn.get(r);const i=new de({source:Th(s)});return i.on("destroy",()=>{Hn.has(r)&&Hn.remove(r)}),e||Hn.set(r,i),i}function jp(t,e=!1){return typeof t=="string"?Hn.get(t):t instanceof Mt?new de({source:t}):Gp(t,e)}de.from=jp;Mt.from=Th;dt.add(xh,bh,vh,Zp,qs,wh,_a);var Ah=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ah||{});function Tt(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function kr(t){return t.split("?")[0].split("#")[0]}function Vp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hp(t,e,n){return t.replace(new RegExp(Vp(e),"g"),n)}function Wp(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 Xr={toPosix(t){return Hp(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){Tt(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(Tt(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=kr(this.toPosix(e??xs.get().getBaseUrl())),s=kr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?Xr.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Tt(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=Wp(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return Tt(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(Tt(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(Tt(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){Tt(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){Tt(t),e&&Tt(e),t=kr(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){Tt(t),t=kr(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){Tt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=kr(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 Ch(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?Ch(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function Yp(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)}),Ch(t,s,0,n,r)}else r.push(t);return r}const Yl=t=>!Array.isArray(t);class Eh{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 Vn(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&&ht("[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)&&ht(`[Resolver] already has key: ${i} overwriting`)},Vn(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=Vn(o).map(_=>typeof _=="string"?Yp(_):Array.isArray(_)?_:[_]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=_=>{const g=this._parsers.find(x=>x.test(_));return{src:_,...g==null?void 0:g.parse(_)}};h.forEach(_=>{_.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(_=>{this._assetMap[_]=d})})}resolveBundle(e){const n=Yl(e);e=Vn(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=Yl(e);e=Vn(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=Xr.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??Xp(e.src),l!==void 0&&(e.progressSize=l),e}}Eh.RETINA_PREFIX=/@([0-9\.]+)x/;function Xp(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Xl=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},Ih=class Dr{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof Mt&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof de?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<=Dr.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:Dr.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 Ne(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?l=new Ne(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 Ne(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 Ne(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 de({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*Dr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Dr.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=[]}};Ih.BATCH_SIZE=1e3;let ql=Ih;const qp=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Ph(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=Xr.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Ph([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const Jp={extension:fe.Asset,cache:{test:t=>t instanceof ql,getCacheableAssets:(t,e)=>Ph(t,e,!1)},resolver:{extension:{type:fe.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&qp.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Eh.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:fe.LoadParser,priority:Ah.Normal,name:"spritesheetLoader"},async testParse(t,e){return Xr.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=Xr.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof de)l=r;else{const d=Xl(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new ql({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 _ of u){if(typeof _!="string")continue;let g=a+_;(f=e.data)!=null&&f.ignoreMultiPack||(g=Xl(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(_=>{_.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==_))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};dt.add(Jp);const Ji=Object.create(null),Jl=Object.create(null);function va(t,e){let n=Jl[t];return n===void 0&&(Ji[e]===void 0&&(Ji[e]=1),Jl[t]=n=Ji[e]++),n}let Zn;function Mh(){return(!Zn||Zn!=null&&Zn.isContextLost())&&(Zn=xs.get().createCanvas().getContext("webgl",{})),Zn}let zs;function Kp(){if(!zs){zs="mediump";const t=Mh();t&&t.getShaderPrecisionFormat&&(zs=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return zs}function Qp(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
|
|
@@ -22,7 +22,7 @@ ${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replac
|
|
|
22
22
|
${t}`:t}const nm={},rm={};function sm(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-"),e+=n?"-fragment":"-vertex";const r=n?nm:rm;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
|
|
23
23
|
${t}`}function im(t,e){return e?t.replace("#version 300 es",""):t}const Ki={stripVersion:im,ensurePrecision:em,addProgramDefines:Qp,setProgramName:sm,insertVersion:tm},Sr=Object.create(null),Rh=class Fo{constructor(e){e={...Fo.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Kp()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(Ki).forEach(o=>{const a=r[o];s=Ki[o](s,a,!0),i=Ki[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=va(`${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,Sr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return Sr[n]||(Sr[n]=new Fo(e),Sr[n]._cacheKey=n),Sr[n]}};Rh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let zh=Rh;const Kl={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 om(t){return Kl[t]??Kl.float32}const am={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"},Ql=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function ec(t,e){let n;for(;(n=Ql.exec(t))!==null;){const r=am[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:om(r).stride,offset:0,instance:!1,start:0}}Ql.lastIndex=0}function lm(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function cm({source:t,entryPoint:e}){const n={},r=lm(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(ec(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&&ec(u[1],n)}}return n}function Qi(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],_=d.match(a).reduce((g,x)=>{const[b,w]=x.split(":");return g[b.trim()]=w.trim(),g},{});return _?{name:m,members:_}:null}).filter(({name:d})=>c.some(m=>m.type===d||m.type.includes(`<${d}>`))))??[];return{groups:c,structs:u}}var An=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(An||{});function um({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:An.VERTEX|An.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:An.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:An.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:An.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:An.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function hm({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 dm(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 Tr=Object.create(null);class pi{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=Qi(n.source);this.structsAndGroups=c}else{const c=Qi(r.source),u=Qi(n.source);this.structsAndGroups=dm(c,u)}this.layout=s??hm(this.structsAndGroups),this.gpuLayout=i??um(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=va(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=cm(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Tr[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Tr[n]||(Tr[n]=new pi(e),Tr[n]._cacheKey=n),Tr[n]}}const Oh=["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>"],fm=Oh.reduce((t,e)=>(t[e]=!0,t),{});function pm(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 $h=class Dh{constructor(e,n){this._touched=0,this.uid=Pe("uniform"),this._resourceType="uniformGroup",this._resourceId=Pe("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...Dh.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,!fm[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: ${Oh.join(", ")}`)}i.value??(i.value=pm(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=va(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};$h.defaultOptions={ubo:!1,isStatic:!1};let Nh=$h;class Ys{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 Lo=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Lo||{});class wa extends mn{constructor(e){super(),this.uid=Pe("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|=Lo.WEBGPU),r&&(o|=Lo.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 Ys,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 Nh(f));const d=l[h];d&&(s[d.group]||(s[d.group]=new Ys,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 Ys,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=pi.from(n)),r&&(o=zh.from(r)),new wa({gpuProgram:i,glProgram:o,...s})}}const mm={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},eo=0,to=1,no=2,ro=3,so=4,io=5,Bo=class Fh{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<eo)}set blend(e){!!(this.data&1<<eo)!==e&&(this.data^=1<<eo)}get offsets(){return!!(this.data&1<<to)}set offsets(e){!!(this.data&1<<to)!==e&&(this.data^=1<<to)}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<<no)}set culling(e){!!(this.data&1<<no)!==e&&(this.data^=1<<no)}get depthTest(){return!!(this.data&1<<ro)}set depthTest(e){!!(this.data&1<<ro)!==e&&(this.data^=1<<ro)}get depthMask(){return!!(this.data&1<<io)}set depthMask(e){!!(this.data&1<<io)!==e&&(this.data^=1<<io)}get clockwiseFrontFace(){return!!(this.data&1<<so)}set clockwiseFrontFace(e){!!(this.data&1<<so)!==e&&(this.data^=1<<so)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=mm[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 Fh;return e.depthTest=!1,e.blend=!0,e}};Bo.default2d=Bo.for2d();let Lh=Bo;function tc(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;let i=Bh(t,0,s,n,!0);const o=[];if(!i||i.next===i.prev)return o;let a,l,c;if(r&&(i=bm(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 qr(i,o,n,a,l,c,0),o}function Bh(t,e,n,r,s){let i;if(s===Mm(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=nc(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=nc(o/r|0,t[o],t[o+1],i);return i&&lr(i,i.next)&&(Kr(i),i=i.next),i}function Mn(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(lr(n,n.next)||Se(n.prev,n,n.next)===0)){if(Kr(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function qr(t,e,n,r,s,i,o){if(!t)return;!o&&i&&Tm(t,r,s,i);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(i?_m(t,r,s,i):gm(t)){e.push(l.i,t.i,c.i),Kr(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=ym(Mn(t),e),qr(t,e,n,r,s,i,2)):o===2&&xm(t,e,n,r,s,i):qr(Mn(t),e,n,r,s,i,1);break}}}function gm(t){const e=t.prev,n=t,r=t.next;if(Se(e,n,r)>=0)return!1;const 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&&Nr(s,a,i,l,o,c,m.x,m.y)&&Se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function _m(t,e,n,r){const s=t.prev,i=t,o=t.next;if(Se(s,i,o)>=0)return!1;const 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),_=Math.max(a,l,c),g=Math.max(u,h,f),x=Zo(d,m,e,n,r),b=Zo(_,g,e,n,r);let w=t.prevZ,k=t.nextZ;for(;w&&w.z>=x&&k&&k.z<=b;){if(w.x>=d&&w.x<=_&&w.y>=m&&w.y<=g&&w!==s&&w!==o&&Nr(a,u,l,h,c,f,w.x,w.y)&&Se(w.prev,w,w.next)>=0||(w=w.prevZ,k.x>=d&&k.x<=_&&k.y>=m&&k.y<=g&&k!==s&&k!==o&&Nr(a,u,l,h,c,f,k.x,k.y)&&Se(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;w&&w.z>=x;){if(w.x>=d&&w.x<=_&&w.y>=m&&w.y<=g&&w!==s&&w!==o&&Nr(a,u,l,h,c,f,w.x,w.y)&&Se(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;k&&k.z<=b;){if(k.x>=d&&k.x<=_&&k.y>=m&&k.y<=g&&k!==s&&k!==o&&Nr(a,u,l,h,c,f,k.x,k.y)&&Se(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function ym(t,e){let n=t;do{const r=n.prev,s=n.next.next;!lr(r,s)&&Uh(r,n,n.next,s)&&Jr(r,s)&&Jr(s,r)&&(e.push(r.i,n.i,s.i),Kr(n),Kr(n.next),n=t=s),n=n.next}while(n!==t);return Mn(n)}function xm(t,e,n,r,s,i){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Em(o,a)){let l=Gh(o,a);o=Mn(o,o.next),l=Mn(l,l.next),qr(o,e,n,r,s,i,0),qr(l,e,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==t)}function bm(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=Bh(t,a,l,r,!1);c===c.next&&(c.steiner=!0),s.push(Cm(c))}s.sort(vm);for(let i=0;i<s.length;i++)n=wm(s[i],n);return n}function vm(t,e){let n=t.x-e.x;if(n===0&&(n=t.y-e.y,n===0)){const r=(t.next.y-t.y)/(t.next.x-t.x),s=(e.next.y-e.y)/(e.next.x-e.x);n=r-s}return n}function wm(t,e){const n=km(t,e);if(!n)return e;const r=Gh(n,t);return Mn(r,r.next),Mn(n,n.next)}function km(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(lr(t,n))return n;do{if(lr(t,n.next))return n.next;if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const h=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,o=n.x<n.next.x?n:n.next,h===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&Zh(s<c?r:i,s,l,c,s<c?i:r,s,n.x,n.y)){const h=Math.abs(s-n.y)/(r-n.x);Jr(n,t)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&Sm(o,n)))&&(o=n,u=h)}n=n.next}while(n!==a);return o}function Sm(t,e){return Se(t.prev,t,e.prev)<0&&Se(e.next,t,t.next)<0}function Tm(t,e,n,r){let s=t;do s.z===0&&(s.z=Zo(s.x,s.y,e,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,Am(s)}function Am(t){let e,n=1;do{let r=t,s;t=null;let i=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<n&&(a++,o=o.nextZ,!!o);c++);let l=n;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(s=r,r=r.nextZ,a--):(s=o,o=o.nextZ,l--),i?i.nextZ=s:t=s,s.prevZ=i,i=s;r=o}i.nextZ=null,n*=2}while(e>1);return t}function Zo(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 Cm(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 Zh(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 Nr(t,e,n,r,s,i,o,a){return!(t===o&&e===a)&&Zh(t,e,n,r,s,i,o,a)}function Em(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Im(t,e)&&(Jr(t,e)&&Jr(e,t)&&Pm(t,e)&&(Se(t.prev,t,e.prev)||Se(t,e.prev,e))||lr(t,e)&&Se(t.prev,t,t.next)>0&&Se(e.prev,e,e.next)>0)}function Se(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function lr(t,e){return t.x===e.x&&t.y===e.y}function Uh(t,e,n,r){const s=$s(Se(t,e,n)),i=$s(Se(t,e,r)),o=$s(Se(n,r,t)),a=$s(Se(n,r,e));return!!(s!==i&&o!==a||s===0&&Os(t,n,e)||i===0&&Os(t,r,e)||o===0&&Os(n,t,r)||a===0&&Os(n,e,r))}function Os(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 $s(t){return t>0?1:t<0?-1:0}function Im(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Uh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Jr(t,e){return Se(t.prev,t,t.next)<0?Se(t,e,t.next)>=0&&Se(t,t.prev,e)>=0:Se(t,e,t.prev)<0||Se(t,t.next,e)<0}function Pm(t,e){let n=t,r=!1;const s=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function Gh(t,e){const n=Uo(t.i,t.x,t.y),r=Uo(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 nc(t,e,n,r){const s=Uo(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 Kr(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)}function Uo(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Mm(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 Rm=tc.default||tc;var oo,rc;function zm(){if(rc)return oo;rc=1,oo=n;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},e=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(i){var o=[];return i.replace(e,function(a,l,c){var u=l.toLowerCase();for(c=s(c),u=="m"&&c.length>2&&(o.push([l].concat(c.splice(0,2))),u="l",l=l=="m"?"l":"L");;){if(c.length==t[u])return c.unshift(l),o.push(c);if(c.length<t[u])throw new Error("malformed path data");o.push([l].concat(c.splice(0,t[u])))}}),o}var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function s(i){var o=i.match(r);return o?o.map(Number):[]}return oo}var Om=zm();const $m=ga(Om);function Dm(t,e){const n=$m(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:ht(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class ka{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new ka(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 Ne),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 Sa{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 Sa(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,_=d*d/(c*c)+m*m/(u*u),g=d*d/(h*h)+m*m/(f*f);return _>1&&g<=1}getBounds(e){return e||(e=new Ne),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 Nm(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 _=t-d,g=e-m;return _*_+g*g}let Fm,Lm;class Vr{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(Fm),r=e.getBounds(Lm);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 Vr(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],_=Nm(e,n,h,f,d,m),g=Math.sign((d-h)*(n-f)-(m-f)*(e-h));if(_<=(g<0?a:o))return!0}return!1}getBounds(e){e||(e=new Ne);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 ge("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return ge("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 Ds=(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 Ta{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 Ne),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new Ta(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,_=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+_||(n>=o-u&&n<=o+h||n>=x-h&&n<=x+u)&&e>=f&&e<=f+m?!0:e<f&&n<d&&Ds(e,n,f,d,c,h,u)||e>g-c&&n<d&&Ds(e,n,g-c,d,c,h,u)||e>g-c&&n>x-c&&Ds(e,n,g-c,x-c,c,h,u)||e<f&&n>x-c&&Ds(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 jh={};function Bm(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 jh[r]||Zm(t,e,r,n)}function Zm(t,e,n,r){const s={};let i=0;for(let a=0;a<r;a++){const l=a<e?t[a]:de.EMPTY.source;s[i++]=l.source,s[i++]=l.style}const o=new Ys(s);return jh[n]=o,o}class sc{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 ic(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 Um={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function oc(t,e){return e.alphaMode==="no-premultiply-alpha"&&Um[t]||t}const Gm=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
24
|
`);function jm(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 Vm(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=Gm.replace(/%forloop%/gi,jm(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 Un=null;function Hm(){var e;if(Un)return Un;const t=Mh();return Un=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Un=Vm(Un,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),Un}class Wm{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 Ym{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Wm,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 Hr=[];let Js=0;ya.register({clear:()=>{if(Hr.length>0)for(const t of Hr)t&&t.destroy();Hr.length=0,Js=0}});function ac(){return Js>0?Hr[--Js]:new Ym}function lc(t){t.elements=null,Hr[Js++]=t}let Ar=0;const Vh=class Hh{constructor(e){this.uid=Pe("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Hh.defaultOptions,...e},e.maxTextures||(ge("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=Hm());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new sc(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++)lc(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=ac(),s=r.textures;s.clear();const i=n[this.elementStart];let o=oc(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 _=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const x=n[g];n[g]=null;const w=x.texture._source,k=oc(x.blendMode,w),I=o!==k||a!==x.topology;if(w._batchTick===Ar&&!I){x._textureId=w._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}w._batchTick=Ar,(s.count>=_||I)&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),d="renderBatch",f=h,o=k,a=x.topology,r=ac(),s=r.textures,s.clear(),m=[],++Ar),x._textureId=w._textureBindLocation=s.count,s.ids[w.uid]=s.count,s.textures[s.count++]=w,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,++Ar),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,++Ar,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 sc(n);ic(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 ic(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++)lc(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}}};Vh.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Xm=Vh;var nt=(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))(nt||{});class Qr extends mn{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=Pe("buffer"),this._resourceType="buffer",this._resourceId=Pe("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&nt.STATIC)}set static(e){e?this.descriptor.usage|=nt.STATIC:this.descriptor.usage&=~nt.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=Pe("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 Wh(t,e){if(!(t instanceof Qr)){let n=e?nt.INDEX:nt.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=nt.INDEX|nt.COPY_DST):(t=new Float32Array(t),n=nt.VERTEX|nt.COPY_DST)),t=new Qr({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function qm(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||8)/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 Jm(t){return(t instanceof Qr||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Wh(t.buffer,!1),t}class Km extends mn{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Pe("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new It,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=Jm(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=Wh(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,qm(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 Qm=new Float32Array(1),eg=new Uint32Array(1);class tg extends Km{constructor(){const n=new Qr({data:Qm,label:"attribute-batch-buffer",usage:nt.VERTEX|nt.COPY_DST,shrinkToFit:!1}),r=new Qr({data:eg,label:"index-batch-buffer",usage:nt.INDEX|nt.COPY_DST,shrinkToFit:!1}),s=24;super({attributes:{aPosition:{buffer:n,format:"float32x2",stride:s,offset:0},aUV:{buffer:n,format:"float32x2",stride:s,offset:8},aColor:{buffer:n,format:"unorm8x4",stride:s,offset:16},aTextureIdAndRound:{buffer:n,format:"uint16x2",stride:s,offset:20}},indexBuffer:r})}}function cc(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 ht(`${r} placement hook does not exist in shader`)}}const ng=/\{\{(.*?)\}\}/g;function uc(t){var r;const e={};return(((r=t.match(ng))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function hc(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function dc(t,e,n=!1){const r=[];hc(e,r),t.forEach(a=>{a.header&&hc(a.header,r)});const s=r;n&&s.sort();const i=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
25
|
+
else `),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function Vm(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=Gm.replace(/%forloop%/gi,jm(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 Un=null;function Hm(){var e;if(Un)return Un;const t=Mh();return Un=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Un=Vm(Un,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),Un}class Wm{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 Ym{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Wm,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 Hr=[];let Js=0;ya.register({clear:()=>{if(Hr.length>0)for(const t of Hr)t&&t.destroy();Hr.length=0,Js=0}});function ac(){return Js>0?Hr[--Js]:new Ym}function lc(t){t.elements=null,Hr[Js++]=t}let Ar=0;const Vh=class Hh{constructor(e){this.uid=Pe("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Hh.defaultOptions,...e},e.maxTextures||(ge("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=Hm());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new sc(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++)lc(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=ac(),s=r.textures;s.clear();const i=n[this.elementStart];let o=oc(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 _=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const x=n[g];n[g]=null;const w=x.texture._source,k=oc(x.blendMode,w),I=o!==k||a!==x.topology;if(w._batchTick===Ar&&!I){x._textureId=w._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}w._batchTick=Ar,(s.count>=_||I)&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),d="renderBatch",f=h,o=k,a=x.topology,r=ac(),s=r.textures,s.clear(),m=[],++Ar),x._textureId=w._textureBindLocation=s.count,s.ids[w.uid]=s.count,s.textures[s.count++]=w,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,++Ar),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,++Ar,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 sc(n);ic(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 ic(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++)lc(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}}};Vh.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Xm=Vh;var nt=(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))(nt||{});class Qr extends mn{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=Pe("buffer"),this._resourceType="buffer",this._resourceId=Pe("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&nt.STATIC)}set static(e){e?this.descriptor.usage|=nt.STATIC:this.descriptor.usage&=~nt.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=Pe("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 Wh(t,e){if(!(t instanceof Qr)){let n=e?nt.INDEX:nt.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=nt.INDEX|nt.COPY_DST):(t=new Float32Array(t),n=nt.VERTEX|nt.COPY_DST)),t=new Qr({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function qm(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 Jm(t){return(t instanceof Qr||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Wh(t.buffer,!1),t}class Km extends mn{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Pe("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new It,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=Jm(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=Wh(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,qm(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 Qm=new Float32Array(1),eg=new Uint32Array(1);class tg extends Km{constructor(){const n=new Qr({data:Qm,label:"attribute-batch-buffer",usage:nt.VERTEX|nt.COPY_DST,shrinkToFit:!1}),r=new Qr({data:eg,label:"index-batch-buffer",usage:nt.INDEX|nt.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 cc(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 ht(`${r} placement hook does not exist in shader`)}}const ng=/\{\{(.*?)\}\}/g;function uc(t){var r;const e={};return(((r=t.match(ng))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function hc(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function dc(t,e,n=!1){const r=[];hc(e,r),t.forEach(a=>{a.header&&hc(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
28
|
`),o}function fc(t,e){let n;const r=/@out\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function rg(t){const n=/\b(\w+)\s*:/g.exec(t);return n?n[1]:""}function sg(t){const e=/@.*?\s+/g;return t.replace(e,"")}function ig(t,e){const n=[];fc(e,n),t.forEach(l=>{l.header&&fc(l.header,n)});let r=0;const s=n.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
@@ -295,7 +295,7 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
295
295
|
${t}</tr>
|
|
296
296
|
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
297
297
|
`}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>${Nt(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=hu(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+Nt(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=hu(t);if(s===null)return Nt(n);t=s;let i=`<img src="${t}" alt="${Nt(n)}"`;return e&&(i+=` title="${Nt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Nt(t.text)}},Va=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}},Et=class la{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||On,this.options.renderer=this.options.renderer||new ai,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Va}static parse(e,n){return new la(n).parse(e)}static parseInline(e,n){return new la(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}},Hs,Ur=(Hs=class{constructor(t){K(this,"options");K(this,"block");this.options=t||On}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?Ct.lex:Ct.lexInline}provideParser(t=this.block){return t?Et.parse:Et.parseInline}},K(Hs,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(Hs,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Hs),Sx=class{constructor(...t){K(this,"defaults",Na());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",Et);K(this,"Renderer",ai);K(this,"TextRenderer",Va);K(this,"Lexer",Ct);K(this,"Tokenizer",oi);K(this,"Hooks",Ur);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 ai(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 oi(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 Ur;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];Ur.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&Ur.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 Ct.lex(t,e??this.defaults)}parser(t,e){return Et.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?Ct.lex:Ct.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?Et.parse:Et.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?Ct.lex:Ct.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?Et.parse:Et.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+=`
|
|
298
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Nt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},zn=new Sx;function le(t,e){return zn.parse(t,e)}le.options=le.setOptions=function(t){return zn.setOptions(t),le.defaults=zn.defaults,pd(le.defaults),le};le.getDefaults=Na;le.defaults=On;le.use=function(...t){return zn.use(...t),le.defaults=zn.defaults,pd(le.defaults),le};le.walkTokens=function(t,e){return zn.walkTokens(t,e)};le.parseInline=zn.parseInline;le.Parser=Et;le.parser=Et.parse;le.Renderer=ai;le.TextRenderer=Va;le.Lexer=Ct;le.lexer=Ct.lex;le.Tokenizer=oi;le.Hooks=Ur;le.parse=le;le.options;le.setOptions;le.use;le.walkTokens;le.parseInline;Et.parse;Ct.lex;le.setOptions({gfm:!0,breaks:!0,async:!1});const Tx="agent-play-preview-chat-display-v1",Sd={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function xo(t,e,n){return Math.min(n,Math.max(e,t))}function Ax(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 pu={...Sd};function Cx(t){return{fontSizePx:xo(Math.round(t.fontSizePx),5,18),panelWidthPx:xo(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:xo(Math.round(t.scrollMaxHeightPx),24,200)}}function Ex(){const t=Ax(typeof localStorage<"u"?localStorage.getItem(Tx):null),e={...Sd,...t};return pu=Cx(e),{...pu}}typeof localStorage<"u"&&Ex();var Zs={exports:{}},bo,mu;function Ix(){if(mu)return bo;mu=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;bo=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 bo}var vo,gu;function Px(){if(gu)return vo;gu=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=Ix(),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,_;function g(...x){if(!g.enabled)return;const b=g,w=Number(new Date),k=w-(f||w);b.diff=k,b.prev=f,b.curr=w,f=w,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,(C,j)=>{if(C==="%%")return"%";I++;const W=r.formatters[j];if(typeof W=="function"){const O=x[I];C=W.call(b,O),x.splice(I,1),I--}return C}),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,_=r.enabled(h)),_),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,_=-1,g=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(_=m,g=d,m++):(d++,m++);else if(_!==-1)m=_+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 vo=t,vo}var _u;function Mx(){return _u||(_u=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=Px()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Zs,Zs.exports)),Zs.exports}var Rx=Mx();const zx=ga(Rx);function Ox(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function $x(){try{if(typeof Zu=="function")return Zu()}catch{}return Ox()}function Td(){try{const t=So==null?void 0:So();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function ca(t){const e=Td();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Ad={get disabled(){return $x()||Td().NODE_ENV==="test"?!0:ca("OPENAI_AGENTS_DISABLE_TRACING")}},yu={get dontLogModelData(){return ca("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return ca("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Ha(t="openai-agents"){return{namespace:t,debug:zx(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return yu.dontLogModelData},get dontLogToolData(){return yu.dontLogToolData}}}const me=Ha("openai-agents:core");function T(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 tr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Cd extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Ed={};function fn(t){return Ed}function Id(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 ua(t,e){return typeof e=="bigint"?e.toString():e}function xi(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Wa(t){return t==null}function Ya(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Dx(t,e){const n=(t.toString().split(".")[1]||"").length,r=e.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(s=Number.parseInt(l[1]))}const i=n>s?n:s,o=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return o%a/10**i}const xu=Symbol("evaluating");function Q(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==xu)return r===void 0&&(r=xu,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function $n(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gn(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function bu(t){return JSON.stringify(t)}function Nx(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pd="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ss(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Fx=xi(()=>{var t;if(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 fr(t){if(ss(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(ss(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Md(t){return fr(t)?{...t}:Array.isArray(t)?[...t]:t}const Lx=new Set(["string","number","symbol"]);function pr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _n(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 B(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 Bx(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Zx={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 Ux(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=gn(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 $n(this,"shape",o),o},checks:[]});return _n(t,i)}function Gx(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=gn(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 $n(this,"shape",o),o},checks:[]});return _n(t,i)}function jx(t,e){if(!fr(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=gn(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return $n(this,"shape",i),i}});return _n(t,s)}function Vx(t,e){if(!fr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=gn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return $n(this,"shape",r),r}});return _n(t,n)}function Hx(t,e){const n=gn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return $n(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return _n(t,n)}function Wx(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=gn(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 $n(this,"shape",l),l},checks:[]});return _n(e,o)}function Yx(t,e,n){const r=gn(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 $n(this,"shape",i),i}});return _n(e,r)}function Kn(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 Qn(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Us(t){return typeof t=="string"?t:t==null?void 0:t.message}function pn(t,e,n){var s,i,o,a,l,c;const r={...t,path:t.path??[]};if(!t.message){const u=Us((o=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,t))??Us((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Us((l=n.customError)==null?void 0:l.call(n,t))??Us((c=n.localeError)==null?void 0:c.call(n,t))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Xa(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 Rd=(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,ua,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},zd=T("$ZodError",Rd),Od=T("$ZodError",Rd,{Parent:Error});function Xx(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 qx(t,e=n=>n.message){const n={_errors:[]},r=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>r({issues:o}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else{let o=n,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(i))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(t),n}const qa=t=>(e,n,r,s)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new tr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>pn(l,i,fn())));throw Pd(a,s==null?void 0:s.callee),a}return o.value},Ja=t=>async(e,n,r,s)=>{const i=r?Object.assign(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=>pn(l,i,fn())));throw Pd(a,s==null?void 0:s.callee),a}return o.value},bi=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 tr;return i.issues.length?{success:!1,error:new(t??zd)(i.issues.map(o=>pn(o,s,fn())))}:{success:!0,data:i.value}},Jx=bi(Od),vi=t=>async(e,n,r)=>{const s=r?Object.assign(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=>pn(o,s,fn())))}:{success:!0,data:i.value}},Kx=vi(Od),Qx=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qa(t)(e,n,s)},eb=t=>(e,n,r)=>qa(t)(e,n,r),tb=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ja(t)(e,n,s)},nb=t=>async(e,n,r)=>Ja(t)(e,n,r),rb=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bi(t)(e,n,s)},sb=t=>(e,n,r)=>bi(t)(e,n,r),ib=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vi(t)(e,n,s)},ob=t=>async(e,n,r)=>vi(t)(e,n,r),ab=/^[cC][^\s-]{8,}$/,lb=/^[0-9a-z]+$/,cb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ub=/^[0-9a-vA-V]{20}$/,hb=/^[A-Za-z0-9]{27}$/,db=/^[a-zA-Z0-9_-]{21}$/,fb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pb=/^([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})$/,vu=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)$/,mb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _b(){return new RegExp(gb,"u")}const yb=/^(?:(?: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])$/,xb=/^(([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}|:))$/,bb=/^((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])$/,vb=/^(([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])$/,wb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$d=/^[A-Za-z0-9_-]*$/,kb=/^\+[1-9]\d{6,14}$/,Dd="(?:(?:\\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])))",Sb=new RegExp(`^${Dd}$`);function Nd(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 Tb(t){return new RegExp(`^${Nd(t)}$`)}function Ab(t){const e=Nd({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(`^${Dd}T(?:${r})$`)}const Cb=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}$`)},Eb=/^-?\d+$/,Fd=/^-?\d+(?:\.\d+)?$/,Ib=/^(?:true|false)$/i,Pb=/^[^A-Z]*$/,Mb=/^[^a-z]*$/,ot=T("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Ld={number:"number",bigint:"bigint",object:"date"},Bd=T("$ZodCheckLessThan",(t,e)=>{ot.init(t,e);const n=Ld[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})}}),Zd=T("$ZodCheckGreaterThan",(t,e)=>{ot.init(t,e);const n=Ld[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})}}),Rb=T("$ZodCheckMultipleOf",(t,e)=>{ot.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):Dx(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})}}),zb=T("$ZodCheckNumberFormat",(t,e)=>{var o;ot.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]=Zx[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=Eb)}),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})}}),Ob=T("$ZodCheckMaxLength",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),$b=T("$ZodCheckMinLength",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Db=T("$ZodCheckLengthEquals",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(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})}}),wi=T("$ZodCheckStringFormat",(t,e)=>{var n,r;ot.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=()=>{})}),Nb=T("$ZodCheckRegex",(t,e)=>{wi.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})}}),Fb=T("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Pb),wi.init(t,e)}),Lb=T("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Mb),wi.init(t,e)}),Bb=T("$ZodCheckIncludes",(t,e)=>{ot.init(t,e);const n=pr(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})}}),Zb=T("$ZodCheckStartsWith",(t,e)=>{ot.init(t,e);const n=new RegExp(`^${pr(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})}}),Ub=T("$ZodCheckEndsWith",(t,e)=>{ot.init(t,e);const n=new RegExp(`.*${pr(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})}}),Gb=T("$ZodCheckOverwrite",(t,e)=>{ot.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class jb{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
|
+
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Nt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},zn=new Sx;function le(t,e){return zn.parse(t,e)}le.options=le.setOptions=function(t){return zn.setOptions(t),le.defaults=zn.defaults,pd(le.defaults),le};le.getDefaults=Na;le.defaults=On;le.use=function(...t){return zn.use(...t),le.defaults=zn.defaults,pd(le.defaults),le};le.walkTokens=function(t,e){return zn.walkTokens(t,e)};le.parseInline=zn.parseInline;le.Parser=Et;le.parser=Et.parse;le.Renderer=ai;le.TextRenderer=Va;le.Lexer=Ct;le.lexer=Ct.lex;le.Tokenizer=oi;le.Hooks=Ur;le.parse=le;le.options;le.setOptions;le.use;le.walkTokens;le.parseInline;Et.parse;Ct.lex;le.setOptions({gfm:!0,breaks:!0,async:!1});const Tx="agent-play-preview-chat-display-v1",Sd={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function xo(t,e,n){return Math.min(n,Math.max(e,t))}function Ax(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 pu={...Sd};function Cx(t){return{fontSizePx:xo(Math.round(t.fontSizePx),5,18),panelWidthPx:xo(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:xo(Math.round(t.scrollMaxHeightPx),24,200)}}function Ex(){const t=Ax(typeof localStorage<"u"?localStorage.getItem(Tx):null),e={...Sd,...t};return pu=Cx(e),{...pu}}typeof localStorage<"u"&&Ex();var Zs={exports:{}},bo,mu;function Ix(){if(mu)return bo;mu=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;bo=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 bo}var vo,gu;function Px(){if(gu)return vo;gu=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=Ix(),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,_;function g(...x){if(!g.enabled)return;const b=g,w=Number(new Date),k=w-(f||w);b.diff=k,b.prev=f,b.curr=w,f=w,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,(C,j)=>{if(C==="%%")return"%";I++;const W=r.formatters[j];if(typeof W=="function"){const O=x[I];C=W.call(b,O),x.splice(I,1),I--}return C}),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,_=r.enabled(h)),_),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,_=-1,g=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(_=m,g=d,m++):(d++,m++);else if(_!==-1)m=_+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 vo=t,vo}var _u;function Mx(){return _u||(_u=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=Px()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(Zs,Zs.exports)),Zs.exports}var Rx=Mx();const zx=ga(Rx);function Ox(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function $x(){try{if(typeof Zu=="function")return Zu()}catch{}return Ox()}function Td(){try{const t=So==null?void 0:So();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function ca(t){const e=Td();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Ad={get disabled(){return $x()||Td().NODE_ENV==="test"?!0:ca("OPENAI_AGENTS_DISABLE_TRACING")}},yu={get dontLogModelData(){return ca("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return ca("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Ha(t="openai-agents"){return{namespace:t,debug:zx(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return yu.dontLogModelData},get dontLogToolData(){return yu.dontLogToolData}}}const me=Ha("openai-agents:core");function T(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 tr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Cd extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Ed={};function fn(t){return Ed}function Id(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 ua(t,e){return typeof e=="bigint"?e.toString():e}function xi(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Wa(t){return t==null}function Ya(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Dx(t,e){const n=(t.toString().split(".")[1]||"").length,r=e.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(s=Number.parseInt(l[1]))}const i=n>s?n:s,o=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return o%a/10**i}const xu=Symbol("evaluating");function Q(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==xu)return r===void 0&&(r=xu,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function $n(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gn(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function bu(t){return JSON.stringify(t)}function Nx(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pd="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ss(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Fx=xi(()=>{var t;if(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 fr(t){if(ss(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(ss(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Md(t){return fr(t)?{...t}:Array.isArray(t)?[...t]:t}const Lx=new Set(["string","number","symbol"]);function pr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _n(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 B(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 Bx(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Zx={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 Ux(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=gn(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 $n(this,"shape",o),o},checks:[]});return _n(t,i)}function Gx(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=gn(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 $n(this,"shape",o),o},checks:[]});return _n(t,i)}function jx(t,e){if(!fr(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=gn(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return $n(this,"shape",i),i}});return _n(t,s)}function Vx(t,e){if(!fr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=gn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return $n(this,"shape",r),r}});return _n(t,n)}function Hx(t,e){const n=gn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return $n(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return _n(t,n)}function Wx(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=gn(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 $n(this,"shape",l),l},checks:[]});return _n(e,o)}function Yx(t,e,n){const r=gn(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 $n(this,"shape",i),i}});return _n(e,r)}function Kn(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 Qn(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Us(t){return typeof t=="string"?t:t==null?void 0:t.message}function pn(t,e,n){var s,i,o,a,l,c;const r={...t,path:t.path??[]};if(!t.message){const u=Us((o=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,t))??Us((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Us((l=n.customError)==null?void 0:l.call(n,t))??Us((c=n.localeError)==null?void 0:c.call(n,t))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Xa(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 Rd=(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,ua,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},zd=T("$ZodError",Rd),Od=T("$ZodError",Rd,{Parent:Error});function Xx(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 qx(t,e=n=>n.message){const n={_errors:[]},r=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>r({issues:o}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else{let o=n,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(i))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(t),n}const qa=t=>(e,n,r,s)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new tr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>pn(l,i,fn())));throw Pd(a,s==null?void 0:s.callee),a}return o.value},Ja=t=>async(e,n,r,s)=>{const i=r?Object.assign(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=>pn(l,i,fn())));throw Pd(a,s==null?void 0:s.callee),a}return o.value},bi=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 tr;return i.issues.length?{success:!1,error:new(t??zd)(i.issues.map(o=>pn(o,s,fn())))}:{success:!0,data:i.value}},Jx=bi(Od),vi=t=>async(e,n,r)=>{const s=r?Object.assign(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=>pn(o,s,fn())))}:{success:!0,data:i.value}},Kx=vi(Od),Qx=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qa(t)(e,n,s)},eb=t=>(e,n,r)=>qa(t)(e,n,r),tb=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ja(t)(e,n,s)},nb=t=>async(e,n,r)=>Ja(t)(e,n,r),rb=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bi(t)(e,n,s)},sb=t=>(e,n,r)=>bi(t)(e,n,r),ib=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vi(t)(e,n,s)},ob=t=>async(e,n,r)=>vi(t)(e,n,r),ab=/^[cC][^\s-]{8,}$/,lb=/^[0-9a-z]+$/,cb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ub=/^[0-9a-vA-V]{20}$/,hb=/^[A-Za-z0-9]{27}$/,db=/^[a-zA-Z0-9_-]{21}$/,fb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pb=/^([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})$/,vu=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)$/,mb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _b(){return new RegExp(gb,"u")}const yb=/^(?:(?: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])$/,xb=/^(([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}|:))$/,bb=/^((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])$/,vb=/^(([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])$/,wb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$d=/^[A-Za-z0-9_-]*$/,kb=/^\+[1-9]\d{6,14}$/,Dd="(?:(?:\\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])))",Sb=new RegExp(`^${Dd}$`);function Nd(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 Tb(t){return new RegExp(`^${Nd(t)}$`)}function Ab(t){const e=Nd({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(`^${Dd}T(?:${r})$`)}const Cb=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}$`)},Eb=/^-?\d+$/,Fd=/^-?\d+(?:\.\d+)?$/,Ib=/^(?:true|false)$/i,Pb=/^[^A-Z]*$/,Mb=/^[^a-z]*$/,ot=T("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Ld={number:"number",bigint:"bigint",object:"date"},Bd=T("$ZodCheckLessThan",(t,e)=>{ot.init(t,e);const n=Ld[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})}}),Zd=T("$ZodCheckGreaterThan",(t,e)=>{ot.init(t,e);const n=Ld[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})}}),Rb=T("$ZodCheckMultipleOf",(t,e)=>{ot.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):Dx(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})}}),zb=T("$ZodCheckNumberFormat",(t,e)=>{var o;ot.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]=Zx[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=Eb)}),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})}}),Ob=T("$ZodCheckMaxLength",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),$b=T("$ZodCheckMinLength",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Db=T("$ZodCheckLengthEquals",(t,e)=>{var n;ot.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Wa(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=Xa(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})}}),wi=T("$ZodCheckStringFormat",(t,e)=>{var n,r;ot.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=()=>{})}),Nb=T("$ZodCheckRegex",(t,e)=>{wi.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})}}),Fb=T("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Pb),wi.init(t,e)}),Lb=T("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Mb),wi.init(t,e)}),Bb=T("$ZodCheckIncludes",(t,e)=>{ot.init(t,e);const n=pr(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})}}),Zb=T("$ZodCheckStartsWith",(t,e)=>{ot.init(t,e);const n=new RegExp(`^${pr(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})}}),Ub=T("$ZodCheckEndsWith",(t,e)=>{ot.init(t,e);const n=new RegExp(`.*${pr(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})}}),Gb=T("$ZodCheckOverwrite",(t,e)=>{ot.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class jb{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(`
|
|
299
299
|
`).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(`
|
|
300
300
|
`))}}const Vb={major:4,minor:3,patch:6},ye=T("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Vb;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=Kn(a),h;for(const f of l){if(f._zod.def.when){if(!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 tr;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=Kn(a,d)))});else{if(a.issues.length===d)continue;u||(u=Kn(a,d))}}return h?h.then(()=>a):a},o=(a,l,c)=>{if(Kn(a))return a.aborted=!0,a;const u=i(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new tr;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 tr;return c.then(u=>i(u,r,l))}return i(c,r,l)}}Q(t,"~standard",()=>({validate:i=>{var o;try{const a=Jx(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Kx(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}))}),Ka=T("$ZodString",(t,e)=>{var n;ye.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??Cb(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}}),we=T("$ZodStringFormat",(t,e)=>{wi.init(t,e),Ka.init(t,e)}),Hb=T("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=pb),we.init(t,e)}),Wb=T("$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=vu(r))}else e.pattern??(e.pattern=vu());we.init(t,e)}),Yb=T("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=mb),we.init(t,e)}),Xb=T("$ZodURL",(t,e)=>{we.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.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(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),qb=T("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=_b()),we.init(t,e)}),Jb=T("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=db),we.init(t,e)}),Kb=T("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=ab),we.init(t,e)}),Qb=T("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=lb),we.init(t,e)}),e0=T("$ZodULID",(t,e)=>{e.pattern??(e.pattern=cb),we.init(t,e)}),t0=T("$ZodXID",(t,e)=>{e.pattern??(e.pattern=ub),we.init(t,e)}),n0=T("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hb),we.init(t,e)}),r0=T("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Ab(e)),we.init(t,e)}),s0=T("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Sb),we.init(t,e)}),i0=T("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Tb(e)),we.init(t,e)}),o0=T("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=fb),we.init(t,e)}),a0=T("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=yb),we.init(t,e),t._zod.bag.format="ipv4"}),l0=T("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=xb),we.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})}}}),c0=T("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=bb),we.init(t,e)}),u0=T("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=vb),we.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 Ud(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const h0=T("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=wb),we.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Ud(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function d0(t){if(!$d.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Ud(n)}const f0=T("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$d),we.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{d0(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),p0=T("$ZodE164",(t,e)=>{e.pattern??(e.pattern=kb),we.init(t,e)});function m0(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 g0=T("$ZodJWT",(t,e)=>{we.init(t,e),t._zod.check=n=>{m0(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Gd=T("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Fd,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}}),_0=T("$ZodNumberFormat",(t,e)=>{zb.init(t,e),Gd.init(t,e)}),y0=T("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Ib,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}}),x0=T("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=n=>n}),b0=T("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=n=>n}),v0=T("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function wu(t,e,n){t.issues.length&&e.issues.push(...Qn(n,t.issues)),e.value[n]=t.value}const w0=T("$ZodArray",(t,e)=>{ye.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=>wu(c,n,o))):wu(l,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function li(t,e,n,r,s){if(t.issues.length){if(s&&!(n in r))return;e.issues.push(...Qn(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function jd(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=Bx(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Vd(t,e,n,r,s,i){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const h in e){if(a.has(h))continue;if(c==="never"){o.push(h);continue}const f=l.run({value:e[h],issues:[]},r);f instanceof Promise?t.push(f.then(d=>li(d,n,h,e,u))):li(f,n,h,e,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}const k0=T("$ZodObject",(t,e)=>{ye.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=xi(()=>jd(e));Q(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=ss,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.optout==="optional",_=d._zod.run({value:c[f],issues:[]},l);_ instanceof Promise?u.push(_.then(g=>li(g,a,f,c,m))):li(_,a,f,c,m)}return i?Vd(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),S0=T("$ZodObjectJIT",(t,e)=>{k0.init(t,e);const n=t._zod.parse,r=xi(()=>jd(e)),s=f=>{var w;const d=new jb(["shape","payload","ctx"]),m=r.value,_=k=>{const I=bu(k);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};d.write("const input = payload.value;");const g=Object.create(null);let x=0;for(const k of m.keys)g[k]=`key_${x++}`;d.write("const newResult = {};");for(const k of m.keys){const I=g[k],A=bu(k),C=f[k],j=((w=C==null?void 0:C._zod)==null?void 0:w.optout)==="optional";d.write(`const ${I} = ${_(k)};`),j?d.write(`
|
|
301
301
|
if (${I}.issues.length) {
|
|
@@ -333,4 +333,4 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
333
333
|
|
|
334
334
|
`)}d.write("payload.value = newResult;"),d.write("return payload;");const b=d.compile();return(k,I)=>b(f,k,I)};let i;const o=ss,a=!Ed.jitless,c=a&&Fx.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?Vd([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function ku(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=>!Kn(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=>pn(o,r,fn())))}),e)}const Hd=T("$ZodUnion",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Q(t._zod,"optout",()=>e.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Q(t._zod,"values",()=>{if(e.options.every(s=>s._zod.values))return new Set(e.options.flatMap(s=>Array.from(s._zod.values)))}),Q(t._zod,"pattern",()=>{if(e.options.every(s=>s._zod.pattern)){const s=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>Ya(i.source)).join("|")})$`)}});const n=e.options.length===1,r=e.options[0]._zod.run;t._zod.parse=(s,i)=>{if(n)return r(s,i);let o=!1;const a=[];for(const l of e.options){const c=l._zod.run({value:s.value,issues:[]},i);if(c instanceof Promise)a.push(c),o=!0;else{if(c.issues.length===0)return c;a.push(c)}}return o?Promise.all(a).then(l=>ku(l,s,t,i)):ku(a,s,t,i)}}),T0=T("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Hd.init(t,e);const n=t._zod.parse;Q(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=xi(()=>{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(!ss(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?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),s)}}),A0=T("$ZodIntersection",(t,e)=>{ye.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])=>Su(n,l,c)):Su(n,i,o)}});function ha(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(fr(t)&&fr(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=ha(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=ha(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 Su(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}),Kn(t))return t;const o=ha(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 C0=T("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!fr(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.valueType._zod.run({value:s[c],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(...Qn(c,h.issues)),n.value[c]=h.value})):(u.issues.length&&n.issues.push(...Qn(c,u.issues)),n.value[c]=u.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__")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"&&Fd.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=>pn(h,r,fn())),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(...Qn(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...Qn(a,u.issues)),n.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),E0=T("$ZodEnum",(t,e)=>{ye.init(t,e);const n=Id(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>Lx.has(typeof s)).map(s=>typeof s=="string"?pr(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}}),I0=T("$ZodLiteral",(t,e)=>{if(ye.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"?pr(r):r?pr(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}}),P0=T("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Cd(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));if(s instanceof Promise)throw new tr;return n.value=s,n}});function Tu(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const Wd=T("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Q(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Ya(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Tu(i,n.value)):Tu(s,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),M0=T("$ZodExactOptional",(t,e)=>{Wd.init(t,e),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),R0=T("$ZodNullable",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Ya(n.source)}|null)$`):void 0}),Q(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)}),z0=T("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Q(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=>Au(i,e)):Au(s,e)}});function Au(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const O0=T("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Q(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))}),$0=T("$ZodNonOptional",(t,e)=>{ye.init(t,e),Q(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=>Cu(i,t)):Cu(s,t)}});function Cu(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 D0=T("$ZodCatch",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(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=>pn(o,r,fn()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>pn(i,r,fn()))},input:n.value}),n.issues=[]),n)}}),N0=T("$ZodPipe",(t,e)=>{ye.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(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=>Gs(o,e.in,r)):Gs(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>Gs(i,e.out,r)):Gs(s,e.out,r)}});function Gs(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const F0=T("$ZodReadonly",(t,e)=>{ye.init(t,e),Q(t._zod,"propValues",()=>e.innerType._zod.propValues),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Q(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(Eu):Eu(s)}});function Eu(t){return t.value=Object.freeze(t.value),t}const L0=T("$ZodLazy",(t,e)=>{ye.init(t,e),Q(t._zod,"innerType",()=>e.getter()),Q(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),Q(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),Q(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),Q(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)}),B0=T("$ZodCustom",(t,e)=>{ot.init(t,e),ye.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=>Iu(i,n,r,t));Iu(s,n,r,t)}});function Iu(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 Pu;class Z0{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 U0(){return new Z0}(Pu=globalThis).__zod_globalRegistry??(Pu.__zod_globalRegistry=U0());const Gr=globalThis.__zod_globalRegistry;function G0(t,e){return new t({type:"string",...B(e)})}function j0(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...B(e)})}function Mu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...B(e)})}function V0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...B(e)})}function H0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(e)})}function W0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(e)})}function Y0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(e)})}function X0(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...B(e)})}function q0(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...B(e)})}function J0(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(e)})}function K0(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...B(e)})}function Q0(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(e)})}function ev(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...B(e)})}function tv(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...B(e)})}function nv(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(e)})}function rv(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(e)})}function sv(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(e)})}function iv(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(e)})}function ov(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(e)})}function av(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...B(e)})}function lv(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...B(e)})}function cv(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...B(e)})}function uv(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...B(e)})}function hv(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(e)})}function dv(t,e){return new t({type:"string",format:"date",check:"string_format",...B(e)})}function fv(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...B(e)})}function pv(t,e){return new t({type:"string",format:"duration",check:"string_format",...B(e)})}function mv(t,e){return new t({type:"number",checks:[],...B(e)})}function gv(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...B(e)})}function _v(t,e){return new t({type:"boolean",...B(e)})}function yv(t){return new t({type:"any"})}function xv(t){return new t({type:"unknown"})}function bv(t,e){return new t({type:"never",...B(e)})}function Ru(t,e){return new Bd({check:"less_than",...B(e),value:t,inclusive:!1})}function wo(t,e){return new Bd({check:"less_than",...B(e),value:t,inclusive:!0})}function zu(t,e){return new Zd({check:"greater_than",...B(e),value:t,inclusive:!1})}function ko(t,e){return new Zd({check:"greater_than",...B(e),value:t,inclusive:!0})}function Ou(t,e){return new Rb({check:"multiple_of",...B(e),value:t})}function Yd(t,e){return new Ob({check:"max_length",...B(e),maximum:t})}function ci(t,e){return new $b({check:"min_length",...B(e),minimum:t})}function Xd(t,e){return new Db({check:"length_equals",...B(e),length:t})}function vv(t,e){return new Nb({check:"string_format",format:"regex",...B(e),pattern:t})}function wv(t){return new Fb({check:"string_format",format:"lowercase",...B(t)})}function kv(t){return new Lb({check:"string_format",format:"uppercase",...B(t)})}function Sv(t,e){return new Bb({check:"string_format",format:"includes",...B(e),includes:t})}function Tv(t,e){return new Zb({check:"string_format",format:"starts_with",...B(e),prefix:t})}function Av(t,e){return new Ub({check:"string_format",format:"ends_with",...B(e),suffix:t})}function gr(t){return new Gb({check:"overwrite",tx:t})}function Cv(t){return gr(e=>e.normalize(t))}function Ev(){return gr(t=>t.trim())}function Iv(){return gr(t=>t.toLowerCase())}function Pv(){return gr(t=>t.toUpperCase())}function Mv(){return gr(t=>Nx(t))}function Rv(t,e,n){return new t({type:"array",element:e,...B(n)})}function zv(t,e,n){return new t({type:"custom",check:"custom",fn:e,...B(n)})}function Ov(t){const e=$v(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(is(r,n.value,e._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!e._zod.def.abort),n.issues.push(is(s))}},t(n.value,n)));return e}function $v(t,e){const n=new ot({check:"custom",...B(e)});return n._zod.check=t,n}function qd(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)??Gr,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 Ee(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,_=e.processors[s.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);_(t,e,m,f)}const d=t._zod.parent;d&&(o.ref||(o.ref=d),Ee(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"&&Ye(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Jd(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 _;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=(_=t.external.registry.get(u[0]))==null?void 0:_.id,x=t.external.uri??(w=>w);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 _ in m)delete m[_];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>
|
|
335
335
|
|
|
336
|
-
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 Kd(t,e){var o,a,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const u=t.seen.get(c);if(u.ref===null)return;const h=u.def??u.schema,f={...h},d=u.ref;if(u.ref=null,d){r(d);const _=t.seen.get(d),g=_.schema;if(g.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(g)):Object.assign(h,g),Object.assign(h,f),c._zod.parent===d)for(const b in h)b==="$ref"||b==="allOf"||b in f||delete h[b];if(g.$ref&&_.def)for(const b in h)b==="$ref"||b==="allOf"||b in _.def&&JSON.stringify(h[b])===JSON.stringify(_.def[b])&&delete h[b]}const m=c._zod.parent;if(m&&m!==d){r(m);const _=t.seen.get(m);if(_!=null&&_.schema.$ref&&(h.$ref=_.schema.$ref,_.def))for(const g in h)g==="$ref"||g==="allOf"||g in _.def&&JSON.stringify(h[g])===JSON.stringify(_.def[g])&&delete h[g]}t.override({zodSchema:c,jsonSchema:h,path:u.path??[]})};for(const c of[...t.seen.entries()].reverse())r(c[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,(o=t.external)!=null&&o.uri){const c=(a=t.external.registry.get(e))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(c)}Object.assign(s,n.def??n.schema);const i=((l=t.external)==null?void 0:l.defs)??{};for(const c of t.seen.entries()){const u=c[1];u.def&&u.defId&&(i[u.defId]=u.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{const c=JSON.parse(JSON.stringify(s));return Object.defineProperty(c,"~standard",{value:{...e["~standard"],jsonSchema:{input:ui(e,"input",t.processors),output:ui(e,"output",t.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ye(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 Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(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 Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Ye(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Ye(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Ye(s,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const Dv=(t,e={})=>n=>{const r=qd({...n,processors:e});return Ee(t,r),Jd(r,t),Kd(r,t)},ui=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=qd({...s??{},target:i,io:e,processors:n});return Ee(t,o),Jd(o,t),Kd(o,t)},Nv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fv=(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=Nv[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}))])}},Lv=(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",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u),typeof i=="number"&&(s.minimum=i,typeof u=="number"&&e.target!=="draft-04"&&(u>=i?delete s.minimum:delete s.exclusiveMinimum)),typeof c=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c),typeof o=="number"&&(s.maximum=o,typeof c=="number"&&e.target!=="draft-04"&&(c<=o?delete s.maximum:delete s.exclusiveMaximum)),typeof l=="number"&&(s.multipleOf=l)},Bv=(t,e,n,r)=>{n.type="boolean"},Zv=(t,e,n,r)=>{n.not={}},Uv=(t,e,n,r)=>{},Gv=(t,e,n,r)=>{},jv=(t,e,n,r)=>{const s=t._zod.def,i=Id(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},Vv=(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},Hv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Wv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Yv=(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=Ee(i.element,e,{...r,path:[...r.path,"items"]})},Xv=(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]=Ee(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=Ee(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},qv=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>Ee(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},Jv=(t,e,n,r)=>{const s=t._zod.def,i=Ee(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ee(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},Kv=(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=Ee(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=Ee(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Ee(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)}},Qv=(t,e,n,r)=>{const s=t._zod.def,i=Ee(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"}]},ew=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},tw=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},nw=(t,e,n,r)=>{const s=t._zod.def;Ee(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)))},rw=(t,e,n,r)=>{const s=t._zod.def;Ee(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},sw=(t,e,n,r)=>{const s=t._zod.def,i=e.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Ee(i,e,r);const o=e.seen.get(t);o.ref=i},iw=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},Qd=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},ow=(t,e,n,r)=>{const s=t._zod.innerType;Ee(s,e,r);const i=e.seen.get(t);i.ref=s},aw=T("ZodISODateTime",(t,e)=>{r0.init(t,e),Te.init(t,e)});function lw(t){return hv(aw,t)}const cw=T("ZodISODate",(t,e)=>{s0.init(t,e),Te.init(t,e)});function uw(t){return dv(cw,t)}const hw=T("ZodISOTime",(t,e)=>{i0.init(t,e),Te.init(t,e)});function dw(t){return fv(hw,t)}const fw=T("ZodISODuration",(t,e)=>{o0.init(t,e),Te.init(t,e)});function pw(t){return pv(fw,t)}const mw=(t,e)=>{zd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>qx(t,n)},flatten:{value:n=>Xx(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,ua,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,ua,2)}},isEmpty:{get(){return t.issues.length===0}}})},yt=T("ZodError",mw,{Parent:Error}),gw=qa(yt),_w=Ja(yt),yw=bi(yt),xw=vi(yt),bw=Qx(yt),vw=eb(yt),ww=tb(yt),kw=nb(yt),Sw=rb(yt),Tw=sb(yt),Aw=ib(yt),Cw=ob(yt),xe=T("ZodType",(t,e)=>(ye.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:ui(t,"input"),output:ui(t,"output")}}),t.toJSONSchema=Dv(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(gn(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>_n(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>gw(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>yw(t,n,r),t.parseAsync=async(n,r)=>_w(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>xw(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>bw(t,n,r),t.decode=(n,r)=>vw(t,n,r),t.encodeAsync=async(n,r)=>ww(t,n,r),t.decodeAsync=async(n,r)=>kw(t,n,r),t.safeEncode=(n,r)=>Sw(t,n,r),t.safeDecode=(n,r)=>Tw(t,n,r),t.safeEncodeAsync=async(n,r)=>Aw(t,n,r),t.safeDecodeAsync=async(n,r)=>Cw(t,n,r),t.refine=(n,r)=>t.check(wk(n,r)),t.superRefine=n=>t.check(kk(n)),t.overwrite=n=>t.check(gr(n)),t.optional=()=>Nu(t),t.exactOptional=()=>lk(t),t.nullable=()=>Fu(t),t.nullish=()=>Nu(Fu(t)),t.nonoptional=n=>pk(t,n),t.array=()=>G(t),t.or=n=>Pt([t,n]),t.and=n=>nk(t,n),t.transform=n=>Lu(t,ok(n)),t.default=n=>hk(t,n),t.prefault=n=>fk(t,n),t.catch=n=>gk(t,n),t.pipe=n=>Lu(t,n),t.readonly=()=>xk(t),t.describe=n=>{const r=t.clone();return Gr.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){var n;return(n=Gr.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Gr.get(t);const r=t.clone();return Gr.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),ef=T("_ZodString",(t,e)=>{Ka.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Fv(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(vv(...r)),t.includes=(...r)=>t.check(Sv(...r)),t.startsWith=(...r)=>t.check(Tv(...r)),t.endsWith=(...r)=>t.check(Av(...r)),t.min=(...r)=>t.check(ci(...r)),t.max=(...r)=>t.check(Yd(...r)),t.length=(...r)=>t.check(Xd(...r)),t.nonempty=(...r)=>t.check(ci(1,...r)),t.lowercase=r=>t.check(wv(r)),t.uppercase=r=>t.check(kv(r)),t.trim=()=>t.check(Ev()),t.normalize=(...r)=>t.check(Cv(...r)),t.toLowerCase=()=>t.check(Iv()),t.toUpperCase=()=>t.check(Pv()),t.slugify=()=>t.check(Mv())}),Ew=T("ZodString",(t,e)=>{Ka.init(t,e),ef.init(t,e),t.email=n=>t.check(j0(Iw,n)),t.url=n=>t.check(X0(Pw,n)),t.jwt=n=>t.check(uv(Vw,n)),t.emoji=n=>t.check(q0(Mw,n)),t.guid=n=>t.check(Mu($u,n)),t.uuid=n=>t.check(V0(js,n)),t.uuidv4=n=>t.check(H0(js,n)),t.uuidv6=n=>t.check(W0(js,n)),t.uuidv7=n=>t.check(Y0(js,n)),t.nanoid=n=>t.check(J0(Rw,n)),t.guid=n=>t.check(Mu($u,n)),t.cuid=n=>t.check(K0(zw,n)),t.cuid2=n=>t.check(Q0(Ow,n)),t.ulid=n=>t.check(ev($w,n)),t.base64=n=>t.check(av(Uw,n)),t.base64url=n=>t.check(lv(Gw,n)),t.xid=n=>t.check(tv(Dw,n)),t.ksuid=n=>t.check(nv(Nw,n)),t.ipv4=n=>t.check(rv(Fw,n)),t.ipv6=n=>t.check(sv(Lw,n)),t.cidrv4=n=>t.check(iv(Bw,n)),t.cidrv6=n=>t.check(ov(Zw,n)),t.e164=n=>t.check(cv(jw,n)),t.datetime=n=>t.check(lw(n)),t.date=n=>t.check(uw(n)),t.time=n=>t.check(dw(n)),t.duration=n=>t.check(pw(n))});function p(t){return G0(Ew,t)}const Te=T("ZodStringFormat",(t,e)=>{we.init(t,e),ef.init(t,e)}),Iw=T("ZodEmail",(t,e)=>{Yb.init(t,e),Te.init(t,e)}),$u=T("ZodGUID",(t,e)=>{Hb.init(t,e),Te.init(t,e)}),js=T("ZodUUID",(t,e)=>{Wb.init(t,e),Te.init(t,e)}),Pw=T("ZodURL",(t,e)=>{Xb.init(t,e),Te.init(t,e)}),Mw=T("ZodEmoji",(t,e)=>{qb.init(t,e),Te.init(t,e)}),Rw=T("ZodNanoID",(t,e)=>{Jb.init(t,e),Te.init(t,e)}),zw=T("ZodCUID",(t,e)=>{Kb.init(t,e),Te.init(t,e)}),Ow=T("ZodCUID2",(t,e)=>{Qb.init(t,e),Te.init(t,e)}),$w=T("ZodULID",(t,e)=>{e0.init(t,e),Te.init(t,e)}),Dw=T("ZodXID",(t,e)=>{t0.init(t,e),Te.init(t,e)}),Nw=T("ZodKSUID",(t,e)=>{n0.init(t,e),Te.init(t,e)}),Fw=T("ZodIPv4",(t,e)=>{a0.init(t,e),Te.init(t,e)}),Lw=T("ZodIPv6",(t,e)=>{l0.init(t,e),Te.init(t,e)}),Bw=T("ZodCIDRv4",(t,e)=>{c0.init(t,e),Te.init(t,e)}),Zw=T("ZodCIDRv6",(t,e)=>{u0.init(t,e),Te.init(t,e)}),Uw=T("ZodBase64",(t,e)=>{h0.init(t,e),Te.init(t,e)}),Gw=T("ZodBase64URL",(t,e)=>{f0.init(t,e),Te.init(t,e)}),jw=T("ZodE164",(t,e)=>{p0.init(t,e),Te.init(t,e)}),Vw=T("ZodJWT",(t,e)=>{g0.init(t,e),Te.init(t,e)}),tf=T("ZodNumber",(t,e)=>{Gd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Lv(t,r,s),t.gt=(r,s)=>t.check(zu(r,s)),t.gte=(r,s)=>t.check(ko(r,s)),t.min=(r,s)=>t.check(ko(r,s)),t.lt=(r,s)=>t.check(Ru(r,s)),t.lte=(r,s)=>t.check(wo(r,s)),t.max=(r,s)=>t.check(wo(r,s)),t.int=r=>t.check(Du(r)),t.safe=r=>t.check(Du(r)),t.positive=r=>t.check(zu(0,r)),t.nonnegative=r=>t.check(ko(0,r)),t.negative=r=>t.check(Ru(0,r)),t.nonpositive=r=>t.check(wo(0,r)),t.multipleOf=(r,s)=>t.check(Ou(r,s)),t.step=(r,s)=>t.check(Ou(r,s)),t.finite=()=>t;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 mv(tf,t)}const Hw=T("ZodNumberFormat",(t,e)=>{_0.init(t,e),tf.init(t,e)});function Du(t){return gv(Hw,t)}const Ww=T("ZodBoolean",(t,e)=>{y0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Bv(t,n,r)});function un(t){return _v(Ww,t)}const Yw=T("ZodAny",(t,e)=>{x0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Uv()});function Y(){return yv(Yw)}const Xw=T("ZodUnknown",(t,e)=>{b0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Gv()});function da(){return xv(Xw)}const qw=T("ZodNever",(t,e)=>{v0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Zv(t,n,r)});function Jw(t){return bv(qw,t)}const Kw=T("ZodArray",(t,e)=>{w0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Yv(t,n,r,s),t.element=e.element,t.min=(n,r)=>t.check(ci(n,r)),t.nonempty=n=>t.check(ci(1,n)),t.max=(n,r)=>t.check(Yd(n,r)),t.length=(n,r)=>t.check(Xd(n,r)),t.unwrap=()=>t.element});function G(t,e){return Rv(Kw,t,e)}const Qw=T("ZodObject",(t,e)=>{S0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Xv(t,n,r,s),Q(t,"shape",()=>e.shape),t.keyof=()=>_e(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:da()}),t.loose=()=>t.clone({...t._zod.def,catchall:da()}),t.strict=()=>t.clone({...t._zod.def,catchall:Jw()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>jx(t,n),t.safeExtend=n=>Vx(t,n),t.merge=n=>Hx(t,n),t.pick=n=>Ux(t,n),t.omit=n=>Gx(t,n),t.partial=(...n)=>Wx(rf,t,n[0]),t.required=(...n)=>Yx(sf,t,n[0])});function v(t,e){const n={type:"object",shape:t??{},...B(e)};return new Qw(n)}const nf=T("ZodUnion",(t,e)=>{Hd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qv(t,n,r,s),t.options=e.options});function Pt(t,e){return new nf({type:"union",options:t,...B(e)})}const ek=T("ZodDiscriminatedUnion",(t,e)=>{nf.init(t,e),T0.init(t,e)});function Be(t,e,n){return new ek({type:"union",options:e,discriminator:t,...B(n)})}const tk=T("ZodIntersection",(t,e)=>{A0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Jv(t,n,r,s)});function nk(t,e){return new tk({type:"intersection",left:t,right:e})}const rk=T("ZodRecord",(t,e)=>{C0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Kv(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function oe(t,e,n){return new rk({type:"record",keyType:t,valueType:e,...B(n)})}const fa=T("ZodEnum",(t,e)=>{E0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>jv(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 fa({...e,checks:[],...B(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 fa({...e,checks:[],...B(s),entries:i})}});function _e(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new fa({type:"enum",entries:n,...B(e)})}const sk=T("ZodLiteral",(t,e)=>{I0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Vv(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 S(t,e){return new sk({type:"literal",values:Array.isArray(t)?t:[t],...B(e)})}const ik=T("ZodTransform",(t,e)=>{P0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Wv(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Cd(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)):(n.value=s,n)}});function ok(t){return new ik({type:"transform",transform:t})}const rf=T("ZodOptional",(t,e)=>{Wd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Nu(t){return new rf({type:"optional",innerType:t})}const ak=T("ZodExactOptional",(t,e)=>{M0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function lk(t){return new ak({type:"optional",innerType:t})}const ck=T("ZodNullable",(t,e)=>{R0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Fu(t){return new ck({type:"nullable",innerType:t})}const uk=T("ZodDefault",(t,e)=>{z0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>tw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function hk(t,e){return new uk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Md(e)}})}const dk=T("ZodPrefault",(t,e)=>{O0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>nw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function fk(t,e){return new dk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Md(e)}})}const sf=T("ZodNonOptional",(t,e)=>{$0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>ew(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function pk(t,e){return new sf({type:"nonoptional",innerType:t,...B(e)})}const mk=T("ZodCatch",(t,e)=>{D0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>rw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function gk(t,e){return new mk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const _k=T("ZodPipe",(t,e)=>{N0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>sw(t,n,r,s),t.in=e.in,t.out=e.out});function Lu(t,e){return new _k({type:"pipe",in:t,out:e})}const yk=T("ZodReadonly",(t,e)=>{F0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>iw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function xk(t){return new yk({type:"readonly",innerType:t})}const bk=T("ZodLazy",(t,e)=>{L0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>ow(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function vk(t){return new bk({type:"lazy",getter:t})}const of=T("ZodCustom",(t,e)=>{B0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Hv(t,n)});function wk(t,e={}){return zv(of,t,e)}function kk(t){return Ov(t)}function af(t,e={}){const n=new of({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...B(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 Sk={custom:"custom"};v({name:p(),description:p().optional(),inputSchema:v({type:S("object"),properties:oe(p(),Y()),required:G(p()),additionalProperties:un()})});function So(){return{}}const lf=()=>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 Bu{constructor(){K(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function Zu(){return!0}class Tk{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 Ak=new Tk,Oe=v({providerData:oe(p(),Y()).optional()}),at=Oe.extend({id:p().optional()}),Ck=Oe.extend({type:S("refusal"),refusal:p()}),Ek=Oe.extend({type:S("output_text"),text:p()}),Qa=Oe.extend({type:S("input_text"),text:p()}),Ik=Oe.extend({type:S("reasoning_text"),text:p()}),cf=Oe.extend({type:S("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()}),uf=Oe.extend({type:S("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()}),hf=Oe.extend({type:S("audio"),audio:p().or(v({id:p()})).describe("Base64 encoded audio data or file id"),format:p().nullable().optional(),transcript:p().nullable().optional()}),Pk=Oe.extend({type:S("image"),image:p().describe("Base64 encoded image data")}),Mk=Oe.extend({type:S("text"),text:p()}),Rk=v({data:Pt([p(),af(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),zk=v({url:p().describe("Publicly accessible URL pointing to the image content")}),Ok=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),$k=Pt([Rk,zk,Ok]).describe("Inline image data or references to uploaded content."),Dk=v({data:Pt([p(),af(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")}),Nk=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),Fk=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),Lk=Pt([p().describe("Existing data URL or base64 string"),Dk,Nk,Fk]).describe("Inline data (with metadata) or references pointing to file contents."),Bk=(...t)=>p(),Zk=Oe.extend({type:S("image"),image:p().or($k).optional(),detail:Bk("low","high","auto").optional()}),Uk=Oe.extend({type:S("file"),file:Lk}),Gk=Oe.extend({type:S("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Uu=Be("type",[v({type:S("screenshot")}),v({type:S("click"),x:M(),y:M(),button:_e(["left","right","wheel","back","forward"])}),v({type:S("double_click"),x:M(),y:M()}),v({type:S("scroll"),x:M(),y:M(),scroll_x:M(),scroll_y:M()}),v({type:S("type"),text:p()}),v({type:S("wait")}),v({type:S("move"),x:M(),y:M()}),v({type:S("keypress"),keys:G(p())}),v({type:S("drag"),path:G(v({x:M(),y:M()}))})]),jk=Be("type",[Ek,Ck,hf,Pk]),el=at.extend({type:S("message").optional()}),ki=el.extend({role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(jk)}),Vk=Be("type",[Qa,cf,uf,hf]),df=el.extend({role:S("user"),content:G(Vk).or(p())}),ff=el.extend({role:S("system"),content:p()});Be("role",[ff,ki,df]);const os=at.extend({type:S("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()}),as=at.extend({type:S("function_call"),callId:p().describe("The ID of the tool call"),name:p().describe("The name of the function"),namespace:p().optional(),status:_e(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:S("tool_reference"),functionName:p(),namespace:p().optional()});const Hk=oe(p(),Y()),Wk=da(),tl=at.extend({type:S("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),arguments:Wk,status:p().optional()}),nl=at.extend({type:S("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),status:p().optional(),tools:G(Hk)}),Yk=Be("type",[Mk,Zk,Uk]),Xk=Be("type",[Qa,cf,uf]),hi=at.extend({type:S("function_call_result"),name:p().describe("The name of the tool"),namespace:p().optional(),callId:p().describe("The ID of the tool call"),status:_e(["in_progress","completed","incomplete"]),output:Pt([p(),Yk,G(Xk)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),Si=at.extend({type:S("computer_call"),callId:p().describe("The ID of the computer call"),status:_e(["in_progress","completed","incomplete"]),action:Uu.optional(),actions:G(Uu).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:Sk.custom,message:"computer_call items must include action or actions.",path:["action"]})}),pf=at.extend({type:S("computer_call_result"),callId:p().describe("The ID of the computer call"),output:Gk}),qk=v({commands:G(p()),timeoutMs:M().int().min(0).optional(),maxOutputLength:M().int().min(0).optional()}),Ti=at.extend({type:S("shell_call"),callId:p(),status:_e(["in_progress","completed","incomplete"]).optional(),action:qk}),Jk=Be("type",[v({type:S("timeout")}),v({type:S("exit"),exitCode:M().int().nullable()})]),Kk=v({stdout:p(),stderr:p(),outcome:Jk}).passthrough(),rl=at.extend({type:S("shell_call_output"),callId:p(),maxOutputLength:M().optional(),output:G(Kk)}),Qk=v({type:S("create_file"),path:p(),diff:p()}),eS=v({type:S("update_file"),path:p(),diff:p()}),tS=v({type:S("delete_file"),path:p()}),nS=Be("type",[Qk,eS,tS]),Ai=at.extend({type:S("apply_patch_call"),callId:p(),status:_e(["in_progress","completed"]),operation:nS}),sl=at.extend({type:S("apply_patch_call_output"),callId:p(),status:_e(["completed","failed"]),output:p().optional()}),rS=Be("type",[Si,Ti,Ai,as,os]),il=Oe.extend({id:p().optional(),type:S("reasoning"),content:G(Qa),rawContent:G(Ik).optional()}),mf=at.extend({type:S("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),gf=at.extend({type:S("unknown")}),_f=Be("type",[ki,tl,nl,os,as,Si,Ti,Ai,hi,rl,sl,il,mf,gf]),sS=Pt([df,ki,ff,tl,nl,os,as,Si,Ti,Ai,hi,pf,rl,sl,il,mf,gf]),iS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),oS=v({requests:M().optional(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:Pt([oe(p(),M()),G(oe(p(),M()))]).optional(),outputTokensDetails:Pt([oe(p(),M()),G(oe(p(),M()))]).optional(),requestUsageEntries:G(iS).optional()}),aS=Oe.extend({type:S("output_text_delta"),delta:p()}),lS=Oe.extend({type:S("response_started")}),cS=Oe.extend({type:S("response_done"),response:Oe.extend({id:p(),requestId:p().optional(),usage:oS,output:G(_f)})}),uS=Oe.extend({type:S("model"),event:Y().describe("The event from the model")});Be("type",[aS,cS,lS,uS]);const Gu=Symbol.for("openai.agents.core.asyncLocalStorage");let To;function hS(){try{const t=globalThis,e=t[Gu];if(e)return e;const n=new Bu;return t[Gu]=n,n}catch{return To||(To=new Bu),To}}function yf(){const t=hS().getStore();if((t==null?void 0:t.active)===!0)return t}function ju(){const t=yf();return t!=null&&t.trace?t.trace:null}function Vu(){const t=yf();return t!=null&&t.span?t.span:null}class dS{async export(e){if(Ad.disabled){me.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 us,nr,hs,ds,rr,Ue,Zt,sn,on,sr,st,pa,ma,qn;class fS{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ae(this,st);ae(this,us);ae(this,nr);ae(this,hs);ae(this,ds);ae(this,rr);ae(this,Ue,[]);ae(this,Zt);ae(this,sn,null);ae(this,on,!1);ae(this,sr,null);q(this,us,n),q(this,nr,r),q(this,hs,s),q(this,ds,n*i),q(this,rr,e),q(this,Zt,Ak),me.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){q(this,sr,new AbortController),St(this,st,ma).call(this)}async onTraceStart(e){await St(this,st,pa).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await St(this,st,pa).call(this,e)}async shutdown(e){var n;for(e&&R(this,Zt).setTimeout(()=>{var r;(r=R(this,sr))==null||r.abort()},e),me.debug("Shutting down gracefully");R(this,Ue).length>0;){if(me.debug(`Waiting for buffer to empty. Items left: ${R(this,Ue).length}`),R(this,on)||await St(this,st,qn).call(this,!0),(n=R(this,sr))!=null&&n.signal.aborted){me.debug("Timeout reached, force flushing"),await St(this,st,qn).call(this,!0);break}await new Promise(r=>R(this,Zt).setTimeout(r,500))}me.debug("Buffer empty. Exiting"),R(this,Zt)&&R(this,sn)&&R(this,Zt).clearTimeout(R(this,sn))}async forceFlush(){R(this,Ue).length>0&&await St(this,st,qn).call(this,!0)}}us=new WeakMap,nr=new WeakMap,hs=new WeakMap,ds=new WeakMap,rr=new WeakMap,Ue=new WeakMap,Zt=new WeakMap,sn=new WeakMap,on=new WeakMap,sr=new WeakMap,st=new WeakSet,pa=async function(e){if(R(this,Ue).length+1>R(this,us)){me.error("Dropping trace because buffer is full");return}R(this,Ue).push(e),R(this,Ue).length>R(this,ds)&&await St(this,st,qn).call(this)},ma=function(){q(this,sn,R(this,Zt).setTimeout(async()=>{await St(this,st,qn).call(this),St(this,st,ma).call(this)},R(this,hs))),typeof R(this,sn).unref=="function"&&R(this,sn).unref()},qn=async function(e=!1){if(R(this,Ue).length!==0){if(me.debug(`Exporting batches. Force: ${e}. Buffer size: ${R(this,Ue).length}`),e||R(this,Ue).length<R(this,nr)){const n=[...R(this,Ue)];q(this,Ue,[]),q(this,on,!0),await R(this,rr).export(n),q(this,on,!1)}else if(R(this,Ue).length>0){const n=R(this,Ue).splice(0,R(this,nr));q(this,on,!0),await R(this,rr).export(n),q(this,on,!1)}}};var ut;class pS{constructor(){ae(this,ut,[])}start(){for(const e of R(this,ut))e.start&&e.start()}addTraceProcessor(e){R(this,ut).push(e)}setProcessors(e){me.debug("Shutting down old processors");for(const n of R(this,ut))n.shutdown();q(this,ut,e)}async onTraceStart(e){for(const n of R(this,ut))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of R(this,ut))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of R(this,ut))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of R(this,ut))await n.onSpanEnd(e)}async shutdown(e){for(const n of R(this,ut))await n.shutdown(e)}async forceFlush(){for(const e of R(this,ut))await e.forceFlush()}}ut=new WeakMap;let Ao=null,Co=null;function mS(){return Ao||(Ao=new dS),Ao}function xf(){return Co||(Co=new fS(mS())),Co}function Hu(){return new Date().toISOString()}function bf(){return`trace_${lf().replace(/-/g,"")}`}function gS(){return`span_${lf().replace(/-/g,"").slice(0,24)}`}function _S(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var fs,ps,ms,gs,_s,En,an,ln,In,ir,ys;const ol=class ol{constructor(e,n){K(this,"type","trace.span");ae(this,fs);ae(this,ps);ae(this,ms);ae(this,gs);ae(this,_s);ae(this,En);ae(this,an);ae(this,ln);ae(this,In);ae(this,ir);ae(this,ys);q(this,ps,e.traceId),q(this,ms,e.spanId??gS()),q(this,fs,e.data),q(this,En,n),q(this,gs,e.parentId??null),q(this,_s,e.traceMetadata),q(this,In,e.error??null),q(this,an,e.startedAt??null),q(this,ln,e.endedAt??null),q(this,ir,e.tracingApiKey)}get traceId(){return R(this,ps)}get spanData(){return R(this,fs)}get traceMetadata(){return R(this,_s)}get spanId(){return R(this,ms)}get parentId(){return R(this,gs)}get previousSpan(){return R(this,ys)}set previousSpan(e){q(this,ys,e)}start(){if(R(this,an)){me.warn("Span already started");return}q(this,an,Hu()),R(this,En).onSpanStart(this)}end(){if(R(this,ln)){me.debug("Span already finished",this.spanData);return}q(this,ln,Hu()),R(this,En).onSpanEnd(this)}setError(e){q(this,In,e)}get error(){return R(this,In)}get startedAt(){return R(this,an)}get endedAt(){return R(this,ln)}get tracingApiKey(){return R(this,ir)}clone(){var n;const e=new ol({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:R(this,an)??void 0,endedAt:R(this,ln)??void 0,error:R(this,In)??void 0,tracingApiKey:R(this,ir)},R(this,En));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:_S(this.spanData),error:this.error}}};fs=new WeakMap,ps=new WeakMap,ms=new WeakMap,gs=new WeakMap,_s=new WeakMap,En=new WeakMap,an=new WeakMap,ln=new WeakMap,In=new WeakMap,ir=new WeakMap,ys=new WeakMap;let ls=ol;class nn extends ls{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var or,Ut;const al=class al{constructor(e,n){K(this,"type","trace");K(this,"traceId");K(this,"name");K(this,"groupId",null);K(this,"metadata");K(this,"tracingApiKey");ae(this,or);ae(this,Ut);this.traceId=e.traceId??bf(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,q(this,or,n??xf()),q(this,Ut,e.started??!1)}async start(){R(this,Ut)||(q(this,Ut,!0),await R(this,or).onTraceStart(this))}async end(){R(this,Ut)&&(q(this,Ut,!1),await R(this,or).onTraceEnd(this))}clone(){return new al({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:R(this,Ut),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}};or=new WeakMap,Ut=new WeakMap;let cs=al;class Eo extends cs{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var Le,Pn,Gt,di,wf;class vf{constructor(){ae(this,di);ae(this,Le);ae(this,Pn);ae(this,Gt);q(this,Le,new pS),q(this,Pn,Ad.disabled),q(this,Gt,null),St(this,di,wf).call(this)}registerProcessor(e){q(this,Gt,null),R(this,Le).addTraceProcessor(e)}setProcessors(e){q(this,Gt,null),R(this,Le).setProcessors(e)}getCurrentTrace(){return ju()}getCurrentSpan(){return Vu()}setDisabled(e){q(this,Pn,e)}startExportLoop(){R(this,Le).start()}createTrace(e){if(R(this,Pn))return me.debug("Tracing is disabled, Not creating trace %o",e),new Eo;const n=e.traceId??bf(),r=e.name??"Agent workflow";return me.debug("Creating trace %s with name %s",n,r),new cs({...e,name:r,traceId:n},R(this,Le))}createSpan(e,n){if(R(this,Pn)||e.disabled)return me.debug("Tracing is disabled, Not creating span %o",e),new nn(e.data,R(this,Le));let r,s,i,o;if(n){if(n instanceof cs){if(n instanceof Eo)return me.debug("Parent trace is no-op, returning NoopSpan"),new nn(e.data,R(this,Le));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof ls){if(n instanceof nn)return me.debug("Parent span is no-op, returning NoopSpan"),new nn(e.data,R(this,Le));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=ju(),l=Vu();if(!a)return me.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new nn(e.data,R(this,Le));if(l instanceof nn||a instanceof Eo)return me.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new nn(e.data,R(this,Le));s=a.traceId,i=a.tracingApiKey,o=a.metadata,l?(me.debug("Using parent span %s",l.spanId),r=l.spanId):me.debug("No parent span, using current trace %s",a.traceId)}return s?(me.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new ls({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},R(this,Le))):(me.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new nn(e.data,R(this,Le)))}async shutdown(e){R(this,Gt)||q(this,Gt,(async()=>{try{me.debug("Shutting down tracing provider"),await R(this,Le).shutdown(e)}catch(n){me.error("Error shutting down tracing provider %o",n)}})()),await R(this,Gt)}async forceFlush(){await R(this,Le).forceFlush()}}Le=new WeakMap,Pn=new WeakMap,Gt=new WeakMap,di=new WeakSet,wf=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(),Wu("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Wu("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{me.error("Unhandled rejection",n,r),await e(),yS("unhandledRejection")||process.exit(1)})}};let Io;function Wu(t){return process.listeners(t).length>1}function yS(t){return process.listeners(t).length>1}function xS(){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 Vs();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return Vs()}try{const s=new vf;return e[t]=s,s}catch{return Vs()}}catch{return Vs()}}function Vs(){return Io||(Io=new vf),Io}function bS(t){xS().registerProcessor(t)}const vS=Be("type",[v({type:S("next_step_handoff"),newAgent:Y()}),v({type:S("next_step_final_output"),output:p()}),v({type:S("next_step_run_again")}),v({type:S("next_step_interruption"),data:oe(p(),Y())})]),wS="1.8",kS=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",wS],SS=_e(kS),pt=v({name:p()}),TS=v({object:S("trace.span"),id:p(),trace_id:p(),parent_id:p().nullable(),started_at:p().nullable(),ended_at:p().nullable(),error:v({message:p(),data:oe(p(),Y()).optional()}).nullable(),span_data:oe(p(),Y())}),kf=TS.extend({previous_span:vk(()=>kf).optional()}),AS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),Sf=v({requests:M(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:G(oe(p(),M())).optional(),outputTokensDetails:G(oe(p(),M())).optional(),requestUsageEntries:G(AS).optional()}),Yu=v({usage:Sf,output:G(_f),responseId:p().optional(),requestId:p().optional(),providerData:oe(p(),Y()).optional()}),Tf=Be("type",[v({type:S("message_output_item"),rawItem:ki,agent:pt}),v({type:S("tool_search_call_item"),rawItem:tl,agent:pt}),v({type:S("tool_search_output_item"),rawItem:nl,agent:pt}),v({type:S("tool_call_item"),rawItem:rS.or(os),agent:pt}),v({type:S("tool_call_output_item"),rawItem:hi.or(pf).or(rl).or(sl),agent:pt,output:p()}),v({type:S("reasoning_item"),rawItem:il,agent:pt}),v({type:S("handoff_call_item"),rawItem:as,agent:pt}),v({type:S("handoff_output_item"),rawItem:hi,sourceAgent:pt,targetAgent:pt}),v({type:S("tool_approval_item"),rawItem:as.or(os).or(Si).or(Ti).or(Ai),agent:pt,toolName:p().optional()})]),CS=v({object:S("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:oe(p(),Y()),tracing_api_key:p().optional().nullable()}),ES=v({newItems:G(Tf),toolsUsed:G(p()),handoffs:G(v({toolCall:Y(),handoff:Y()})),functions:G(v({toolCall:Y(),tool:Y()})),computerActions:G(v({toolCall:Y(),computer:Y()})),shellActions:G(v({toolCall:Y(),shell:Y()})).optional(),applyPatchActions:G(v({toolCall:Y(),applyPatch:Y()})).optional(),mcpApprovalRequests:G(v({requestItem:v({rawItem:v({type:S("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:oe(p(),Y()).nullable().optional()})}),mcpTool:v({type:S("hosted_tool"),name:S("hosted_mcp"),providerData:oe(p(),Y())})})).optional()}),Af=v({tripwireTriggered:un(),outputInfo:Y()}),IS=Be("type",[v({type:S("allow")}),v({type:S("rejectContent"),message:p()}),v({type:S("throwException")})]),Cf=v({outputInfo:Y().optional(),behavior:IS}),Ef=v({type:Pt([S("tool_input"),S("tool_output")]),name:p()}),PS=v({guardrail:v({type:S("input"),name:p()}),output:Af}),MS=v({guardrail:v({type:S("output"),name:p()}),agentOutput:Y(),agent:pt,output:Af}),RS=v({guardrail:Ef.extend({type:S("tool_input")}),output:Cf}),zS=v({guardrail:Ef.extend({type:S("tool_output")}),output:Cf});v({$schemaVersion:SS,currentTurn:M(),currentAgent:pt,originalInput:p().or(G(sS)),modelResponses:G(Yu),context:v({usage:Sf,approvals:oe(p(),v({approved:G(p()).or(un()),rejected:G(p()).or(un()),messages:oe(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:oe(p(),Y()),toolInput:Y().optional()}),toolUseTracker:oe(p(),G(p())),maxTurns:M(),currentAgentSpan:kf.nullable().optional(),noActiveAgentRun:un(),inputGuardrailResults:G(PS),outputGuardrailResults:G(MS),toolInputGuardrailResults:G(RS).optional().default([]),toolOutputGuardrailResults:G(zS).optional().default([]),currentTurnInProgress:un().optional(),currentStep:vS.optional(),lastModelResponse:Yu.optional(),generatedItems:G(Tf),pendingAgentToolRuns:oe(p(),p()).optional().default({}),lastProcessedResponse:ES.optional(),currentTurnPersistedItemCount:M().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:_e(["preserve","omit"]).optional(),trace:CS.nullable()});v({input:p()});Ha("openai-agents:mcp-servers");bS(xf());v({itemId:p()});Be("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("system"),content:G(v({type:S("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("user"),status:_e(["in_progress","completed"]),content:G(v({type:S("input_text"),text:p()}).or(v({type:S("input_audio"),audio:p().nullable().optional(),transcript:p().nullable()})))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(v({type:S("output_text"),text:p()}).or(v({type:S("output_audio"),audio:p().nullable().optional(),transcript:p().nullable().optional()})))})]);v({itemId:p(),previousItemId:p().nullable().optional(),type:S("function_call"),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:_e(["mcp_call","mcp_tool_call"]),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:S("mcp_approval_request"),serverLabel:p(),name:p(),arguments:oe(p(),Y()),approved:un().optional().nullable()});Ha("openai-agents:realtime");const If=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:M().or(S("inf")).optional().nullable(),metadata:oe(p(),Y()).optional().nullable(),output_modalities:G(p()).optional().nullable(),object:S("realtime.response").optional().nullable(),output:G(Y()).optional().nullable(),audio:v({output:v({format:Y().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:_e(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:oe(p(),Y()).optional().nullable(),usage:v({input_tokens:M().optional(),input_token_details:oe(p(),Y()).optional().nullable(),output_tokens:M().optional(),output_token_details:oe(p(),Y()).optional().nullable()}).optional().nullable()}),OS=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Pt([S("input_text"),S("input_audio"),S("item_reference"),S("output_text"),S("output_audio")])}),_r=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:G(OS).optional(),name:p().optional(),output:p().nullable().optional(),role:_e(["user","assistant","system"]).optional(),status:_e(["completed","incomplete","in_progress"]).optional(),type:_e(["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:un().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:Y().nullable().optional(),tools:G(v({name:p(),description:p(),input_schema:oe(p(),Y()).optional()}).passthrough()).optional()}).passthrough(),$S=v({type:S("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:S("realtime.conversation").optional()})}),DS=v({type:S("conversation.item.added"),event_id:p(),item:_r,previous_item_id:p().nullable().optional()}),NS=v({type:S("conversation.item.done"),event_id:p(),item:_r,previous_item_id:p().nullable().optional()}),FS=v({type:S("conversation.item.deleted"),event_id:p(),item_id:p()}),LS=v({type:S("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),logprobs:G(Y()).nullable().optional(),usage:v({type:S("tokens"),total_tokens:M(),input_tokens:M(),input_token_details:v({text_tokens:M(),audio_tokens:M()}),output_tokens:M()}).optional()}),BS=v({type:S("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:M().optional(),delta:p().optional(),logprobs:G(Y()).nullable().optional()}),ZS=v({type:S("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()})}),US=v({type:S("conversation.item.retrieved"),event_id:p(),item:_r}),GS=v({type:S("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:M(),content_index:M()}),jS=v({type:S("conversation.item.create"),item:_r,event_id:p().optional(),previous_item_id:p().nullable().optional()}),VS=v({type:S("conversation.item.delete"),item_id:p(),event_id:p().optional()}),HS=v({type:S("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),WS=v({type:S("conversation.item.truncate"),item_id:p(),audio_end_ms:M(),content_index:M(),event_id:p().optional()}),YS=v({type:S("error"),event_id:p().optional(),error:Y().optional()}),XS=v({type:S("input_audio_buffer.cleared"),event_id:p()}),qS=v({type:S("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),JS=v({type:S("input_audio_buffer.clear"),event_id:p().optional()}),KS=v({type:S("input_audio_buffer.commit"),event_id:p().optional()}),QS=v({type:S("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),e1=v({type:S("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:M()}),t1=v({type:S("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:M()}),n1=v({type:S("output_audio_buffer.started"),event_id:p()}).passthrough(),r1=v({type:S("output_audio_buffer.stopped"),event_id:p()}).passthrough(),s1=v({type:S("output_audio_buffer.cleared"),event_id:p()}),i1=v({type:S("rate_limits.updated"),event_id:p(),rate_limits:G(v({limit:M().optional(),name:_e(["requests","tokens"]).optional(),remaining:M().optional(),reset_seconds:M().optional()}))}),o1=v({type:S("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),a1=v({type:S("response.output_audio.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p()}),l1=v({type:S("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),c1=v({type:S("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),output_index:M(),response_id:p()}),u1=v({type:S("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:_e(["text","audio"]).optional()})}),h1=v({type:S("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:_e(["text","audio"]).optional()})}),d1=v({type:S("response.created"),event_id:p(),response:If}),f1=v({type:S("response.done"),event_id:p(),response:If}),p1=v({type:S("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:M(),response_id:p()}),m1=v({type:S("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:M(),response_id:p()}),g1=v({type:S("response.output_item.added"),event_id:p(),item:_r,output_index:M(),response_id:p()}),_1=v({type:S("response.output_item.done"),event_id:p(),item:_r,output_index:M(),response_id:p()}),y1=v({type:S("response.output_text.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),x1=v({type:S("response.output_text.done"),event_id:p(),item_id:p(),content_index:M(),text:p(),output_index:M(),response_id:p()}),b1=v({type:S("session.created"),event_id:p(),session:Y()}),v1=v({type:S("session.updated"),event_id:p(),session:Y()}),w1=v({type:S("response.cancel"),event_id:p().optional(),response_id:p().optional()}),k1=v({type:S("response.create"),event_id:p().optional(),response:Y().optional()}),S1=v({type:S("session.update"),event_id:p().optional(),session:Y()}),T1=v({type:S("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),A1=v({type:S("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),C1=v({type:S("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),delta:p(),obfuscation:p()}),E1=v({type:S("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),arguments:p()}),I1=v({type:S("response.mcp_call.in_progress"),event_id:p(),output_index:M(),item_id:p()}),P1=v({type:S("response.mcp_call.completed"),event_id:p(),output_index:M(),item_id:p()}),M1=v({type:S("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();Be("type",[$S,DS,NS,FS,LS,BS,ZS,US,GS,YS,XS,QS,e1,t1,n1,r1,s1,i1,o1,a1,l1,c1,u1,h1,d1,f1,p1,m1,g1,_1,y1,x1,b1,v1,T1,A1,M1,C1,E1,I1,P1]);Be("type",[jS,VS,HS,WS,qS,JS,KS,w1,k1,S1]);function R1(){return["park","new_york","tokyo"]}const z1="agent-play-preview-view-settings-v2",O1=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function $1(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Pf(t){return t==="default"||t==="ember"||t==="forest"}function Mf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function Rf(t){return O1.includes(t)}function er(){return{themeId:"park",showChatUi:!0,debugMode:$1(),joystickEnabled:!0,p2aEnabled:!1,profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function zf(t){return R1().includes(t)}function D1(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"&&zf(n.themeId)&&(r.themeId=n.themeId),typeof n.showChatUi=="boolean"&&(r.showChatUi=n.showChatUi),typeof n.debugMode=="boolean"&&(r.debugMode=n.debugMode),typeof n.joystickEnabled=="boolean"&&(r.joystickEnabled=n.joystickEnabled),typeof n.p2aEnabled=="boolean"&&(r.p2aEnabled=n.p2aEnabled),typeof n.profileAvatarPresetId=="string"&&Pf(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&Mf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&Rf(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Xu=er();function N1(t){const e=zf(t.themeId)?t.themeId:er().themeId,n=Pf(t.profileAvatarPresetId)?t.profileAvatarPresetId:er().profileAvatarPresetId,r=Mf(t.profileGender)?t.profileGender:er().profileGender,s=Rf(t.language)?t.language:er().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,joystickEnabled:t.joystickEnabled,p2aEnabled:t.p2aEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function F1(){const t=D1(typeof localStorage<"u"?localStorage.getItem(z1):null),e={...er(),...t};return Xu=N1(e),{...Xu}}typeof localStorage<"u"&&F1();const Po={};var jt={};const L1=typeof process<"u"&&typeof(jt==null?void 0:jt.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?jt.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(jt==null?void 0:jt.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&jt.NEXT_PUBLIC_PLAY_API_BASE.length>0?jt.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(Po==null?void 0:Po.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");$_({});new qt;new Ks;new qt;new qt;new qt;export{It as B,qt as C,xs as D,fe as E,pi as G,te as M,Ve as P,Lo as R,wa as S,Rs as T,Do as U,mn as a,Lh as b,zh as c,Wt as d,dt as e,ya as f,he as g,ph as h,Nh as i,Ys as j,de as k,Km as l,Pl as n,yp as r,ht as w};
|
|
336
|
+
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 Kd(t,e){var o,a,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const u=t.seen.get(c);if(u.ref===null)return;const h=u.def??u.schema,f={...h},d=u.ref;if(u.ref=null,d){r(d);const _=t.seen.get(d),g=_.schema;if(g.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(g)):Object.assign(h,g),Object.assign(h,f),c._zod.parent===d)for(const b in h)b==="$ref"||b==="allOf"||b in f||delete h[b];if(g.$ref&&_.def)for(const b in h)b==="$ref"||b==="allOf"||b in _.def&&JSON.stringify(h[b])===JSON.stringify(_.def[b])&&delete h[b]}const m=c._zod.parent;if(m&&m!==d){r(m);const _=t.seen.get(m);if(_!=null&&_.schema.$ref&&(h.$ref=_.schema.$ref,_.def))for(const g in h)g==="$ref"||g==="allOf"||g in _.def&&JSON.stringify(h[g])===JSON.stringify(_.def[g])&&delete h[g]}t.override({zodSchema:c,jsonSchema:h,path:u.path??[]})};for(const c of[...t.seen.entries()].reverse())r(c[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,(o=t.external)!=null&&o.uri){const c=(a=t.external.registry.get(e))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(c)}Object.assign(s,n.def??n.schema);const i=((l=t.external)==null?void 0:l.defs)??{};for(const c of t.seen.entries()){const u=c[1];u.def&&u.defId&&(i[u.defId]=u.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{const c=JSON.parse(JSON.stringify(s));return Object.defineProperty(c,"~standard",{value:{...e["~standard"],jsonSchema:{input:ui(e,"input",t.processors),output:ui(e,"output",t.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ye(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 Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(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 Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Ye(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Ye(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Ye(s,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const Dv=(t,e={})=>n=>{const r=qd({...n,processors:e});return Ee(t,r),Jd(r,t),Kd(r,t)},ui=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=qd({...s??{},target:i,io:e,processors:n});return Ee(t,o),Jd(o,t),Kd(o,t)},Nv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fv=(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=Nv[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}))])}},Lv=(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",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u),typeof i=="number"&&(s.minimum=i,typeof u=="number"&&e.target!=="draft-04"&&(u>=i?delete s.minimum:delete s.exclusiveMinimum)),typeof c=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c),typeof o=="number"&&(s.maximum=o,typeof c=="number"&&e.target!=="draft-04"&&(c<=o?delete s.maximum:delete s.exclusiveMaximum)),typeof l=="number"&&(s.multipleOf=l)},Bv=(t,e,n,r)=>{n.type="boolean"},Zv=(t,e,n,r)=>{n.not={}},Uv=(t,e,n,r)=>{},Gv=(t,e,n,r)=>{},jv=(t,e,n,r)=>{const s=t._zod.def,i=Id(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},Vv=(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},Hv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Wv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Yv=(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=Ee(i.element,e,{...r,path:[...r.path,"items"]})},Xv=(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]=Ee(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=Ee(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},qv=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>Ee(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},Jv=(t,e,n,r)=>{const s=t._zod.def,i=Ee(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ee(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},Kv=(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=Ee(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=Ee(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Ee(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)}},Qv=(t,e,n,r)=>{const s=t._zod.def,i=Ee(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"}]},ew=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},tw=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},nw=(t,e,n,r)=>{const s=t._zod.def;Ee(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)))},rw=(t,e,n,r)=>{const s=t._zod.def;Ee(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},sw=(t,e,n,r)=>{const s=t._zod.def,i=e.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Ee(i,e,r);const o=e.seen.get(t);o.ref=i},iw=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},Qd=(t,e,n,r)=>{const s=t._zod.def;Ee(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},ow=(t,e,n,r)=>{const s=t._zod.innerType;Ee(s,e,r);const i=e.seen.get(t);i.ref=s},aw=T("ZodISODateTime",(t,e)=>{r0.init(t,e),Te.init(t,e)});function lw(t){return hv(aw,t)}const cw=T("ZodISODate",(t,e)=>{s0.init(t,e),Te.init(t,e)});function uw(t){return dv(cw,t)}const hw=T("ZodISOTime",(t,e)=>{i0.init(t,e),Te.init(t,e)});function dw(t){return fv(hw,t)}const fw=T("ZodISODuration",(t,e)=>{o0.init(t,e),Te.init(t,e)});function pw(t){return pv(fw,t)}const mw=(t,e)=>{zd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>qx(t,n)},flatten:{value:n=>Xx(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,ua,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,ua,2)}},isEmpty:{get(){return t.issues.length===0}}})},yt=T("ZodError",mw,{Parent:Error}),gw=qa(yt),_w=Ja(yt),yw=bi(yt),xw=vi(yt),bw=Qx(yt),vw=eb(yt),ww=tb(yt),kw=nb(yt),Sw=rb(yt),Tw=sb(yt),Aw=ib(yt),Cw=ob(yt),xe=T("ZodType",(t,e)=>(ye.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:ui(t,"input"),output:ui(t,"output")}}),t.toJSONSchema=Dv(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(gn(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>_n(t,n,r),t.brand=()=>t,t.register=(n,r)=>(n.add(t,r),t),t.parse=(n,r)=>gw(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>yw(t,n,r),t.parseAsync=async(n,r)=>_w(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>xw(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>bw(t,n,r),t.decode=(n,r)=>vw(t,n,r),t.encodeAsync=async(n,r)=>ww(t,n,r),t.decodeAsync=async(n,r)=>kw(t,n,r),t.safeEncode=(n,r)=>Sw(t,n,r),t.safeDecode=(n,r)=>Tw(t,n,r),t.safeEncodeAsync=async(n,r)=>Aw(t,n,r),t.safeDecodeAsync=async(n,r)=>Cw(t,n,r),t.refine=(n,r)=>t.check(wk(n,r)),t.superRefine=n=>t.check(kk(n)),t.overwrite=n=>t.check(gr(n)),t.optional=()=>Nu(t),t.exactOptional=()=>lk(t),t.nullable=()=>Fu(t),t.nullish=()=>Nu(Fu(t)),t.nonoptional=n=>pk(t,n),t.array=()=>G(t),t.or=n=>Pt([t,n]),t.and=n=>nk(t,n),t.transform=n=>Lu(t,ok(n)),t.default=n=>hk(t,n),t.prefault=n=>fk(t,n),t.catch=n=>gk(t,n),t.pipe=n=>Lu(t,n),t.readonly=()=>xk(t),t.describe=n=>{const r=t.clone();return Gr.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){var n;return(n=Gr.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Gr.get(t);const r=t.clone();return Gr.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),ef=T("_ZodString",(t,e)=>{Ka.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Fv(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(vv(...r)),t.includes=(...r)=>t.check(Sv(...r)),t.startsWith=(...r)=>t.check(Tv(...r)),t.endsWith=(...r)=>t.check(Av(...r)),t.min=(...r)=>t.check(ci(...r)),t.max=(...r)=>t.check(Yd(...r)),t.length=(...r)=>t.check(Xd(...r)),t.nonempty=(...r)=>t.check(ci(1,...r)),t.lowercase=r=>t.check(wv(r)),t.uppercase=r=>t.check(kv(r)),t.trim=()=>t.check(Ev()),t.normalize=(...r)=>t.check(Cv(...r)),t.toLowerCase=()=>t.check(Iv()),t.toUpperCase=()=>t.check(Pv()),t.slugify=()=>t.check(Mv())}),Ew=T("ZodString",(t,e)=>{Ka.init(t,e),ef.init(t,e),t.email=n=>t.check(j0(Iw,n)),t.url=n=>t.check(X0(Pw,n)),t.jwt=n=>t.check(uv(Vw,n)),t.emoji=n=>t.check(q0(Mw,n)),t.guid=n=>t.check(Mu($u,n)),t.uuid=n=>t.check(V0(js,n)),t.uuidv4=n=>t.check(H0(js,n)),t.uuidv6=n=>t.check(W0(js,n)),t.uuidv7=n=>t.check(Y0(js,n)),t.nanoid=n=>t.check(J0(Rw,n)),t.guid=n=>t.check(Mu($u,n)),t.cuid=n=>t.check(K0(zw,n)),t.cuid2=n=>t.check(Q0(Ow,n)),t.ulid=n=>t.check(ev($w,n)),t.base64=n=>t.check(av(Uw,n)),t.base64url=n=>t.check(lv(Gw,n)),t.xid=n=>t.check(tv(Dw,n)),t.ksuid=n=>t.check(nv(Nw,n)),t.ipv4=n=>t.check(rv(Fw,n)),t.ipv6=n=>t.check(sv(Lw,n)),t.cidrv4=n=>t.check(iv(Bw,n)),t.cidrv6=n=>t.check(ov(Zw,n)),t.e164=n=>t.check(cv(jw,n)),t.datetime=n=>t.check(lw(n)),t.date=n=>t.check(uw(n)),t.time=n=>t.check(dw(n)),t.duration=n=>t.check(pw(n))});function p(t){return G0(Ew,t)}const Te=T("ZodStringFormat",(t,e)=>{we.init(t,e),ef.init(t,e)}),Iw=T("ZodEmail",(t,e)=>{Yb.init(t,e),Te.init(t,e)}),$u=T("ZodGUID",(t,e)=>{Hb.init(t,e),Te.init(t,e)}),js=T("ZodUUID",(t,e)=>{Wb.init(t,e),Te.init(t,e)}),Pw=T("ZodURL",(t,e)=>{Xb.init(t,e),Te.init(t,e)}),Mw=T("ZodEmoji",(t,e)=>{qb.init(t,e),Te.init(t,e)}),Rw=T("ZodNanoID",(t,e)=>{Jb.init(t,e),Te.init(t,e)}),zw=T("ZodCUID",(t,e)=>{Kb.init(t,e),Te.init(t,e)}),Ow=T("ZodCUID2",(t,e)=>{Qb.init(t,e),Te.init(t,e)}),$w=T("ZodULID",(t,e)=>{e0.init(t,e),Te.init(t,e)}),Dw=T("ZodXID",(t,e)=>{t0.init(t,e),Te.init(t,e)}),Nw=T("ZodKSUID",(t,e)=>{n0.init(t,e),Te.init(t,e)}),Fw=T("ZodIPv4",(t,e)=>{a0.init(t,e),Te.init(t,e)}),Lw=T("ZodIPv6",(t,e)=>{l0.init(t,e),Te.init(t,e)}),Bw=T("ZodCIDRv4",(t,e)=>{c0.init(t,e),Te.init(t,e)}),Zw=T("ZodCIDRv6",(t,e)=>{u0.init(t,e),Te.init(t,e)}),Uw=T("ZodBase64",(t,e)=>{h0.init(t,e),Te.init(t,e)}),Gw=T("ZodBase64URL",(t,e)=>{f0.init(t,e),Te.init(t,e)}),jw=T("ZodE164",(t,e)=>{p0.init(t,e),Te.init(t,e)}),Vw=T("ZodJWT",(t,e)=>{g0.init(t,e),Te.init(t,e)}),tf=T("ZodNumber",(t,e)=>{Gd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Lv(t,r,s),t.gt=(r,s)=>t.check(zu(r,s)),t.gte=(r,s)=>t.check(ko(r,s)),t.min=(r,s)=>t.check(ko(r,s)),t.lt=(r,s)=>t.check(Ru(r,s)),t.lte=(r,s)=>t.check(wo(r,s)),t.max=(r,s)=>t.check(wo(r,s)),t.int=r=>t.check(Du(r)),t.safe=r=>t.check(Du(r)),t.positive=r=>t.check(zu(0,r)),t.nonnegative=r=>t.check(ko(0,r)),t.negative=r=>t.check(Ru(0,r)),t.nonpositive=r=>t.check(wo(0,r)),t.multipleOf=(r,s)=>t.check(Ou(r,s)),t.step=(r,s)=>t.check(Ou(r,s)),t.finite=()=>t;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 mv(tf,t)}const Hw=T("ZodNumberFormat",(t,e)=>{_0.init(t,e),tf.init(t,e)});function Du(t){return gv(Hw,t)}const Ww=T("ZodBoolean",(t,e)=>{y0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Bv(t,n,r)});function un(t){return _v(Ww,t)}const Yw=T("ZodAny",(t,e)=>{x0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Uv()});function Y(){return yv(Yw)}const Xw=T("ZodUnknown",(t,e)=>{b0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Gv()});function da(){return xv(Xw)}const qw=T("ZodNever",(t,e)=>{v0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Zv(t,n,r)});function Jw(t){return bv(qw,t)}const Kw=T("ZodArray",(t,e)=>{w0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Yv(t,n,r,s),t.element=e.element,t.min=(n,r)=>t.check(ci(n,r)),t.nonempty=n=>t.check(ci(1,n)),t.max=(n,r)=>t.check(Yd(n,r)),t.length=(n,r)=>t.check(Xd(n,r)),t.unwrap=()=>t.element});function G(t,e){return Rv(Kw,t,e)}const Qw=T("ZodObject",(t,e)=>{S0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Xv(t,n,r,s),Q(t,"shape",()=>e.shape),t.keyof=()=>_e(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:da()}),t.loose=()=>t.clone({...t._zod.def,catchall:da()}),t.strict=()=>t.clone({...t._zod.def,catchall:Jw()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>jx(t,n),t.safeExtend=n=>Vx(t,n),t.merge=n=>Hx(t,n),t.pick=n=>Ux(t,n),t.omit=n=>Gx(t,n),t.partial=(...n)=>Wx(rf,t,n[0]),t.required=(...n)=>Yx(sf,t,n[0])});function v(t,e){const n={type:"object",shape:t??{},...B(e)};return new Qw(n)}const nf=T("ZodUnion",(t,e)=>{Hd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qv(t,n,r,s),t.options=e.options});function Pt(t,e){return new nf({type:"union",options:t,...B(e)})}const ek=T("ZodDiscriminatedUnion",(t,e)=>{nf.init(t,e),T0.init(t,e)});function Be(t,e,n){return new ek({type:"union",options:e,discriminator:t,...B(n)})}const tk=T("ZodIntersection",(t,e)=>{A0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Jv(t,n,r,s)});function nk(t,e){return new tk({type:"intersection",left:t,right:e})}const rk=T("ZodRecord",(t,e)=>{C0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Kv(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function oe(t,e,n){return new rk({type:"record",keyType:t,valueType:e,...B(n)})}const fa=T("ZodEnum",(t,e)=>{E0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>jv(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 fa({...e,checks:[],...B(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 fa({...e,checks:[],...B(s),entries:i})}});function _e(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new fa({type:"enum",entries:n,...B(e)})}const sk=T("ZodLiteral",(t,e)=>{I0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Vv(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 S(t,e){return new sk({type:"literal",values:Array.isArray(t)?t:[t],...B(e)})}const ik=T("ZodTransform",(t,e)=>{P0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Wv(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Cd(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)):(n.value=s,n)}});function ok(t){return new ik({type:"transform",transform:t})}const rf=T("ZodOptional",(t,e)=>{Wd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Nu(t){return new rf({type:"optional",innerType:t})}const ak=T("ZodExactOptional",(t,e)=>{M0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function lk(t){return new ak({type:"optional",innerType:t})}const ck=T("ZodNullable",(t,e)=>{R0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Fu(t){return new ck({type:"nullable",innerType:t})}const uk=T("ZodDefault",(t,e)=>{z0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>tw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function hk(t,e){return new uk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Md(e)}})}const dk=T("ZodPrefault",(t,e)=>{O0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>nw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function fk(t,e){return new dk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Md(e)}})}const sf=T("ZodNonOptional",(t,e)=>{$0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>ew(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function pk(t,e){return new sf({type:"nonoptional",innerType:t,...B(e)})}const mk=T("ZodCatch",(t,e)=>{D0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>rw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function gk(t,e){return new mk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const _k=T("ZodPipe",(t,e)=>{N0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>sw(t,n,r,s),t.in=e.in,t.out=e.out});function Lu(t,e){return new _k({type:"pipe",in:t,out:e})}const yk=T("ZodReadonly",(t,e)=>{F0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>iw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function xk(t){return new yk({type:"readonly",innerType:t})}const bk=T("ZodLazy",(t,e)=>{L0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>ow(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function vk(t){return new bk({type:"lazy",getter:t})}const of=T("ZodCustom",(t,e)=>{B0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Hv(t,n)});function wk(t,e={}){return zv(of,t,e)}function kk(t){return Ov(t)}function af(t,e={}){const n=new of({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...B(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 Sk={custom:"custom"};v({name:p(),description:p().optional(),inputSchema:v({type:S("object"),properties:oe(p(),Y()),required:G(p()),additionalProperties:un()})});function So(){return{}}const lf=()=>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 Bu{constructor(){K(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function Zu(){return!0}class Tk{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 Ak=new Tk,Oe=v({providerData:oe(p(),Y()).optional()}),at=Oe.extend({id:p().optional()}),Ck=Oe.extend({type:S("refusal"),refusal:p()}),Ek=Oe.extend({type:S("output_text"),text:p()}),Qa=Oe.extend({type:S("input_text"),text:p()}),Ik=Oe.extend({type:S("reasoning_text"),text:p()}),cf=Oe.extend({type:S("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()}),uf=Oe.extend({type:S("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()}),hf=Oe.extend({type:S("audio"),audio:p().or(v({id:p()})).describe("Base64 encoded audio data or file id"),format:p().nullable().optional(),transcript:p().nullable().optional()}),Pk=Oe.extend({type:S("image"),image:p().describe("Base64 encoded image data")}),Mk=Oe.extend({type:S("text"),text:p()}),Rk=v({data:Pt([p(),af(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),zk=v({url:p().describe("Publicly accessible URL pointing to the image content")}),Ok=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),$k=Pt([Rk,zk,Ok]).describe("Inline image data or references to uploaded content."),Dk=v({data:Pt([p(),af(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")}),Nk=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),Fk=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),Lk=Pt([p().describe("Existing data URL or base64 string"),Dk,Nk,Fk]).describe("Inline data (with metadata) or references pointing to file contents."),Bk=(...t)=>p(),Zk=Oe.extend({type:S("image"),image:p().or($k).optional(),detail:Bk("low","high","auto").optional()}),Uk=Oe.extend({type:S("file"),file:Lk}),Gk=Oe.extend({type:S("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Uu=Be("type",[v({type:S("screenshot")}),v({type:S("click"),x:M(),y:M(),button:_e(["left","right","wheel","back","forward"])}),v({type:S("double_click"),x:M(),y:M()}),v({type:S("scroll"),x:M(),y:M(),scroll_x:M(),scroll_y:M()}),v({type:S("type"),text:p()}),v({type:S("wait")}),v({type:S("move"),x:M(),y:M()}),v({type:S("keypress"),keys:G(p())}),v({type:S("drag"),path:G(v({x:M(),y:M()}))})]),jk=Be("type",[Ek,Ck,hf,Pk]),el=at.extend({type:S("message").optional()}),ki=el.extend({role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(jk)}),Vk=Be("type",[Qa,cf,uf,hf]),df=el.extend({role:S("user"),content:G(Vk).or(p())}),ff=el.extend({role:S("system"),content:p()});Be("role",[ff,ki,df]);const os=at.extend({type:S("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()}),as=at.extend({type:S("function_call"),callId:p().describe("The ID of the tool call"),name:p().describe("The name of the function"),namespace:p().optional(),status:_e(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:S("tool_reference"),functionName:p(),namespace:p().optional()});const Hk=oe(p(),Y()),Wk=da(),tl=at.extend({type:S("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),arguments:Wk,status:p().optional()}),nl=at.extend({type:S("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),status:p().optional(),tools:G(Hk)}),Yk=Be("type",[Mk,Zk,Uk]),Xk=Be("type",[Qa,cf,uf]),hi=at.extend({type:S("function_call_result"),name:p().describe("The name of the tool"),namespace:p().optional(),callId:p().describe("The ID of the tool call"),status:_e(["in_progress","completed","incomplete"]),output:Pt([p(),Yk,G(Xk)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),Si=at.extend({type:S("computer_call"),callId:p().describe("The ID of the computer call"),status:_e(["in_progress","completed","incomplete"]),action:Uu.optional(),actions:G(Uu).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:Sk.custom,message:"computer_call items must include action or actions.",path:["action"]})}),pf=at.extend({type:S("computer_call_result"),callId:p().describe("The ID of the computer call"),output:Gk}),qk=v({commands:G(p()),timeoutMs:M().int().min(0).optional(),maxOutputLength:M().int().min(0).optional()}),Ti=at.extend({type:S("shell_call"),callId:p(),status:_e(["in_progress","completed","incomplete"]).optional(),action:qk}),Jk=Be("type",[v({type:S("timeout")}),v({type:S("exit"),exitCode:M().int().nullable()})]),Kk=v({stdout:p(),stderr:p(),outcome:Jk}).passthrough(),rl=at.extend({type:S("shell_call_output"),callId:p(),maxOutputLength:M().optional(),output:G(Kk)}),Qk=v({type:S("create_file"),path:p(),diff:p()}),eS=v({type:S("update_file"),path:p(),diff:p()}),tS=v({type:S("delete_file"),path:p()}),nS=Be("type",[Qk,eS,tS]),Ai=at.extend({type:S("apply_patch_call"),callId:p(),status:_e(["in_progress","completed"]),operation:nS}),sl=at.extend({type:S("apply_patch_call_output"),callId:p(),status:_e(["completed","failed"]),output:p().optional()}),rS=Be("type",[Si,Ti,Ai,as,os]),il=Oe.extend({id:p().optional(),type:S("reasoning"),content:G(Qa),rawContent:G(Ik).optional()}),mf=at.extend({type:S("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),gf=at.extend({type:S("unknown")}),_f=Be("type",[ki,tl,nl,os,as,Si,Ti,Ai,hi,rl,sl,il,mf,gf]),sS=Pt([df,ki,ff,tl,nl,os,as,Si,Ti,Ai,hi,pf,rl,sl,il,mf,gf]),iS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),oS=v({requests:M().optional(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:Pt([oe(p(),M()),G(oe(p(),M()))]).optional(),outputTokensDetails:Pt([oe(p(),M()),G(oe(p(),M()))]).optional(),requestUsageEntries:G(iS).optional()}),aS=Oe.extend({type:S("output_text_delta"),delta:p()}),lS=Oe.extend({type:S("response_started")}),cS=Oe.extend({type:S("response_done"),response:Oe.extend({id:p(),requestId:p().optional(),usage:oS,output:G(_f)})}),uS=Oe.extend({type:S("model"),event:Y().describe("The event from the model")});Be("type",[aS,cS,lS,uS]);const Gu=Symbol.for("openai.agents.core.asyncLocalStorage");let To;function hS(){try{const t=globalThis,e=t[Gu];if(e)return e;const n=new Bu;return t[Gu]=n,n}catch{return To||(To=new Bu),To}}function yf(){const t=hS().getStore();if((t==null?void 0:t.active)===!0)return t}function ju(){const t=yf();return t!=null&&t.trace?t.trace:null}function Vu(){const t=yf();return t!=null&&t.span?t.span:null}class dS{async export(e){if(Ad.disabled){me.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 us,nr,hs,ds,rr,Ue,Zt,sn,on,sr,st,pa,ma,qn;class fS{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ae(this,st);ae(this,us);ae(this,nr);ae(this,hs);ae(this,ds);ae(this,rr);ae(this,Ue,[]);ae(this,Zt);ae(this,sn,null);ae(this,on,!1);ae(this,sr,null);q(this,us,n),q(this,nr,r),q(this,hs,s),q(this,ds,n*i),q(this,rr,e),q(this,Zt,Ak),me.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){q(this,sr,new AbortController),St(this,st,ma).call(this)}async onTraceStart(e){await St(this,st,pa).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await St(this,st,pa).call(this,e)}async shutdown(e){var n;for(e&&R(this,Zt).setTimeout(()=>{var r;(r=R(this,sr))==null||r.abort()},e),me.debug("Shutting down gracefully");R(this,Ue).length>0;){if(me.debug(`Waiting for buffer to empty. Items left: ${R(this,Ue).length}`),R(this,on)||await St(this,st,qn).call(this,!0),(n=R(this,sr))!=null&&n.signal.aborted){me.debug("Timeout reached, force flushing"),await St(this,st,qn).call(this,!0);break}await new Promise(r=>R(this,Zt).setTimeout(r,500))}me.debug("Buffer empty. Exiting"),R(this,Zt)&&R(this,sn)&&R(this,Zt).clearTimeout(R(this,sn))}async forceFlush(){R(this,Ue).length>0&&await St(this,st,qn).call(this,!0)}}us=new WeakMap,nr=new WeakMap,hs=new WeakMap,ds=new WeakMap,rr=new WeakMap,Ue=new WeakMap,Zt=new WeakMap,sn=new WeakMap,on=new WeakMap,sr=new WeakMap,st=new WeakSet,pa=async function(e){if(R(this,Ue).length+1>R(this,us)){me.error("Dropping trace because buffer is full");return}R(this,Ue).push(e),R(this,Ue).length>R(this,ds)&&await St(this,st,qn).call(this)},ma=function(){q(this,sn,R(this,Zt).setTimeout(async()=>{await St(this,st,qn).call(this),St(this,st,ma).call(this)},R(this,hs))),typeof R(this,sn).unref=="function"&&R(this,sn).unref()},qn=async function(e=!1){if(R(this,Ue).length!==0){if(me.debug(`Exporting batches. Force: ${e}. Buffer size: ${R(this,Ue).length}`),e||R(this,Ue).length<R(this,nr)){const n=[...R(this,Ue)];q(this,Ue,[]),q(this,on,!0),await R(this,rr).export(n),q(this,on,!1)}else if(R(this,Ue).length>0){const n=R(this,Ue).splice(0,R(this,nr));q(this,on,!0),await R(this,rr).export(n),q(this,on,!1)}}};var ut;class pS{constructor(){ae(this,ut,[])}start(){for(const e of R(this,ut))e.start&&e.start()}addTraceProcessor(e){R(this,ut).push(e)}setProcessors(e){me.debug("Shutting down old processors");for(const n of R(this,ut))n.shutdown();q(this,ut,e)}async onTraceStart(e){for(const n of R(this,ut))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of R(this,ut))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of R(this,ut))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of R(this,ut))await n.onSpanEnd(e)}async shutdown(e){for(const n of R(this,ut))await n.shutdown(e)}async forceFlush(){for(const e of R(this,ut))await e.forceFlush()}}ut=new WeakMap;let Ao=null,Co=null;function mS(){return Ao||(Ao=new dS),Ao}function xf(){return Co||(Co=new fS(mS())),Co}function Hu(){return new Date().toISOString()}function bf(){return`trace_${lf().replace(/-/g,"")}`}function gS(){return`span_${lf().replace(/-/g,"").slice(0,24)}`}function _S(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var fs,ps,ms,gs,_s,En,an,ln,In,ir,ys;const ol=class ol{constructor(e,n){K(this,"type","trace.span");ae(this,fs);ae(this,ps);ae(this,ms);ae(this,gs);ae(this,_s);ae(this,En);ae(this,an);ae(this,ln);ae(this,In);ae(this,ir);ae(this,ys);q(this,ps,e.traceId),q(this,ms,e.spanId??gS()),q(this,fs,e.data),q(this,En,n),q(this,gs,e.parentId??null),q(this,_s,e.traceMetadata),q(this,In,e.error??null),q(this,an,e.startedAt??null),q(this,ln,e.endedAt??null),q(this,ir,e.tracingApiKey)}get traceId(){return R(this,ps)}get spanData(){return R(this,fs)}get traceMetadata(){return R(this,_s)}get spanId(){return R(this,ms)}get parentId(){return R(this,gs)}get previousSpan(){return R(this,ys)}set previousSpan(e){q(this,ys,e)}start(){if(R(this,an)){me.warn("Span already started");return}q(this,an,Hu()),R(this,En).onSpanStart(this)}end(){if(R(this,ln)){me.debug("Span already finished",this.spanData);return}q(this,ln,Hu()),R(this,En).onSpanEnd(this)}setError(e){q(this,In,e)}get error(){return R(this,In)}get startedAt(){return R(this,an)}get endedAt(){return R(this,ln)}get tracingApiKey(){return R(this,ir)}clone(){var n;const e=new ol({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:R(this,an)??void 0,endedAt:R(this,ln)??void 0,error:R(this,In)??void 0,tracingApiKey:R(this,ir)},R(this,En));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:_S(this.spanData),error:this.error}}};fs=new WeakMap,ps=new WeakMap,ms=new WeakMap,gs=new WeakMap,_s=new WeakMap,En=new WeakMap,an=new WeakMap,ln=new WeakMap,In=new WeakMap,ir=new WeakMap,ys=new WeakMap;let ls=ol;class nn extends ls{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var or,Ut;const al=class al{constructor(e,n){K(this,"type","trace");K(this,"traceId");K(this,"name");K(this,"groupId",null);K(this,"metadata");K(this,"tracingApiKey");ae(this,or);ae(this,Ut);this.traceId=e.traceId??bf(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,q(this,or,n??xf()),q(this,Ut,e.started??!1)}async start(){R(this,Ut)||(q(this,Ut,!0),await R(this,or).onTraceStart(this))}async end(){R(this,Ut)&&(q(this,Ut,!1),await R(this,or).onTraceEnd(this))}clone(){return new al({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:R(this,Ut),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}};or=new WeakMap,Ut=new WeakMap;let cs=al;class Eo extends cs{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var Le,Pn,Gt,di,wf;class vf{constructor(){ae(this,di);ae(this,Le);ae(this,Pn);ae(this,Gt);q(this,Le,new pS),q(this,Pn,Ad.disabled),q(this,Gt,null),St(this,di,wf).call(this)}registerProcessor(e){q(this,Gt,null),R(this,Le).addTraceProcessor(e)}setProcessors(e){q(this,Gt,null),R(this,Le).setProcessors(e)}getCurrentTrace(){return ju()}getCurrentSpan(){return Vu()}setDisabled(e){q(this,Pn,e)}startExportLoop(){R(this,Le).start()}createTrace(e){if(R(this,Pn))return me.debug("Tracing is disabled, Not creating trace %o",e),new Eo;const n=e.traceId??bf(),r=e.name??"Agent workflow";return me.debug("Creating trace %s with name %s",n,r),new cs({...e,name:r,traceId:n},R(this,Le))}createSpan(e,n){if(R(this,Pn)||e.disabled)return me.debug("Tracing is disabled, Not creating span %o",e),new nn(e.data,R(this,Le));let r,s,i,o;if(n){if(n instanceof cs){if(n instanceof Eo)return me.debug("Parent trace is no-op, returning NoopSpan"),new nn(e.data,R(this,Le));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof ls){if(n instanceof nn)return me.debug("Parent span is no-op, returning NoopSpan"),new nn(e.data,R(this,Le));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=ju(),l=Vu();if(!a)return me.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new nn(e.data,R(this,Le));if(l instanceof nn||a instanceof Eo)return me.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new nn(e.data,R(this,Le));s=a.traceId,i=a.tracingApiKey,o=a.metadata,l?(me.debug("Using parent span %s",l.spanId),r=l.spanId):me.debug("No parent span, using current trace %s",a.traceId)}return s?(me.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new ls({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},R(this,Le))):(me.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new nn(e.data,R(this,Le)))}async shutdown(e){R(this,Gt)||q(this,Gt,(async()=>{try{me.debug("Shutting down tracing provider"),await R(this,Le).shutdown(e)}catch(n){me.error("Error shutting down tracing provider %o",n)}})()),await R(this,Gt)}async forceFlush(){await R(this,Le).forceFlush()}}Le=new WeakMap,Pn=new WeakMap,Gt=new WeakMap,di=new WeakSet,wf=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(),Wu("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Wu("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{me.error("Unhandled rejection",n,r),await e(),yS("unhandledRejection")||process.exit(1)})}};let Io;function Wu(t){return process.listeners(t).length>1}function yS(t){return process.listeners(t).length>1}function xS(){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 Vs();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return Vs()}try{const s=new vf;return e[t]=s,s}catch{return Vs()}}catch{return Vs()}}function Vs(){return Io||(Io=new vf),Io}function bS(t){xS().registerProcessor(t)}const vS=Be("type",[v({type:S("next_step_handoff"),newAgent:Y()}),v({type:S("next_step_final_output"),output:p()}),v({type:S("next_step_run_again")}),v({type:S("next_step_interruption"),data:oe(p(),Y())})]),wS="1.8",kS=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",wS],SS=_e(kS),pt=v({name:p()}),TS=v({object:S("trace.span"),id:p(),trace_id:p(),parent_id:p().nullable(),started_at:p().nullable(),ended_at:p().nullable(),error:v({message:p(),data:oe(p(),Y()).optional()}).nullable(),span_data:oe(p(),Y())}),kf=TS.extend({previous_span:vk(()=>kf).optional()}),AS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),Sf=v({requests:M(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:G(oe(p(),M())).optional(),outputTokensDetails:G(oe(p(),M())).optional(),requestUsageEntries:G(AS).optional()}),Yu=v({usage:Sf,output:G(_f),responseId:p().optional(),requestId:p().optional(),providerData:oe(p(),Y()).optional()}),Tf=Be("type",[v({type:S("message_output_item"),rawItem:ki,agent:pt}),v({type:S("tool_search_call_item"),rawItem:tl,agent:pt}),v({type:S("tool_search_output_item"),rawItem:nl,agent:pt}),v({type:S("tool_call_item"),rawItem:rS.or(os),agent:pt}),v({type:S("tool_call_output_item"),rawItem:hi.or(pf).or(rl).or(sl),agent:pt,output:p()}),v({type:S("reasoning_item"),rawItem:il,agent:pt}),v({type:S("handoff_call_item"),rawItem:as,agent:pt}),v({type:S("handoff_output_item"),rawItem:hi,sourceAgent:pt,targetAgent:pt}),v({type:S("tool_approval_item"),rawItem:as.or(os).or(Si).or(Ti).or(Ai),agent:pt,toolName:p().optional()})]),CS=v({object:S("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:oe(p(),Y()),tracing_api_key:p().optional().nullable()}),ES=v({newItems:G(Tf),toolsUsed:G(p()),handoffs:G(v({toolCall:Y(),handoff:Y()})),functions:G(v({toolCall:Y(),tool:Y()})),computerActions:G(v({toolCall:Y(),computer:Y()})),shellActions:G(v({toolCall:Y(),shell:Y()})).optional(),applyPatchActions:G(v({toolCall:Y(),applyPatch:Y()})).optional(),mcpApprovalRequests:G(v({requestItem:v({rawItem:v({type:S("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:oe(p(),Y()).nullable().optional()})}),mcpTool:v({type:S("hosted_tool"),name:S("hosted_mcp"),providerData:oe(p(),Y())})})).optional()}),Af=v({tripwireTriggered:un(),outputInfo:Y()}),IS=Be("type",[v({type:S("allow")}),v({type:S("rejectContent"),message:p()}),v({type:S("throwException")})]),Cf=v({outputInfo:Y().optional(),behavior:IS}),Ef=v({type:Pt([S("tool_input"),S("tool_output")]),name:p()}),PS=v({guardrail:v({type:S("input"),name:p()}),output:Af}),MS=v({guardrail:v({type:S("output"),name:p()}),agentOutput:Y(),agent:pt,output:Af}),RS=v({guardrail:Ef.extend({type:S("tool_input")}),output:Cf}),zS=v({guardrail:Ef.extend({type:S("tool_output")}),output:Cf});v({$schemaVersion:SS,currentTurn:M(),currentAgent:pt,originalInput:p().or(G(sS)),modelResponses:G(Yu),context:v({usage:Sf,approvals:oe(p(),v({approved:G(p()).or(un()),rejected:G(p()).or(un()),messages:oe(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:oe(p(),Y()),toolInput:Y().optional()}),toolUseTracker:oe(p(),G(p())),maxTurns:M(),currentAgentSpan:kf.nullable().optional(),noActiveAgentRun:un(),inputGuardrailResults:G(PS),outputGuardrailResults:G(MS),toolInputGuardrailResults:G(RS).optional().default([]),toolOutputGuardrailResults:G(zS).optional().default([]),currentTurnInProgress:un().optional(),currentStep:vS.optional(),lastModelResponse:Yu.optional(),generatedItems:G(Tf),pendingAgentToolRuns:oe(p(),p()).optional().default({}),lastProcessedResponse:ES.optional(),currentTurnPersistedItemCount:M().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:_e(["preserve","omit"]).optional(),trace:CS.nullable()});v({input:p()});Ha("openai-agents:mcp-servers");bS(xf());v({itemId:p()});Be("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("system"),content:G(v({type:S("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("user"),status:_e(["in_progress","completed"]),content:G(v({type:S("input_text"),text:p()}).or(v({type:S("input_audio"),audio:p().nullable().optional(),transcript:p().nullable()})))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(v({type:S("output_text"),text:p()}).or(v({type:S("output_audio"),audio:p().nullable().optional(),transcript:p().nullable().optional()})))})]);v({itemId:p(),previousItemId:p().nullable().optional(),type:S("function_call"),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:_e(["mcp_call","mcp_tool_call"]),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:S("mcp_approval_request"),serverLabel:p(),name:p(),arguments:oe(p(),Y()),approved:un().optional().nullable()});Ha("openai-agents:realtime");const If=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:M().or(S("inf")).optional().nullable(),metadata:oe(p(),Y()).optional().nullable(),output_modalities:G(p()).optional().nullable(),object:S("realtime.response").optional().nullable(),output:G(Y()).optional().nullable(),audio:v({output:v({format:Y().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:_e(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:oe(p(),Y()).optional().nullable(),usage:v({input_tokens:M().optional(),input_token_details:oe(p(),Y()).optional().nullable(),output_tokens:M().optional(),output_token_details:oe(p(),Y()).optional().nullable()}).optional().nullable()}),OS=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Pt([S("input_text"),S("input_audio"),S("item_reference"),S("output_text"),S("output_audio")])}),_r=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:G(OS).optional(),name:p().optional(),output:p().nullable().optional(),role:_e(["user","assistant","system"]).optional(),status:_e(["completed","incomplete","in_progress"]).optional(),type:_e(["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:un().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:Y().nullable().optional(),tools:G(v({name:p(),description:p(),input_schema:oe(p(),Y()).optional()}).passthrough()).optional()}).passthrough(),$S=v({type:S("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:S("realtime.conversation").optional()})}),DS=v({type:S("conversation.item.added"),event_id:p(),item:_r,previous_item_id:p().nullable().optional()}),NS=v({type:S("conversation.item.done"),event_id:p(),item:_r,previous_item_id:p().nullable().optional()}),FS=v({type:S("conversation.item.deleted"),event_id:p(),item_id:p()}),LS=v({type:S("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),logprobs:G(Y()).nullable().optional(),usage:v({type:S("tokens"),total_tokens:M(),input_tokens:M(),input_token_details:v({text_tokens:M(),audio_tokens:M()}),output_tokens:M()}).optional()}),BS=v({type:S("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:M().optional(),delta:p().optional(),logprobs:G(Y()).nullable().optional()}),ZS=v({type:S("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()})}),US=v({type:S("conversation.item.retrieved"),event_id:p(),item:_r}),GS=v({type:S("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:M(),content_index:M()}),jS=v({type:S("conversation.item.create"),item:_r,event_id:p().optional(),previous_item_id:p().nullable().optional()}),VS=v({type:S("conversation.item.delete"),item_id:p(),event_id:p().optional()}),HS=v({type:S("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),WS=v({type:S("conversation.item.truncate"),item_id:p(),audio_end_ms:M(),content_index:M(),event_id:p().optional()}),YS=v({type:S("error"),event_id:p().optional(),error:Y().optional()}),XS=v({type:S("input_audio_buffer.cleared"),event_id:p()}),qS=v({type:S("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),JS=v({type:S("input_audio_buffer.clear"),event_id:p().optional()}),KS=v({type:S("input_audio_buffer.commit"),event_id:p().optional()}),QS=v({type:S("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),e1=v({type:S("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:M()}),t1=v({type:S("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:M()}),n1=v({type:S("output_audio_buffer.started"),event_id:p()}).passthrough(),r1=v({type:S("output_audio_buffer.stopped"),event_id:p()}).passthrough(),s1=v({type:S("output_audio_buffer.cleared"),event_id:p()}),i1=v({type:S("rate_limits.updated"),event_id:p(),rate_limits:G(v({limit:M().optional(),name:_e(["requests","tokens"]).optional(),remaining:M().optional(),reset_seconds:M().optional()}))}),o1=v({type:S("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),a1=v({type:S("response.output_audio.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p()}),l1=v({type:S("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),c1=v({type:S("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),output_index:M(),response_id:p()}),u1=v({type:S("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:_e(["text","audio"]).optional()})}),h1=v({type:S("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:_e(["text","audio"]).optional()})}),d1=v({type:S("response.created"),event_id:p(),response:If}),f1=v({type:S("response.done"),event_id:p(),response:If}),p1=v({type:S("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:M(),response_id:p()}),m1=v({type:S("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:M(),response_id:p()}),g1=v({type:S("response.output_item.added"),event_id:p(),item:_r,output_index:M(),response_id:p()}),_1=v({type:S("response.output_item.done"),event_id:p(),item:_r,output_index:M(),response_id:p()}),y1=v({type:S("response.output_text.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),x1=v({type:S("response.output_text.done"),event_id:p(),item_id:p(),content_index:M(),text:p(),output_index:M(),response_id:p()}),b1=v({type:S("session.created"),event_id:p(),session:Y()}),v1=v({type:S("session.updated"),event_id:p(),session:Y()}),w1=v({type:S("response.cancel"),event_id:p().optional(),response_id:p().optional()}),k1=v({type:S("response.create"),event_id:p().optional(),response:Y().optional()}),S1=v({type:S("session.update"),event_id:p().optional(),session:Y()}),T1=v({type:S("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),A1=v({type:S("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),C1=v({type:S("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),delta:p(),obfuscation:p()}),E1=v({type:S("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),arguments:p()}),I1=v({type:S("response.mcp_call.in_progress"),event_id:p(),output_index:M(),item_id:p()}),P1=v({type:S("response.mcp_call.completed"),event_id:p(),output_index:M(),item_id:p()}),M1=v({type:S("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();Be("type",[$S,DS,NS,FS,LS,BS,ZS,US,GS,YS,XS,QS,e1,t1,n1,r1,s1,i1,o1,a1,l1,c1,u1,h1,d1,f1,p1,m1,g1,_1,y1,x1,b1,v1,T1,A1,M1,C1,E1,I1,P1]);Be("type",[jS,VS,HS,WS,qS,JS,KS,w1,k1,S1]);function R1(){return["park","new_york","tokyo"]}const z1="agent-play-preview-view-settings-v2",O1=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function $1(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Pf(t){return t==="default"||t==="ember"||t==="forest"}function Mf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function Rf(t){return O1.includes(t)}function er(){return{themeId:"park",showChatUi:!0,debugMode:$1(),joystickEnabled:!0,p2aEnabled:!1,profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function zf(t){return R1().includes(t)}function D1(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"&&zf(n.themeId)&&(r.themeId=n.themeId),typeof n.showChatUi=="boolean"&&(r.showChatUi=n.showChatUi),typeof n.debugMode=="boolean"&&(r.debugMode=n.debugMode),typeof n.joystickEnabled=="boolean"&&(r.joystickEnabled=n.joystickEnabled),typeof n.p2aEnabled=="boolean"&&(r.p2aEnabled=n.p2aEnabled),typeof n.profileAvatarPresetId=="string"&&Pf(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&Mf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&Rf(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Xu=er();function N1(t){const e=zf(t.themeId)?t.themeId:er().themeId,n=Pf(t.profileAvatarPresetId)?t.profileAvatarPresetId:er().profileAvatarPresetId,r=Mf(t.profileGender)?t.profileGender:er().profileGender,s=Rf(t.language)?t.language:er().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,joystickEnabled:t.joystickEnabled,p2aEnabled:t.p2aEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function F1(){const t=D1(typeof localStorage<"u"?localStorage.getItem(z1):null),e={...er(),...t};return Xu=N1(e),{...Xu}}typeof localStorage<"u"&&F1();const Po={};var jt={};const L1=typeof process<"u"&&typeof(jt==null?void 0:jt.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?jt.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(jt==null?void 0:jt.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&jt.NEXT_PUBLIC_PLAY_API_BASE.length>0?jt.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(Po==null?void 0:Po.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");$_({});new qt;new Ks;new qt;new qt;new qt;export{It as B,qt as C,xs as D,fe as E,pi as G,te as M,Ve as P,Lo as R,wa as S,Rs as T,Do as U,mn as a,Lh as b,zh as c,Wt as d,dt as e,ya as f,he as g,ph as h,Nh as i,Ys as j,de as k,Km as l,Pl as n,yp as r,ht as w};
|