@mcp-use/inspector 0.14.0-canary.1 → 0.14.0-canary.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.
- package/dist/cli.js +3 -1
- package/dist/client/assets/{base-Aouj1Yhj.js → base-Bnm339-a.js} +1 -1
- package/dist/client/assets/{base-ZEkF4ver.js → base-RWAdy9P6.js} +1 -1
- package/dist/client/assets/{browser-BWolhM7l.js → browser-9kmymM9X.js} +1 -1
- package/dist/client/assets/{embeddings-BTUgP3x_.js → embeddings-C7cRBw1j.js} +1 -1
- package/dist/client/assets/{index-BOIA9kd1.js → index-Apq2pBJl.js} +1 -1
- package/dist/client/assets/{index-CNfmoBX-.js → index-BsLLCsBP.js} +6 -6
- package/dist/client/assets/{index-Bfe1ynAS.js → index-C2UfjD9L.js} +1 -1
- package/dist/client/assets/{index-CSZqqrHs.js → index-C69r9Nt9.js} +1 -1
- package/dist/client/assets/{index-CtWrgdCi.js → index-CtpnfKmY.js} +1 -1
- package/dist/client/assets/{index-C88Q8iJs.js → index-DIa0UgbZ.js} +1 -1
- package/dist/client/assets/{index-DIlJ2WcE.js → index-DKR-Owed.js} +1 -1
- package/dist/client/assets/{index-BSuQO5pd.js → index-DXrgZUfu.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/{chunk-YLX7JQDX.js → chunk-BC23UV5D.js} +3 -1
- package/dist/server/{chunk-Y4GX3FDV.js → chunk-NOEIHEAG.js} +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/middleware.js +2 -2
- package/dist/server/server.js +1 -1
- package/dist/server/shared-static.d.ts.map +1 -1
- package/dist/server/shared-static.js +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1359,7 +1359,9 @@ function registerStaticRoutes(app2, clientDistPath) {
|
|
|
1359
1359
|
return c.notFound();
|
|
1360
1360
|
});
|
|
1361
1361
|
app2.get("/", (c) => {
|
|
1362
|
-
|
|
1362
|
+
const url = new URL(c.req.url);
|
|
1363
|
+
const queryString = url.search;
|
|
1364
|
+
return c.redirect(`/inspector${queryString}`);
|
|
1363
1365
|
});
|
|
1364
1366
|
app2.get("/inspector", (c) => {
|
|
1365
1367
|
const indexPath = join2(distPath, "index.html");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as G,av as P,G as U,ad as X,aw as Y,_ as C,O as Z,q as L,ai as Q}from"./base-ZEkF4ver.js";import{g as ee}from"./index-CNfmoBX-.js";function te(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function se(e){return e!==void 0&&P.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function ae(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&(G(e.schema)||e.schema!=null&&typeof e.schema=="object"&&"type"in e.schema&&typeof e.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(e.schema.type))}function Re(e){return ae(e)||se(e)||te(e)}var re={};C(re,{BasePromptValue:()=>M,ChatPromptValue:()=>V,ImagePromptValue:()=>ie,StringPromptValue:()=>O});var M=class extends Y{},O=class extends M{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new U(this.value)]}},V=class extends M{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return X(this.messages)}toChatMessages(){return this.messages}},ie=class extends M{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new U({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}},o="0123456789abcdef".split(""),ne=[-2147483648,8388608,32768,128],_=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=[];function A(e,t){t?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}A.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if(r!=="string"){if(r==="object"){if(e===null)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var s,i=0,a,h=e.length,n=this.blocks;i<h;){if(this.hashed&&(this.hashed=!1,n[0]=this.block,this.block=n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),t)for(a=this.start;i<h&&a<64;++i)n[a>>>2]|=e[i]<<_[a++&3];else for(a=this.start;i<h&&a<64;++i)s=e.charCodeAt(i),s<128?n[a>>>2]|=s<<_[a++&3]:s<2048?(n[a>>>2]|=(192|s>>>6)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]):s<55296||s>=57344?(n[a>>>2]|=(224|s>>>12)<<_[a++&3],n[a>>>2]|=(128|s>>>6&63)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]):(s=65536+((s&1023)<<10|e.charCodeAt(++i)&1023),n[a>>>2]|=(240|s>>>18)<<_[a++&3],n[a>>>2]|=(128|s>>>12&63)<<_[a++&3],n[a>>>2]|=(128|s>>>6&63)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=n[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};A.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=ne[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}};A.prototype.hash=function(){var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=this.blocks,u,b,x,k,c,l,p,d,y,f,v;for(u=16;u<64;++u)c=g[u-15],b=(c>>>7|c<<25)^(c>>>18|c<<14)^c>>>3,c=g[u-2],x=(c>>>17|c<<15)^(c>>>19|c<<13)^c>>>10,g[u]=g[u-16]+b+g[u-7]+x<<0;for(v=t&r,u=0;u<64;u+=4)this.first?(this.is224?(d=300032,c=g[0]-1413257819,n=c-150054599<<0,s=c+24177077<<0):(d=704751109,c=g[0]-210244248,n=c-1521486534<<0,s=c+143694565<<0),this.first=!1):(b=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),x=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),d=e&t,k=d^e&r^v,p=i&a^~i&h,c=n+x+p+E[u]+g[u],l=b+k,n=s+c<<0,s=c+l<<0),b=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),x=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),y=s&e,k=y^s&t^d,p=h&n^~h&i,c=a+x+p+E[u+1]+g[u+1],l=b+k,h=r+c<<0,r=c+l<<0,b=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),x=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),f=r&s,k=f^r&e^y,p=a&h^~a&n,c=i+x+p+E[u+2]+g[u+2],l=b+k,a=t+c<<0,t=c+l<<0,b=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),x=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=t&r,k=v^t&s^f,p=a&h^~a&n,c=i+x+p+E[u+3]+g[u+3],l=b+k,i=e+c<<0,e=c+l<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+s<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+h<<0,this.h7=this.h7+n<<0};A.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=o[e>>>28&15]+o[e>>>24&15]+o[e>>>20&15]+o[e>>>16&15]+o[e>>>12&15]+o[e>>>8&15]+o[e>>>4&15]+o[e&15]+o[t>>>28&15]+o[t>>>24&15]+o[t>>>20&15]+o[t>>>16&15]+o[t>>>12&15]+o[t>>>8&15]+o[t>>>4&15]+o[t&15]+o[r>>>28&15]+o[r>>>24&15]+o[r>>>20&15]+o[r>>>16&15]+o[r>>>12&15]+o[r>>>8&15]+o[r>>>4&15]+o[r&15]+o[s>>>28&15]+o[s>>>24&15]+o[s>>>20&15]+o[s>>>16&15]+o[s>>>12&15]+o[s>>>8&15]+o[s>>>4&15]+o[s&15]+o[i>>>28&15]+o[i>>>24&15]+o[i>>>20&15]+o[i>>>16&15]+o[i>>>12&15]+o[i>>>8&15]+o[i>>>4&15]+o[i&15]+o[a>>>28&15]+o[a>>>24&15]+o[a>>>20&15]+o[a>>>16&15]+o[a>>>12&15]+o[a>>>8&15]+o[a>>>4&15]+o[a&15]+o[h>>>28&15]+o[h>>>24&15]+o[h>>>20&15]+o[h>>>16&15]+o[h>>>12&15]+o[h>>>8&15]+o[h>>>4&15]+o[h&15];return this.is224||(g+=o[n>>>28&15]+o[n>>>24&15]+o[n>>>20&15]+o[n>>>16&15]+o[n>>>12&15]+o[n>>>8&15]+o[n>>>4&15]+o[n&15]),g};A.prototype.toString=A.prototype.hex;A.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255];return this.is224||g.push(n>>>24&255,n>>>16&255,n>>>8&255,n&255),g};A.prototype.array=A.prototype.digest;A.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};const I=(...e)=>new A(!1,!0).update(e.join("")).hex();var ce={};C(ce,{sha256:()=>I});var oe={};C(oe,{BaseCache:()=>$,InMemoryCache:()=>D,defaultHashKeyEncoder:()=>H,deserializeStoredGeneration:()=>he,serializeGeneration:()=>le});const H=(...e)=>I(e.join("_"));function he(e){return e.message!==void 0?{text:e.text,message:Z(e.message)}:{text:e.text}}function le(e){const t={text:e.text};return e.message!==void 0&&(t.message=e.message.toDict()),t}var $=class{keyEncoder=H;makeDefaultKeyEncoder(e){this.keyEncoder=e}};const ue=new Map;var D=class W extends ${cache;constructor(t){super(),this.cache=t??new Map}lookup(t,r){return Promise.resolve(this.cache.get(this.keyEncoder(t,r))??null)}async update(t,r,s){this.cache.set(this.keyEncoder(t,r),s)}static global(){return new W(ue)}},F={},z;function pe(){if(z)return F;z=1,F.byteLength=n,F.toByteArray=u,F.fromByteArray=k;for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=s.length;i<a;++i)e[i]=s[i],t[s.charCodeAt(i)]=i;t[45]=62,t[95]=63;function h(c){var l=c.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=c.indexOf("=");p===-1&&(p=l);var d=p===l?0:4-p%4;return[p,d]}function n(c){var l=h(c),p=l[0],d=l[1];return(p+d)*3/4-d}function g(c,l,p){return(l+p)*3/4-p}function u(c){var l,p=h(c),d=p[0],y=p[1],f=new r(g(c,d,y)),v=0,T=y>0?d-4:d,w;for(w=0;w<T;w+=4)l=t[c.charCodeAt(w)]<<18|t[c.charCodeAt(w+1)]<<12|t[c.charCodeAt(w+2)]<<6|t[c.charCodeAt(w+3)],f[v++]=l>>16&255,f[v++]=l>>8&255,f[v++]=l&255;return y===2&&(l=t[c.charCodeAt(w)]<<2|t[c.charCodeAt(w+1)]>>4,f[v++]=l&255),y===1&&(l=t[c.charCodeAt(w)]<<10|t[c.charCodeAt(w+1)]<<4|t[c.charCodeAt(w+2)]>>2,f[v++]=l>>8&255,f[v++]=l&255),f}function b(c){return e[c>>18&63]+e[c>>12&63]+e[c>>6&63]+e[c&63]}function x(c,l,p){for(var d,y=[],f=l;f<p;f+=3)d=(c[f]<<16&16711680)+(c[f+1]<<8&65280)+(c[f+2]&255),y.push(b(d));return y.join("")}function k(c){for(var l,p=c.length,d=p%3,y=[],f=16383,v=0,T=p-d;v<T;v+=f)y.push(x(c,v,v+f>T?T:v+f));return d===1?(l=c[p-1],y.push(e[l>>2]+e[l<<4&63]+"==")):d===2&&(l=(c[p-2]<<8)+c[p-1],y.push(e[l>>10]+e[l>>4&63]+e[l<<2&63]+"=")),y.join("")}return F}var ge=pe();const de=ee(ge);var fe=Object.defineProperty,be=(e,t,r)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t,r)=>(be(e,t+"",r),r);function ve(e,t){let r=Array.from({length:e.length},(s,i)=>({start:i,end:i+1}));for(;r.length>1;){let s=null;for(let i=0;i<r.length-1;i++){const a=e.slice(r[i].start,r[i+1].end),h=t.get(a.join(","));h!=null&&(s==null||h<s[0])&&(s=[h,i])}if(s!=null){const i=s[1];r[i]={start:r[i].start,end:r[i+1].end},r.splice(i+1,1)}else break}return r}function ye(e,t){return e.length===1?[t.get(e.join(","))]:ve(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function xe(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var R=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;const r=e.bpe_ranks.split(`
|
|
1
|
+
import{i as G,av as P,G as U,ad as X,aw as Y,_ as C,O as Z,q as L,ai as Q}from"./base-RWAdy9P6.js";import{g as ee}from"./index-BsLLCsBP.js";function te(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function se(e){return e!==void 0&&P.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function ae(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&(G(e.schema)||e.schema!=null&&typeof e.schema=="object"&&"type"in e.schema&&typeof e.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(e.schema.type))}function Re(e){return ae(e)||se(e)||te(e)}var re={};C(re,{BasePromptValue:()=>M,ChatPromptValue:()=>V,ImagePromptValue:()=>ie,StringPromptValue:()=>O});var M=class extends Y{},O=class extends M{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new U(this.value)]}},V=class extends M{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return X(this.messages)}toChatMessages(){return this.messages}},ie=class extends M{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new U({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}},o="0123456789abcdef".split(""),ne=[-2147483648,8388608,32768,128],_=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=[];function A(e,t){t?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}A.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if(r!=="string"){if(r==="object"){if(e===null)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var s,i=0,a,h=e.length,n=this.blocks;i<h;){if(this.hashed&&(this.hashed=!1,n[0]=this.block,this.block=n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),t)for(a=this.start;i<h&&a<64;++i)n[a>>>2]|=e[i]<<_[a++&3];else for(a=this.start;i<h&&a<64;++i)s=e.charCodeAt(i),s<128?n[a>>>2]|=s<<_[a++&3]:s<2048?(n[a>>>2]|=(192|s>>>6)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]):s<55296||s>=57344?(n[a>>>2]|=(224|s>>>12)<<_[a++&3],n[a>>>2]|=(128|s>>>6&63)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]):(s=65536+((s&1023)<<10|e.charCodeAt(++i)&1023),n[a>>>2]|=(240|s>>>18)<<_[a++&3],n[a>>>2]|=(128|s>>>12&63)<<_[a++&3],n[a>>>2]|=(128|s>>>6&63)<<_[a++&3],n[a>>>2]|=(128|s&63)<<_[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=n[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};A.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=ne[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}};A.prototype.hash=function(){var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=this.blocks,u,b,x,k,c,l,p,d,y,f,v;for(u=16;u<64;++u)c=g[u-15],b=(c>>>7|c<<25)^(c>>>18|c<<14)^c>>>3,c=g[u-2],x=(c>>>17|c<<15)^(c>>>19|c<<13)^c>>>10,g[u]=g[u-16]+b+g[u-7]+x<<0;for(v=t&r,u=0;u<64;u+=4)this.first?(this.is224?(d=300032,c=g[0]-1413257819,n=c-150054599<<0,s=c+24177077<<0):(d=704751109,c=g[0]-210244248,n=c-1521486534<<0,s=c+143694565<<0),this.first=!1):(b=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),x=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),d=e&t,k=d^e&r^v,p=i&a^~i&h,c=n+x+p+E[u]+g[u],l=b+k,n=s+c<<0,s=c+l<<0),b=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),x=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),y=s&e,k=y^s&t^d,p=h&n^~h&i,c=a+x+p+E[u+1]+g[u+1],l=b+k,h=r+c<<0,r=c+l<<0,b=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),x=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),f=r&s,k=f^r&e^y,p=a&h^~a&n,c=i+x+p+E[u+2]+g[u+2],l=b+k,a=t+c<<0,t=c+l<<0,b=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),x=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=t&r,k=v^t&s^f,p=a&h^~a&n,c=i+x+p+E[u+3]+g[u+3],l=b+k,i=e+c<<0,e=c+l<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+s<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+h<<0,this.h7=this.h7+n<<0};A.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=o[e>>>28&15]+o[e>>>24&15]+o[e>>>20&15]+o[e>>>16&15]+o[e>>>12&15]+o[e>>>8&15]+o[e>>>4&15]+o[e&15]+o[t>>>28&15]+o[t>>>24&15]+o[t>>>20&15]+o[t>>>16&15]+o[t>>>12&15]+o[t>>>8&15]+o[t>>>4&15]+o[t&15]+o[r>>>28&15]+o[r>>>24&15]+o[r>>>20&15]+o[r>>>16&15]+o[r>>>12&15]+o[r>>>8&15]+o[r>>>4&15]+o[r&15]+o[s>>>28&15]+o[s>>>24&15]+o[s>>>20&15]+o[s>>>16&15]+o[s>>>12&15]+o[s>>>8&15]+o[s>>>4&15]+o[s&15]+o[i>>>28&15]+o[i>>>24&15]+o[i>>>20&15]+o[i>>>16&15]+o[i>>>12&15]+o[i>>>8&15]+o[i>>>4&15]+o[i&15]+o[a>>>28&15]+o[a>>>24&15]+o[a>>>20&15]+o[a>>>16&15]+o[a>>>12&15]+o[a>>>8&15]+o[a>>>4&15]+o[a&15]+o[h>>>28&15]+o[h>>>24&15]+o[h>>>20&15]+o[h>>>16&15]+o[h>>>12&15]+o[h>>>8&15]+o[h>>>4&15]+o[h&15];return this.is224||(g+=o[n>>>28&15]+o[n>>>24&15]+o[n>>>20&15]+o[n>>>16&15]+o[n>>>12&15]+o[n>>>8&15]+o[n>>>4&15]+o[n&15]),g};A.prototype.toString=A.prototype.hex;A.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,s=this.h3,i=this.h4,a=this.h5,h=this.h6,n=this.h7,g=[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255];return this.is224||g.push(n>>>24&255,n>>>16&255,n>>>8&255,n&255),g};A.prototype.array=A.prototype.digest;A.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};const I=(...e)=>new A(!1,!0).update(e.join("")).hex();var ce={};C(ce,{sha256:()=>I});var oe={};C(oe,{BaseCache:()=>$,InMemoryCache:()=>D,defaultHashKeyEncoder:()=>H,deserializeStoredGeneration:()=>he,serializeGeneration:()=>le});const H=(...e)=>I(e.join("_"));function he(e){return e.message!==void 0?{text:e.text,message:Z(e.message)}:{text:e.text}}function le(e){const t={text:e.text};return e.message!==void 0&&(t.message=e.message.toDict()),t}var $=class{keyEncoder=H;makeDefaultKeyEncoder(e){this.keyEncoder=e}};const ue=new Map;var D=class W extends ${cache;constructor(t){super(),this.cache=t??new Map}lookup(t,r){return Promise.resolve(this.cache.get(this.keyEncoder(t,r))??null)}async update(t,r,s){this.cache.set(this.keyEncoder(t,r),s)}static global(){return new W(ue)}},F={},z;function pe(){if(z)return F;z=1,F.byteLength=n,F.toByteArray=u,F.fromByteArray=k;for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=s.length;i<a;++i)e[i]=s[i],t[s.charCodeAt(i)]=i;t[45]=62,t[95]=63;function h(c){var l=c.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=c.indexOf("=");p===-1&&(p=l);var d=p===l?0:4-p%4;return[p,d]}function n(c){var l=h(c),p=l[0],d=l[1];return(p+d)*3/4-d}function g(c,l,p){return(l+p)*3/4-p}function u(c){var l,p=h(c),d=p[0],y=p[1],f=new r(g(c,d,y)),v=0,T=y>0?d-4:d,w;for(w=0;w<T;w+=4)l=t[c.charCodeAt(w)]<<18|t[c.charCodeAt(w+1)]<<12|t[c.charCodeAt(w+2)]<<6|t[c.charCodeAt(w+3)],f[v++]=l>>16&255,f[v++]=l>>8&255,f[v++]=l&255;return y===2&&(l=t[c.charCodeAt(w)]<<2|t[c.charCodeAt(w+1)]>>4,f[v++]=l&255),y===1&&(l=t[c.charCodeAt(w)]<<10|t[c.charCodeAt(w+1)]<<4|t[c.charCodeAt(w+2)]>>2,f[v++]=l>>8&255,f[v++]=l&255),f}function b(c){return e[c>>18&63]+e[c>>12&63]+e[c>>6&63]+e[c&63]}function x(c,l,p){for(var d,y=[],f=l;f<p;f+=3)d=(c[f]<<16&16711680)+(c[f+1]<<8&65280)+(c[f+2]&255),y.push(b(d));return y.join("")}function k(c){for(var l,p=c.length,d=p%3,y=[],f=16383,v=0,T=p-d;v<T;v+=f)y.push(x(c,v,v+f>T?T:v+f));return d===1?(l=c[p-1],y.push(e[l>>2]+e[l<<4&63]+"==")):d===2&&(l=(c[p-2]<<8)+c[p-1],y.push(e[l>>10]+e[l>>4&63]+e[l<<2&63]+"=")),y.join("")}return F}var ge=pe();const de=ee(ge);var fe=Object.defineProperty,be=(e,t,r)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t,r)=>(be(e,t+"",r),r);function ve(e,t){let r=Array.from({length:e.length},(s,i)=>({start:i,end:i+1}));for(;r.length>1;){let s=null;for(let i=0;i<r.length-1;i++){const a=e.slice(r[i].start,r[i+1].end),h=t.get(a.join(","));h!=null&&(s==null||h<s[0])&&(s=[h,i])}if(s!=null){const i=s[1];r[i]={start:r[i].start,end:r[i+1].end},r.splice(i+1,1)}else break}return r}function ye(e,t){return e.length===1?[t.get(e.join(","))]:ve(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function xe(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var R=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;const r=e.bpe_ranks.split(`
|
|
2
2
|
`).filter(Boolean).reduce((s,i)=>{const[a,h,...n]=i.split(" "),g=Number.parseInt(h,10);return n.forEach((u,b)=>s[u]=g+b),s},{});for(const[s,i]of Object.entries(r)){const a=de.toByteArray(s);this.rankMap.set(a.join(","),i),this.textMap.set(i,a)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((s,[i,a])=>(s[a]=this.textEncoder.encode(i),s),{})}encode(e,t=[],r="all"){const s=new RegExp(this.patStr,"ug"),i=R.specialTokenRegex(Object.keys(this.specialTokens)),a=[],h=new Set(t==="all"?Object.keys(this.specialTokens):t),n=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!h.has(u)):r);if(n.size>0){const u=R.specialTokenRegex([...n]),b=e.match(u);if(b!=null)throw new Error(`The text contains a special token that is not allowed: ${b[0]}`)}let g=0;for(;;){let u=null,b=g;for(;i.lastIndex=b,u=i.exec(e),!(u==null||h.has(u[0]));)b=u.index+1;const x=u?.index??e.length;for(const c of e.substring(g,x).matchAll(s)){const l=this.textEncoder.encode(c[0]),p=this.rankMap.get(l.join(","));if(p!=null){a.push(p);continue}a.push(...ye(l,this.rankMap))}if(u==null)break;let k=this.specialTokens[u[0]];a.push(k),g=u.index+u[0].length}return a}decode(e){const t=[];let r=0;for(let a=0;a<e.length;++a){const h=e[a],n=this.textMap.get(h)??this.inverseSpecialTokens[h];n!=null&&(t.push(n),r+=n.length)}const s=new Uint8Array(r);let i=0;for(const a of t)s.set(a,i),i+=a.length;return this.textDecoder.decode(s)}},J=R;me(J,"specialTokenRegex",e=>new RegExp(e.map(t=>xe(t)).join("|"),"g"));function ke(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var we={};C(we,{encodingForModel:()=>j,getEncoding:()=>K});const S={},_e=new L({});async function K(e){return e in S||(S[e]=_e.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(t=>t.json()).then(t=>new J(t)).catch(t=>{throw delete S[e],t})),await S[e]}async function j(e){return K(ke(e))}var Ae={};C(Ae,{BaseLangChain:()=>q,BaseLanguageModel:()=>Se,calculateMaxTokens:()=>Ce,getEmbeddingContextSize:()=>Te,getModelContextSize:()=>N,getModelNameForTiktoken:()=>B,isOpenAITool:()=>Fe});const B=e=>e.startsWith("gpt-5")?"gpt-5":e.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":e.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":e.startsWith("gpt-4-32k")?"gpt-4-32k":e.startsWith("gpt-4-")?"gpt-4":e.startsWith("gpt-4o")?"gpt-4o":e,Te=e=>{switch(e){case"text-embedding-ada-002":return 8191;default:return 2046}},N=e=>{switch(B(e)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function Fe(e){return typeof e!="object"||!e?!1:!!("type"in e&&e.type==="function"&&"function"in e&&typeof e.function=="object"&&e.function&&"name"in e.function&&"parameters"in e.function)}const Ce=async({prompt:e,modelName:t})=>{let r;try{r=(await j(B(t))).encode(e).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(e.length/4)}return N(t)-r},Ee=()=>!1;var q=class extends P{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??Ee(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},Se=class extends q{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...r}){const{cache:s,...i}=r;super({callbacks:e??t,...i}),typeof s=="object"?this.cache=s:s?this.cache=D.global():this.cache=void 0,this.caller=new L(r??{})}_encoding;async getNumTokens(e){let t;typeof e=="string"?t=e:t=e.map(s=>typeof s=="string"?s:s.type==="text"&&"text"in s?s.text:"").join("");let r=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await j("modelName"in this?B(this.modelName):"gpt2")}catch(s){console.warn("Failed to calculate number of tokens, falling back to approximate count",s)}if(this._encoding)try{r=this._encoding.encode(t).length}catch(s){console.warn("Failed to calculate number of tokens, falling back to approximate count",s)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new O(e):Array.isArray(e)?new V(e.map(Q)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){const r={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([a,h])=>h!==void 0).map(([a,h])=>`${a}:${JSON.stringify(h)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}};export{q as B,te as a,se as b,Re as c,Fe as d,Se as e,ae as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ua,k as Ce,m as So,q as Xe,v as Qc,$ as Xc,w as eu,x as tu,y as ru,z as To,i as Fa,A as nu,h as hs}from"./index-CNfmoBX-.js";var te;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(te||(te={}));var ps;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ps||(ps={}));const C=te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),it=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},w=te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class rt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return a(this),n}static assert(e){if(!(e instanceof rt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}rt.create=t=>new rt(t);const ga=(t,e)=>{let r;switch(t.code){case w.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,te.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${te.joinValues(t.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${te.joinValues(t.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${te.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:te.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case w.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case w.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=e.defaultError,te.assertNever(t)}return{message:r}};let au=ga;function su(){return au}const iu=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function $(t,e){const r=su(),n=iu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ga?void 0:ga].filter(a=>!!a)});t.common.issues.push(n)}class Ne{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return K;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return Ne.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return K;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const K=Object.freeze({status:"aborted"}),Vt=t=>({status:"dirty",value:t}),Le=t=>({status:"valid",value:t}),ms=t=>t.status==="aborted",gs=t=>t.status==="dirty",jt=t=>t.status==="valid",Nr=t=>typeof Promise<"u"&&t instanceof Promise;var N;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));class ft{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const _s=(t,e)=>{if(jt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new rt(t.common.issues);return this._error=r,this._error}}};function Q(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}class ee{get description(){return this._def.description}_getType(e){return it(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ne,ctx:{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Nr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)},a=this._parseSync({data:e,path:n.path,parent:n});return _s(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return jt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>jt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(Nr(a)?a:Promise.resolve(a));return _s(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:w.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Ut({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lt.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Je.create(this)}promise(){return jr.create(this,this._def)}or(e){return Lr.create([this,e],this._def)}and(e){return Mr.create(this,e,this._def)}transform(e){return new Ut({...Q(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new va({...Q(this._def),innerType:this,defaultValue:r,typeName:b.ZodDefault})}brand(){return new Ru({typeName:b.ZodBranded,type:this,...Q(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wa({...Q(this._def),innerType:this,catchValue:r,typeName:b.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return za.create(this,e)}readonly(){return ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ou=/^c[^\s-]{8,}$/i,cu=/^[0-9a-z]+$/,uu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,du=/^[a-z0-9_-]{21}$/i,fu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rn;const gu=/^(?:(?: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])$/,_u=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,vu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xo="((\\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])))",Eu=new RegExp(`^${xo}$`);function Io(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Su(t){return new RegExp(`^${Io(t)}$`)}function Tu(t){let e=`${xo}T${Io(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function xu(t,e){return!!((e==="v4"||!e)&&gu.test(t)||(e==="v6"||!e)&&yu.test(t))}function Iu(t,e){if(!fu.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function $u(t,e){return!!((e==="v4"||!e)&&_u.test(t)||(e==="v6"||!e)&&vu.test(t))}class ct extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.string,received:s.parsedType}),K}const n=new Ne;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?$(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&$(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")pu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"email",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")rn||(rn=new RegExp(mu,"u")),rn.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"emoji",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")lu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"uuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")du.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"nanoid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ou.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")cu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cuid2",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")uu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"ulid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),$(a,{validation:"url",code:w.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"regex",code:w.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Tu(s).test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Su(s).test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?hu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"duration",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?xu(e.data,s.version)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"ip",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Iu(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"jwt",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?$u(e.data,s.version)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cidr",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?wu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"base64",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?bu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"base64url",code:w.invalid_string,message:s.message}),n.dirty()):te.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:w.invalid_string,...N.errToObj(n)})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...N.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...N.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...N.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...N.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...N.errToObj(r)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ct.create=t=>new ct({checks:[],typeName:b.ZodString,coerce:t?.coerce??!1,...Q(t)});function Au(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class er extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.number,received:s.parsedType}),K}let n;const a=new Ne;for(const s of this._def.checks)s.kind==="int"?te.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),$(n,{code:w.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Au(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_finite,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new er({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new er({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&te.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}er.create=t=>new er({checks:[],typeName:b.ZodNumber,coerce:t?.coerce||!1,...Q(t)});class tr extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let n;const a=new Ne;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return $(r,{code:w.invalid_type,expected:C.bigint,received:r.parsedType}),K}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new tr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new tr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}tr.create=t=>new tr({checks:[],typeName:b.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});class ys extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.boolean,received:n.parsedType}),K}return Le(e.data)}}ys.create=t=>new ys({typeName:b.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});class Pr extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.date,received:s.parsedType}),K}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_date}),K}const n=new Ne;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):te.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Pr.create=t=>new Pr({checks:[],coerce:t?.coerce||!1,typeName:b.ZodDate,...Q(t)});class vs extends ee{_parse(e){if(this._getType(e)!==C.symbol){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.symbol,received:n.parsedType}),K}return Le(e.data)}}vs.create=t=>new vs({typeName:b.ZodSymbol,...Q(t)});class ws extends ee{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.undefined,received:n.parsedType}),K}return Le(e.data)}}ws.create=t=>new ws({typeName:b.ZodUndefined,...Q(t)});class bs extends ee{_parse(e){if(this._getType(e)!==C.null){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.null,received:n.parsedType}),K}return Le(e.data)}}bs.create=t=>new bs({typeName:b.ZodNull,...Q(t)});class _a extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Le(e.data)}}_a.create=t=>new _a({typeName:b.ZodAny,...Q(t)});class Es extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Le(e.data)}}Es.create=t=>new Es({typeName:b.ZodUnknown,...Q(t)});class ht extends ee{_parse(e){const r=this._getOrReturnCtx(e);return $(r,{code:w.invalid_type,expected:C.never,received:r.parsedType}),K}}ht.create=t=>new ht({typeName:b.ZodNever,...Q(t)});class Ss extends ee{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.void,received:n.parsedType}),K}return Le(e.data)}}Ss.create=t=>new Ss({typeName:b.ZodVoid,...Q(t)});class Je extends ee{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==C.array)return $(r,{code:w.invalid_type,expected:C.array,received:r.parsedType}),K;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&($(r,{code:i?w.too_big:w.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&($(r,{code:w.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&($(r,{code:w.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new ft(r,i,r.path,o)))).then(i=>Ne.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new ft(r,i,r.path,o)));return Ne.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Je({...this._def,minLength:{value:e,message:N.toString(r)}})}max(e,r){return new Je({...this._def,maxLength:{value:e,message:N.toString(r)}})}length(e,r){return new Je({...this._def,exactLength:{value:e,message:N.toString(r)}})}nonempty(e){return this.min(1,e)}}Je.create=(t,e)=>new Je({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...Q(e)});function Ct(t){if(t instanceof de){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=lt.create(Ct(n))}return new de({...t._def,shape:()=>e})}else return t instanceof Je?new Je({...t._def,type:Ct(t.element)}):t instanceof lt?lt.create(Ct(t.unwrap())):t instanceof Ft?Ft.create(Ct(t.unwrap())):t instanceof xt?xt.create(t.items.map(e=>Ct(e))):t}class de extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=te.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){const u=this._getOrReturnCtx(e);return $(u,{code:w.invalid_type,expected:C.object,received:u.parsedType}),K}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ht&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const l=s[u],d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ft(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof ht){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:a.data[l]}});else if(u==="strict")o.length>0&&($(a,{code:w.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of o){const d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ft(a,d,a.path,l)),alwaysSet:l in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Ne.mergeObjectSync(n,u)):Ne.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new de({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:N.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new de({...this._def,unknownKeys:"strip"})}passthrough(){return new de({...this._def,unknownKeys:"passthrough"})}extend(e){return new de({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new de({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new de({...this._def,catchall:e})}pick(e){const r={};for(const n of te.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}omit(e){const r={};for(const n of te.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}deepPartial(){return Ct(this)}partial(e){const r={};for(const n of te.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new de({...this._def,shape:()=>r})}required(e){const r={};for(const n of te.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof lt;)s=s._def.innerType;r[n]=s}return new de({...this._def,shape:()=>r})}keyof(){return $o(te.objectKeys(this.shape))}}de.create=(t,e)=>new de({shape:()=>t,unknownKeys:"strip",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});de.strictCreate=(t,e)=>new de({shape:()=>t,unknownKeys:"strict",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});de.lazycreate=(t,e)=>new de({shape:t,unknownKeys:"strip",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});class Lr extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new rt(o.ctx.common.issues));return $(r,{code:w.invalid_union,unionErrors:i}),K}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(c=>new rt(c));return $(r,{code:w.invalid_union,unionErrors:o}),K}}get options(){return this._def.options}}Lr.create=(t,e)=>new Lr({options:t,typeName:b.ZodUnion,...Q(e)});function ya(t,e){const r=it(t),n=it(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&n===C.object){const a=te.objectKeys(e),s=te.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const c=ya(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===C.array&&n===C.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],c=ya(i,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===C.date&&n===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(ms(s)||ms(i))return K;const o=ya(s.value,i.value);return o.valid?((gs(s)||gs(i))&&r.dirty(),{status:r.value,value:o.data}):($(n,{code:w.invalid_intersection_types}),K)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Mr.create=(t,e,r)=>new Mr({left:t,right:e,typeName:b.ZodIntersection,...Q(r)});class xt extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.array)return $(n,{code:w.invalid_type,expected:C.array,received:n.parsedType}),K;if(n.data.length<this._def.items.length)return $(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ft(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Ne.mergeArray(r,i)):Ne.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new xt({...this._def,rest:e})}}xt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xt({items:t,typeName:b.ZodTuple,rest:null,...Q(e)})};class Ts extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.map)return $(n,{code:w.invalid_type,expected:C.map,received:n.parsedType}),K;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new ft(n,o,n.path,[u,"key"])),value:s._parse(new ft(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return K;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return K;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}}Ts.create=(t,e,r)=>new Ts({valueType:e,keyType:t,typeName:b.ZodMap,...Q(r)});class rr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.set)return $(n,{code:w.invalid_type,expected:C.set,received:n.parsedType}),K;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&($(n,{code:w.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&($(n,{code:w.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const l of c){if(l.status==="aborted")return K;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>s._parse(new ft(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new rr({...this._def,minSize:{value:e,message:N.toString(r)}})}max(e,r){return new rr({...this._def,maxSize:{value:e,message:N.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}rr.create=(t,e)=>new rr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...Q(e)});class xs extends ee{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}xs.create=(t,e)=>new xs({getter:t,typeName:b.ZodLazy,...Q(e)});class Is extends ee{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return $(r,{received:r.data,code:w.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:e.data}}get value(){return this._def.value}}Is.create=(t,e)=>new Is({value:t,typeName:b.ZodLiteral,...Q(e)});function $o(t,e){return new Dt({values:t,typeName:b.ZodEnum,...Q(e)})}class Dt extends ee{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return $(r,{expected:te.joinValues(n),received:r.parsedType,code:w.invalid_type}),K}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return $(r,{received:r.data,code:w.invalid_enum_value,options:n}),K}return Le(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Dt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Dt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Dt.create=$o;class $s extends ee{_parse(e){const r=te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==C.string&&n.parsedType!==C.number){const a=te.objectValues(r);return $(n,{expected:te.joinValues(a),received:n.parsedType,code:w.invalid_type}),K}if(this._cache||(this._cache=new Set(te.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=te.objectValues(r);return $(n,{received:n.data,code:w.invalid_enum_value,options:a}),K}return Le(e.data)}get enum(){return this._def.values}}$s.create=(t,e)=>new $s({values:t,typeName:b.ZodNativeEnum,...Q(e)});class jr extends ee{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return $(r,{code:w.invalid_type,expected:C.promise,received:r.parsedType}),K;const n=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return Le(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}jr.create=(t,e)=>new jr({type:t,typeName:b.ZodPromise,...Q(e)});class Ut extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{$(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return K;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?K:c.status==="dirty"||r.value==="dirty"?Vt(c.value):c});{if(r.value==="aborted")return K;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?K:o.status==="dirty"||r.value==="dirty"?Vt(o.value):o}}if(a.type==="refinement"){const i=o=>{const c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?K:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?K:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!jt(i))return K;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>jt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):K);te.assertNever(a)}}Ut.create=(t,e,r)=>new Ut({schema:t,typeName:b.ZodEffects,effect:e,...Q(r)});Ut.createWithPreprocess=(t,e,r)=>new Ut({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...Q(r)});class lt extends ee{_parse(e){return this._getType(e)===C.undefined?Le(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lt.create=(t,e)=>new lt({innerType:t,typeName:b.ZodOptional,...Q(e)});class Ft extends ee{_parse(e){return this._getType(e)===C.null?Le(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ft.create=(t,e)=>new Ft({innerType:t,typeName:b.ZodNullable,...Q(e)});class va extends ee{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===C.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}va.create=(t,e)=>new va({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});class wa extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Nr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wa.create=(t,e)=>new wa({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});class As extends ee{_parse(e){if(this._getType(e)!==C.nan){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.nan,received:n.parsedType}),K}return{status:"valid",value:e.data}}}As.create=t=>new As({typeName:b.ZodNaN,...Q(t)});class Ru extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class za extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?K:s.status==="dirty"?(r.dirty(),Vt(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?K:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new za({in:e,out:r,typeName:b.ZodPipeline})}}class ba extends ee{_parse(e){const r=this._def.innerType._parse(e),n=a=>(jt(a)&&(a.value=Object.freeze(a.value)),a);return Nr(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}ba.create=(t,e)=>new ba({innerType:t,typeName:b.ZodReadonly,...Q(e)});var b;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(b||(b={}));const Ou=ct.create,Rs=_a.create;ht.create;Je.create;const ku=de.create;Lr.create;Mr.create;xt.create;Dt.create;jr.create;lt.create;Ft.create;var Cu=Object.defineProperty,ye=(t,e)=>{for(var r in e)Cu(t,r,{get:e[r],enumerable:!0})};function It(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function Nu(t){return It(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function Pu(t){return It(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function eg(t){return It(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Lu(t){return It(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function tg(t){if(It(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function rg(t){const e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);const r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);const a={};for(const s of t.split(";").slice(1)){const i=s.split("=");if(i.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);const o=i[0].trim(),c=i[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);a[o]=c}return{type:r,subtype:n,parameters:a}}function Os({dataUrl:t,asTypedArray:e=!1}){const r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let n;if(r){n=r[1].toLowerCase();const a=e?Uint8Array.from(atob(r[2]),s=>s.charCodeAt(0)):r[2];return{mime_type:n,data:a}}}function ng(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Mu(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var nn,ks;function ju(){return ks||(ks=1,nn=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}),nn}var Du=ju();const Uu=Ua(Du);var yr={exports:{}},Cs;function Fu(){if(Cs)return yr.exports;Cs=1;const t=/[\p{Lu}]/u,e=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,a=/[_.\- ]+/,s=new RegExp("^"+a.source),i=new RegExp(a.source+n.source,"gu"),o=new RegExp("\\d+"+n.source,"gu"),c=(f,h,p)=>{let m=!1,g=!1,_=!1;for(let v=0;v<f.length;v++){const y=f[v];m&&t.test(y)?(f=f.slice(0,v)+"-"+f.slice(v),m=!1,_=g,g=!0,v++):g&&_&&e.test(y)?(f=f.slice(0,v-1)+"-"+f.slice(v-1),_=g,g=!1,m=!0):(m=h(y)===y&&p(y)!==y,_=g,g=p(y)===y&&h(y)!==y)}return f},u=(f,h)=>(r.lastIndex=0,f.replace(r,p=>h(p))),l=(f,h)=>(i.lastIndex=0,o.lastIndex=0,f.replace(i,(p,m)=>h(m)).replace(o,p=>h(p))),d=(f,h)=>{if(!(typeof f=="string"||Array.isArray(f)))throw new TypeError("Expected the input to be `string | string[]`");if(h={pascalCase:!1,preserveConsecutiveUppercase:!1,...h},Array.isArray(f)?f=f.map(_=>_.trim()).filter(_=>_.length).join("-"):f=f.trim(),f.length===0)return"";const p=h.locale===!1?_=>_.toLowerCase():_=>_.toLocaleLowerCase(h.locale),m=h.locale===!1?_=>_.toUpperCase():_=>_.toLocaleUpperCase(h.locale);return f.length===1?h.pascalCase?m(f):p(f):(f!==p(f)&&(f=c(f,p,m)),f=f.replace(s,""),h.preserveConsecutiveUppercase?f=u(f,p):f=p(f),h.pascalCase&&(f=m(f.charAt(0))+f.slice(1)),l(f,m))};return yr.exports=d,yr.exports.default=d,yr.exports}Fu();function zu(t,e){return e?.[t]||Uu(t)}function Bu(t,e,r){const n={};for(const a in t)Object.hasOwn(t,a)&&(n[e(a,r)]=t[a]);return n}var qu={};ye(qu,{Serializable:()=>nr,get_lc_unique_name:()=>Ba});function Ns(t){return Array.isArray(t)?[...t]:{...t}}function Gu(t,e){const r=Ns(t);for(const[n,a]of Object.entries(e)){const[s,...i]=n.split(".").reverse();let o=r;for(const c of i.reverse()){if(o[c]===void 0)break;o[c]=Ns(o[c]),o=o[c]}o[s]!==void 0&&(o[s]={lc:1,type:"secret",id:[a]})}return r}function Ba(t){const e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var nr=class Ao{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Ba(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Ao||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const e={},r={},n=Object.keys(this.lc_kwargs).reduce((a,s)=>(a[s]=s in this?this[s]:this.lc_kwargs[s],a),{});for(let a=Object.getPrototypeOf(this);a;a=Object.getPrototypeOf(a))Object.assign(e,Reflect.get(a,"lc_aliases",this)),Object.assign(r,Reflect.get(a,"lc_secrets",this)),Object.assign(n,Reflect.get(a,"lc_attributes",this));return Object.keys(r).forEach(a=>{let s=this,i=n;const[o,...c]=a.split(".").reverse();for(const u of c.reverse()){if(!(u in s)||s[u]===void 0)return;(!(u in i)||i[u]===void 0)&&(typeof s[u]=="object"&&s[u]!=null?i[u]={}:Array.isArray(s[u])&&(i[u]=[])),s=s[u],i=i[u]}o in s&&s[o]!==void 0&&(i[o]=i[o]||s[o])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:Bu(Object.keys(r).length?Gu(n,r):n,zu,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function D(t,e){return J(t)&&t.type===e}function J(t){return typeof t=="object"&&t!==null}function Ke(t){return Array.isArray(t)}function O(t){return typeof t=="string"}function ze(t){return typeof t=="number"}function qa(t){return t instanceof Uint8Array}function Ps(t){try{return JSON.parse(t)}catch{return}}const ar=t=>t();function Zu(t){if(t.type==="char_location"&&O(t.document_title)&&ze(t.start_char_index)&&ze(t.end_char_index)&&O(t.cited_text)){const{document_title:e,start_char_index:r,end_char_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="page_location"&&O(t.document_title)&&ze(t.start_page_number)&&ze(t.end_page_number)&&O(t.cited_text)){const{document_title:e,start_page_number:r,end_page_number:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="content_block_location"&&O(t.document_title)&&ze(t.start_block_index)&&ze(t.end_block_index)&&O(t.cited_text)){const{document_title:e,start_block_index:r,end_block_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="web_search_result_location"&&O(t.url)&&O(t.title)&&O(t.encrypted_index)&&O(t.cited_text)){const{url:e,title:r,encrypted_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:a}}if(t.type==="search_result_location"&&O(t.source)&&O(t.title)&&ze(t.start_block_index)&&ze(t.end_block_index)&&O(t.cited_text)){const{source:e,title:r,start_block_index:n,end_block_index:a,cited_text:s,...i}=t;return{...i,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:a,citedText:s}}}function Ro(t){if(D(t,"document")&&J(t.source)&&"type"in t.source){if(t.source.type==="base64"&&O(t.source.media_type)&&O(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&O(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&O(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&O(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(D(t,"image")&&J(t.source)&&"type"in t.source){if(t.source.type==="base64"&&O(t.source.media_type)&&O(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&O(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&O(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function Hu(t){function*e(){for(const r of t){const n=Ro(r);n?yield n:yield r}}return Array.from(e())}function Ls(t){function*e(){const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r){if(D(n,"text")&&O(n.text)){const{text:a,citations:s,...i}=n;if(Ke(s)&&s.length){const o=s.reduce((c,u)=>{const l=Zu(u);return l?[...c,l]:c},[]);yield{...i,type:"text",text:a,annotations:o};continue}else{yield{...i,type:"text",text:a};continue}}else if(D(n,"thinking")&&O(n.thinking)){const{thinking:a,signature:s,...i}=n;yield{...i,type:"reasoning",reasoning:a,signature:s};continue}else if(D(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(D(n,"tool_use")&&O(n.name)&&O(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(D(n,"input_json_delta")){if(Wu(t)&&t.tool_call_chunks?.length){const a=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:a.id,name:a.name,args:a.args,index:a.index};continue}}else if(D(n,"server_tool_use")&&O(n.name)&&O(n.id)){const{name:a,id:s}=n;if(a==="web_search"){const i=ar(()=>{if(typeof n.input=="string")return n.input;if(J(n.input)&&O(n.input.query))return n.input.query;if(O(n.partial_json)){const o=Ps(n.partial_json);if(o?.query)return o.query}return""});yield{id:s,type:"server_tool_call",name:"web_search",args:{query:i}};continue}else if(n.name==="code_execution"){const i=ar(()=>{if(typeof n.input=="string")return n.input;if(J(n.input)&&O(n.input.code))return n.input.code;if(O(n.partial_json)){const o=Ps(n.partial_json);if(o?.code)return o.code}return""});yield{id:s,type:"server_tool_call",name:"code_execution",args:{code:i}};continue}}else if(D(n,"web_search_tool_result")&&O(n.tool_use_id)&&Ke(n.content)){const{content:a,tool_use_id:s}=n,i=a.reduce((o,c)=>D(c,"web_search_result")?[...o,c.url]:o,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:s,status:"success",output:{urls:i}};continue}else if(D(n,"code_execution_tool_result")&&O(n.tool_use_id)&&J(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(D(n,"mcp_tool_result")&&O(n.tool_use_id)&&J(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(D(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(D(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{const a=Ro(n);if(a){yield a;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}const Vu={translateContent:Ls,translateContentChunk:Ls};function Wu(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function Ju(t){return Nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:Pu(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Lu(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Ku(t){return t.map(Ju)}function Yu(t){return!!(D(t,"image_url")&&J(t.image_url)||D(t,"input_audio")&&J(t.input_audio)||D(t,"file")&&J(t.file))}function Qu(t){if(D(t,"image_url")&&J(t.image_url)&&O(t.image_url.url)){const e=Os({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(D(t,"input_audio")&&J(t.input_audio)&&O(t.input_audio.data)&&O(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(D(t,"file")&&J(t.file)&&O(t.file.data)){const e=Os({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(O(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function Xu(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Ga(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function el(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Ga(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Ga(t){const e=[];for(const r of t)Yu(r)?e.push(Qu(r)):e.push(r);return e}function tl(t){if(t.type==="url_citation"){const{url:e,title:r,start_index:n,end_index:a}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:a}}if(t.type==="file_citation"){const{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function Oo(t){function*e(){J(t.additional_kwargs?.reasoning)&&Ke(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((a,s)=>J(s)&&O(s.text)?`${a}${s.text}`:a,"")});const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r)if(D(n,"text")){const{text:a,annotations:s,...i}=n;Array.isArray(s)?yield{...i,type:"text",text:String(a),annotations:s.map(tl)}:yield{...i,type:"text",text:String(a)}}for(const n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(J(t.additional_kwargs)&&Ke(t.additional_kwargs.tool_outputs))for(const n of t.additional_kwargs.tool_outputs){if(D(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(D(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(D(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(D(n,"code_interpreter_call")){if(O(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ke(n.outputs)){const a=ar(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(const s of n.outputs)if(D(s,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:a??0,stderr:[0,void 0].includes(a)?void 0:String(s.logs),stdout:[0,void 0].includes(a)?String(s.logs):void 0}};continue}}continue}else if(D(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(D(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(D(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(D(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}J(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function rl(t){function*e(){yield*Oo(t);for(const r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}const nl={translateContent:t=>typeof t.content=="string"?Xu(t):Oo(t),translateContentChunk:t=>typeof t.content=="string"?el(t):rl(t)};function al(t,e="pretty"){return e==="pretty"?sl(t):JSON.stringify(t)}function sl(t){const e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),a="=".repeat(n),s=r.length%2===0?a:`${a}=`;if(e.push(`${a}${r}${s}`),t.type==="ai"){const i=t;if(i.tool_calls&&i.tool_calls.length>0){e.push("Tool Calls:");for(const o of i.tool_calls){e.push(` ${o.name} (${o.id})`),e.push(` Call ID: ${o.id}`),e.push(" Args:");for(const[c,u]of Object.entries(o.args))e.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(t.type==="tool"){const i=t;i.name&&e.push(`Name: ${i.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
|
|
1
|
+
import{g as Ua,k as Ce,m as So,q as Xe,v as Qc,$ as Xc,w as eu,x as tu,y as ru,z as To,i as Fa,A as nu,h as hs}from"./index-BsLLCsBP.js";var te;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(te||(te={}));var ps;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ps||(ps={}));const C=te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),it=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},w=te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class rt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return a(this),n}static assert(e){if(!(e instanceof rt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}rt.create=t=>new rt(t);const ga=(t,e)=>{let r;switch(t.code){case w.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,te.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${te.joinValues(t.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${te.joinValues(t.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${te.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:te.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case w.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case w.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=e.defaultError,te.assertNever(t)}return{message:r}};let au=ga;function su(){return au}const iu=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function $(t,e){const r=su(),n=iu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ga?void 0:ga].filter(a=>!!a)});t.common.issues.push(n)}class Ne{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return K;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return Ne.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return K;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const K=Object.freeze({status:"aborted"}),Vt=t=>({status:"dirty",value:t}),Le=t=>({status:"valid",value:t}),ms=t=>t.status==="aborted",gs=t=>t.status==="dirty",jt=t=>t.status==="valid",Nr=t=>typeof Promise<"u"&&t instanceof Promise;var N;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));class ft{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const _s=(t,e)=>{if(jt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new rt(t.common.issues);return this._error=r,this._error}}};function Q(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}class ee{get description(){return this._def.description}_getType(e){return it(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ne,ctx:{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Nr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)},a=this._parseSync({data:e,path:n.path,parent:n});return _s(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return jt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>jt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:it(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(Nr(a)?a:Promise.resolve(a));return _s(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:w.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Ut({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lt.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Je.create(this)}promise(){return jr.create(this,this._def)}or(e){return Lr.create([this,e],this._def)}and(e){return Mr.create(this,e,this._def)}transform(e){return new Ut({...Q(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new va({...Q(this._def),innerType:this,defaultValue:r,typeName:b.ZodDefault})}brand(){return new Ru({typeName:b.ZodBranded,type:this,...Q(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wa({...Q(this._def),innerType:this,catchValue:r,typeName:b.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return za.create(this,e)}readonly(){return ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ou=/^c[^\s-]{8,}$/i,cu=/^[0-9a-z]+$/,uu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,du=/^[a-z0-9_-]{21}$/i,fu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rn;const gu=/^(?:(?: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])$/,_u=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,vu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xo="((\\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])))",Eu=new RegExp(`^${xo}$`);function Io(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Su(t){return new RegExp(`^${Io(t)}$`)}function Tu(t){let e=`${xo}T${Io(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function xu(t,e){return!!((e==="v4"||!e)&&gu.test(t)||(e==="v6"||!e)&&yu.test(t))}function Iu(t,e){if(!fu.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function $u(t,e){return!!((e==="v4"||!e)&&_u.test(t)||(e==="v6"||!e)&&vu.test(t))}class ct extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.string,received:s.parsedType}),K}const n=new Ne;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?$(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&$(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")pu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"email",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")rn||(rn=new RegExp(mu,"u")),rn.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"emoji",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")lu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"uuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")du.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"nanoid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ou.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")cu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cuid2",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")uu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"ulid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),$(a,{validation:"url",code:w.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"regex",code:w.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Tu(s).test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Su(s).test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{code:w.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?hu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"duration",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?xu(e.data,s.version)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"ip",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Iu(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"jwt",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?$u(e.data,s.version)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"cidr",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?wu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"base64",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?bu.test(e.data)||(a=this._getOrReturnCtx(e,a),$(a,{validation:"base64url",code:w.invalid_string,message:s.message}),n.dirty()):te.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:w.invalid_string,...N.errToObj(n)})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...N.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...N.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...N.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...N.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...N.errToObj(r)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ct.create=t=>new ct({checks:[],typeName:b.ZodString,coerce:t?.coerce??!1,...Q(t)});function Au(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class er extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.number,received:s.parsedType}),K}let n;const a=new Ne;for(const s of this._def.checks)s.kind==="int"?te.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),$(n,{code:w.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Au(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_finite,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new er({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new er({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&te.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}er.create=t=>new er({checks:[],typeName:b.ZodNumber,coerce:t?.coerce||!1,...Q(t)});class tr extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let n;const a=new Ne;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),$(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return $(r,{code:w.invalid_type,expected:C.bigint,received:r.parsedType}),K}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new tr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new tr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}tr.create=t=>new tr({checks:[],typeName:b.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});class ys extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.boolean,received:n.parsedType}),K}return Le(e.data)}}ys.create=t=>new ys({typeName:b.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});class Pr extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:C.date,received:s.parsedType}),K}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_date}),K}const n=new Ne;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),$(a,{code:w.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):te.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Pr.create=t=>new Pr({checks:[],coerce:t?.coerce||!1,typeName:b.ZodDate,...Q(t)});class vs extends ee{_parse(e){if(this._getType(e)!==C.symbol){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.symbol,received:n.parsedType}),K}return Le(e.data)}}vs.create=t=>new vs({typeName:b.ZodSymbol,...Q(t)});class ws extends ee{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.undefined,received:n.parsedType}),K}return Le(e.data)}}ws.create=t=>new ws({typeName:b.ZodUndefined,...Q(t)});class bs extends ee{_parse(e){if(this._getType(e)!==C.null){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.null,received:n.parsedType}),K}return Le(e.data)}}bs.create=t=>new bs({typeName:b.ZodNull,...Q(t)});class _a extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Le(e.data)}}_a.create=t=>new _a({typeName:b.ZodAny,...Q(t)});class Es extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Le(e.data)}}Es.create=t=>new Es({typeName:b.ZodUnknown,...Q(t)});class ht extends ee{_parse(e){const r=this._getOrReturnCtx(e);return $(r,{code:w.invalid_type,expected:C.never,received:r.parsedType}),K}}ht.create=t=>new ht({typeName:b.ZodNever,...Q(t)});class Ss extends ee{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.void,received:n.parsedType}),K}return Le(e.data)}}Ss.create=t=>new Ss({typeName:b.ZodVoid,...Q(t)});class Je extends ee{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==C.array)return $(r,{code:w.invalid_type,expected:C.array,received:r.parsedType}),K;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&($(r,{code:i?w.too_big:w.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&($(r,{code:w.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&($(r,{code:w.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new ft(r,i,r.path,o)))).then(i=>Ne.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new ft(r,i,r.path,o)));return Ne.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Je({...this._def,minLength:{value:e,message:N.toString(r)}})}max(e,r){return new Je({...this._def,maxLength:{value:e,message:N.toString(r)}})}length(e,r){return new Je({...this._def,exactLength:{value:e,message:N.toString(r)}})}nonempty(e){return this.min(1,e)}}Je.create=(t,e)=>new Je({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...Q(e)});function Ct(t){if(t instanceof de){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=lt.create(Ct(n))}return new de({...t._def,shape:()=>e})}else return t instanceof Je?new Je({...t._def,type:Ct(t.element)}):t instanceof lt?lt.create(Ct(t.unwrap())):t instanceof Ft?Ft.create(Ct(t.unwrap())):t instanceof xt?xt.create(t.items.map(e=>Ct(e))):t}class de extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=te.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){const u=this._getOrReturnCtx(e);return $(u,{code:w.invalid_type,expected:C.object,received:u.parsedType}),K}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ht&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const l=s[u],d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ft(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof ht){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:a.data[l]}});else if(u==="strict")o.length>0&&($(a,{code:w.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of o){const d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ft(a,d,a.path,l)),alwaysSet:l in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Ne.mergeObjectSync(n,u)):Ne.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new de({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:N.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new de({...this._def,unknownKeys:"strip"})}passthrough(){return new de({...this._def,unknownKeys:"passthrough"})}extend(e){return new de({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new de({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new de({...this._def,catchall:e})}pick(e){const r={};for(const n of te.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}omit(e){const r={};for(const n of te.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}deepPartial(){return Ct(this)}partial(e){const r={};for(const n of te.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new de({...this._def,shape:()=>r})}required(e){const r={};for(const n of te.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof lt;)s=s._def.innerType;r[n]=s}return new de({...this._def,shape:()=>r})}keyof(){return $o(te.objectKeys(this.shape))}}de.create=(t,e)=>new de({shape:()=>t,unknownKeys:"strip",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});de.strictCreate=(t,e)=>new de({shape:()=>t,unknownKeys:"strict",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});de.lazycreate=(t,e)=>new de({shape:t,unknownKeys:"strip",catchall:ht.create(),typeName:b.ZodObject,...Q(e)});class Lr extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new rt(o.ctx.common.issues));return $(r,{code:w.invalid_union,unionErrors:i}),K}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(c=>new rt(c));return $(r,{code:w.invalid_union,unionErrors:o}),K}}get options(){return this._def.options}}Lr.create=(t,e)=>new Lr({options:t,typeName:b.ZodUnion,...Q(e)});function ya(t,e){const r=it(t),n=it(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&n===C.object){const a=te.objectKeys(e),s=te.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const c=ya(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===C.array&&n===C.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],c=ya(i,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===C.date&&n===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(ms(s)||ms(i))return K;const o=ya(s.value,i.value);return o.valid?((gs(s)||gs(i))&&r.dirty(),{status:r.value,value:o.data}):($(n,{code:w.invalid_intersection_types}),K)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Mr.create=(t,e,r)=>new Mr({left:t,right:e,typeName:b.ZodIntersection,...Q(r)});class xt extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.array)return $(n,{code:w.invalid_type,expected:C.array,received:n.parsedType}),K;if(n.data.length<this._def.items.length)return $(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ft(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Ne.mergeArray(r,i)):Ne.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new xt({...this._def,rest:e})}}xt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xt({items:t,typeName:b.ZodTuple,rest:null,...Q(e)})};class Ts extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.map)return $(n,{code:w.invalid_type,expected:C.map,received:n.parsedType}),K;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new ft(n,o,n.path,[u,"key"])),value:s._parse(new ft(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return K;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return K;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}}Ts.create=(t,e,r)=>new Ts({valueType:e,keyType:t,typeName:b.ZodMap,...Q(r)});class rr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.set)return $(n,{code:w.invalid_type,expected:C.set,received:n.parsedType}),K;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&($(n,{code:w.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&($(n,{code:w.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const l of c){if(l.status==="aborted")return K;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>s._parse(new ft(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new rr({...this._def,minSize:{value:e,message:N.toString(r)}})}max(e,r){return new rr({...this._def,maxSize:{value:e,message:N.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}rr.create=(t,e)=>new rr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...Q(e)});class xs extends ee{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}xs.create=(t,e)=>new xs({getter:t,typeName:b.ZodLazy,...Q(e)});class Is extends ee{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return $(r,{received:r.data,code:w.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:e.data}}get value(){return this._def.value}}Is.create=(t,e)=>new Is({value:t,typeName:b.ZodLiteral,...Q(e)});function $o(t,e){return new Dt({values:t,typeName:b.ZodEnum,...Q(e)})}class Dt extends ee{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return $(r,{expected:te.joinValues(n),received:r.parsedType,code:w.invalid_type}),K}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return $(r,{received:r.data,code:w.invalid_enum_value,options:n}),K}return Le(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Dt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Dt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Dt.create=$o;class $s extends ee{_parse(e){const r=te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==C.string&&n.parsedType!==C.number){const a=te.objectValues(r);return $(n,{expected:te.joinValues(a),received:n.parsedType,code:w.invalid_type}),K}if(this._cache||(this._cache=new Set(te.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=te.objectValues(r);return $(n,{received:n.data,code:w.invalid_enum_value,options:a}),K}return Le(e.data)}get enum(){return this._def.values}}$s.create=(t,e)=>new $s({values:t,typeName:b.ZodNativeEnum,...Q(e)});class jr extends ee{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return $(r,{code:w.invalid_type,expected:C.promise,received:r.parsedType}),K;const n=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return Le(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}jr.create=(t,e)=>new jr({type:t,typeName:b.ZodPromise,...Q(e)});class Ut extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{$(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return K;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?K:c.status==="dirty"||r.value==="dirty"?Vt(c.value):c});{if(r.value==="aborted")return K;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?K:o.status==="dirty"||r.value==="dirty"?Vt(o.value):o}}if(a.type==="refinement"){const i=o=>{const c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?K:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?K:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!jt(i))return K;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>jt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):K);te.assertNever(a)}}Ut.create=(t,e,r)=>new Ut({schema:t,typeName:b.ZodEffects,effect:e,...Q(r)});Ut.createWithPreprocess=(t,e,r)=>new Ut({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...Q(r)});class lt extends ee{_parse(e){return this._getType(e)===C.undefined?Le(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lt.create=(t,e)=>new lt({innerType:t,typeName:b.ZodOptional,...Q(e)});class Ft extends ee{_parse(e){return this._getType(e)===C.null?Le(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ft.create=(t,e)=>new Ft({innerType:t,typeName:b.ZodNullable,...Q(e)});class va extends ee{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===C.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}va.create=(t,e)=>new va({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});class wa extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Nr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wa.create=(t,e)=>new wa({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});class As extends ee{_parse(e){if(this._getType(e)!==C.nan){const n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:C.nan,received:n.parsedType}),K}return{status:"valid",value:e.data}}}As.create=t=>new As({typeName:b.ZodNaN,...Q(t)});class Ru extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class za extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?K:s.status==="dirty"?(r.dirty(),Vt(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?K:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new za({in:e,out:r,typeName:b.ZodPipeline})}}class ba extends ee{_parse(e){const r=this._def.innerType._parse(e),n=a=>(jt(a)&&(a.value=Object.freeze(a.value)),a);return Nr(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}ba.create=(t,e)=>new ba({innerType:t,typeName:b.ZodReadonly,...Q(e)});var b;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(b||(b={}));const Ou=ct.create,Rs=_a.create;ht.create;Je.create;const ku=de.create;Lr.create;Mr.create;xt.create;Dt.create;jr.create;lt.create;Ft.create;var Cu=Object.defineProperty,ye=(t,e)=>{for(var r in e)Cu(t,r,{get:e[r],enumerable:!0})};function It(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function Nu(t){return It(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function Pu(t){return It(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function eg(t){return It(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Lu(t){return It(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function tg(t){if(It(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function rg(t){const e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);const r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);const a={};for(const s of t.split(";").slice(1)){const i=s.split("=");if(i.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);const o=i[0].trim(),c=i[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);a[o]=c}return{type:r,subtype:n,parameters:a}}function Os({dataUrl:t,asTypedArray:e=!1}){const r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let n;if(r){n=r[1].toLowerCase();const a=e?Uint8Array.from(atob(r[2]),s=>s.charCodeAt(0)):r[2];return{mime_type:n,data:a}}}function ng(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Mu(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var nn,ks;function ju(){return ks||(ks=1,nn=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}),nn}var Du=ju();const Uu=Ua(Du);var yr={exports:{}},Cs;function Fu(){if(Cs)return yr.exports;Cs=1;const t=/[\p{Lu}]/u,e=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,a=/[_.\- ]+/,s=new RegExp("^"+a.source),i=new RegExp(a.source+n.source,"gu"),o=new RegExp("\\d+"+n.source,"gu"),c=(f,h,p)=>{let m=!1,g=!1,_=!1;for(let v=0;v<f.length;v++){const y=f[v];m&&t.test(y)?(f=f.slice(0,v)+"-"+f.slice(v),m=!1,_=g,g=!0,v++):g&&_&&e.test(y)?(f=f.slice(0,v-1)+"-"+f.slice(v-1),_=g,g=!1,m=!0):(m=h(y)===y&&p(y)!==y,_=g,g=p(y)===y&&h(y)!==y)}return f},u=(f,h)=>(r.lastIndex=0,f.replace(r,p=>h(p))),l=(f,h)=>(i.lastIndex=0,o.lastIndex=0,f.replace(i,(p,m)=>h(m)).replace(o,p=>h(p))),d=(f,h)=>{if(!(typeof f=="string"||Array.isArray(f)))throw new TypeError("Expected the input to be `string | string[]`");if(h={pascalCase:!1,preserveConsecutiveUppercase:!1,...h},Array.isArray(f)?f=f.map(_=>_.trim()).filter(_=>_.length).join("-"):f=f.trim(),f.length===0)return"";const p=h.locale===!1?_=>_.toLowerCase():_=>_.toLocaleLowerCase(h.locale),m=h.locale===!1?_=>_.toUpperCase():_=>_.toLocaleUpperCase(h.locale);return f.length===1?h.pascalCase?m(f):p(f):(f!==p(f)&&(f=c(f,p,m)),f=f.replace(s,""),h.preserveConsecutiveUppercase?f=u(f,p):f=p(f),h.pascalCase&&(f=m(f.charAt(0))+f.slice(1)),l(f,m))};return yr.exports=d,yr.exports.default=d,yr.exports}Fu();function zu(t,e){return e?.[t]||Uu(t)}function Bu(t,e,r){const n={};for(const a in t)Object.hasOwn(t,a)&&(n[e(a,r)]=t[a]);return n}var qu={};ye(qu,{Serializable:()=>nr,get_lc_unique_name:()=>Ba});function Ns(t){return Array.isArray(t)?[...t]:{...t}}function Gu(t,e){const r=Ns(t);for(const[n,a]of Object.entries(e)){const[s,...i]=n.split(".").reverse();let o=r;for(const c of i.reverse()){if(o[c]===void 0)break;o[c]=Ns(o[c]),o=o[c]}o[s]!==void 0&&(o[s]={lc:1,type:"secret",id:[a]})}return r}function Ba(t){const e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var nr=class Ao{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Ba(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Ao||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const e={},r={},n=Object.keys(this.lc_kwargs).reduce((a,s)=>(a[s]=s in this?this[s]:this.lc_kwargs[s],a),{});for(let a=Object.getPrototypeOf(this);a;a=Object.getPrototypeOf(a))Object.assign(e,Reflect.get(a,"lc_aliases",this)),Object.assign(r,Reflect.get(a,"lc_secrets",this)),Object.assign(n,Reflect.get(a,"lc_attributes",this));return Object.keys(r).forEach(a=>{let s=this,i=n;const[o,...c]=a.split(".").reverse();for(const u of c.reverse()){if(!(u in s)||s[u]===void 0)return;(!(u in i)||i[u]===void 0)&&(typeof s[u]=="object"&&s[u]!=null?i[u]={}:Array.isArray(s[u])&&(i[u]=[])),s=s[u],i=i[u]}o in s&&s[o]!==void 0&&(i[o]=i[o]||s[o])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:Bu(Object.keys(r).length?Gu(n,r):n,zu,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function D(t,e){return J(t)&&t.type===e}function J(t){return typeof t=="object"&&t!==null}function Ke(t){return Array.isArray(t)}function O(t){return typeof t=="string"}function ze(t){return typeof t=="number"}function qa(t){return t instanceof Uint8Array}function Ps(t){try{return JSON.parse(t)}catch{return}}const ar=t=>t();function Zu(t){if(t.type==="char_location"&&O(t.document_title)&&ze(t.start_char_index)&&ze(t.end_char_index)&&O(t.cited_text)){const{document_title:e,start_char_index:r,end_char_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="page_location"&&O(t.document_title)&&ze(t.start_page_number)&&ze(t.end_page_number)&&O(t.cited_text)){const{document_title:e,start_page_number:r,end_page_number:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="content_block_location"&&O(t.document_title)&&ze(t.start_block_index)&&ze(t.end_block_index)&&O(t.cited_text)){const{document_title:e,start_block_index:r,end_block_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="web_search_result_location"&&O(t.url)&&O(t.title)&&O(t.encrypted_index)&&O(t.cited_text)){const{url:e,title:r,encrypted_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:a}}if(t.type==="search_result_location"&&O(t.source)&&O(t.title)&&ze(t.start_block_index)&&ze(t.end_block_index)&&O(t.cited_text)){const{source:e,title:r,start_block_index:n,end_block_index:a,cited_text:s,...i}=t;return{...i,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:a,citedText:s}}}function Ro(t){if(D(t,"document")&&J(t.source)&&"type"in t.source){if(t.source.type==="base64"&&O(t.source.media_type)&&O(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&O(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&O(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&O(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(D(t,"image")&&J(t.source)&&"type"in t.source){if(t.source.type==="base64"&&O(t.source.media_type)&&O(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&O(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&O(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function Hu(t){function*e(){for(const r of t){const n=Ro(r);n?yield n:yield r}}return Array.from(e())}function Ls(t){function*e(){const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r){if(D(n,"text")&&O(n.text)){const{text:a,citations:s,...i}=n;if(Ke(s)&&s.length){const o=s.reduce((c,u)=>{const l=Zu(u);return l?[...c,l]:c},[]);yield{...i,type:"text",text:a,annotations:o};continue}else{yield{...i,type:"text",text:a};continue}}else if(D(n,"thinking")&&O(n.thinking)){const{thinking:a,signature:s,...i}=n;yield{...i,type:"reasoning",reasoning:a,signature:s};continue}else if(D(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(D(n,"tool_use")&&O(n.name)&&O(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(D(n,"input_json_delta")){if(Wu(t)&&t.tool_call_chunks?.length){const a=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:a.id,name:a.name,args:a.args,index:a.index};continue}}else if(D(n,"server_tool_use")&&O(n.name)&&O(n.id)){const{name:a,id:s}=n;if(a==="web_search"){const i=ar(()=>{if(typeof n.input=="string")return n.input;if(J(n.input)&&O(n.input.query))return n.input.query;if(O(n.partial_json)){const o=Ps(n.partial_json);if(o?.query)return o.query}return""});yield{id:s,type:"server_tool_call",name:"web_search",args:{query:i}};continue}else if(n.name==="code_execution"){const i=ar(()=>{if(typeof n.input=="string")return n.input;if(J(n.input)&&O(n.input.code))return n.input.code;if(O(n.partial_json)){const o=Ps(n.partial_json);if(o?.code)return o.code}return""});yield{id:s,type:"server_tool_call",name:"code_execution",args:{code:i}};continue}}else if(D(n,"web_search_tool_result")&&O(n.tool_use_id)&&Ke(n.content)){const{content:a,tool_use_id:s}=n,i=a.reduce((o,c)=>D(c,"web_search_result")?[...o,c.url]:o,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:s,status:"success",output:{urls:i}};continue}else if(D(n,"code_execution_tool_result")&&O(n.tool_use_id)&&J(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(D(n,"mcp_tool_result")&&O(n.tool_use_id)&&J(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(D(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(D(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{const a=Ro(n);if(a){yield a;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}const Vu={translateContent:Ls,translateContentChunk:Ls};function Wu(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function Ju(t){return Nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:Pu(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Lu(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Ku(t){return t.map(Ju)}function Yu(t){return!!(D(t,"image_url")&&J(t.image_url)||D(t,"input_audio")&&J(t.input_audio)||D(t,"file")&&J(t.file))}function Qu(t){if(D(t,"image_url")&&J(t.image_url)&&O(t.image_url.url)){const e=Os({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(D(t,"input_audio")&&J(t.input_audio)&&O(t.input_audio.data)&&O(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(D(t,"file")&&J(t.file)&&O(t.file.data)){const e=Os({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(O(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function Xu(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Ga(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function el(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Ga(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Ga(t){const e=[];for(const r of t)Yu(r)?e.push(Qu(r)):e.push(r);return e}function tl(t){if(t.type==="url_citation"){const{url:e,title:r,start_index:n,end_index:a}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:a}}if(t.type==="file_citation"){const{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function Oo(t){function*e(){J(t.additional_kwargs?.reasoning)&&Ke(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((a,s)=>J(s)&&O(s.text)?`${a}${s.text}`:a,"")});const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r)if(D(n,"text")){const{text:a,annotations:s,...i}=n;Array.isArray(s)?yield{...i,type:"text",text:String(a),annotations:s.map(tl)}:yield{...i,type:"text",text:String(a)}}for(const n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(J(t.additional_kwargs)&&Ke(t.additional_kwargs.tool_outputs))for(const n of t.additional_kwargs.tool_outputs){if(D(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(D(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(D(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(D(n,"code_interpreter_call")){if(O(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ke(n.outputs)){const a=ar(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(const s of n.outputs)if(D(s,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:a??0,stderr:[0,void 0].includes(a)?void 0:String(s.logs),stdout:[0,void 0].includes(a)?String(s.logs):void 0}};continue}}continue}else if(D(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(D(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(D(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(D(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}J(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function rl(t){function*e(){yield*Oo(t);for(const r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}const nl={translateContent:t=>typeof t.content=="string"?Xu(t):Oo(t),translateContentChunk:t=>typeof t.content=="string"?el(t):rl(t)};function al(t,e="pretty"){return e==="pretty"?sl(t):JSON.stringify(t)}function sl(t){const e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),a="=".repeat(n),s=r.length%2===0?a:`${a}=`;if(e.push(`${a}${r}${s}`),t.type==="ai"){const i=t;if(i.tool_calls&&i.tool_calls.length>0){e.push("Tool Calls:");for(const o of i.tool_calls){e.push(` ${o.name} (${o.id})`),e.push(` Call ID: ${o.id}`),e.push(" Args:");for(const[c,u]of Object.entries(o.args))e.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(t.type==="tool"){const i=t;i.name&&e.push(`Name: ${i.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
|
|
2
2
|
`)}const an=Symbol.for("langchain.message");function pt(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>It(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?Hr(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>It(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function il(t,e){return t==="error"||e==="error"?"error":"success"}function ol(t,e){function r(n,a){if(typeof n!="object"||n===null||n===void 0)return n;if(a>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(i=>r(i,a+1));const s={};for(const i of Object.keys(n))s[i]=r(n[i],a+1);return s}return JSON.stringify(r(t,0),null,2)}var gt=class extends nr{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[an]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){const e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){const t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[Ku,Ga,Hu].reduce((n,a)=>a(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&an in t&&t[an]===!0&&Mu(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;const e=ol(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return al(this,t)}};function ag(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function Se(t={},e={}){const r={...t};for(const[n,a]of Object.entries(e))if(r[n]==null)r[n]=a;else{if(a==null)continue;if(typeof r[n]!=typeof a||Array.isArray(r[n])!==Array.isArray(a))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?a&&(r[n]=a):r[n]+=a}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=Se(r[n],a);else if(Array.isArray(r[n]))r[n]=Hr(r[n],a);else{if(r[n]===a)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function Hr(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{const r=[...t];for(const n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){const a=r.findIndex(s=>{const i=typeof s=="object",o="index"in s&&s.index===n.index,c="id"in s&&"id"in n&&s?.id===n?.id,u=!("id"in s)||!s?.id||!("id"in n)||!n?.id;return i&&o&&(c||u)});a!==-1&&typeof r[a]=="object"&&r[a]!==null?r[a]=Se(r[a],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function cl(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
|
|
3
3
|
Left ${typeof t}
|
|
4
4
|
Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return Hr(t,e);if(typeof t=="object"&&typeof e=="object")return Se(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as d,C as O,D as a,h as Y,Z as N,f as T,E,c as Z,n as W,s as z,b as Q,o as w,F as X}from"./index-
|
|
1
|
+
import{B as d,C as O,D as a,h as Y,Z as N,f as T,E,c as Z,n as W,s as z,b as Q,o as w,F as X}from"./index-BsLLCsBP.js";import{G as ve,H as Se,T as we,I as Ee,L as Ae,J as Ce,M as _e,T as Pe,K as Ie,V as Le,N as $e,O as Oe,P as Ne,P as Te}from"./index-BsLLCsBP.js";import{D as k}from"./index-CtpnfKmY.js";import"./base-RWAdy9P6.js";import"./base-Bnm339-a.js";async function*ee(c){for await(const e of c)if(e.event==="on_chat_model_stream"&&e.data?.chunk?.text){const t=e.data.chunk.text;typeof t=="string"&&t.length>0&&(yield t)}}d(ee,"streamEventsToAISDK");function te(c){return new ReadableStream({async start(e){try{for await(const t of c)e.enqueue(t);e.close()}catch(t){e.error(t)}}})}d(te,"createReadableStreamFromGenerator");async function*re(c){for await(const e of c)switch(e.event){case"on_chat_model_stream":if(e.data?.chunk?.text){const t=e.data.chunk.text;typeof t=="string"&&t.length>0&&(yield t)}break;case"on_tool_start":yield`
|
|
2
2
|
🔧 Using tool: ${e.name}
|
|
3
3
|
`;break;case"on_tool_end":yield`
|
|
4
4
|
✅ Tool completed: ${e.name}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,q as d}from"./base-
|
|
1
|
+
import{_ as e,q as d}from"./base-RWAdy9P6.js";var l={};e(l,{chunkArray:()=>u});const u=(r,n)=>r.reduce((a,o,s)=>{const c=Math.floor(s/n),t=a[c]||[];return a[c]=t.concat([o]),a},[]);var _={};e(_,{Embeddings:()=>h});var h=class{caller;constructor(r){this.caller=new d(r??{})}};
|