@mcp-use/inspector 1.0.0-canary.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +79424 -78744
- package/dist/client/index.js +13657 -775
- package/dist/web/assets/{browser-ctrPxPGG.js → browser-BwHKNEau.js} +4 -4
- package/dist/web/assets/{chunk-62CHIOHA-BqLxpYpN.js → chunk-BBSBHVGK-D4wCPq_w.js} +1 -1
- package/dist/web/assets/{chunk-VAZ3ORZF-xdDkmZd3.js → chunk-ECXMLUNG-CSRGaMIB.js} +1 -1
- package/dist/web/assets/{chunk-JU7W27UC-B2439jaH.js → chunk-JU7W27UC-CMTI_w7A.js} +1 -1
- package/dist/web/assets/{chunk-QWQYAQCK-CyFuZlX8.js → chunk-QWQYAQCK-BR4V0xsV.js} +1 -1
- package/dist/web/assets/{chunk-RPN2XO5I-BhkUchqc.js → chunk-RPN2XO5I-Cr13Miz-.js} +1 -1
- package/dist/web/assets/{chunk-UJPHRNQP-C5slpjuZ.js → chunk-UJPHRNQP-B14ZPq5a.js} +1 -1
- package/dist/web/assets/{chunk_array-DyR0murc.js → chunk_array-Bw1lTtex.js} +1 -1
- package/dist/web/assets/{client-SJZVAN5F-B1CFq11b.js → client-2BTCLEUX-BhvJZmo-.js} +3 -3
- package/dist/web/assets/{client-DbpdPhaZ.js → client-z1GrRUEs.js} +2 -2
- package/dist/web/assets/{display-A5IEINAP-C6oc4kO3.js → display-A5IEINAP-B8BJrcag.js} +1 -1
- package/dist/web/assets/{dist-B902efBV.js → dist-BZmXa__p.js} +1 -1
- package/dist/web/assets/{dist-CZy-FXZn.js → dist-JsQmV3pO.js} +1 -1
- package/dist/web/assets/{dist-DgSb0Sz-.js → dist-t5Yo0YiG.js} +1 -1
- package/dist/web/assets/{function_calling-BfpScnEV.js → function_calling-kK7um7Ye.js} +1 -1
- package/dist/web/assets/index-CM9P_1sf.css +2 -0
- package/dist/web/assets/index-zlrXpRSB.js +720 -0
- package/dist/web/assets/langfuse-U2OEF7K7-BF5JV8uu.js +1 -0
- package/dist/web/assets/{llms-BsPQSnXF.js → llms-ByyTYk2T.js} +1 -1
- package/dist/web/assets/{messages-CARqPn1v.js → messages-D4_mH1tk.js} +1 -1
- package/dist/web/assets/react-C6BFTceN.js +1 -0
- package/dist/web/assets/rpc-logger-TPNV75J4-CMVlzCN7.js +1 -0
- package/dist/web/assets/{schemas-R05rZMzG.js → schemas-BrqAD_Qo.js} +1 -1
- package/dist/web/assets/{stdio-LCWQPR45-CGHsqeDK.js → stdio-RWLH66ZO-C753VwJ7.js} +1 -1
- package/dist/web/assets/{tools-Dk1xpPiY.js → tools-kLe9X8V8.js} +1 -1
- package/dist/web/index.html +13 -13
- package/package.json +8 -17
- package/dist/web/assets/index-DAB6h2wg.css +0 -2
- package/dist/web/assets/index-DdgwtcKr.js +0 -430
- package/dist/web/assets/langfuse-U2OEF7K7-CXu1ftDi.js +0 -1
- package/dist/web/assets/react-CR79PxS-.js +0 -1
- package/dist/web/assets/rpc-logger-TPNV75J4-DvyEg0Mj.js +0 -1
- /package/dist/web/assets/{chunk-3GQAWCBQ-C-9Cm0Np.js → chunk-3GQAWCBQ-ntjTDD_C.js} +0 -0
- /package/dist/web/assets/{json-schema-processors-BJc5OsHH.js → json-schema-processors-DNSjFPrk.js} +0 -0
- /package/dist/web/assets/{preload-helper-7Icc4Czl.js → preload-helper-ckxxtgMM.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-QWQYAQCK-BR4V0xsV.js";import{n as e,r as t,t as n}from"./chunk-UJPHRNQP-B14ZPq5a.js";export{n as initializeLangfuse,e as langfuseHandler,t as langfuseInitPromise};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ft as e,P as t,Qt as n,at as r,ot as i,pt as a,tn as o,wt as s,zn as c}from"./messages-
|
|
1
|
+
import{Ft as e,P as t,Qt as n,at as r,ot as i,pt as a,tn as o,wt as s,zn as c}from"./messages-D4_mH1tk.js";import{A as l,D as u,u as d}from"./function_calling-kK7um7Ye.js";function f(e,t){if(e.function===void 0)return;let n;if(t?.partial)try{n=o(e.function.arguments??`{}`)}catch{return}else try{n=JSON.parse(e.function.arguments)}catch(t){throw new l([`Function "${e.function.name}" arguments:`,``,e.function.arguments,``,`are not valid JSON.`,`Error: ${t.message}`].join(`
|
|
2
2
|
`))}let r={name:e.function.name,args:n,type:`tool_call`};return t?.returnId&&(r.id=e.id),r}function p(e){if(e.id===void 0)throw Error(`All OpenAI tool calls must have an "id" field.`);return{id:e.id,type:`function`,function:{name:e.name,arguments:JSON.stringify(e.args)}}}function m(e,t){return{name:e.function?.name,args:e.function?.arguments,id:e.id,error:t,type:`invalid_tool_call`}}var h=class extends u{static lc_name(){return`JsonOutputToolsParser`}returnId=!1;lc_namespace=[`langchain`,`output_parsers`,`openai_tools`];lc_serializable=!0;constructor(e){super(e),this.returnId=e?.returnId??this.returnId}_diff(){throw Error(`Not supported.`)}async parse(){throw Error(`Not implemented.`)}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){let r=e[0].message,i;if(n(r)&&r.tool_calls?.length?i=r.tool_calls.map(e=>{let{id:t,...n}=e;return this.returnId?{id:t,...n}:n}):r.additional_kwargs.tool_calls!==void 0&&(i=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(e=>f(e,{returnId:this.returnId,partial:t}))),!i)return[];let a=[];for(let e of i)if(e!==void 0){let t={type:e.name,args:e.args,id:e.id};a.push(t)}return a}},g=class extends h{static lc_name(){return`JsonOutputKeyToolsParser`}lc_namespace=[`langchain`,`output_parsers`,`openai_tools`];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let n=await t(this.zodSchema,e);if(n.success)return n.data;throw new l(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let t=(await super.parsePartialResult(e)).filter(e=>e.type===this.keyName),n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?n[0]:n}async parseResult(e){let t=(await super.parsePartialResult(e,!1)).filter(e=>e.type===this.keyName),n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(e=>this._validateResult(e)))}},_={};c(_,{JsonOutputKeyToolsParser:()=>g,JsonOutputToolsParser:()=>h,convertLangChainToolCallToOpenAI:()=>p,makeInvalidToolCall:()=>m,parseToolCall:()=>f});var v={};c(v,{BaseLLM:()=>y,LLM:()=>b});var y=class t extends d{lc_namespace=[`langchain`,`llms`,this._llmType()];async invoke(e,n){let r=t._convertInputToPromptValue(e);return(await this.generatePrompt([r],n,n?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,t,n){throw Error(`Not implemented.`)}_separateRunnableConfigFromCallOptionsCompat(e){let[t,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=t.signal,[t,n]}async*_streamIterator(e,n){if(this._streamResponseChunks===t.prototype._streamResponseChunks)yield this.invoke(e,n);else{let i=t._convertInputToPromptValue(e),[a,o]=this._separateRunnableConfigFromCallOptionsCompat(n),c=await s.configure(a.callbacks,this.callbacks,a.tags,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},u=await c?.handleLLMStart(this.toJSON(),[i.toString()],a.runId,void 0,l,void 0,void 0,a.runName),d=new r({text:``});try{for await(let e of this._streamResponseChunks(i.toString(),o,u?.[0]))d=d?d.concat(e):e,typeof e.text==`string`&&(yield e.text)}catch(e){throw await Promise.all((u??[]).map(t=>t?.handleLLMError(e))),e}await Promise.all((u??[]).map(e=>e?.handleLLMEnd({generations:[[d]]})))}}async generatePrompt(e,t,n){let r=e.map(e=>e.toString());return this.generate(r,t,n)}invocationParams(e){return{}}_flattenLLMResult(e){let t=[];for(let n=0;n<e.generations.length;n+=1){let r=e.generations[n];if(n===0)t.push({generations:[r],llmOutput:e.llmOutput});else{let n=e.llmOutput?{...e.llmOutput,tokenUsage:{}}:void 0;t.push({generations:[r],llmOutput:n})}}return t}async _generateUncached(n,r,o,c){let l;if(c!==void 0&&c.length===n.length)l=c;else{let e=await s.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),t={options:r,invocation_params:this?.invocationParams(r),batch_size:n.length};l=await e?.handleLLMStart(this.toJSON(),n,o.runId,void 0,t,void 0,void 0,o?.runName)}let u=!!l?.[0].handlers.find(e),d;if(u&&n.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let e=await this._streamResponseChunks(n[0],r,l?.[0]),t;for await(let n of e)t=t===void 0?n:a(t,n);if(t===void 0)throw Error(`Received empty response from chat model call.`);d={generations:[[t]],llmOutput:{}},await l?.[0].handleLLMEnd(d)}catch(e){throw await l?.[0].handleLLMError(e),e}else{try{d=await this._generate(n,r,l?.[0])}catch(e){throw await Promise.all((l??[]).map(t=>t?.handleLLMError(e))),e}let e=this._flattenLLMResult(d);await Promise.all((l??[]).map((t,n)=>t?.handleLLMEnd(e[n])))}let f=l?.map(e=>e.runId)||void 0;return Object.defineProperty(d,i,{value:f?{runIds:f}:void 0,configurable:!0}),d}async _generateCached({prompts:e,cache:t,llmStringKey:n,parsedOptions:r,handledOptions:a,runId:o}){let c=await s.configure(a.callbacks,this.callbacks,a.tags,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),l={options:r,invocation_params:this?.invocationParams(r),batch_size:e.length},u=await c?.handleLLMStart(this.toJSON(),e,o,void 0,l,void 0,void 0,a?.runName),d=[],f=(await Promise.allSettled(e.map(async(e,r)=>{let i=await t.lookup(e,n);return i??d.push(r),i}))).map((e,t)=>({result:e,runManager:u?.[t]})).filter(({result:e})=>e.status===`fulfilled`&&e.value!=null||e.status===`rejected`),p=[];await Promise.all(f.map(async({result:e,runManager:t},n)=>{if(e.status===`fulfilled`){let r=e.value;return p[n]=r.map(e=>(e.generationInfo={...e.generationInfo,tokenUsage:{}},e)),r.length&&await t?.handleLLMNewToken(r[0].text),t?.handleLLMEnd({generations:[r]},void 0,void 0,void 0,{cached:!0})}else return await t?.handleLLMError(e.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(e.reason)}));let m={generations:p,missingPromptIndices:d,startedRunManagers:u};return Object.defineProperty(m,i,{value:u?{runIds:u?.map(e=>e.runId)}:void 0,configurable:!0}),m}async generate(e,t,n){if(!Array.isArray(e))throw Error(`Argument 'prompts' is expected to be a string[]`);let r;r=Array.isArray(t)?{stop:t}:t;let[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,a,i);let{cache:o}=this,s=this._getSerializedCacheKeyParametersForCall(a),{generations:c,missingPromptIndices:l,startedRunManagers:u}=await this._generateCached({prompts:e,cache:o,llmStringKey:s,parsedOptions:a,handledOptions:i,runId:i.runId}),d={};if(l.length>0){let t=await this._generateUncached(l.map(t=>e[t]),a,i,u===void 0?void 0:l.map(e=>u?.[e]));await Promise.all(t.generations.map(async(t,n)=>{let r=l[n];return c[r]=t,o.update(e[r],s,t)})),d=t.llmOutput??{}}return{generations:c,llmOutput:d}}_identifyingParams(){return{}}_modelType(){return`base_llm`}},b=class extends y{async _generate(e,t,n){return{generations:await Promise.all(e.map((e,r)=>this._call(e,{...t,promptIndex:r},n).then(e=>[{text:e}])))}}};export{p as a,g as i,v as n,m as o,_ as r,f as s,b as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t,t as n}from"./chunk-zsgVPwQN.js";import{Et as r,Fn as i,Lt as a,S as o,Xn as s,Yn as c,dt as l,mn as u,rr as d,tr as f,ur as p,xn as m}from"./json-schema-processors-BJc5OsHH.js";var h;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(h||={});var g;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(g||={});var _=h.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),v=e=>{switch(typeof e){case`undefined`:return _.undefined;case`string`:return _.string;case`number`:return Number.isNaN(e)?_.nan:_.number;case`boolean`:return _.boolean;case`function`:return _.function;case`bigint`:return _.bigint;case`symbol`:return _.symbol;case`object`:return Array.isArray(e)?_.array:e===null?_.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?_.promise:typeof Map<`u`&&e instanceof Map?_.map:typeof Set<`u`&&e instanceof Set?_.set:typeof Date<`u`&&e instanceof Date?_.date:_.object;default:return _.unknown}},y=h.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`]),b=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,h.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=e=>new b(e);var ee=(e,t)=>{let n;switch(e.code){case y.invalid_type:n=e.received===_.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,h.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:n=`Unrecognized key(s) in object: ${h.joinValues(e.keys,`, `)}`;break;case y.invalid_union:n=`Invalid input`;break;case y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${h.joinValues(e.options)}`;break;case y.invalid_enum_value:n=`Invalid enum value. Expected ${h.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:n=`Invalid function arguments`;break;case y.invalid_return_type:n=`Invalid function return type`;break;case y.invalid_date:n=`Invalid date`;break;case y.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:h.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case y.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case y.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case y.custom:n=`Invalid input`;break;case y.invalid_intersection_types:n=`Intersection results could not be merged`;break;case y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,h.assertNever(e)}return{message:n}},te=ee;function ne(){return te}var re=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function x(e,t){let n=ne(),r=re({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ee?void 0:ee].filter(e=>!!e)});e.common.issues.push(r)}var S=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return C;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return C;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},C=Object.freeze({status:`aborted`}),ie=e=>({status:`dirty`,value:e}),w=e=>({status:`valid`,value:e}),ae=e=>e.status===`aborted`,oe=e=>e.status===`dirty`,se=e=>e.status===`valid`,ce=e=>typeof Promise<`u`&&e instanceof Promise,T;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(T||={});var le=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},ue=(e,t)=>{if(se(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new b(e.common.issues),this._error}}};function E(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var D=class{get description(){return this._def.description}_getType(e){return v(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ce(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};return ue(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return se(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>se(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},r=this._parse({data:e,path:n.path,parent:n});return ue(n,await(ce(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:y.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ft({schema:this,typeName:k.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:e=>this[`~validate`](e)}}optional(){return pt.create(this,this._def)}nullable(){return mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return dt.create(this,this._def)}or(e){return Xe.create([this,e],this._def)}and(e){return et.create(this,e,this._def)}transform(e){return new ft({...E(this._def),schema:this,typeName:k.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ht({...E(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new vt({typeName:k.ZodBranded,type:this,...E(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new gt({...E(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return yt.create(this,e)}readonly(){return bt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},de=/^c[^\s-]{8,}$/i,fe=/^[0-9a-z]+$/,pe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,me=/^[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,he=/^[a-z0-9_-]{21}$/i,ge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_e=/^[-+]?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)?)??$/,ve=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ye=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,be,xe=/^(?:(?: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])$/,Se=/^(?:(?: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])$/,Ce=/^(([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]))$/,we=/^(([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])$/,Te=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ee=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,De=`((\\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])))`,O=RegExp(`^${De}$`);function Oe(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ke(e){return RegExp(`^${Oe(e)}$`)}function Ae(e){let t=`${De}T${Oe(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function je(e,t){return!!((t===`v4`||!t)&&xe.test(e)||(t===`v6`||!t)&&Ce.test(e))}function Me(e,t){if(!ge.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ne(e,t){return!!((t===`v4`||!t)&&Se.test(e)||(t===`v6`||!t)&&we.test(e))}var Pe=class e extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.string,received:t.parsedType}),C}let t=new S,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)ve.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`email`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)be||=new RegExp(ye,`u`),be.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`emoji`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)me.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`uuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)he.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`nanoid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)de.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)fe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid2`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)pe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ulid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),x(n,{validation:`url`,code:y.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`regex`,code:y.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Ae(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?O.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?ke(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?_e.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`duration`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?je(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ip`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Me(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`jwt`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Ne(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cidr`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Te.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Ee.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64url`,code:y.invalid_string,message:r.message}),t.dirty()):h.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:y.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...T.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...T.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...T.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...T.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...T.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...T.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...T.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...T.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...T.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...T.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...T.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:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.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:e?.precision===void 0?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...T.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...T.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...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(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Pe.create=e=>new Pe({checks:[],typeName:k.ZodString,coerce:e?.coerce??!1,...E(e)});function Fe(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ie=class e extends D{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)!==_.number){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.number,received:t.parsedType}),C}let t,n=new S;for(let r of this._def.checks)r.kind===`int`?h.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Fe(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_finite,message:r.message}),n.dirty()):h.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,T.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,T.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,T.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,T.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:T.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:T.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:T.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:T.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:T.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&h.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ie.create=e=>new Ie({checks:[],typeName:k.ZodNumber,coerce:e?.coerce||!1,...E(e)});var Le=class e extends D{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)!==_.bigint)return this._getInvalidInput(e);let t,n=new S;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):h.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.bigint,received:t.parsedType}),C}gte(e,t){return this.setLimit(`min`,e,!0,T.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,T.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,T.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,T.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:T.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:T.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=e=>new Le({checks:[],typeName:k.ZodBigInt,coerce:e?.coerce??!1,...E(e)});var Re=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.boolean,received:t.parsedType}),C}return w(e.data)}};Re.create=e=>new Re({typeName:k.ZodBoolean,coerce:e?.coerce||!1,...E(e)});var ze=class e extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.date,received:t.parsedType}),C}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:y.invalid_date}),C;let t=new S,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):h.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};ze.create=e=>new ze({checks:[],coerce:e?.coerce||!1,typeName:k.ZodDate,...E(e)});var Be=class extends D{_parse(e){if(this._getType(e)!==_.symbol){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.symbol,received:t.parsedType}),C}return w(e.data)}};Be.create=e=>new Be({typeName:k.ZodSymbol,...E(e)});var Ve=class extends D{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.undefined,received:t.parsedType}),C}return w(e.data)}};Ve.create=e=>new Ve({typeName:k.ZodUndefined,...E(e)});var He=class extends D{_parse(e){if(this._getType(e)!==_.null){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.null,received:t.parsedType}),C}return w(e.data)}};He.create=e=>new He({typeName:k.ZodNull,...E(e)});var Ue=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};Ue.create=e=>new Ue({typeName:k.ZodAny,...E(e)});var We=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};We.create=e=>new We({typeName:k.ZodUnknown,...E(e)});var Ge=class extends D{_parse(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.never,received:t.parsedType}),C}};Ge.create=e=>new Ge({typeName:k.ZodNever,...E(e)});var Ke=class extends D{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.void,received:t.parsedType}),C}return w(e.data)}};Ke.create=e=>new Ke({typeName:k.ZodVoid,...E(e)});var qe=class e extends D{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==_.array)return x(t,{code:y.invalid_type,expected:_.array,received:t.parsedType}),C;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(x(t,{code:e?y.too_big:y.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(x(t,{code:y.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(x(t,{code:y.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new le(t,e,t.path,n)))).then(e=>S.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new le(t,e,t.path,n)));return S.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:T.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:T.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:T.toString(n)}})}nonempty(e){return this.min(1,e)}};qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...E(t)});function Je(e){if(e instanceof Ye){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=pt.create(Je(r))}return new Ye({...e._def,shape:()=>t})}else if(e instanceof qe)return new qe({...e._def,type:Je(e.element)});else if(e instanceof pt)return pt.create(Je(e.unwrap()));else if(e instanceof mt)return mt.create(Je(e.unwrap()));else if(e instanceof tt)return tt.create(e.items.map(e=>Je(e)));else return e}var Ye=class e extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:h.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==_.object){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ge&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new le(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ge){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(x(n,{code:y.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new le(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>S.mergeObjectSync(t,e)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:T.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of h.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of h.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Je(this)}partial(t){let n={};for(let e of h.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of h.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof pt;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ct(h.objectKeys(this.shape))}};Ye.create=(e,t)=>new Ye({shape:()=>e,unknownKeys:`strip`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)}),Ye.strictCreate=(e,t)=>new Ye({shape:()=>e,unknownKeys:`strict`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)}),Ye.lazycreate=(e,t)=>new Ye({shape:e,unknownKeys:`strip`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)});var Xe=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new b(e.ctx.common.issues));return x(t,{code:y.invalid_union,unionErrors:n}),C}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new b(e));return x(t,{code:y.invalid_union,unionErrors:i}),C}}get options(){return this._def.options}};Xe.create=(e,t)=>new Xe({options:e,typeName:k.ZodUnion,...E(t)});var Ze=e=>e instanceof ot?Ze(e.schema):e instanceof ft?Ze(e.innerType()):e instanceof st?[e.value]:e instanceof lt?e.options:e instanceof ut?h.objectValues(e.enum):e instanceof ht?Ze(e._def.innerType):e instanceof Ve?[void 0]:e instanceof He?[null]:e instanceof pt?[void 0,...Ze(e.unwrap())]:e instanceof mt?[null,...Ze(e.unwrap())]:e instanceof vt||e instanceof bt?Ze(e.unwrap()):e instanceof gt?Ze(e._def.innerType):[],Qe=class e extends D{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Ze(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:k.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...E(r)})}};function $e(e,t){let n=v(e),r=v(t);if(e===t)return{valid:!0,data:e};if(n===_.object&&r===_.object){let n=h.objectKeys(t),r=h.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=$e(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$e(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===_.date&&r===_.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var et=class extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ae(e)||ae(r))return C;let i=$e(e.value,r.value);return i.valid?((oe(e)||oe(r))&&t.dirty(),{status:t.value,value:i.data}):(x(n,{code:y.invalid_intersection_types}),C)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};et.create=(e,t,n)=>new et({left:e,right:t,typeName:k.ZodIntersection,...E(n)});var tt=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return x(n,{code:y.invalid_type,expected:_.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return x(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),C;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new le(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>S.mergeArray(t,e)):S.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tt.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new tt({items:e,typeName:k.ZodTuple,rest:null,...E(t)})};var nt=class e extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return x(n,{code:y.invalid_type,expected:_.object,received:n.parsedType}),C;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new le(n,e,n.path,e)),value:a._parse(new le(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?S.mergeObjectAsync(t,r):S.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof D?new e({keyType:t,valueType:n,typeName:k.ZodRecord,...E(r)}):new e({keyType:Pe.create(),valueType:t,typeName:k.ZodRecord,...E(n)})}},rt=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return x(n,{code:y.invalid_type,expected:_.map,received:n.parsedType}),C;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new le(n,e,n.path,[a,`key`])),value:i._parse(new le(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};rt.create=(e,t,n)=>new rt({valueType:t,keyType:e,typeName:k.ZodMap,...E(n)});var it=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return x(n,{code:y.invalid_type,expected:_.set,received:n.parsedType}),C;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(x(n,{code:y.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(x(n,{code:y.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return C;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new le(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:T.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:T.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};it.create=(e,t)=>new it({valueType:e,minSize:null,maxSize:null,typeName:k.ZodSet,...E(t)});var at=class e extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return x(t,{code:y.invalid_type,expected:_.function,received:t.parsedType}),C;function n(e,n){return re({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),ee].filter(e=>!!e),issueData:{code:y.invalid_arguments,argumentsError:n}})}function r(e,n){return re({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),ee].filter(e=>!!e),issueData:{code:y.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof dt){let e=this;return w(async function(...t){let o=new b([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return w(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new b([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new b([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tt.create(t).rest(We.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||tt.create([]).rest(We.create()),returns:n||We.create(),typeName:k.ZodFunction,...E(r)})}},ot=class extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ot.create=(e,t)=>new ot({getter:e,typeName:k.ZodLazy,...E(t)});var st=class extends D{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:`valid`,value:e.data}}get value(){return this._def.value}};st.create=(e,t)=>new st({value:e,typeName:k.ZodLiteral,...E(t)});function ct(e,t){return new lt({values:e,typeName:k.ZodEnum,...E(t)})}var lt=class e extends D{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:h.joinValues(n),received:t.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:y.invalid_enum_value,options:n}),C}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};lt.create=ct;var ut=class extends D{_parse(e){let t=h.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let e=h.objectValues(t);return x(n,{expected:h.joinValues(e),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(h.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=h.objectValues(t);return x(n,{received:n.data,code:y.invalid_enum_value,options:e}),C}return w(e.data)}get enum(){return this._def.values}};ut.create=(e,t)=>new ut({values:e,typeName:k.ZodNativeEnum,...E(t)});var dt=class extends D{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==_.promise&&t.common.async===!1?(x(t,{code:y.invalid_type,expected:_.promise,received:t.parsedType}),C):w((t.parsedType===_.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};dt.create=(e,t)=>new dt({type:e,typeName:k.ZodPromise,...E(t)});var ft=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{x(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return C;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ie(r.value):r});{if(t.value===`aborted`)return C;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ie(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?C:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?C:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!se(e))return C;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>se(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):C);h.assertNever(r)}};ft.create=(e,t,n)=>new ft({schema:e,typeName:k.ZodEffects,effect:t,...E(n)}),ft.createWithPreprocess=(e,t,n)=>new ft({schema:t,effect:{type:`preprocess`,transform:e},typeName:k.ZodEffects,...E(n)});var pt=class extends D{_parse(e){return this._getType(e)===_.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pt.create=(e,t)=>new pt({innerType:e,typeName:k.ZodOptional,...E(t)});var mt=class extends D{_parse(e){return this._getType(e)===_.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:k.ZodNullable,...E(t)});var ht=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ht.create=(e,t)=>new ht({innerType:e,typeName:k.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...E(t)});var gt=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ce(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gt.create=(e,t)=>new gt({innerType:e,typeName:k.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...E(t)});var _t=class extends D{_parse(e){if(this._getType(e)!==_.nan){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.nan,received:t.parsedType}),C}return{status:`valid`,value:e.data}}};_t.create=e=>new _t({typeName:k.ZodNaN,...E(e)});var vt=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},yt=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),ie(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:k.ZodPipeline})}},bt=class extends D{_parse(e){let t=this._def.innerType._parse(e),n=e=>(se(e)&&(e.value=Object.freeze(e.value)),e);return ce(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:k.ZodReadonly,...E(t)});function xt(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function St(e,t={},n){return e?Ue.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=xt(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=xt(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):Ue.create()}Ye.lazycreate;var k;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(k||={});var Ct=(e,t={message:`Input not instance of ${e.name}`})=>St(t=>t instanceof e,t),wt=Pe.create,Tt=Ie.create;_t.create,Le.create;var Et=Re.create;ze.create,Be.create,Ve.create,He.create;var Dt=Ue.create;We.create,Ge.create,Ke.create;var Ot=qe.create,kt=Ye.create;Ye.strictCreate;var At=Xe.create;Qe.create,et.create,tt.create;var jt=nt.create;rt.create,it.create;var Mt=at.create;ot.create;var Nt=st.create,Pt=lt.create;ut.create;var Ft=dt.create;ft.create,pt.create,mt.create,ft.createWithPreprocess,yt.create;var It=Object.defineProperty,A=(e,t)=>{for(var n in t)It(e,n,{get:t[n],enumerable:!0})};function Lt(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&`source_type`in e&&(e.source_type===`url`||e.source_type===`base64`||e.source_type===`text`||e.source_type===`id`)}function Rt(e){return Lt(e)&&e.source_type===`url`&&`url`in e&&typeof e.url==`string`}function zt(e){return Lt(e)&&e.source_type===`base64`&&`data`in e&&typeof e.data==`string`}function Bt(e){return Lt(e)&&e.source_type===`text`&&`text`in e&&typeof e.text==`string`}function Vt(e){return Lt(e)&&e.source_type===`id`&&`id`in e&&typeof e.id==`string`}function Ht(e){if(Lt(e)){if(e.source_type===`url`)return{type:`image_url`,image_url:{url:e.url}};if(e.source_type===`base64`){if(!e.mime_type)throw Error(`mime_type key is required for base64 data.`);return{type:`image_url`,image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw Error(`Unsupported source type. Only 'url' and 'base64' are supported.`)}function Ut(e){let t=e.split(`;`)[0].split(`/`);if(t.length!==2)throw Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let n=t[0].trim(),r=t[1].trim();if(n===``||r===``)throw Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let t of e.split(`;`).slice(1)){let n=t.split(`=`);if(n.length!==2)throw Error(`Invalid parameter syntax in mime type: "${e}".`);let r=n[0].trim(),a=n[1].trim();if(r===``)throw Error(`Invalid parameter syntax in mime type: "${e}".`);i[r]=a}return{type:n,subtype:r,parameters:i}}function Wt({dataUrl:e,asTypedArray:t=!1}){let n=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),r;if(n){r=n[1].toLowerCase();let e=t?Uint8Array.from(atob(n[2]),e=>e.charCodeAt(0)):n[2];return{mime_type:r,data:e}}}function Gt(e,t){if(e.type===`text`){if(!t.fromStandardTextBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type===`image`){if(!t.fromStandardImageBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type===`audio`){if(!t.fromStandardAudioBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type===`file`){if(!t.fromStandardFileBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function Kt(e){return typeof e==`object`&&!!e&&`type`in e&&`content`in e&&(typeof e.content==`string`||Array.isArray(e.content))}var qt=n(((e,t)=>{t.exports=function(e,t){if(typeof e!=`string`)throw TypeError(`Expected a string`);return t=t===void 0?`_`:t,e.replace(/([a-z\d])([A-Z])/g,`$1`+t+`$2`).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,`$1`+t+`$2`).toLowerCase()}})),Jt=n(((e,t)=>{var n=/[\p{Lu}]/u,r=/[\p{Ll}]/u,i=/^[\p{Lu}](?![\p{Lu}])/gu,a=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,s=RegExp(`^`+o.source),c=new RegExp(o.source+a.source,`gu`),l=RegExp(`\\d+`+a.source,`gu`),u=(e,t,i)=>{let a=!1,o=!1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];a&&n.test(l)?(e=e.slice(0,c)+`-`+e.slice(c),a=!1,s=o,o=!0,c++):o&&s&&r.test(l)?(e=e.slice(0,c-1)+`-`+e.slice(c-1),s=o,o=!1,a=!0):(a=t(l)===l&&i(l)!==l,s=o,o=i(l)===l&&t(l)!==l)}return e},d=(e,t)=>(i.lastIndex=0,e.replace(i,e=>t(e))),f=(e,t)=>(c.lastIndex=0,l.lastIndex=0,e.replace(c,(e,n)=>t(n)).replace(l,e=>t(e))),p=(e,t)=>{if(!(typeof e==`string`||Array.isArray(e)))throw TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join(`-`):e.trim(),e.length===0)return``;let n=t.locale===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),r=t.locale===!1?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return e.length===1?t.pascalCase?r(e):n(e):(e!==n(e)&&(e=u(e,n,r)),e=e.replace(s,``),e=t.preserveConsecutiveUppercase?d(e,n):n(e),t.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),f(e,r))};t.exports=p,t.exports.default=p})),Yt=e(qt(),1),Xt=e(Jt(),1);function Zt(e,t){return t?.[e]||(0,Yt.default)(e)}function Qt(e,t){return t?.[e]||(0,Xt.default)(e)}function $t(e,t,n){let r={};for(let i in e)Object.hasOwn(e,i)&&(r[t(i,n)]=e[i]);return r}var en=`__lc_escaped__`;function tn(e){return`lc`in e||Object.keys(e).length===1&&en in e}function nn(e){return{[en]:e}}function rn(e){return Object.keys(e).length===1&&en in e}function an(e){return typeof e==`object`&&!!e&&`lc_serializable`in e&&typeof e.toJSON==`function`}function on(e){let t;return t=typeof e==`object`&&e?`lc_id`in e&&Array.isArray(e.lc_id)?e.lc_id:[e.constructor?.name??`Object`]:[typeof e],{lc:1,type:`not_implemented`,id:t}}function sn(e,t=new WeakSet){if(typeof e==`object`&&e&&!Array.isArray(e)){if(t.has(e))return on(e);if(an(e))return e;t.add(e);let n=e;if(tn(n))return t.delete(e),nn(n);let r={};for(let[e,i]of Object.entries(n))r[e]=sn(i,t);return t.delete(e),r}return Array.isArray(e)?e.map(e=>sn(e,t)):e}function cn(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e;if(rn(t))return t[en];let n={};for(let[e,r]of Object.entries(t))n[e]=cn(r);return n}return Array.isArray(e)?e.map(e=>cn(e)):e}var ln={};A(ln,{Serializable:()=>pn,get_lc_unique_name:()=>fn});function un(e){return Array.isArray(e)?[...e]:{...e}}function dn(e,t){let n=un(e);for(let[e,r]of Object.entries(t)){let[t,...i]=e.split(`.`).reverse(),a=n;for(let e of i.reverse()){if(a[e]===void 0)break;a[e]=un(a[e]),a=a[e]}a[t]!==void 0&&(a[t]={lc:1,type:`secret`,id:[r]})}return n}function fn(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name==`function`&&(typeof t.lc_name!=`function`||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var pn=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,fn(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){this.lc_serializable_keys===void 0?this.lc_kwargs=e??{}:this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e)))}toJSON(){if(!this.lc_serializable||this.lc_kwargs instanceof e||typeof this.lc_kwargs!=`object`||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},n={},r=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,`lc_aliases`,this)),Object.assign(n,Reflect.get(e,`lc_secrets`,this)),Object.assign(r,Reflect.get(e,`lc_attributes`,this));Object.keys(n).forEach(e=>{let t=this,n=r,[i,...a]=e.split(`.`).reverse();for(let e of a.reverse()){if(!(e in t)||t[e]===void 0)return;(!(e in n)||n[e]===void 0)&&(typeof t[e]==`object`&&t[e]!=null?n[e]={}:Array.isArray(t[e])&&(n[e]=[])),t=t[e],n=n[e]}i in t&&t[i]!==void 0&&(n[i]=n[i]||t[i])});let i={},a=new WeakSet;a.add(this);for(let[e,t]of Object.entries(r))i[e]=sn(t,a);let o=$t(Object.keys(n).length?dn(i,n):i,Zt,t);return{lc:1,type:`constructor`,id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:`not_implemented`,id:this.lc_id}}};function j(e,t){return M(e)&&e.type===t}function M(e){return typeof e==`object`&&!!e}function mn(e){return Array.isArray(e)}function N(e){return typeof e==`string`}function hn(e){return typeof e==`number`}function gn(e){return e instanceof Uint8Array}function _n(e){try{return JSON.parse(e)}catch{return}}var vn=e=>e();function yn(e){if(e.type===`char_location`&&N(e.document_title)&&hn(e.start_char_index)&&hn(e.end_char_index)&&N(e.cited_text)){let{document_title:t,start_char_index:n,end_char_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`char`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`page_location`&&N(e.document_title)&&hn(e.start_page_number)&&hn(e.end_page_number)&&N(e.cited_text)){let{document_title:t,start_page_number:n,end_page_number:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`page`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`content_block_location`&&N(e.document_title)&&hn(e.start_block_index)&&hn(e.end_block_index)&&N(e.cited_text)){let{document_title:t,start_block_index:n,end_block_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`block`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`web_search_result_location`&&N(e.url)&&N(e.title)&&N(e.encrypted_index)&&N(e.cited_text)){let{url:t,title:n,encrypted_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`url`,url:t,title:n,startIndex:Number(r),endIndex:Number(r),citedText:i}}if(e.type===`search_result_location`&&N(e.source)&&N(e.title)&&hn(e.start_block_index)&&hn(e.end_block_index)&&N(e.cited_text)){let{source:t,title:n,start_block_index:r,end_block_index:i,cited_text:a,...o}=e;return{...o,type:`citation`,source:`search`,url:t,title:n??void 0,startIndex:r,endIndex:i,citedText:a}}}function bn(e){if(j(e,`document`)&&M(e.source)&&`type`in e.source){if(e.source.type===`base64`&&N(e.source.media_type)&&N(e.source.data))return{type:`file`,mimeType:e.source.media_type,data:e.source.data};if(e.source.type===`url`&&N(e.source.url))return{type:`file`,url:e.source.url};if(e.source.type===`file`&&N(e.source.file_id))return{type:`file`,fileId:e.source.file_id};if(e.source.type===`text`&&N(e.source.data))return{type:`file`,mimeType:String(e.source.media_type??`text/plain`),data:e.source.data}}else if(j(e,`image`)&&M(e.source)&&`type`in e.source){if(e.source.type===`base64`&&N(e.source.media_type)&&N(e.source.data))return{type:`image`,mimeType:e.source.media_type,data:e.source.data};if(e.source.type===`url`&&N(e.source.url))return{type:`image`,url:e.source.url};if(e.source.type===`file`&&N(e.source.file_id))return{type:`image`,fileId:e.source.file_id}}}function xn(e){function*t(){for(let t of e){let e=bn(t);e?yield e:yield t}}return Array.from(t())}function Sn(e){function*t(){let t=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content;for(let n of t){if(j(n,`text`)&&N(n.text)){let{text:e,citations:t,...r}=n;if(mn(t)&&t.length){let n=t.reduce((e,t)=>{let n=yn(t);return n?[...e,n]:e},[]);yield{...r,type:`text`,text:e,annotations:n};continue}else{yield{...r,type:`text`,text:e};continue}}else if(j(n,`thinking`)&&N(n.thinking)){let{thinking:e,signature:t,...r}=n;yield{...r,type:`reasoning`,reasoning:e,signature:t};continue}else if(j(n,`redacted_thinking`)){yield{type:`non_standard`,value:n};continue}else if(j(n,`tool_use`)&&N(n.name)&&N(n.id)){yield{type:`tool_call`,id:n.id,name:n.name,args:n.input};continue}else if(j(n,`input_json_delta`)){if(wn(e)&&e.tool_call_chunks?.length){let t=e.tool_call_chunks[0];yield{type:`tool_call_chunk`,id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(j(n,`server_tool_use`)&&N(n.name)&&N(n.id)){let{name:e,id:t}=n;if(e===`web_search`){yield{id:t,type:`server_tool_call`,name:`web_search`,args:{query:vn(()=>{if(typeof n.input==`string`)return n.input;if(M(n.input)&&N(n.input.query))return n.input.query;if(N(n.partial_json)){let e=_n(n.partial_json);if(e?.query)return e.query}return``})}};continue}else if(n.name===`code_execution`){yield{id:t,type:`server_tool_call`,name:`code_execution`,args:{code:vn(()=>{if(typeof n.input==`string`)return n.input;if(M(n.input)&&N(n.input.code))return n.input.code;if(N(n.partial_json)){let e=_n(n.partial_json);if(e?.code)return e.code}return``})}};continue}}else if(j(n,`web_search_tool_result`)&&N(n.tool_use_id)&&mn(n.content)){let{content:e,tool_use_id:t}=n;yield{type:`server_tool_call_result`,name:`web_search`,toolCallId:t,status:`success`,output:{urls:e.reduce((e,t)=>j(t,`web_search_result`)?[...e,t.url]:e,[])}};continue}else if(j(n,`code_execution_tool_result`)&&N(n.tool_use_id)&&M(n.content)){yield{type:`server_tool_call_result`,name:`code_execution`,toolCallId:n.tool_use_id,status:`success`,output:n.content};continue}else if(j(n,`mcp_tool_use`)){yield{id:n.id,type:`server_tool_call`,name:`mcp_tool_use`,args:n.input};continue}else if(j(n,`mcp_tool_result`)&&N(n.tool_use_id)&&M(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(j(n,`container_upload`)){yield{type:`server_tool_call`,name:`container_upload`,args:n.input};continue}else if(j(n,`search_result`)){yield{id:n.id,type:`non_standard`,value:n};continue}else if(j(n,`tool_result`)){yield{id:n.id,type:`non_standard`,value:n};continue}else{let e=bn(n);if(e){yield e;continue}}yield{type:`non_standard`,value:n}}}return Array.from(t())}var Cn={translateContent:Sn,translateContentChunk:Sn};function wn(e){return typeof e?._getType==`function`&&typeof e.concat==`function`&&e._getType()===`ai`}function Tn(e){return Rt(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:zt(e)?{type:e.type,mimeType:e.mime_type??`application/octet-stream`,data:e.data,metadata:e.metadata}:Vt(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function En(e){return e.map(Tn)}function Dn(e){return!!(j(e,`image_url`)&&M(e.image_url)||j(e,`input_audio`)&&M(e.input_audio)||j(e,`file`)&&M(e.file))}function On(e){if(j(e,`image_url`)&&M(e.image_url)&&N(e.image_url.url)){let t=Wt({dataUrl:e.image_url.url});return t?{type:`image`,mimeType:t.mime_type,data:t.data}:{type:`image`,url:e.image_url.url}}else if(j(e,`input_audio`)&&M(e.input_audio)&&N(e.input_audio.data)&&N(e.input_audio.format))return{type:`audio`,data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};else if(j(e,`file`)&&M(e.file)&&N(e.file.data)){let t=Wt({dataUrl:e.file.data});if(t)return{type:`file`,data:t.data,mimeType:t.mime_type};if(N(e.file.file_id))return{type:`file`,fileId:e.file.file_id}}return e}function kn(e){let t=[];typeof e.content==`string`?t.push({type:`text`,text:e.content}):t.push(...jn(e.content));for(let n of e.tool_calls??[])t.push({type:`tool_call`,id:n.id,name:n.name,args:n.args});return t}function An(e){let t=[];typeof e.content==`string`?t.push({type:`text`,text:e.content}):t.push(...jn(e.content));for(let n of e.tool_calls??[])t.push({type:`tool_call`,id:n.id,name:n.name,args:n.args});return t}function jn(e){let t=[];for(let n of e)Dn(n)?t.push(On(n)):t.push(n);return t}function Mn(e){if(e.type===`url_citation`){let{url:t,title:n,start_index:r,end_index:i}=e;return{type:`citation`,url:t,title:n,startIndex:r,endIndex:i}}if(e.type===`file_citation`){let{file_id:t,filename:n,index:r}=e;return{type:`citation`,title:n,startIndex:r,endIndex:r,fileId:t}}return e}function Nn(e){function*t(){M(e.additional_kwargs?.reasoning)&&mn(e.additional_kwargs.reasoning.summary)&&(yield{type:`reasoning`,reasoning:e.additional_kwargs.reasoning.summary.reduce((e,t)=>M(t)&&N(t.text)?`${e}${t.text}`:e,``)});let t=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content;for(let e of t)if(j(e,`text`)){let{text:t,annotations:n,...r}=e;Array.isArray(n)?yield{...r,type:`text`,text:String(t),annotations:n.map(Mn)}:yield{...r,type:`text`,text:String(t)}}for(let t of e.tool_calls??[])yield{type:`tool_call`,id:t.id,name:t.name,args:t.args};if(M(e.additional_kwargs)&&mn(e.additional_kwargs.tool_outputs))for(let t of e.additional_kwargs.tool_outputs){if(j(t,`web_search_call`)){yield{id:t.id,type:`server_tool_call`,name:`web_search`,args:{query:t.query}};continue}else if(j(t,`file_search_call`)){yield{id:t.id,type:`server_tool_call`,name:`file_search`,args:{query:t.query}};continue}else if(j(t,`computer_call`)){yield{type:`non_standard`,value:t};continue}else if(j(t,`code_interpreter_call`)){if(N(t.code)&&(yield{id:t.id,type:`server_tool_call`,name:`code_interpreter`,args:{code:t.code}}),mn(t.outputs)){let e=vn(()=>{if(t.status!==`in_progress`){if(t.status===`completed`)return 0;if(t.status===`incomplete`)return 127;if(t.status!==`interpreting`&&t.status===`failed`)return 1}});for(let n of t.outputs)if(j(n,`logs`)){yield{type:`server_tool_call_result`,toolCallId:t.id??``,status:`success`,output:{type:`code_interpreter_output`,returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(n.logs),stdout:[0,void 0].includes(e)?String(n.logs):void 0}};continue}}continue}else if(j(t,`mcp_call`)){yield{id:t.id,type:`server_tool_call`,name:`mcp_call`,args:t.input};continue}else if(j(t,`mcp_list_tools`)){yield{id:t.id,type:`server_tool_call`,name:`mcp_list_tools`,args:t.input};continue}else if(j(t,`mcp_approval_request`)){yield{type:`non_standard`,value:t};continue}else if(j(t,`image_generation_call`)){N(t.result)&&(yield{type:`image`,mimeType:`image/png`,data:t.result,id:N(t.id)?t.id:void 0,metadata:{status:N(t.status)?t.status:void 0}}),yield{type:`non_standard`,value:t};continue}M(t)&&(yield{type:`non_standard`,value:t})}}return Array.from(t())}function Pn(e){function*t(){yield*Nn(e);for(let t of e.tool_call_chunks??[])yield{type:`tool_call_chunk`,id:t.id,name:t.name,args:t.args}}return Array.from(t())}var Fn={translateContent:e=>typeof e.content==`string`?kn(e):Nn(e),translateContentChunk:e=>typeof e.content==`string`?An(e):Pn(e)};function In(e,t=`pretty`){return t===`pretty`?Ln(e):JSON.stringify(e)}function Ln(e){let t=[],n=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,r=Math.floor((80-n.length)/2),i=`=`.repeat(r),a=n.length%2==0?i:`${i}=`;if(t.push(`${i}${n}${a}`),e.type===`ai`){let n=e;if(n.tool_calls&&n.tool_calls.length>0){t.push(`Tool Calls:`);for(let e of n.tool_calls){t.push(` ${e.name} (${e.id})`),t.push(` Call ID: ${e.id}`),t.push(` Args:`);for(let[n,r]of Object.entries(e.args))t.push(` ${n}: ${typeof r==`object`?JSON.stringify(r):r}`)}}}if(e.type===`tool`){let n=e;n.name&&t.push(`Name: ${n.name}`)}return typeof e.content==`string`&&e.content.trim()&&(t.length>1&&t.push(``),t.push(e.content)),t.join(`
|
|
1
|
+
import{o as e,r as t,t as n}from"./chunk-zsgVPwQN.js";import{Et as r,Fn as i,Lt as a,S as o,Xn as s,Yn as c,dt as l,mn as u,rr as d,tr as f,ur as p,xn as m}from"./json-schema-processors-DNSjFPrk.js";var h;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(h||={});var g;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(g||={});var _=h.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),v=e=>{switch(typeof e){case`undefined`:return _.undefined;case`string`:return _.string;case`number`:return Number.isNaN(e)?_.nan:_.number;case`boolean`:return _.boolean;case`function`:return _.function;case`bigint`:return _.bigint;case`symbol`:return _.symbol;case`object`:return Array.isArray(e)?_.array:e===null?_.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?_.promise:typeof Map<`u`&&e instanceof Map?_.map:typeof Set<`u`&&e instanceof Set?_.set:typeof Date<`u`&&e instanceof Date?_.date:_.object;default:return _.unknown}},y=h.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`]),b=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,h.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=e=>new b(e);var ee=(e,t)=>{let n;switch(e.code){case y.invalid_type:n=e.received===_.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,h.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:n=`Unrecognized key(s) in object: ${h.joinValues(e.keys,`, `)}`;break;case y.invalid_union:n=`Invalid input`;break;case y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${h.joinValues(e.options)}`;break;case y.invalid_enum_value:n=`Invalid enum value. Expected ${h.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:n=`Invalid function arguments`;break;case y.invalid_return_type:n=`Invalid function return type`;break;case y.invalid_date:n=`Invalid date`;break;case y.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:h.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case y.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case y.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case y.custom:n=`Invalid input`;break;case y.invalid_intersection_types:n=`Intersection results could not be merged`;break;case y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,h.assertNever(e)}return{message:n}},te=ee;function ne(){return te}var re=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function x(e,t){let n=ne(),r=re({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ee?void 0:ee].filter(e=>!!e)});e.common.issues.push(r)}var S=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return C;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return C;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},C=Object.freeze({status:`aborted`}),ie=e=>({status:`dirty`,value:e}),w=e=>({status:`valid`,value:e}),ae=e=>e.status===`aborted`,oe=e=>e.status===`dirty`,se=e=>e.status===`valid`,ce=e=>typeof Promise<`u`&&e instanceof Promise,T;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(T||={});var le=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},ue=(e,t)=>{if(se(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new b(e.common.issues),this._error}}};function E(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var D=class{get description(){return this._def.description}_getType(e){return v(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ce(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};return ue(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return se(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>se(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},r=this._parse({data:e,path:n.path,parent:n});return ue(n,await(ce(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:y.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ft({schema:this,typeName:k.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:e=>this[`~validate`](e)}}optional(){return pt.create(this,this._def)}nullable(){return mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return dt.create(this,this._def)}or(e){return Xe.create([this,e],this._def)}and(e){return et.create(this,e,this._def)}transform(e){return new ft({...E(this._def),schema:this,typeName:k.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ht({...E(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new vt({typeName:k.ZodBranded,type:this,...E(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new gt({...E(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return yt.create(this,e)}readonly(){return bt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},de=/^c[^\s-]{8,}$/i,fe=/^[0-9a-z]+$/,pe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,me=/^[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,he=/^[a-z0-9_-]{21}$/i,ge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_e=/^[-+]?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)?)??$/,ve=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ye=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,be,xe=/^(?:(?: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])$/,Se=/^(?:(?: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])$/,Ce=/^(([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]))$/,we=/^(([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])$/,Te=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ee=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,De=`((\\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])))`,O=RegExp(`^${De}$`);function Oe(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ke(e){return RegExp(`^${Oe(e)}$`)}function Ae(e){let t=`${De}T${Oe(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function je(e,t){return!!((t===`v4`||!t)&&xe.test(e)||(t===`v6`||!t)&&Ce.test(e))}function Me(e,t){if(!ge.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ne(e,t){return!!((t===`v4`||!t)&&Se.test(e)||(t===`v6`||!t)&&we.test(e))}var Pe=class e extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.string,received:t.parsedType}),C}let t=new S,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)ve.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`email`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)be||=new RegExp(ye,`u`),be.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`emoji`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)me.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`uuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)he.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`nanoid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)de.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)fe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid2`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)pe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ulid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),x(n,{validation:`url`,code:y.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`regex`,code:y.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Ae(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?O.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?ke(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?_e.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`duration`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?je(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ip`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Me(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`jwt`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Ne(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cidr`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Te.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Ee.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64url`,code:y.invalid_string,message:r.message}),t.dirty()):h.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:y.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...T.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...T.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...T.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...T.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...T.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...T.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...T.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...T.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...T.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...T.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...T.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:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.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:e?.precision===void 0?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...T.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...T.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...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(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Pe.create=e=>new Pe({checks:[],typeName:k.ZodString,coerce:e?.coerce??!1,...E(e)});function Fe(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ie=class e extends D{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)!==_.number){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.number,received:t.parsedType}),C}let t,n=new S;for(let r of this._def.checks)r.kind===`int`?h.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Fe(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_finite,message:r.message}),n.dirty()):h.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,T.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,T.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,T.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,T.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:T.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:T.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:T.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:T.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:T.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&h.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ie.create=e=>new Ie({checks:[],typeName:k.ZodNumber,coerce:e?.coerce||!1,...E(e)});var Le=class e extends D{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)!==_.bigint)return this._getInvalidInput(e);let t,n=new S;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):h.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.bigint,received:t.parsedType}),C}gte(e,t){return this.setLimit(`min`,e,!0,T.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,T.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,T.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,T.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:T.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:T.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=e=>new Le({checks:[],typeName:k.ZodBigInt,coerce:e?.coerce??!1,...E(e)});var Re=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.boolean,received:t.parsedType}),C}return w(e.data)}};Re.create=e=>new Re({typeName:k.ZodBoolean,coerce:e?.coerce||!1,...E(e)});var ze=class e extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.date,received:t.parsedType}),C}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:y.invalid_date}),C;let t=new S,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):h.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};ze.create=e=>new ze({checks:[],coerce:e?.coerce||!1,typeName:k.ZodDate,...E(e)});var Be=class extends D{_parse(e){if(this._getType(e)!==_.symbol){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.symbol,received:t.parsedType}),C}return w(e.data)}};Be.create=e=>new Be({typeName:k.ZodSymbol,...E(e)});var Ve=class extends D{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.undefined,received:t.parsedType}),C}return w(e.data)}};Ve.create=e=>new Ve({typeName:k.ZodUndefined,...E(e)});var He=class extends D{_parse(e){if(this._getType(e)!==_.null){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.null,received:t.parsedType}),C}return w(e.data)}};He.create=e=>new He({typeName:k.ZodNull,...E(e)});var Ue=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};Ue.create=e=>new Ue({typeName:k.ZodAny,...E(e)});var We=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};We.create=e=>new We({typeName:k.ZodUnknown,...E(e)});var Ge=class extends D{_parse(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.never,received:t.parsedType}),C}};Ge.create=e=>new Ge({typeName:k.ZodNever,...E(e)});var Ke=class extends D{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.void,received:t.parsedType}),C}return w(e.data)}};Ke.create=e=>new Ke({typeName:k.ZodVoid,...E(e)});var qe=class e extends D{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==_.array)return x(t,{code:y.invalid_type,expected:_.array,received:t.parsedType}),C;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(x(t,{code:e?y.too_big:y.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(x(t,{code:y.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(x(t,{code:y.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new le(t,e,t.path,n)))).then(e=>S.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new le(t,e,t.path,n)));return S.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:T.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:T.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:T.toString(n)}})}nonempty(e){return this.min(1,e)}};qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...E(t)});function Je(e){if(e instanceof Ye){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=pt.create(Je(r))}return new Ye({...e._def,shape:()=>t})}else if(e instanceof qe)return new qe({...e._def,type:Je(e.element)});else if(e instanceof pt)return pt.create(Je(e.unwrap()));else if(e instanceof mt)return mt.create(Je(e.unwrap()));else if(e instanceof tt)return tt.create(e.items.map(e=>Je(e)));else return e}var Ye=class e extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:h.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==_.object){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ge&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new le(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ge){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(x(n,{code:y.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new le(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>S.mergeObjectSync(t,e)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:T.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of h.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of h.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Je(this)}partial(t){let n={};for(let e of h.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of h.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof pt;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ct(h.objectKeys(this.shape))}};Ye.create=(e,t)=>new Ye({shape:()=>e,unknownKeys:`strip`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)}),Ye.strictCreate=(e,t)=>new Ye({shape:()=>e,unknownKeys:`strict`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)}),Ye.lazycreate=(e,t)=>new Ye({shape:e,unknownKeys:`strip`,catchall:Ge.create(),typeName:k.ZodObject,...E(t)});var Xe=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new b(e.ctx.common.issues));return x(t,{code:y.invalid_union,unionErrors:n}),C}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new b(e));return x(t,{code:y.invalid_union,unionErrors:i}),C}}get options(){return this._def.options}};Xe.create=(e,t)=>new Xe({options:e,typeName:k.ZodUnion,...E(t)});var Ze=e=>e instanceof ot?Ze(e.schema):e instanceof ft?Ze(e.innerType()):e instanceof st?[e.value]:e instanceof lt?e.options:e instanceof ut?h.objectValues(e.enum):e instanceof ht?Ze(e._def.innerType):e instanceof Ve?[void 0]:e instanceof He?[null]:e instanceof pt?[void 0,...Ze(e.unwrap())]:e instanceof mt?[null,...Ze(e.unwrap())]:e instanceof vt||e instanceof bt?Ze(e.unwrap()):e instanceof gt?Ze(e._def.innerType):[],Qe=class e extends D{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Ze(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:k.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...E(r)})}};function $e(e,t){let n=v(e),r=v(t);if(e===t)return{valid:!0,data:e};if(n===_.object&&r===_.object){let n=h.objectKeys(t),r=h.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=$e(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$e(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===_.date&&r===_.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var et=class extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ae(e)||ae(r))return C;let i=$e(e.value,r.value);return i.valid?((oe(e)||oe(r))&&t.dirty(),{status:t.value,value:i.data}):(x(n,{code:y.invalid_intersection_types}),C)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};et.create=(e,t,n)=>new et({left:e,right:t,typeName:k.ZodIntersection,...E(n)});var tt=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return x(n,{code:y.invalid_type,expected:_.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return x(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),C;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new le(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>S.mergeArray(t,e)):S.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tt.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new tt({items:e,typeName:k.ZodTuple,rest:null,...E(t)})};var nt=class e extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return x(n,{code:y.invalid_type,expected:_.object,received:n.parsedType}),C;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new le(n,e,n.path,e)),value:a._parse(new le(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?S.mergeObjectAsync(t,r):S.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof D?new e({keyType:t,valueType:n,typeName:k.ZodRecord,...E(r)}):new e({keyType:Pe.create(),valueType:t,typeName:k.ZodRecord,...E(n)})}},rt=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return x(n,{code:y.invalid_type,expected:_.map,received:n.parsedType}),C;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new le(n,e,n.path,[a,`key`])),value:i._parse(new le(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};rt.create=(e,t,n)=>new rt({valueType:t,keyType:e,typeName:k.ZodMap,...E(n)});var it=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return x(n,{code:y.invalid_type,expected:_.set,received:n.parsedType}),C;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(x(n,{code:y.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(x(n,{code:y.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return C;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new le(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:T.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:T.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};it.create=(e,t)=>new it({valueType:e,minSize:null,maxSize:null,typeName:k.ZodSet,...E(t)});var at=class e extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return x(t,{code:y.invalid_type,expected:_.function,received:t.parsedType}),C;function n(e,n){return re({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),ee].filter(e=>!!e),issueData:{code:y.invalid_arguments,argumentsError:n}})}function r(e,n){return re({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),ee].filter(e=>!!e),issueData:{code:y.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof dt){let e=this;return w(async function(...t){let o=new b([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return w(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new b([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new b([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tt.create(t).rest(We.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||tt.create([]).rest(We.create()),returns:n||We.create(),typeName:k.ZodFunction,...E(r)})}},ot=class extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ot.create=(e,t)=>new ot({getter:e,typeName:k.ZodLazy,...E(t)});var st=class extends D{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:`valid`,value:e.data}}get value(){return this._def.value}};st.create=(e,t)=>new st({value:e,typeName:k.ZodLiteral,...E(t)});function ct(e,t){return new lt({values:e,typeName:k.ZodEnum,...E(t)})}var lt=class e extends D{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:h.joinValues(n),received:t.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:y.invalid_enum_value,options:n}),C}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};lt.create=ct;var ut=class extends D{_parse(e){let t=h.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let e=h.objectValues(t);return x(n,{expected:h.joinValues(e),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(h.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=h.objectValues(t);return x(n,{received:n.data,code:y.invalid_enum_value,options:e}),C}return w(e.data)}get enum(){return this._def.values}};ut.create=(e,t)=>new ut({values:e,typeName:k.ZodNativeEnum,...E(t)});var dt=class extends D{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==_.promise&&t.common.async===!1?(x(t,{code:y.invalid_type,expected:_.promise,received:t.parsedType}),C):w((t.parsedType===_.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};dt.create=(e,t)=>new dt({type:e,typeName:k.ZodPromise,...E(t)});var ft=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{x(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return C;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ie(r.value):r});{if(t.value===`aborted`)return C;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ie(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?C:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?C:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!se(e))return C;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>se(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):C);h.assertNever(r)}};ft.create=(e,t,n)=>new ft({schema:e,typeName:k.ZodEffects,effect:t,...E(n)}),ft.createWithPreprocess=(e,t,n)=>new ft({schema:t,effect:{type:`preprocess`,transform:e},typeName:k.ZodEffects,...E(n)});var pt=class extends D{_parse(e){return this._getType(e)===_.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pt.create=(e,t)=>new pt({innerType:e,typeName:k.ZodOptional,...E(t)});var mt=class extends D{_parse(e){return this._getType(e)===_.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:k.ZodNullable,...E(t)});var ht=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ht.create=(e,t)=>new ht({innerType:e,typeName:k.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...E(t)});var gt=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ce(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gt.create=(e,t)=>new gt({innerType:e,typeName:k.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...E(t)});var _t=class extends D{_parse(e){if(this._getType(e)!==_.nan){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.nan,received:t.parsedType}),C}return{status:`valid`,value:e.data}}};_t.create=e=>new _t({typeName:k.ZodNaN,...E(e)});var vt=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},yt=class e extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),ie(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:k.ZodPipeline})}},bt=class extends D{_parse(e){let t=this._def.innerType._parse(e),n=e=>(se(e)&&(e.value=Object.freeze(e.value)),e);return ce(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:k.ZodReadonly,...E(t)});function xt(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function St(e,t={},n){return e?Ue.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=xt(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=xt(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):Ue.create()}Ye.lazycreate;var k;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(k||={});var Ct=(e,t={message:`Input not instance of ${e.name}`})=>St(t=>t instanceof e,t),wt=Pe.create,Tt=Ie.create;_t.create,Le.create;var Et=Re.create;ze.create,Be.create,Ve.create,He.create;var Dt=Ue.create;We.create,Ge.create,Ke.create;var Ot=qe.create,kt=Ye.create;Ye.strictCreate;var At=Xe.create;Qe.create,et.create,tt.create;var jt=nt.create;rt.create,it.create;var Mt=at.create;ot.create;var Nt=st.create,Pt=lt.create;ut.create;var Ft=dt.create;ft.create,pt.create,mt.create,ft.createWithPreprocess,yt.create;var It=Object.defineProperty,A=(e,t)=>{for(var n in t)It(e,n,{get:t[n],enumerable:!0})};function Lt(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&`source_type`in e&&(e.source_type===`url`||e.source_type===`base64`||e.source_type===`text`||e.source_type===`id`)}function Rt(e){return Lt(e)&&e.source_type===`url`&&`url`in e&&typeof e.url==`string`}function zt(e){return Lt(e)&&e.source_type===`base64`&&`data`in e&&typeof e.data==`string`}function Bt(e){return Lt(e)&&e.source_type===`text`&&`text`in e&&typeof e.text==`string`}function Vt(e){return Lt(e)&&e.source_type===`id`&&`id`in e&&typeof e.id==`string`}function Ht(e){if(Lt(e)){if(e.source_type===`url`)return{type:`image_url`,image_url:{url:e.url}};if(e.source_type===`base64`){if(!e.mime_type)throw Error(`mime_type key is required for base64 data.`);return{type:`image_url`,image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw Error(`Unsupported source type. Only 'url' and 'base64' are supported.`)}function Ut(e){let t=e.split(`;`)[0].split(`/`);if(t.length!==2)throw Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let n=t[0].trim(),r=t[1].trim();if(n===``||r===``)throw Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let t of e.split(`;`).slice(1)){let n=t.split(`=`);if(n.length!==2)throw Error(`Invalid parameter syntax in mime type: "${e}".`);let r=n[0].trim(),a=n[1].trim();if(r===``)throw Error(`Invalid parameter syntax in mime type: "${e}".`);i[r]=a}return{type:n,subtype:r,parameters:i}}function Wt({dataUrl:e,asTypedArray:t=!1}){let n=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),r;if(n){r=n[1].toLowerCase();let e=t?Uint8Array.from(atob(n[2]),e=>e.charCodeAt(0)):n[2];return{mime_type:r,data:e}}}function Gt(e,t){if(e.type===`text`){if(!t.fromStandardTextBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type===`image`){if(!t.fromStandardImageBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type===`audio`){if(!t.fromStandardAudioBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type===`file`){if(!t.fromStandardFileBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function Kt(e){return typeof e==`object`&&!!e&&`type`in e&&`content`in e&&(typeof e.content==`string`||Array.isArray(e.content))}var qt=n(((e,t)=>{t.exports=function(e,t){if(typeof e!=`string`)throw TypeError(`Expected a string`);return t=t===void 0?`_`:t,e.replace(/([a-z\d])([A-Z])/g,`$1`+t+`$2`).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,`$1`+t+`$2`).toLowerCase()}})),Jt=n(((e,t)=>{var n=/[\p{Lu}]/u,r=/[\p{Ll}]/u,i=/^[\p{Lu}](?![\p{Lu}])/gu,a=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,s=RegExp(`^`+o.source),c=new RegExp(o.source+a.source,`gu`),l=RegExp(`\\d+`+a.source,`gu`),u=(e,t,i)=>{let a=!1,o=!1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];a&&n.test(l)?(e=e.slice(0,c)+`-`+e.slice(c),a=!1,s=o,o=!0,c++):o&&s&&r.test(l)?(e=e.slice(0,c-1)+`-`+e.slice(c-1),s=o,o=!1,a=!0):(a=t(l)===l&&i(l)!==l,s=o,o=i(l)===l&&t(l)!==l)}return e},d=(e,t)=>(i.lastIndex=0,e.replace(i,e=>t(e))),f=(e,t)=>(c.lastIndex=0,l.lastIndex=0,e.replace(c,(e,n)=>t(n)).replace(l,e=>t(e))),p=(e,t)=>{if(!(typeof e==`string`||Array.isArray(e)))throw TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join(`-`):e.trim(),e.length===0)return``;let n=t.locale===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),r=t.locale===!1?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return e.length===1?t.pascalCase?r(e):n(e):(e!==n(e)&&(e=u(e,n,r)),e=e.replace(s,``),e=t.preserveConsecutiveUppercase?d(e,n):n(e),t.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),f(e,r))};t.exports=p,t.exports.default=p})),Yt=e(qt(),1),Xt=e(Jt(),1);function Zt(e,t){return t?.[e]||(0,Yt.default)(e)}function Qt(e,t){return t?.[e]||(0,Xt.default)(e)}function $t(e,t,n){let r={};for(let i in e)Object.hasOwn(e,i)&&(r[t(i,n)]=e[i]);return r}var en=`__lc_escaped__`;function tn(e){return`lc`in e||Object.keys(e).length===1&&en in e}function nn(e){return{[en]:e}}function rn(e){return Object.keys(e).length===1&&en in e}function an(e){return typeof e==`object`&&!!e&&`lc_serializable`in e&&typeof e.toJSON==`function`}function on(e){let t;return t=typeof e==`object`&&e?`lc_id`in e&&Array.isArray(e.lc_id)?e.lc_id:[e.constructor?.name??`Object`]:[typeof e],{lc:1,type:`not_implemented`,id:t}}function sn(e,t=new WeakSet){if(typeof e==`object`&&e&&!Array.isArray(e)){if(t.has(e))return on(e);if(an(e))return e;t.add(e);let n=e;if(tn(n))return t.delete(e),nn(n);let r={};for(let[e,i]of Object.entries(n))r[e]=sn(i,t);return t.delete(e),r}return Array.isArray(e)?e.map(e=>sn(e,t)):e}function cn(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e;if(rn(t))return t[en];let n={};for(let[e,r]of Object.entries(t))n[e]=cn(r);return n}return Array.isArray(e)?e.map(e=>cn(e)):e}var ln={};A(ln,{Serializable:()=>pn,get_lc_unique_name:()=>fn});function un(e){return Array.isArray(e)?[...e]:{...e}}function dn(e,t){let n=un(e);for(let[e,r]of Object.entries(t)){let[t,...i]=e.split(`.`).reverse(),a=n;for(let e of i.reverse()){if(a[e]===void 0)break;a[e]=un(a[e]),a=a[e]}a[t]!==void 0&&(a[t]={lc:1,type:`secret`,id:[r]})}return n}function fn(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name==`function`&&(typeof t.lc_name!=`function`||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var pn=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,fn(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){this.lc_serializable_keys===void 0?this.lc_kwargs=e??{}:this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e)))}toJSON(){if(!this.lc_serializable||this.lc_kwargs instanceof e||typeof this.lc_kwargs!=`object`||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},n={},r=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,`lc_aliases`,this)),Object.assign(n,Reflect.get(e,`lc_secrets`,this)),Object.assign(r,Reflect.get(e,`lc_attributes`,this));Object.keys(n).forEach(e=>{let t=this,n=r,[i,...a]=e.split(`.`).reverse();for(let e of a.reverse()){if(!(e in t)||t[e]===void 0)return;(!(e in n)||n[e]===void 0)&&(typeof t[e]==`object`&&t[e]!=null?n[e]={}:Array.isArray(t[e])&&(n[e]=[])),t=t[e],n=n[e]}i in t&&t[i]!==void 0&&(n[i]=n[i]||t[i])});let i={},a=new WeakSet;a.add(this);for(let[e,t]of Object.entries(r))i[e]=sn(t,a);let o=$t(Object.keys(n).length?dn(i,n):i,Zt,t);return{lc:1,type:`constructor`,id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:`not_implemented`,id:this.lc_id}}};function j(e,t){return M(e)&&e.type===t}function M(e){return typeof e==`object`&&!!e}function mn(e){return Array.isArray(e)}function N(e){return typeof e==`string`}function hn(e){return typeof e==`number`}function gn(e){return e instanceof Uint8Array}function _n(e){try{return JSON.parse(e)}catch{return}}var vn=e=>e();function yn(e){if(e.type===`char_location`&&N(e.document_title)&&hn(e.start_char_index)&&hn(e.end_char_index)&&N(e.cited_text)){let{document_title:t,start_char_index:n,end_char_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`char`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`page_location`&&N(e.document_title)&&hn(e.start_page_number)&&hn(e.end_page_number)&&N(e.cited_text)){let{document_title:t,start_page_number:n,end_page_number:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`page`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`content_block_location`&&N(e.document_title)&&hn(e.start_block_index)&&hn(e.end_block_index)&&N(e.cited_text)){let{document_title:t,start_block_index:n,end_block_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`block`,title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if(e.type===`web_search_result_location`&&N(e.url)&&N(e.title)&&N(e.encrypted_index)&&N(e.cited_text)){let{url:t,title:n,encrypted_index:r,cited_text:i,...a}=e;return{...a,type:`citation`,source:`url`,url:t,title:n,startIndex:Number(r),endIndex:Number(r),citedText:i}}if(e.type===`search_result_location`&&N(e.source)&&N(e.title)&&hn(e.start_block_index)&&hn(e.end_block_index)&&N(e.cited_text)){let{source:t,title:n,start_block_index:r,end_block_index:i,cited_text:a,...o}=e;return{...o,type:`citation`,source:`search`,url:t,title:n??void 0,startIndex:r,endIndex:i,citedText:a}}}function bn(e){if(j(e,`document`)&&M(e.source)&&`type`in e.source){if(e.source.type===`base64`&&N(e.source.media_type)&&N(e.source.data))return{type:`file`,mimeType:e.source.media_type,data:e.source.data};if(e.source.type===`url`&&N(e.source.url))return{type:`file`,url:e.source.url};if(e.source.type===`file`&&N(e.source.file_id))return{type:`file`,fileId:e.source.file_id};if(e.source.type===`text`&&N(e.source.data))return{type:`file`,mimeType:String(e.source.media_type??`text/plain`),data:e.source.data}}else if(j(e,`image`)&&M(e.source)&&`type`in e.source){if(e.source.type===`base64`&&N(e.source.media_type)&&N(e.source.data))return{type:`image`,mimeType:e.source.media_type,data:e.source.data};if(e.source.type===`url`&&N(e.source.url))return{type:`image`,url:e.source.url};if(e.source.type===`file`&&N(e.source.file_id))return{type:`image`,fileId:e.source.file_id}}}function xn(e){function*t(){for(let t of e){let e=bn(t);e?yield e:yield t}}return Array.from(t())}function Sn(e){function*t(){let t=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content;for(let n of t){if(j(n,`text`)&&N(n.text)){let{text:e,citations:t,...r}=n;if(mn(t)&&t.length){let n=t.reduce((e,t)=>{let n=yn(t);return n?[...e,n]:e},[]);yield{...r,type:`text`,text:e,annotations:n};continue}else{yield{...r,type:`text`,text:e};continue}}else if(j(n,`thinking`)&&N(n.thinking)){let{thinking:e,signature:t,...r}=n;yield{...r,type:`reasoning`,reasoning:e,signature:t};continue}else if(j(n,`redacted_thinking`)){yield{type:`non_standard`,value:n};continue}else if(j(n,`tool_use`)&&N(n.name)&&N(n.id)){yield{type:`tool_call`,id:n.id,name:n.name,args:n.input};continue}else if(j(n,`input_json_delta`)){if(wn(e)&&e.tool_call_chunks?.length){let t=e.tool_call_chunks[0];yield{type:`tool_call_chunk`,id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(j(n,`server_tool_use`)&&N(n.name)&&N(n.id)){let{name:e,id:t}=n;if(e===`web_search`){yield{id:t,type:`server_tool_call`,name:`web_search`,args:{query:vn(()=>{if(typeof n.input==`string`)return n.input;if(M(n.input)&&N(n.input.query))return n.input.query;if(N(n.partial_json)){let e=_n(n.partial_json);if(e?.query)return e.query}return``})}};continue}else if(n.name===`code_execution`){yield{id:t,type:`server_tool_call`,name:`code_execution`,args:{code:vn(()=>{if(typeof n.input==`string`)return n.input;if(M(n.input)&&N(n.input.code))return n.input.code;if(N(n.partial_json)){let e=_n(n.partial_json);if(e?.code)return e.code}return``})}};continue}}else if(j(n,`web_search_tool_result`)&&N(n.tool_use_id)&&mn(n.content)){let{content:e,tool_use_id:t}=n;yield{type:`server_tool_call_result`,name:`web_search`,toolCallId:t,status:`success`,output:{urls:e.reduce((e,t)=>j(t,`web_search_result`)?[...e,t.url]:e,[])}};continue}else if(j(n,`code_execution_tool_result`)&&N(n.tool_use_id)&&M(n.content)){yield{type:`server_tool_call_result`,name:`code_execution`,toolCallId:n.tool_use_id,status:`success`,output:n.content};continue}else if(j(n,`mcp_tool_use`)){yield{id:n.id,type:`server_tool_call`,name:`mcp_tool_use`,args:n.input};continue}else if(j(n,`mcp_tool_result`)&&N(n.tool_use_id)&&M(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(j(n,`container_upload`)){yield{type:`server_tool_call`,name:`container_upload`,args:n.input};continue}else if(j(n,`search_result`)){yield{id:n.id,type:`non_standard`,value:n};continue}else if(j(n,`tool_result`)){yield{id:n.id,type:`non_standard`,value:n};continue}else{let e=bn(n);if(e){yield e;continue}}yield{type:`non_standard`,value:n}}}return Array.from(t())}var Cn={translateContent:Sn,translateContentChunk:Sn};function wn(e){return typeof e?._getType==`function`&&typeof e.concat==`function`&&e._getType()===`ai`}function Tn(e){return Rt(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:zt(e)?{type:e.type,mimeType:e.mime_type??`application/octet-stream`,data:e.data,metadata:e.metadata}:Vt(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function En(e){return e.map(Tn)}function Dn(e){return!!(j(e,`image_url`)&&M(e.image_url)||j(e,`input_audio`)&&M(e.input_audio)||j(e,`file`)&&M(e.file))}function On(e){if(j(e,`image_url`)&&M(e.image_url)&&N(e.image_url.url)){let t=Wt({dataUrl:e.image_url.url});return t?{type:`image`,mimeType:t.mime_type,data:t.data}:{type:`image`,url:e.image_url.url}}else if(j(e,`input_audio`)&&M(e.input_audio)&&N(e.input_audio.data)&&N(e.input_audio.format))return{type:`audio`,data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};else if(j(e,`file`)&&M(e.file)&&N(e.file.data)){let t=Wt({dataUrl:e.file.data});if(t)return{type:`file`,data:t.data,mimeType:t.mime_type};if(N(e.file.file_id))return{type:`file`,fileId:e.file.file_id}}return e}function kn(e){let t=[];typeof e.content==`string`?t.push({type:`text`,text:e.content}):t.push(...jn(e.content));for(let n of e.tool_calls??[])t.push({type:`tool_call`,id:n.id,name:n.name,args:n.args});return t}function An(e){let t=[];typeof e.content==`string`?t.push({type:`text`,text:e.content}):t.push(...jn(e.content));for(let n of e.tool_calls??[])t.push({type:`tool_call`,id:n.id,name:n.name,args:n.args});return t}function jn(e){let t=[];for(let n of e)Dn(n)?t.push(On(n)):t.push(n);return t}function Mn(e){if(e.type===`url_citation`){let{url:t,title:n,start_index:r,end_index:i}=e;return{type:`citation`,url:t,title:n,startIndex:r,endIndex:i}}if(e.type===`file_citation`){let{file_id:t,filename:n,index:r}=e;return{type:`citation`,title:n,startIndex:r,endIndex:r,fileId:t}}return e}function Nn(e){function*t(){M(e.additional_kwargs?.reasoning)&&mn(e.additional_kwargs.reasoning.summary)&&(yield{type:`reasoning`,reasoning:e.additional_kwargs.reasoning.summary.reduce((e,t)=>M(t)&&N(t.text)?`${e}${t.text}`:e,``)});let t=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content;for(let e of t)if(j(e,`text`)){let{text:t,annotations:n,...r}=e;Array.isArray(n)?yield{...r,type:`text`,text:String(t),annotations:n.map(Mn)}:yield{...r,type:`text`,text:String(t)}}for(let t of e.tool_calls??[])yield{type:`tool_call`,id:t.id,name:t.name,args:t.args};if(M(e.additional_kwargs)&&mn(e.additional_kwargs.tool_outputs))for(let t of e.additional_kwargs.tool_outputs){if(j(t,`web_search_call`)){yield{id:t.id,type:`server_tool_call`,name:`web_search`,args:{query:t.query}};continue}else if(j(t,`file_search_call`)){yield{id:t.id,type:`server_tool_call`,name:`file_search`,args:{query:t.query}};continue}else if(j(t,`computer_call`)){yield{type:`non_standard`,value:t};continue}else if(j(t,`code_interpreter_call`)){if(N(t.code)&&(yield{id:t.id,type:`server_tool_call`,name:`code_interpreter`,args:{code:t.code}}),mn(t.outputs)){let e=vn(()=>{if(t.status!==`in_progress`){if(t.status===`completed`)return 0;if(t.status===`incomplete`)return 127;if(t.status!==`interpreting`&&t.status===`failed`)return 1}});for(let n of t.outputs)if(j(n,`logs`)){yield{type:`server_tool_call_result`,toolCallId:t.id??``,status:`success`,output:{type:`code_interpreter_output`,returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(n.logs),stdout:[0,void 0].includes(e)?String(n.logs):void 0}};continue}}continue}else if(j(t,`mcp_call`)){yield{id:t.id,type:`server_tool_call`,name:`mcp_call`,args:t.input};continue}else if(j(t,`mcp_list_tools`)){yield{id:t.id,type:`server_tool_call`,name:`mcp_list_tools`,args:t.input};continue}else if(j(t,`mcp_approval_request`)){yield{type:`non_standard`,value:t};continue}else if(j(t,`image_generation_call`)){N(t.result)&&(yield{type:`image`,mimeType:`image/png`,data:t.result,id:N(t.id)?t.id:void 0,metadata:{status:N(t.status)?t.status:void 0}}),yield{type:`non_standard`,value:t};continue}M(t)&&(yield{type:`non_standard`,value:t})}}return Array.from(t())}function Pn(e){function*t(){yield*Nn(e);for(let t of e.tool_call_chunks??[])yield{type:`tool_call_chunk`,id:t.id,name:t.name,args:t.args}}return Array.from(t())}var Fn={translateContent:e=>typeof e.content==`string`?kn(e):Nn(e),translateContentChunk:e=>typeof e.content==`string`?An(e):Pn(e)};function In(e,t=`pretty`){return t===`pretty`?Ln(e):JSON.stringify(e)}function Ln(e){let t=[],n=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,r=Math.floor((80-n.length)/2),i=`=`.repeat(r),a=n.length%2==0?i:`${i}=`;if(t.push(`${i}${n}${a}`),e.type===`ai`){let n=e;if(n.tool_calls&&n.tool_calls.length>0){t.push(`Tool Calls:`);for(let e of n.tool_calls){t.push(` ${e.name} (${e.id})`),t.push(` Call ID: ${e.id}`),t.push(` Args:`);for(let[n,r]of Object.entries(e.args))t.push(` ${n}: ${typeof r==`object`?JSON.stringify(r):r}`)}}}if(e.type===`tool`){let n=e;n.name&&t.push(`Name: ${n.name}`)}return typeof e.content==`string`&&e.content.trim()&&(t.length>1&&t.push(``),t.push(e.content)),t.join(`
|
|
2
2
|
`)}var Rn=Symbol.for(`langchain.message`);function zn(e,t){return typeof e==`string`?e===``?t:typeof t==`string`?e+t:Array.isArray(t)&&t.length===0?e:Array.isArray(t)&&t.some(e=>Lt(e))?[{type:`text`,source_type:`text`,text:e},...t]:[{type:`text`,text:e},...t]:Array.isArray(t)?Gn(e,t)??[...e,...t]:t===``?e:Array.isArray(e)&&e.some(e=>Lt(e))?[...e,{type:`file`,source_type:`text`,text:t}]:[...e,{type:`text`,text:t}]}function Bn(e,t){return e===`error`||t===`error`?`error`:`success`}function Vn(e,t){function n(e,r){if(typeof e!=`object`||!e||e===void 0)return e;if(r>=t)return Array.isArray(e)?`[Array]`:`[Object]`;if(Array.isArray(e))return e.map(e=>n(e,r+1));let i={};for(let t of Object.keys(e))i[t]=n(e[t],r+1);return i}return JSON.stringify(n(e,0),null,2)}var Hn=class extends pn{lc_namespace=[`langchain_core`,`messages`];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:`additional_kwargs`,response_metadata:`response_metadata`}}[Rn]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){let t=typeof e==`string`||Array.isArray(e)?{content:e}:e;t.additional_kwargs||={},t.response_metadata||={},super(t),this.name=t.name,t.content===void 0&&t.contentBlocks!==void 0?(this.content=t.contentBlocks,this.response_metadata={output_version:`v1`,...t.response_metadata}):t.content===void 0?(this.content=[],this.response_metadata=t.response_metadata):(this.content=t.content??[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return typeof this.content==`string`?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e==`string`?e:e.type===`text`?e.text:``).join(``):``}get contentBlocks(){let e=typeof this.content==`string`?[{type:`text`,text:this.content}]:this.content;return[En,jn,xn].reduce((e,t)=>t(e),e)}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(e){return typeof e==`object`&&!!e&&Rn in e&&e[Rn]===!0&&Kt(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for(`nodejs.util.inspect.custom`)](e){if(e===null)return this;let t=Vn(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${t}`}toFormattedString(e=`pretty`){return In(this,e)}};function Un(e){return Array.isArray(e)&&e.every(e=>typeof e.index==`number`)}var Wn=[`index`,`created`,`timestamp`];function P(e,t,n){let r=n?.ignoreKeys??Wn;if(e==null&&t==null)return;if(e==null||t==null)return e??t;let i={...e};for(let[e,a]of Object.entries(t))if(i[e]==null)i[e]=a;else if(a==null)continue;else if(typeof i[e]!=typeof a||Array.isArray(i[e])!==Array.isArray(a))throw Error(`field[${e}] already exists in the message chunk, but with a different type.`);else if(typeof i[e]==`string`){if(e===`type`)continue;if([`id`,`name`,`output_version`,`model_provider`].includes(e))a&&(i[e]=a);else if(r.includes(e))continue;else i[e]+=a}else if(typeof i[e]==`number`){if(r.includes(e))continue;i[e]=i[e]+a}else if(typeof i[e]==`object`&&!Array.isArray(i[e]))i[e]=P(i[e],a,n);else if(Array.isArray(i[e]))i[e]=Gn(i[e],a,n);else if(i[e]===a)continue;else console.warn(`field[${e}] already exists in this message chunk and value has unsupported type.`);return i}function Gn(e,t,n){if(!(e==null&&t==null)){if(e==null||t==null)return e||t;{let r=[...e];for(let e of t)if(typeof e==`object`&&e&&`index`in e&&typeof e.index==`number`){let t=r.findIndex(t=>{let n=typeof t==`object`,r=`index`in t&&t.index===e.index,i=`id`in t&&`id`in e&&t?.id===e?.id,a=!(`id`in t)||!t?.id||!(`id`in e)||!e?.id;return n&&r&&(i||a)});t!==-1&&typeof r[t]==`object`&&r[t]!==null?r[t]=P(r[t],e,n):r.push(e)}else if(typeof e==`object`&&e&&`text`in e&&e.text===``)continue;else r.push(e);return r}}}function Kn(e,t,n){if(!(e==null&&t==null)){if(e==null||t==null)return e??t;if(typeof e!=typeof t)throw Error(`Cannot merge objects of different types.\nLeft ${typeof e}\nRight ${typeof t}`);if(typeof e==`string`&&typeof t==`string`)return e+t;if(Array.isArray(e)&&Array.isArray(t))return Gn(e,t,n);if(typeof e==`object`&&typeof t==`object`)return P(e,t,n);if(e===t)return e;throw Error(`Can not merge objects of different types.\nLeft ${e}\nRight ${t}`)}}var qn=class e extends Hn{static isInstance(t){if(!super.isInstance(t))return!1;let n=Object.getPrototypeOf(t);for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1}};function Jn(e){return typeof e.role==`string`}function Yn(e){return typeof e?._getType==`function`}function Xn(e){return qn.isInstance(e)}function Zn(e,t){return P(e,t)??{}}function Qn(e,t){let n={};return(e?.audio!==void 0||t?.audio!==void 0)&&(n.audio=(e?.audio??0)+(t?.audio??0)),(e?.image!==void 0||t?.image!==void 0)&&(n.image=(e?.image??0)+(t?.image??0)),(e?.video!==void 0||t?.video!==void 0)&&(n.video=(e?.video??0)+(t?.video??0)),(e?.document!==void 0||t?.document!==void 0)&&(n.document=(e?.document??0)+(t?.document??0)),(e?.text!==void 0||t?.text!==void 0)&&(n.text=(e?.text??0)+(t?.text??0)),n}function $n(e,t){let n={...Qn(e,t)};return(e?.cache_read!==void 0||t?.cache_read!==void 0)&&(n.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),(e?.cache_creation!==void 0||t?.cache_creation!==void 0)&&(n.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),n}function er(e,t){let n={...Qn(e,t)};return(e?.reasoning!==void 0||t?.reasoning!==void 0)&&(n.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),n}function tr(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:$n(e?.input_token_details,t?.input_token_details),output_token_details:er(e?.output_token_details,t?.output_token_details)}}var nr={};A(nr,{ToolMessage:()=>ir,ToolMessageChunk:()=>ar,defaultToolCallParser:()=>or,isDirectToolOutput:()=>rr,isToolMessage:()=>sr,isToolMessageChunk:()=>cr});function rr(e){return typeof e==`object`&&!!e&&`lc_direct_tool_output`in e&&e.lc_direct_tool_output===!0}var ir=class extends Hn{static lc_name(){return`ToolMessage`}get lc_aliases(){return{tool_call_id:`tool_call_id`}}lc_direct_tool_output=!0;type=`tool`;status;tool_call_id;metadata;artifact;constructor(e,t,n){let r=typeof e==`string`||Array.isArray(e)?{content:e,name:n,tool_call_id:t}:e;super(r),this.tool_call_id=r.tool_call_id,this.artifact=r.artifact,this.status=r.status,this.metadata=r.metadata}static isInstance(e){return super.isInstance(e)&&e.type===`tool`}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},ar=class extends qn{type=`tool`;tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return`ToolMessageChunk`}concat(e){let t=this.constructor;return new t({content:zn(this.content,e.content),additional_kwargs:P(this.additional_kwargs,e.additional_kwargs),response_metadata:P(this.response_metadata,e.response_metadata),artifact:Kn(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Bn(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function or(e){let t=[],n=[];for(let r of e)if(r.function){let e=r.function.name;try{let n=JSON.parse(r.function.arguments);t.push({name:e||``,args:n||{},id:r.id})}catch{n.push({name:e,args:r.function.arguments,id:r.id,error:`Malformed args.`})}}else continue;return[t,n]}function sr(e){return typeof e==`object`&&!!e&&`getType`in e&&typeof e.getType==`function`&&e.getType()===`tool`}function cr(e){return e._getType()===`tool`}var lr=class e extends Hn{static lc_name(){return`ChatMessage`}type=`generic`;role;static _chatMessageClass(){return e}constructor(e,t){(typeof e==`string`||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type===`generic`}get _printableFields(){return{...super._printableFields,role:this.role}}},ur=class extends qn{static lc_name(){return`ChatMessageChunk`}type=`generic`;role;constructor(e,t){(typeof e==`string`||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}concat(e){let t=this.constructor;return new t({content:zn(this.content,e.content),additional_kwargs:P(this.additional_kwargs,e.additional_kwargs),response_metadata:P(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type===`generic`}get _printableFields(){return{...super._printableFields,role:this.role}}};function dr(e){return e._getType()===`generic`}function fr(e){return e._getType()===`generic`}var pr=class extends Hn{static lc_name(){return`FunctionMessage`}type=`function`;name;constructor(e){super(e),this.name=e.name}},mr=class extends qn{static lc_name(){return`FunctionMessageChunk`}type=`function`;concat(e){let t=this.constructor;return new t({content:zn(this.content,e.content),additional_kwargs:P(this.additional_kwargs,e.additional_kwargs),response_metadata:P(this.response_metadata,e.response_metadata),name:this.name??``,id:this.id??e.id})}};function hr(e){return e._getType()===`function`}function gr(e){return e._getType()===`function`}var _r=class extends Hn{static lc_name(){return`HumanMessage`}type=`human`;constructor(e){super(e)}static isInstance(e){return super.isInstance(e)&&e.type===`human`}},vr=class extends qn{static lc_name(){return`HumanMessageChunk`}type=`human`;constructor(e){super(e)}concat(e){let t=this.constructor;return new t({content:zn(this.content,e.content),additional_kwargs:P(this.additional_kwargs,e.additional_kwargs),response_metadata:P(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type===`human`}};function yr(e){return e.getType()===`human`}function br(e){return e.getType()===`human`}var xr=class extends Hn{type=`remove`;id;constructor(e){super({...e,content:[]}),this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&e.type===`remove`}},Sr=class e extends Hn{static lc_name(){return`SystemMessage`}type=`system`;constructor(e){super(e)}concat(t){if(typeof t==`string`)return new e({...this,content:zn(this.content,t)});if(e.isInstance(t))return new e({...this,additional_kwargs:{...this.additional_kwargs,...t.additional_kwargs},response_metadata:{...this.response_metadata,...t.response_metadata},content:zn(this.content,t.content)});throw Error(`Unexpected chunk type for system message`)}static isInstance(e){return super.isInstance(e)&&e.type===`system`}},Cr=class extends qn{static lc_name(){return`SystemMessageChunk`}type=`system`;constructor(e){super(e)}concat(e){let t=this.constructor;return new t({content:zn(this.content,e.content),additional_kwargs:P(this.additional_kwargs,e.additional_kwargs),response_metadata:P(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type===`system`}};function wr(e){return e._getType()===`system`}function Tr(e){return e._getType()===`system`}var Er={};A(Er,{ModelAbortError:()=>Or,addLangChainErrorFields:()=>Dr});function Dr(e,t){return e.lc_error_code=t,e.message=`${e.message}\n\nTroubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${t}/\n`,e}var Or=class e extends Error{name=`ModelAbortError`;lc_error_code=`MODEL_ABORTED`;partialOutput;constructor(t,n){super(t),this.partialOutput=n,Error.captureStackTrace&&Error.captureStackTrace(this,e)}static isInstance(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===`ModelAbortError`&&`lc_error_code`in e&&e.lc_error_code===`MODEL_ABORTED`}};function kr(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`tool_call`)}function Ar(e){return!!(e&&typeof e==`object`&&`toolCall`in e&&e.toolCall!=null&&typeof e.toolCall==`object`&&`id`in e.toolCall&&typeof e.toolCall.id==`string`)}var jr=class extends Error{output;constructor(e,t){super(e),this.output=t}};function Mr(e,t=Pr){e=e.trim();let n=e.indexOf("```");if(n===-1)return t(e);let r=e.substring(n+3);r.startsWith(`json
|
|
3
3
|
`)?r=r.substring(5):r.startsWith(`json`)?r=r.substring(4):r.startsWith(`
|
|
4
4
|
`)&&(r=r.substring(1));let i=r.indexOf("```"),a=r;return i!==-1&&(a=r.substring(0,i)),t(a.trim())}function Nr(e){try{return JSON.parse(e)}catch{}let t=e.trim();if(t.length===0)throw Error(`Unexpected end of JSON input`);let n=0;function r(){for(;n<t.length&&/\s/.test(t[n]);)n+=1}function i(){if(t[n]!==`"`)throw Error(`Expected '"' at position ${n}, got '${t[n]}'`);n+=1;let e=``,r=!1;for(;n<t.length;){let i=t[n];if(r){if(i===`n`)e+=`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./index-zlrXpRSB.js";export default e();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-QWQYAQCK-BR4V0xsV.js";import{a as e}from"./chunk-JU7W27UC-CMTI_w7A.js";export{e as wrapTransportForLogging};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,$n as t,$t as n,A as r,An as i,At as ee,B as te,Bn as ne,Bt as re,C as ie,Cn as ae,Ct as oe,D as a,Dn as se,Dt as ce,E as le,En as o,Et as ue,F as de,Fn as fe,G as s,Gn as pe,Gt as me,H as he,Hn as ge,Ht as _e,In as ve,J as ye,Jn as be,Jt as xe,K as c,Kn as Se,Kt as Ce,L as we,Ln as Te,Lt as l,M as Ee,Mn as De,Mt as Oe,N as ke,Nn as Ae,Nt as je,O as Me,On as Ne,Ot as u,P as Pe,Pn as Fe,Q as Ie,Qn as Le,Qt as Re,R as ze,Rn as Be,Rt as d,Sn as f,St as p,T as Ve,Tn as He,Tt as Ue,U as We,Un as Ge,Ut as Ke,V as qe,Vn as Je,Vt as Ye,W as m,Wn as Xe,Wt as Ze,X as Qe,Xt as $e,Y as et,Yt as tt,Z as nt,Zn as rt,Zt as it,_ as at,_n as ot,_t as st,a as ct,an as lt,ar as h,at as g,b as ut,bn as dt,bt as ft,c as pt,cn as mt,cr as _,ct as v,d as ht,dn as gt,dr as _t,dt as vt,en as yt,et as bt,f as xt,fn as St,fr as Ct,ft as wt,g as y,gn as Tt,gr as b,gt as Et,h as Dt,hn as Ot,hr as kt,ht as At,i as jt,in as Mt,ir as x,it as Nt,j as Pt,jn as Ft,jt as It,k as Lt,kn as Rt,kt as zt,l as Bt,ln as Vt,lr as Ht,lt as S,m as Ut,mn as Wt,mr as C,mt as Gt,n as Kt,nn as qt,nr as Jt,nt as Yt,o as Xt,on as Zt,or as Qt,ot as w,p as $t,pn as en,pr as tn,pt as nn,q as rn,qn as an,qt as on,r as sn,rn as cn,rr as ln,rt as T,s as un,sn as dn,sr as fn,st as E,t as pn,tn as mn,tr as hn,tt as gn,u as _n,un as vn,ur as yn,ut as bn,v as xn,vn as Sn,vt as Cn,w as wn,wn as Tn,wt as En,x as Dn,xn as On,xt as kn,y as An,yn as jn,yt as Mn,z as Nn,zn as Pn,zt as Fn}from"./json-schema-processors-BJc5OsHH.js";var In=b(`ZodISODateTime`,(e,t)=>{Zt.init(e,t),M.init(e,t)});function D(e){return Ie(In,e)}var Ln=b(`ZodISODate`,(e,t)=>{lt.init(e,t),M.init(e,t)});function Rn(e){return nt(Ln,e)}var zn=b(`ZodISOTime`,(e,t)=>{mt.init(e,t),M.init(e,t)});function Bn(e){return bt(zn,e)}var Vn=b(`ZodISODuration`,(e,t)=>{dn.init(e,t),M.init(e,t)});function Hn(t){return e(Vn,t)}var O=(e,n)=>{rt.init(e,n),e.name=`ZodError`,Object.defineProperties(e,{format:{value:n=>t(e,n)},flatten:{value:t=>Le(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,h,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,h,2)}},isEmpty:{get(){return e.issues.length===0}}})};b(`ZodError`,O);var k=b(`ZodError`,O,{Parent:Error}),Un=Je(k),Wn=ge(k),Gn=an(k),Kn=be(k),qn=Pn(k),Jn=Te(k),Yn=ne(k),Xn=Be(k),Zn=pe(k),Qn=Ge(k),$n=Se(k),er=Xe(k),A=b(`ZodType`,(e,t)=>(i.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:a(e,`input`),output:a(e,`output`)}}),e.toJSONSchema=Me(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(fn(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>hn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Un(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Gn(e,t,n),e.parseAsync=async(t,n)=>Wn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Kn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>qn(e,t,n),e.decode=(t,n)=>Jn(e,t,n),e.encodeAsync=async(t,n)=>Yn(e,t,n),e.decodeAsync=async(t,n)=>Xn(e,t,n),e.safeEncode=(t,n)=>Zn(e,t,n),e.safeDecode=(t,n)=>Qn(e,t,n),e.safeEncodeAsync=async(t,n)=>$n(e,t,n),e.safeDecodeAsync=async(t,n)=>er(e,t,n),e.refine=(t,n)=>e.check(ri(t,n)),e.superRefine=t=>e.check(ii(t)),e.overwrite=t=>e.check(At(t)),e.optional=()=>J(e),e.exactOptional=()=>Wr(e),e.nullable=()=>X(e),e.nullish=()=>J(X(e)),e.nonoptional=t=>Xr(e,t),e.array=()=>z(e),e.or=t=>H([e,t]),e.and=t=>U(e,t),e.transform=t=>Q(e,K(t)),e.default=t=>qr(e,t),e.prefault=t=>Yr(e,t),e.catch=t=>Qr(e,t),e.pipe=t=>Q(e,t),e.readonly=()=>ti(e),e.describe=t=>{let n=e.clone();return l.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return l.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return l.get(e);let n=e.clone();return l.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j=b(`_ZodString`,(e,t)=>{o.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dn(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(st(...t)),e.includes=(...t)=>e.check(rn(...t)),e.startsWith=(...t)=>e.check(Mn(...t)),e.endsWith=(...t)=>e.check(We(...t)),e.min=(...t)=>e.check(v(...t)),e.max=(...t)=>e.check(E(...t)),e.length=(...t)=>e.check(T(...t)),e.nonempty=(...t)=>e.check(v(1,...t)),e.lowercase=t=>e.check(Nt(t)),e.uppercase=t=>e.check(ce(t)),e.trim=()=>e.check(En()),e.normalize=(...t)=>e.check(wt(...t)),e.toLowerCase=()=>e.check(p()),e.toUpperCase=()=>e.check(oe()),e.slugify=()=>e.check(Cn())}),tr=b(`ZodString`,(e,t)=>{o.init(e,t),j.init(e,t),e.email=t=>e.check(qe(rr,t)),e.url=t=>e.check(u(F,t)),e.jwt=t=>e.check(gn(yr,t)),e.emoji=t=>e.check(he(ar,t)),e.guid=t=>e.check(c(N,t)),e.uuid=t=>e.check(zt(P,t)),e.uuidv4=t=>e.check(ee(P,t)),e.uuidv6=t=>e.check(It(P,t)),e.uuidv7=t=>e.check(Oe(P,t)),e.nanoid=t=>e.check(bn(or,t)),e.guid=t=>e.check(c(N,t)),e.cuid=t=>e.check(we(sr,t)),e.cuid2=t=>e.check(ze(cr,t)),e.ulid=t=>e.check(Ue(lr,t)),e.base64=t=>e.check(Pt(gr,t)),e.base64url=t=>e.check(Ee(_r,t)),e.xid=t=>e.check(je(ur,t)),e.ksuid=t=>e.check(Yt(dr,t)),e.ipv4=t=>e.check(et(fr,t)),e.ipv6=t=>e.check(Qe(pr,t)),e.cidrv4=t=>e.check(Pe(mr,t)),e.cidrv6=t=>e.check(de(hr,t)),e.e164=t=>e.check(te(vr,t)),e.datetime=t=>e.check(D(t)),e.date=t=>e.check(Rn(t)),e.time=t=>e.check(Bn(t)),e.duration=t=>e.check(Hn(t))});function nr(e){return ft(tr,e)}var M=b(`ZodStringFormat`,(e,t)=>{se.init(e,t),j.init(e,t)}),rr=b(`ZodEmail`,(e,t)=>{Re.init(e,t),M.init(e,t)}),N=b(`ZodGUID`,(e,t)=>{qt.init(e,t),M.init(e,t)}),P=b(`ZodUUID`,(e,t)=>{Ae.init(e,t),M.init(e,t)}),F=b(`ZodURL`,(e,t)=>{De.init(e,t),M.init(e,t)});function ir(e){return u(F,e)}var ar=b(`ZodEmoji`,(e,t)=>{n.init(e,t),M.init(e,t)}),or=b(`ZodNanoID`,(e,t)=>{en.init(e,t),M.init(e,t)}),sr=b(`ZodCUID`,(e,t)=>{me.init(e,t),M.init(e,t)}),cr=b(`ZodCUID2`,(e,t)=>{Ce.init(e,t),M.init(e,t)}),lr=b(`ZodULID`,(e,t)=>{Ft.init(e,t),M.init(e,t)}),ur=b(`ZodXID`,(e,t)=>{ve.init(e,t),M.init(e,t)}),dr=b(`ZodKSUID`,(e,t)=>{gt.init(e,t),M.init(e,t)}),fr=b(`ZodIPv4`,(e,t)=>{cn.init(e,t),M.init(e,t)}),pr=b(`ZodIPv6`,(e,t)=>{Mt.init(e,t),M.init(e,t)}),mr=b(`ZodCIDRv4`,(e,t)=>{Ke.init(e,t),M.init(e,t)}),hr=b(`ZodCIDRv6`,(e,t)=>{Ze.init(e,t),M.init(e,t)}),gr=b(`ZodBase64`,(e,t)=>{re.init(e,t),M.init(e,t)}),_r=b(`ZodBase64URL`,(e,t)=>{Ye.init(e,t),M.init(e,t)}),vr=b(`ZodE164`,(e,t)=>{it.init(e,t),M.init(e,t)}),yr=b(`ZodJWT`,(e,t)=>{vn.init(e,t),M.init(e,t)}),I=b(`ZodNumber`,(e,t)=>{Sn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ut(e,t,n,r),e.gt=(t,n)=>e.check(m(t,n)),e.gte=(t,n)=>e.check(s(t,n)),e.min=(t,n)=>e.check(s(t,n)),e.lt=(t,n)=>e.check(g(t,n)),e.lte=(t,n)=>e.check(w(t,n)),e.max=(t,n)=>e.check(w(t,n)),e.int=t=>e.check(L(t)),e.safe=t=>e.check(L(t)),e.positive=t=>e.check(m(0,t)),e.nonnegative=t=>e.check(s(0,t)),e.negative=t=>e.check(g(0,t)),e.nonpositive=t=>e.check(w(0,t)),e.multipleOf=(t,n)=>e.check(S(t,n)),e.step=(t,n)=>e.check(S(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function br(e){return Gt(I,e)}var xr=b(`ZodNumberFormat`,(e,t)=>{jn.init(e,t),I.init(e,t)});function L(e){return ye(xr,e)}var Sr=b(`ZodBoolean`,(e,t)=>{_e.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sn(e,t,n,r)});function Cr(e){return ke(Sr,e)}var wr=b(`ZodNull`,(e,t)=>{Tt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xt(e,t,n,r)});function Tr(e){return nn(wr,e)}var Er=b(`ZodAny`,(e,t)=>{d.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pn(e,t,n,r)});function Dr(){return Lt(Er)}var Or=b(`ZodUnknown`,(e,t)=>{fe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>le(e,t,n,r)});function R(){return ue(Or)}var kr=b(`ZodNever`,(e,t)=>{Wt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_n(e,t,n,r)});function Ar(e){return vt(kr,e)}var jr=b(`ZodArray`,(e,t)=>{Fn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kt(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(v(t,n)),e.nonempty=t=>e.check(v(1,t)),e.max=(t,n)=>e.check(E(t,n)),e.length=(t,n)=>e.check(T(t,n)),e.unwrap=()=>e.element});function z(e,t){return r(jr,e,t)}var B=b(`ZodObject`,(e,t)=>{dt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dt(e,t,n,r),Jt(e,`shape`,()=>t.shape),e.keyof=()=>G(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:R()}),e.loose=()=>e.clone({...e._zod.def,catchall:R()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ar()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ln(e,t),e.safeExtend=t=>tn(e,t),e.merge=t=>Qt(e,t),e.pick=t=>_t(e,t),e.omit=t=>Ht(e,t),e.partial=(...t)=>yn(q,e,t[0]),e.required=(...t)=>Ct(Z,e,t[0])});function Mr(e,t){return new B({type:`object`,shape:e??{},..._(t)})}function Nr(e,t){return new B({type:`object`,shape:e,catchall:R(),..._(t)})}var V=b(`ZodUnion`,(e,t)=>{Fe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ve(e,t,n,r),e.options=t.options});function H(e,t){return new V({type:`union`,options:e,..._(t)})}var Pr=b(`ZodDiscriminatedUnion`,(e,t)=>{V.init(e,t),$e.init(e,t)});function Fr(e,t,n){return new Pr({type:`union`,options:t,discriminator:e,..._(n)})}var Ir=b(`ZodIntersection`,(e,t)=>{Vt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pt(e,t,n,r)});function U(e,t){return new Ir({type:`intersection`,left:e,right:t})}var Lr=b(`ZodTuple`,(e,t)=>{Rt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wn(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Rr(e,t,n){let r=t instanceof i;return new Lr({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}var zr=b(`ZodRecord`,(e,t)=>{He.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ut(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Br(e,t,n){return new zr({type:`record`,keyType:e,valueType:t,..._(n)})}var W=b(`ZodEnum`,(e,t)=>{yt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new W({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new W({...t,checks:[],..._(r),entries:i})}});function G(e,t){return new W({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var Vr=b(`ZodLiteral`,(e,t)=>{St.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bt(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Hr(e,t){return new Vr({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Ur=b(`ZodTransform`,(e,t)=>{Ne.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ie(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(x(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(x(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function K(e){return new Ur({type:`transform`,transform:e})}var q=b(`ZodOptional`,(e,t)=>{On.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function J(e){return new q({type:`optional`,innerType:e})}var Y=b(`ZodExactOptional`,(e,t)=>{mn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wr(e){return new Y({type:`optional`,innerType:e})}var Gr=b(`ZodNullable`,(e,t)=>{ot.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$t(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function X(e){return new Gr({type:`nullable`,innerType:e})}var Kr=b(`ZodDefault`,(e,t)=>{tt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xt(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qr(e,t){return new Kr({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():C(t)}})}var Jr=b(`ZodPrefault`,(e,t)=>{ae.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yr(e,t){return new Jr({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():C(t)}})}var Z=b(`ZodNonOptional`,(e,t)=>{Ot.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ht(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xr(e,t){return new Z({type:`nonoptional`,innerType:e,..._(t)})}var Zr=b(`ZodCatch`,(e,t)=>{on.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jt(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qr(e,t){return new Zr({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var $r=b(`ZodPipe`,(e,t)=>{f.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>at(e,t,n,r),e.in=t.in,e.out=t.out});function Q(e,t){return new $r({type:`pipe`,in:e,out:t})}var ei=b(`ZodReadonly`,(e,t)=>{Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>An(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ti(e){return new ei({type:`readonly`,innerType:e})}var $=b(`ZodCustom`,(e,t)=>{xe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ct(e,t,n,r)});function ni(e,t){return Nn($,e??(()=>!0),t)}function ri(e,t={}){return Et($,e,t)}function ii(e){return kn(e)}function ai(e,t){return Q(K(e),t)}export{D as C,ir as S,Br as _,Dr as a,H as b,ni as c,Hr as d,Nr as f,ai as g,J as h,Tr as i,Fr as l,Mr as m,A as n,z as o,br as p,G as r,Cr as s,I as t,U as u,nr as v,R as x,Rr as y};
|
|
1
|
+
import{$ as e,$n as t,$t as n,A as r,An as i,At as ee,B as te,Bn as ne,Bt as re,C as ie,Cn as ae,Ct as oe,D as a,Dn as se,Dt as ce,E as le,En as o,Et as ue,F as de,Fn as fe,G as s,Gn as pe,Gt as me,H as he,Hn as ge,Ht as _e,In as ve,J as ye,Jn as be,Jt as xe,K as c,Kn as Se,Kt as Ce,L as we,Ln as Te,Lt as l,M as Ee,Mn as De,Mt as Oe,N as ke,Nn as Ae,Nt as je,O as Me,On as Ne,Ot as u,P as Pe,Pn as Fe,Q as Ie,Qn as Le,Qt as Re,R as ze,Rn as Be,Rt as d,Sn as f,St as p,T as Ve,Tn as He,Tt as Ue,U as We,Un as Ge,Ut as Ke,V as qe,Vn as Je,Vt as Ye,W as m,Wn as Xe,Wt as Ze,X as Qe,Xt as $e,Y as et,Yt as tt,Z as nt,Zn as rt,Zt as it,_ as at,_n as ot,_t as st,a as ct,an as lt,ar as h,at as g,b as ut,bn as dt,bt as ft,c as pt,cn as mt,cr as _,ct as v,d as ht,dn as gt,dr as _t,dt as vt,en as yt,et as bt,f as xt,fn as St,fr as Ct,ft as wt,g as y,gn as Tt,gr as b,gt as Et,h as Dt,hn as Ot,hr as kt,ht as At,i as jt,in as Mt,ir as x,it as Nt,j as Pt,jn as Ft,jt as It,k as Lt,kn as Rt,kt as zt,l as Bt,ln as Vt,lr as Ht,lt as S,m as Ut,mn as Wt,mr as C,mt as Gt,n as Kt,nn as qt,nr as Jt,nt as Yt,o as Xt,on as Zt,or as Qt,ot as w,p as $t,pn as en,pr as tn,pt as nn,q as rn,qn as an,qt as on,r as sn,rn as cn,rr as ln,rt as T,s as un,sn as dn,sr as fn,st as E,t as pn,tn as mn,tr as hn,tt as gn,u as _n,un as vn,ur as yn,ut as bn,v as xn,vn as Sn,vt as Cn,w as wn,wn as Tn,wt as En,x as Dn,xn as On,xt as kn,y as An,yn as jn,yt as Mn,z as Nn,zn as Pn,zt as Fn}from"./json-schema-processors-DNSjFPrk.js";var In=b(`ZodISODateTime`,(e,t)=>{Zt.init(e,t),M.init(e,t)});function D(e){return Ie(In,e)}var Ln=b(`ZodISODate`,(e,t)=>{lt.init(e,t),M.init(e,t)});function Rn(e){return nt(Ln,e)}var zn=b(`ZodISOTime`,(e,t)=>{mt.init(e,t),M.init(e,t)});function Bn(e){return bt(zn,e)}var Vn=b(`ZodISODuration`,(e,t)=>{dn.init(e,t),M.init(e,t)});function Hn(t){return e(Vn,t)}var O=(e,n)=>{rt.init(e,n),e.name=`ZodError`,Object.defineProperties(e,{format:{value:n=>t(e,n)},flatten:{value:t=>Le(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,h,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,h,2)}},isEmpty:{get(){return e.issues.length===0}}})};b(`ZodError`,O);var k=b(`ZodError`,O,{Parent:Error}),Un=Je(k),Wn=ge(k),Gn=an(k),Kn=be(k),qn=Pn(k),Jn=Te(k),Yn=ne(k),Xn=Be(k),Zn=pe(k),Qn=Ge(k),$n=Se(k),er=Xe(k),A=b(`ZodType`,(e,t)=>(i.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:a(e,`input`),output:a(e,`output`)}}),e.toJSONSchema=Me(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(fn(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>hn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Un(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Gn(e,t,n),e.parseAsync=async(t,n)=>Wn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Kn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>qn(e,t,n),e.decode=(t,n)=>Jn(e,t,n),e.encodeAsync=async(t,n)=>Yn(e,t,n),e.decodeAsync=async(t,n)=>Xn(e,t,n),e.safeEncode=(t,n)=>Zn(e,t,n),e.safeDecode=(t,n)=>Qn(e,t,n),e.safeEncodeAsync=async(t,n)=>$n(e,t,n),e.safeDecodeAsync=async(t,n)=>er(e,t,n),e.refine=(t,n)=>e.check(ri(t,n)),e.superRefine=t=>e.check(ii(t)),e.overwrite=t=>e.check(At(t)),e.optional=()=>J(e),e.exactOptional=()=>Wr(e),e.nullable=()=>X(e),e.nullish=()=>J(X(e)),e.nonoptional=t=>Xr(e,t),e.array=()=>z(e),e.or=t=>H([e,t]),e.and=t=>U(e,t),e.transform=t=>Q(e,K(t)),e.default=t=>qr(e,t),e.prefault=t=>Yr(e,t),e.catch=t=>Qr(e,t),e.pipe=t=>Q(e,t),e.readonly=()=>ti(e),e.describe=t=>{let n=e.clone();return l.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return l.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return l.get(e);let n=e.clone();return l.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j=b(`_ZodString`,(e,t)=>{o.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dn(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(st(...t)),e.includes=(...t)=>e.check(rn(...t)),e.startsWith=(...t)=>e.check(Mn(...t)),e.endsWith=(...t)=>e.check(We(...t)),e.min=(...t)=>e.check(v(...t)),e.max=(...t)=>e.check(E(...t)),e.length=(...t)=>e.check(T(...t)),e.nonempty=(...t)=>e.check(v(1,...t)),e.lowercase=t=>e.check(Nt(t)),e.uppercase=t=>e.check(ce(t)),e.trim=()=>e.check(En()),e.normalize=(...t)=>e.check(wt(...t)),e.toLowerCase=()=>e.check(p()),e.toUpperCase=()=>e.check(oe()),e.slugify=()=>e.check(Cn())}),tr=b(`ZodString`,(e,t)=>{o.init(e,t),j.init(e,t),e.email=t=>e.check(qe(rr,t)),e.url=t=>e.check(u(F,t)),e.jwt=t=>e.check(gn(yr,t)),e.emoji=t=>e.check(he(ar,t)),e.guid=t=>e.check(c(N,t)),e.uuid=t=>e.check(zt(P,t)),e.uuidv4=t=>e.check(ee(P,t)),e.uuidv6=t=>e.check(It(P,t)),e.uuidv7=t=>e.check(Oe(P,t)),e.nanoid=t=>e.check(bn(or,t)),e.guid=t=>e.check(c(N,t)),e.cuid=t=>e.check(we(sr,t)),e.cuid2=t=>e.check(ze(cr,t)),e.ulid=t=>e.check(Ue(lr,t)),e.base64=t=>e.check(Pt(gr,t)),e.base64url=t=>e.check(Ee(_r,t)),e.xid=t=>e.check(je(ur,t)),e.ksuid=t=>e.check(Yt(dr,t)),e.ipv4=t=>e.check(et(fr,t)),e.ipv6=t=>e.check(Qe(pr,t)),e.cidrv4=t=>e.check(Pe(mr,t)),e.cidrv6=t=>e.check(de(hr,t)),e.e164=t=>e.check(te(vr,t)),e.datetime=t=>e.check(D(t)),e.date=t=>e.check(Rn(t)),e.time=t=>e.check(Bn(t)),e.duration=t=>e.check(Hn(t))});function nr(e){return ft(tr,e)}var M=b(`ZodStringFormat`,(e,t)=>{se.init(e,t),j.init(e,t)}),rr=b(`ZodEmail`,(e,t)=>{Re.init(e,t),M.init(e,t)}),N=b(`ZodGUID`,(e,t)=>{qt.init(e,t),M.init(e,t)}),P=b(`ZodUUID`,(e,t)=>{Ae.init(e,t),M.init(e,t)}),F=b(`ZodURL`,(e,t)=>{De.init(e,t),M.init(e,t)});function ir(e){return u(F,e)}var ar=b(`ZodEmoji`,(e,t)=>{n.init(e,t),M.init(e,t)}),or=b(`ZodNanoID`,(e,t)=>{en.init(e,t),M.init(e,t)}),sr=b(`ZodCUID`,(e,t)=>{me.init(e,t),M.init(e,t)}),cr=b(`ZodCUID2`,(e,t)=>{Ce.init(e,t),M.init(e,t)}),lr=b(`ZodULID`,(e,t)=>{Ft.init(e,t),M.init(e,t)}),ur=b(`ZodXID`,(e,t)=>{ve.init(e,t),M.init(e,t)}),dr=b(`ZodKSUID`,(e,t)=>{gt.init(e,t),M.init(e,t)}),fr=b(`ZodIPv4`,(e,t)=>{cn.init(e,t),M.init(e,t)}),pr=b(`ZodIPv6`,(e,t)=>{Mt.init(e,t),M.init(e,t)}),mr=b(`ZodCIDRv4`,(e,t)=>{Ke.init(e,t),M.init(e,t)}),hr=b(`ZodCIDRv6`,(e,t)=>{Ze.init(e,t),M.init(e,t)}),gr=b(`ZodBase64`,(e,t)=>{re.init(e,t),M.init(e,t)}),_r=b(`ZodBase64URL`,(e,t)=>{Ye.init(e,t),M.init(e,t)}),vr=b(`ZodE164`,(e,t)=>{it.init(e,t),M.init(e,t)}),yr=b(`ZodJWT`,(e,t)=>{vn.init(e,t),M.init(e,t)}),I=b(`ZodNumber`,(e,t)=>{Sn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ut(e,t,n,r),e.gt=(t,n)=>e.check(m(t,n)),e.gte=(t,n)=>e.check(s(t,n)),e.min=(t,n)=>e.check(s(t,n)),e.lt=(t,n)=>e.check(g(t,n)),e.lte=(t,n)=>e.check(w(t,n)),e.max=(t,n)=>e.check(w(t,n)),e.int=t=>e.check(L(t)),e.safe=t=>e.check(L(t)),e.positive=t=>e.check(m(0,t)),e.nonnegative=t=>e.check(s(0,t)),e.negative=t=>e.check(g(0,t)),e.nonpositive=t=>e.check(w(0,t)),e.multipleOf=(t,n)=>e.check(S(t,n)),e.step=(t,n)=>e.check(S(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function br(e){return Gt(I,e)}var xr=b(`ZodNumberFormat`,(e,t)=>{jn.init(e,t),I.init(e,t)});function L(e){return ye(xr,e)}var Sr=b(`ZodBoolean`,(e,t)=>{_e.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sn(e,t,n,r)});function Cr(e){return ke(Sr,e)}var wr=b(`ZodNull`,(e,t)=>{Tt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xt(e,t,n,r)});function Tr(e){return nn(wr,e)}var Er=b(`ZodAny`,(e,t)=>{d.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pn(e,t,n,r)});function Dr(){return Lt(Er)}var Or=b(`ZodUnknown`,(e,t)=>{fe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>le(e,t,n,r)});function R(){return ue(Or)}var kr=b(`ZodNever`,(e,t)=>{Wt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_n(e,t,n,r)});function Ar(e){return vt(kr,e)}var jr=b(`ZodArray`,(e,t)=>{Fn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kt(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(v(t,n)),e.nonempty=t=>e.check(v(1,t)),e.max=(t,n)=>e.check(E(t,n)),e.length=(t,n)=>e.check(T(t,n)),e.unwrap=()=>e.element});function z(e,t){return r(jr,e,t)}var B=b(`ZodObject`,(e,t)=>{dt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dt(e,t,n,r),Jt(e,`shape`,()=>t.shape),e.keyof=()=>G(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:R()}),e.loose=()=>e.clone({...e._zod.def,catchall:R()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ar()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ln(e,t),e.safeExtend=t=>tn(e,t),e.merge=t=>Qt(e,t),e.pick=t=>_t(e,t),e.omit=t=>Ht(e,t),e.partial=(...t)=>yn(q,e,t[0]),e.required=(...t)=>Ct(Z,e,t[0])});function Mr(e,t){return new B({type:`object`,shape:e??{},..._(t)})}function Nr(e,t){return new B({type:`object`,shape:e,catchall:R(),..._(t)})}var V=b(`ZodUnion`,(e,t)=>{Fe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ve(e,t,n,r),e.options=t.options});function H(e,t){return new V({type:`union`,options:e,..._(t)})}var Pr=b(`ZodDiscriminatedUnion`,(e,t)=>{V.init(e,t),$e.init(e,t)});function Fr(e,t,n){return new Pr({type:`union`,options:t,discriminator:e,..._(n)})}var Ir=b(`ZodIntersection`,(e,t)=>{Vt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pt(e,t,n,r)});function U(e,t){return new Ir({type:`intersection`,left:e,right:t})}var Lr=b(`ZodTuple`,(e,t)=>{Rt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wn(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Rr(e,t,n){let r=t instanceof i;return new Lr({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}var zr=b(`ZodRecord`,(e,t)=>{He.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ut(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Br(e,t,n){return new zr({type:`record`,keyType:e,valueType:t,..._(n)})}var W=b(`ZodEnum`,(e,t)=>{yt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new W({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new W({...t,checks:[],..._(r),entries:i})}});function G(e,t){return new W({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var Vr=b(`ZodLiteral`,(e,t)=>{St.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bt(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Hr(e,t){return new Vr({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Ur=b(`ZodTransform`,(e,t)=>{Ne.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ie(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(x(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(x(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function K(e){return new Ur({type:`transform`,transform:e})}var q=b(`ZodOptional`,(e,t)=>{On.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function J(e){return new q({type:`optional`,innerType:e})}var Y=b(`ZodExactOptional`,(e,t)=>{mn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wr(e){return new Y({type:`optional`,innerType:e})}var Gr=b(`ZodNullable`,(e,t)=>{ot.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$t(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function X(e){return new Gr({type:`nullable`,innerType:e})}var Kr=b(`ZodDefault`,(e,t)=>{tt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xt(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qr(e,t){return new Kr({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():C(t)}})}var Jr=b(`ZodPrefault`,(e,t)=>{ae.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yr(e,t){return new Jr({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():C(t)}})}var Z=b(`ZodNonOptional`,(e,t)=>{Ot.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ht(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xr(e,t){return new Z({type:`nonoptional`,innerType:e,..._(t)})}var Zr=b(`ZodCatch`,(e,t)=>{on.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jt(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qr(e,t){return new Zr({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var $r=b(`ZodPipe`,(e,t)=>{f.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>at(e,t,n,r),e.in=t.in,e.out=t.out});function Q(e,t){return new $r({type:`pipe`,in:e,out:t})}var ei=b(`ZodReadonly`,(e,t)=>{Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>An(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ti(e){return new ei({type:`readonly`,innerType:e})}var $=b(`ZodCustom`,(e,t)=>{xe.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ct(e,t,n,r)});function ni(e,t){return Nn($,e??(()=>!0),t)}function ri(e,t={}){return Et($,e,t)}function ii(e){return kn(e)}function ai(e,t){return Q(K(e),t)}export{D as C,ir as S,Br as _,Dr as a,H as b,ni as c,Hr as d,Nr as f,ai as g,J as h,Tr as i,Fr as l,Mr as m,A as n,z as o,br as p,G as r,Cr as s,I as t,U as u,nr as v,R as x,Rr as y};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./chunk-zsgVPwQN.js";import{t as a}from"./chunk-3GQAWCBQ-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./chunk-zsgVPwQN.js";import{t as a}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n as o}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{g as s,n as c,r as l,t as u}from"./client-z1GrRUEs.js";import{a as d,o as f,r as p,t as m}from"./path-CG3438uq.js";var h={env:{},platform:`browser`,version:`v18.0.0`,versions:{node:`18.0.0`},cwd:()=>`/`,nextTick:(e,...t)=>queueMicrotask(()=>e(...t)),browser:!0},g=r({default:()=>w,exec:()=>v,execFile:()=>y,execFileSync:()=>C,execSync:()=>x,fork:()=>b,spawn:()=>_,spawnSync:()=>S});function _(){throw Error(`child_process.spawn is not available in browser environment`)}function v(){throw Error(`child_process.exec is not available in browser environment`)}function y(){throw Error(`child_process.execFile is not available in browser environment`)}function b(){throw Error(`child_process.fork is not available in browser environment`)}function x(){throw Error(`child_process.execSync is not available in browser environment`)}function S(){throw Error(`child_process.spawnSync is not available in browser environment`)}function C(){throw Error(`child_process.execFileSync is not available in browser environment`)}var w,T=t((()=>{w={spawn:_,exec:v,execFile:y,fork:b,execSync:x,spawnSync:S,execFileSync:C}})),E=i(((t,n)=>{n.exports=o,o.sync=s;var r=(f(),e(d));function i(e,t){var n=t.pathExt===void 0?{}.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function a(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:i(t,n)}function o(e,t,n){r.stat(e,function(r,i){n(r,r?!1:a(i,e,t))})}function s(e,t){return a(r.statSync(e),e,t)}})),D=i(((t,n)=>{n.exports=i,i.sync=a;var r=(f(),e(d));function i(e,t,n){r.stat(e,function(e,r){n(e,e?!1:o(r,t))})}function a(e,t){return o(r.statSync(e),t)}function o(e,t){return e.isFile()&&s(e,t)}function s(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),O=i(((e,t)=>{f();var n=globalThis.TESTING_WINDOWS?E():D();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),k=i(((t,n)=>{var r={}.OSTYPE===`cygwin`||{}.OSTYPE===`msys`,i=(m(),e(p)),a=r?`;`:`:`,o=O(),s=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),c=(e,t)=>{let n=t.colon||a,i=e.match(/\//)||r&&e.match(/\\/)?[``]:[...r?[process.cwd()]:[],...(t.path||{}.PATH||``).split(n)],o=r?t.pathExt||{}.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=r?o.split(n):[``];return r&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:i,pathExt:s,pathExtExe:o}},l=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:r,pathExt:a,pathExtExe:l}=c(e,t),u=[],d=n=>new Promise((a,o)=>{if(n===r.length)return t.all&&u.length?a(u):o(s(e));let c=r[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,s)=>{if(r===a.length)return i(d(n+1));let c=a[r];o(e+c,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+c);else return i(e+c);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};n.exports=l,l.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:r,pathExtExe:a}=c(e,t),l=[];for(let s=0;s<n.length;s++){let c=n[s],u=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<r.length;e++){let n=f+r[e];try{if(o.sync(n,{pathExt:a}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw s(e)}})),A=i(((e,t)=>{var n=(e={})=>{let t=e.env||{};return(e.platform||`browser`)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),j=i(((t,n)=>{var r=(m(),e(p)),i=k(),a=A();function o(e,t){let n=e.options.env||{},o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=i.sync(e.command,{path:n[a({env:n})],pathExt:t?r.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=r.resolve(s?e.options.cwd:``,l),l}function s(e){return o(e)||o(e,!0)}n.exports=s})),M=i(((e,t)=>{var n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),N=i(((e,t)=>{t.exports=/^#!(.*)/})),P=i(((e,t)=>{var n=N();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),F=i(((t,n)=>{var r=(f(),e(d)),i=P();function a(e){let t=Buffer.alloc(150),n;try{n=r.openSync(e,`r`),r.readSync(n,t,0,150,0),r.closeSync(n)}catch{}return i(t.toString())}n.exports=a})),I=i(((e,t)=>{m(),j(),M(),F();function n(e){return e}function r(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:n(i)}t.exports=r})),L=i(((e,t)=>{function n(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function r(e,t){}function i(e,t){return null}function a(e,t){return null}t.exports={hookChildProcess:r,verifyENOENT:i,verifyENOENTSync:a,notFoundError:n}})),R=n(i(((t,n)=>{var r=(T(),e(g)),i=I(),a=L();function o(e,t,n){let o=i(e,t,n),s=r.spawn(o.command,o.args,o.options);return a.hookChildProcess(s,o),s}function s(e,t,n){let o=i(e,t,n),s=r.spawnSync(o.command,o.args,o.options);return s.error=s.error||a.verifyENOENTSync(s.status,o),s}n.exports=o,n.exports.spawn=o,n.exports.sync=s,n.exports._parse=i,n.exports._enoent=a}))(),1),z=class{constructor(){console.warn(`PassThrough stream is not available in browser environment`)}},B=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
2
2
|
`);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);return this._buffer=this._buffer.subarray(e+1),V(t)}clear(){this._buffer=void 0}};function V(e){return s.parse(JSON.parse(e))}function H(e){return JSON.stringify(e)+`
|
|
3
3
|
`}var U=h.platform===`win32`?[`APPDATA`,`HOMEDRIVE`,`HOMEPATH`,`LOCALAPPDATA`,`PATH`,`PROCESSOR_ARCHITECTURE`,`SYSTEMDRIVE`,`SYSTEMROOT`,`TEMP`,`USERNAME`,`USERPROFILE`,`PROGRAMFILES`]:[`HOME`,`LOGNAME`,`PATH`,`SHELL`,`TERM`,`USER`];function W(){let e={};for(let t of U){let n=h.env[t];n!==void 0&&(n.startsWith(`()`)||(e[t]=n))}return e}var G=class{constructor(e){this._readBuffer=new B,this._stderrStream=null,this._serverParams=e,(e.stderr===`pipe`||e.stderr===`overlapped`)&&(this._stderrStream=new z)}async start(){if(this._process)throw Error(`StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.`);return new Promise((e,t)=>{this._process=(0,R.default)(this._serverParams.command,this._serverParams.args??[],{env:{...W(),...this._serverParams.env},stdio:[`pipe`,`pipe`,this._serverParams.stderr??`inherit`],shell:!1,windowsHide:h.platform===`win32`&&K(),cwd:this._serverParams.cwd}),this._process.on(`error`,e=>{t(e),this.onerror?.(e)}),this._process.on(`spawn`,()=>{e()}),this._process.on(`close`,e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on(`error`,e=>{this.onerror?.(e)}),this._process.stdout?.on(`data`,e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on(`error`,e=>{this.onerror?.(e)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once(`close`,()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),e.exitCode===null){try{e.kill(`SIGTERM`)}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(e.exitCode===null)try{e.kill(`SIGKILL`)}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error(`Not connected`);let n=H(e);this._process.stdin.write(n)?t():this._process.stdin.once(`drain`,t)})}};function K(){return`type`in h}var q=class extends l{static{a(this,`StdioConnectionManager`)}serverParams;errlog;_transport=null;constructor(e,t=process.stderr){super(),this.serverParams=e,this.errlog=t}async establishConnection(){return this._transport=new G(this.serverParams),this._transport.stderr&&typeof this._transport.stderr.pipe==`function`&&this._transport.stderr.pipe(this.errlog),o.debug(`${this.constructor.name} connected successfully`),this._transport}async closeConnection(e){if(this._transport)try{await this._transport.close()}catch(e){o.warn(`Error closing stdio transport: ${e}`)}finally{this._transport=null}}},J=class extends c{static{a(this,`StdioConnector`)}command;args;env;errlog;clientInfo;constructor({command:e=`npx`,args:t=[],env:n,errlog:r=h.stderr,...i}={}){super(i),this.command=e,this.args=t,this.env=n,this.errlog=r,this.clientInfo=i.clientInfo??{name:`stdio-connector`,version:`1.0.0`}}async connect(){if(this.connected){o.debug(`Already connected to MCP implementation`);return}o.debug(`Connecting to MCP implementation via stdio: ${this.command}`);try{let e;if(this.env){e={};for(let[t,n]of Object.entries(h.env))n!==void 0&&(e[t]=n);Object.assign(e,this.env)}this.connectionManager=new q({command:this.command,args:this.args,env:e},this.errlog);let t=await this.connectionManager.start(),n={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.onSampling??this.opts.samplingCallback?{sampling:{}}:{},...this.opts.onElicitation??this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};this.client=new u(this.clientInfo,n),await this.client.connect(t),this.connected=!0,this.setupNotificationHandler(),this.setupRootsHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),o.debug(`Successfully connected to MCP implementation: ${this.command}`),this.trackConnectorInit({serverCommand:this.command,serverArgs:this.args,publicIdentifier:`${this.command} ${this.args.join(` `)}`})}catch(e){throw o.error(`Failed to connect to MCP implementation: ${e}`),await this.cleanupResources(),e}}get publicIdentifier(){return{type:`stdio`,"command&args":`${this.command} ${this.args.join(` `)}`}}};export{J as StdioConnector};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as e,C as t,Ct as n,Et as r,G as i,M as a,T as o,U as s,Zn as c,_t as l,bt as u,er as d,gn as f,ht as p,in as m,nn as h,rn as g,vn as _,wt as v,xt as y,yt as b,zn as x}from"./messages-
|
|
1
|
+
import{B as e,C as t,Ct as n,Et as r,G as i,M as a,T as o,U as s,Zn as c,_t as l,bt as u,er as d,gn as f,ht as p,in as m,nn as h,rn as g,vn as _,wt as v,xt as y,yt as b,zn as x}from"./messages-D4_mH1tk.js";import{er as S}from"./json-schema-processors-DNSjFPrk.js";import{a as C,i as w,l as T,o as E,r as D}from"./function_calling-kK7um7Ye.js";var O={};x(O,{BaseToolkit:()=>N,DynamicStructuredTool:()=>M,DynamicTool:()=>j,StructuredTool:()=>k,Tool:()=>A,ToolInputParsingException:()=>h,isLangChainTool:()=>D,isRunnableToolLike:()=>w,isStructuredTool:()=>C,isStructuredToolParams:()=>E,tool:()=>P});var k=class extends T{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return[`langchain`,`tools`]}responseFormat=`content`;defaultConfig;constructor(e){super(e??{}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}async invoke(e,t){let n,r=l(b(this.defaultConfig,t));return m(e)?(n=e.args,r={...r,toolCall:e}):n=e,this.call(n,r)}async call(t,n,i){let c=m(t)?t.args:t,l;if(s(this.schema))try{l=await a(this.schema,c)}catch(n){let r=`Received tool input did not match expected schema`;throw this.verboseParsingErrors&&(r=`${r}\nDetails: ${n.message}`),e(n)&&(r=`${r}\n\n${S(n)}`),new h(r,JSON.stringify(t))}else{let e=o(c,this.schema);if(!e.valid){let n=`Received tool input did not match expected schema`;throw this.verboseParsingErrors&&(n=`${n}\nDetails: ${e.errors.map(e=>`${e.keywordLocation}: ${e.error}`).join(`
|
|
2
2
|
`)}`),new h(n,JSON.stringify(t))}l=c}let u=r(n),d=await v.configure(u.callbacks,this.callbacks,u.tags||i,this.tags,u.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t==`string`?t:JSON.stringify(t),u.runId,void 0,void 0,void 0,u.runName);delete u.runId;let f;try{f=await this._call(l,d,u)}catch(e){throw await d?.handleToolError(e),e}let p,_;if(this.responseFormat===`content_and_artifact`)if(Array.isArray(f)&&f.length===2)[p,_]=f;else throw Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.\nResult: ${JSON.stringify(f)}`);else p=f;let y;m(t)&&(y=t.id),!y&&g(u)&&(y=u.toolCall.id);let b=F({content:p,artifact:_,toolCallId:y,name:this.name,metadata:this.metadata});return await d?.handleToolEnd(b),b}},A=class extends k{schema=c({input:d().optional()}).transform(e=>e.input);constructor(e){super(e)}call(e,t){let n=typeof e==`string`||e==null?{input:e}:e;return super.call(n,t)}},j=class extends A{static lc_name(){return`DynamicTool`}name;description;func;constructor(e){super(e),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,t){let n=r(t);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,t,n){return this.func(e,t,n)}},M=class extends k{static lc_name(){return`DynamicStructuredTool`}description;func;schema;constructor(e){super(e),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,t,n){let i=r(t);return i.runName===void 0&&(i.runName=this.name),super.call(e,i,n)}_call(e,t,n){return this.func(e,t,n)}},N=class{getTools(){return this.tools}};function P(e,r){let a=i(r.schema),o=t(r.schema);if(!r.schema||a||o)return new j({...r,description:r.description??r.schema?.description??`${r.name} tool`,func:async(t,r,i)=>new Promise((a,o)=>{let s=u(i,{callbacks:r?.getChild()});n.runWithConfig(y(s),async()=>{try{a(e(t,s))}catch(e){o(e)}})})});let s=r.schema,c=r.description??r.schema.description??`${r.name} tool`;return new M({...r,description:c,schema:s,func:async(t,r,i)=>new Promise((a,o)=>{let s,c=()=>{i?.signal&&s&&i.signal.removeEventListener(`abort`,s)};i?.signal&&(s=()=>{c(),o(p(i.signal))},i.signal.addEventListener(`abort`,s));let l=u(i,{callbacks:r?.getChild()});n.runWithConfig(y(l),async()=>{try{let n=await e(t,l);if(i?.signal?.aborted){c();return}c(),a(n)}catch(e){c(),o(e)}})})})}function F(e){let{content:t,artifact:n,toolCallId:r,metadata:i}=e;return r&&!_(t)?typeof t==`string`||Array.isArray(t)&&t.every(e=>typeof e==`object`)?new f({status:`success`,content:t,artifact:n,tool_call_id:r,name:e.name,metadata:i}):new f({status:`success`,content:I(t),artifact:n,tool_call_id:r,name:e.name,metadata:i}):t}function I(e){try{return JSON.stringify(e)??``}catch{return`${e}`}}export{P as a,A as i,j as n,O as o,k as r,M as t};
|