@mcp-use/inspector 0.12.0 → 0.12.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{browser-Cx0JHZqb.js → browser-DhQAQTLS.js} +53 -51
- package/dist/client/assets/{display-A5IEINAP-C_3SaotY.js → display-A5IEINAP-BjtA5bgX.js} +2 -2
- package/dist/client/assets/{embeddings-DN38A_vZ.js → embeddings-DWqXM9cI.js} +1 -1
- package/dist/client/assets/{index-DVE3PVDT.js → index-C522z4fg.js} +1 -1
- package/dist/client/assets/{index-BRR1ewVe.js → index-CppzqsxT.js} +1 -1
- package/dist/client/assets/{index-D3h9OtLD.js → index-Dsn6bJ_W.js} +1 -1
- package/dist/client/assets/{index-IsrJH759.js → index-Dx3O2_mP.js} +6 -6
- package/dist/client/assets/{index-CNOfsJmB.js → index-FYQEmRnY.js} +1 -1
- package/dist/client/assets/{index-1cJS7z-O.js → index-H8hjVEcK.js} +1 -1
- package/dist/client/assets/{index-D4BJ-4dv.js → index-I27vQsLz.js} +1 -1
- package/dist/client/assets/{index-C1PULc-j.js → index-XUbcs2v4.js} +1 -1
- package/dist/client/assets/{index-B-y3tpvd.js → index-ZgUrgLDI.js} +1 -1
- package/dist/client/assets/{winston-C9XdstMd.js → winston-Cj1D1cto.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as Yu,f as $e,h as Xu,g as br,i as nc,j as xt,k as Qu,l as el,m as ac,d as os,n as tl,o as rl,q as nl,s as al}from"./index-
|
|
1
|
+
import{$ as Yu,f as $e,h as Xu,g as br,i as nc,j as xt,k as Qu,l as el,m as ac,d as os,n as tl,o as rl,q as nl,s as al}from"./index-Dx3O2_mP.js";class Vs{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??$e,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,o);const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)o.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{const h=o.schema;switch(a.type){case"string":{const p=h;p.type="string";const{minimum:m,maximum:g,format:y,patterns:v,contentEncoding:_}=e._zod.bag;if(typeof m=="number"&&(p.minLength=m),typeof g=="number"&&(p.maxLength=g),y&&(p.format=s[y]??y,p.format===""&&delete p.format),_&&(p.contentEncoding=_),v&&v.size>0){const E=[...v];E.length===1?p.pattern=E[0].source:E.length>1&&(o.schema.allOf=[...E.map($=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:$.source}))])}break}case"number":{const p=h,{minimum:m,maximum:g,format:y,multipleOf:v,exclusiveMaximum:_,exclusiveMinimum:E}=e._zod.bag;typeof y=="string"&&y.includes("int")?p.type="integer":p.type="number",typeof E=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(p.minimum=E,p.exclusiveMinimum=!0):p.exclusiveMinimum=E),typeof m=="number"&&(p.minimum=m,typeof E=="number"&&this.target!=="draft-4"&&(E>=m?delete p.minimum:delete p.exclusiveMinimum)),typeof _=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(p.maximum=_,p.exclusiveMaximum=!0):p.exclusiveMaximum=_),typeof g=="number"&&(p.maximum=g,typeof _=="number"&&this.target!=="draft-4"&&(_<=g?delete p.maximum:delete p.exclusiveMaximum)),typeof v=="number"&&(p.multipleOf=v);break}case"boolean":{const p=h;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(h.type="string",h.nullable=!0,h.enum=[null]):h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const p=h,{minimum:m,maximum:g}=e._zod.bag;typeof m=="number"&&(p.minItems=m),typeof g=="number"&&(p.maxItems=g),p.type="array",p.items=this.process(a.element,{...d,path:[...d.path,"items"]});break}case"object":{const p=h;p.type="object",p.properties={};const m=a.shape;for(const v in m)p.properties[v]=this.process(m[v],{...d,path:[...d.path,"properties",v]});const g=new Set(Object.keys(m)),y=new Set([...g].filter(v=>{const _=a.shape[v]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));y.size>0&&(p.required=Array.from(y)),a.catchall?._zod.def.type==="never"?p.additionalProperties=!1:a.catchall?a.catchall&&(p.additionalProperties=this.process(a.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{const p=h,m=a.discriminator!==void 0,g=a.options.map((y,v)=>this.process(y,{...d,path:[...d.path,m?"oneOf":"anyOf",v]}));m?p.oneOf=g:p.anyOf=g;break}case"intersection":{const p=h,m=this.process(a.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(a.right,{...d,path:[...d.path,"allOf",1]}),y=_=>"allOf"in _&&Object.keys(_).length===1,v=[...y(m)?m.allOf:[m],...y(g)?g.allOf:[g]];p.allOf=v;break}case"tuple":{const p=h;p.type="array";const m=this.target==="draft-2020-12"?"prefixItems":"items",g=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",y=a.items.map(($,U)=>this.process($,{...d,path:[...d.path,m,U]})),v=a.rest?this.process(a.rest,{...d,path:[...d.path,g,...this.target==="openapi-3.0"?[a.items.length]:[]]}):null;this.target==="draft-2020-12"?(p.prefixItems=y,v&&(p.items=v)):this.target==="openapi-3.0"?(p.items={anyOf:y},v&&p.items.anyOf.push(v),p.minItems=y.length,v||(p.maxItems=y.length)):(p.items=y,v&&(p.additionalItems=v));const{minimum:_,maximum:E}=e._zod.bag;typeof _=="number"&&(p.minItems=_),typeof E=="number"&&(p.maxItems=E);break}case"record":{const p=h;p.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(p.propertyNames=this.process(a.keyType,{...d,path:[...d.path,"propertyNames"]})),p.additionalProperties=this.process(a.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const p=h,m=Xu(a.entries);m.every(g=>typeof g=="number")&&(p.type="number"),m.every(g=>typeof g=="string")&&(p.type="string"),p.enum=m;break}case"literal":{const p=h,m=[];for(const g of a.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){const g=m[0];p.type=g===null?"null":typeof g,this.target==="draft-4"||this.target==="openapi-3.0"?p.enum=[g]:p.const=g}else m.every(g=>typeof g=="number")&&(p.type="number"),m.every(g=>typeof g=="string")&&(p.type="string"),m.every(g=>typeof g=="boolean")&&(p.type="string"),m.every(g=>g===null)&&(p.type="null"),p.enum=m;break}case"file":{const p=h,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:v}=e._zod.bag;g!==void 0&&(m.minLength=g),y!==void 0&&(m.maxLength=y),v?v.length===1?(m.contentMediaType=v[0],Object.assign(p,m)):p.anyOf=v.map(_=>({...m,contentMediaType:_})):Object.assign(p,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const p=this.process(a.innerType,d);this.target==="openapi-3.0"?(o.ref=a.innerType,h.nullable=!0):h.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(a.innerType,d),o.ref=a.innerType;break}case"success":{const p=h;p.type="boolean";break}case"default":{this.process(a.innerType,d),o.ref=a.innerType,h.default=JSON.parse(JSON.stringify(a.defaultValue));break}case"prefault":{this.process(a.innerType,d),o.ref=a.innerType,this.io==="input"&&(h._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break}case"catch":{this.process(a.innerType,d),o.ref=a.innerType;let p;try{p=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}h.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const p=h,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=m.source;break}case"pipe":{const p=this.io==="input"?a.in._zod.def.type==="transform"?a.out:a.in:a.out;this.process(p,d),o.ref=p;break}case"readonly":{this.process(a.innerType,d),o.ref=a.innerType,h.readOnly=!0;break}case"promise":{this.process(a.innerType,d),o.ref=a.innerType;break}case"optional":{this.process(a.innerType,d),o.ref=a.innerType;break}case"lazy":{const p=e._zod.innerType;this.process(p,d),o.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}}}}const u=this.metadataRegistry.get(e);return u&&Object.assign(o.schema,u),this.io==="input"&&Se(e)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,r){const n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},a=this.seen.get(e);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=l=>{const d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const m=n.external.registry.get(l[0])?.id,g=n.external.uri??(v=>v);if(m)return{ref:g(m)};const y=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=y,{defId:y,ref:`${g("__shared")}#/${d}/${y}`}}if(l[1]===a)return{ref:"#"};const h=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:h+p}},i=l=>{if(l[1].schema.$ref)return;const d=l[1],{ref:f,defId:h}=s(l);d.def={...d.schema},h&&(d.defId=h);const p=d.schema;for(const m in p)delete p[m];p.$ref=f};if(n.cycles==="throw")for(const l of this.seen.entries()){const d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
|
2
2
|
|
|
3
3
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of this.seen.entries()){const d=l[1];if(e===l[0]){i(l);continue}if(n.external){const h=n.external.registry.get(l[0])?.id;if(e!==l[0]&&h){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}const o=(l,d)=>{const f=this.seen.get(l),h=f.def??f.schema,p={...h};if(f.ref===null)return;const m=f.ref;if(f.ref=null,m){o(m,d);const g=this.seen.get(m).schema;g.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(g)):(Object.assign(h,g),Object.assign(h,p))}f.isParent||this.override({zodSchema:l,jsonSchema:h,path:f.path??[]})};for(const l of[...this.seen.entries()].reverse())o(l[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){const l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,a.def);const u=n.external?.defs??{};for(const l of this.seen.entries()){const d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Js(t,e){if(t instanceof Yu){const n=new Vs(e),a={};for(const o of t._idmap.entries()){const[c,u]=o;n.process(u)}const s={},i={registry:t,uri:e?.uri,defs:a};for(const o of t._idmap.entries()){const[c,u]=o;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(a).length>0){const o=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[o]:a}}return{schemas:s}}const r=new Vs(e);return r.process(t),r.emit(t,e)}function Se(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Se(n.element,r);if(n.type==="set")return Se(n.valueType,r);if(n.type==="lazy")return Se(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Se(n.innerType,r);if(n.type==="intersection")return Se(n.left,r)||Se(n.right,r);if(n.type==="record"||n.type==="map")return Se(n.keyType,r)||Se(n.valueType,r);if(n.type==="pipe")return Se(n.in,r)||Se(n.out,r);if(n.type==="object"){for(const a in n.shape)if(Se(n.shape[a],r))return!0;return!1}if(n.type==="union"){for(const a of n.options)if(Se(a,r))return!0;return!1}if(n.type==="tuple"){for(const a of n.items)if(Se(a,r))return!0;return!!(n.rest&&Se(n.rest,r))}return!1}var te;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(te||(te={}));var Ws;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ws||(Ws={}));const R=te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ft=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}},w=te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class De extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return a(this),n}static assert(e){if(!(e instanceof De))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}De.create=t=>new De(t);const cr=(t,e)=>{let r;switch(t.code){case w.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,te.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${te.joinValues(t.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${te.joinValues(t.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${te.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:te.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case w.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case w.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=e.defaultError,te.assertNever(t)}return{message:r}};let sl=cr;function Da(){return sl}const Ua=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function x(t,e){const r=Da(),n=Ua({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===cr?void 0:cr].filter(a=>!!a)});t.common.issues.push(n)}class xe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return V;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return xe.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return V;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const V=Object.freeze({status:"aborted"}),tr=t=>({status:"dirty",value:t}),Ne=t=>({status:"valid",value:t}),Ks=t=>t.status==="aborted",Ys=t=>t.status==="dirty",Bt=t=>t.status==="valid",Jr=t=>typeof Promise<"u"&&t instanceof Promise;var N;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));class Qe{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Xs=(t,e)=>{if(Bt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new De(t.common.issues);return this._error=r,this._error}}};function X(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}class ee{get description(){return this._def.description}_getType(e){return ft(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ft(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xe,ctx:{common:e.parent.common,data:e.data,parsedType:ft(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Jr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ft(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Xs(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ft(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return Bt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Bt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ft(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(Jr(a)?a:Promise.resolve(a));return Xs(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:w.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Gt({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return pt.create(this,this._def)}nullable(){return Ht.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ye.create(this)}promise(){return fr.create(this,this._def)}or(e){return Kr.create([this,e],this._def)}and(e){return Yr.create(this,e,this._def)}transform(e){return new Gt({...X(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Ga({...X(this._def),innerType:this,defaultValue:r,typeName:b.ZodDefault})}brand(){return new Ol({typeName:b.ZodBranded,type:this,...X(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Ha({...X(this._def),innerType:this,catchValue:r,typeName:b.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return cs.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const il=/^c[^\s-]{8,}$/i,ol=/^[0-9a-z]+$/,cl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ul=/^[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,ll=/^[a-z0-9_-]{21}$/i,dl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fl=/^[-+]?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)?)??$/,hl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Sn;const ml=/^(?:(?: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])$/,gl=/^(?:(?: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])$/,yl=/^(([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]))$/,_l=/^(([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])$/,vl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sc="((\\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])))",bl=new RegExp(`^${sc}$`);function ic(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function El(t){return new RegExp(`^${ic(t)}$`)}function Sl(t){let e=`${sc}T${ic(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Tl(t,e){return!!((e==="v4"||!e)&&ml.test(t)||(e==="v6"||!e)&&yl.test(t))}function xl(t,e){if(!dl.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Il(t,e){return!!((e==="v4"||!e)&&gl.test(t)||(e==="v6"||!e)&&_l.test(t))}class nt extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){const s=this._getOrReturnCtx(e);return x(s,{code:w.invalid_type,expected:R.string,received:s.parsedType}),V}const n=new xe;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),x(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),x(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?x(a,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&x(a,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")hl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"email",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Sn||(Sn=new RegExp(pl,"u")),Sn.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"emoji",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ul.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"uuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")ll.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"nanoid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")il.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"cuid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")ol.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"cuid2",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")cl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"ulid",code:w.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),x(a,{validation:"url",code:w.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"regex",code:w.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Sl(s).test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?bl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?El(s).test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{code:w.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?fl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"duration",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Tl(e.data,s.version)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"ip",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?xl(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"jwt",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Il(e.data,s.version)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"cidr",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?vl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"base64",code:w.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?wl.test(e.data)||(a=this._getOrReturnCtx(e,a),x(a,{validation:"base64url",code:w.invalid_string,message:s.message}),n.dirty()):te.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:w.invalid_string,...N.errToObj(n)})}_addCheck(e){return new nt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...N.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...N.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...N.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...N.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...N.errToObj(r)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new nt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new nt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new nt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}nt.create=t=>new nt({checks:[],typeName:b.ZodString,coerce:t?.coerce??!1,...X(t)});function Al(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class zt extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){const s=this._getOrReturnCtx(e);return x(s,{code:w.invalid_type,expected:R.number,received:s.parsedType}),V}let n;const a=new xe;for(const s of this._def.checks)s.kind==="int"?te.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:w.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Al(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_finite,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new zt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new zt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&te.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}zt.create=t=>new zt({checks:[],typeName:b.ZodNumber,coerce:t?.coerce||!1,...X(t)});class ur extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n;const a=new xe;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):te.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return x(r,{code:w.invalid_type,expected:R.bigint,received:r.parsedType}),V}gte(e,r){return this.setLimit("min",e,!0,N.toString(r))}gt(e,r){return this.setLimit("min",e,!1,N.toString(r))}lte(e,r){return this.setLimit("max",e,!0,N.toString(r))}lt(e,r){return this.setLimit("max",e,!1,N.toString(r))}setLimit(e,r,n,a){return new ur({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:N.toString(a)}]})}_addCheck(e){return new ur({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ur.create=t=>new ur({checks:[],typeName:b.ZodBigInt,coerce:t?.coerce??!1,...X(t)});class Fa extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.boolean,received:n.parsedType}),V}return Ne(e.data)}}Fa.create=t=>new Fa({typeName:b.ZodBoolean,coerce:t?.coerce||!1,...X(t)});class Wr extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){const s=this._getOrReturnCtx(e);return x(s,{code:w.invalid_type,expected:R.date,received:s.parsedType}),V}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return x(s,{code:w.invalid_date}),V}const n=new xe;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),x(a,{code:w.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),x(a,{code:w.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):te.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Wr.create=t=>new Wr({checks:[],coerce:t?.coerce||!1,typeName:b.ZodDate,...X(t)});class Qs extends ee{_parse(e){if(this._getType(e)!==R.symbol){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.symbol,received:n.parsedType}),V}return Ne(e.data)}}Qs.create=t=>new Qs({typeName:b.ZodSymbol,...X(t)});class Ba extends ee{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.undefined,received:n.parsedType}),V}return Ne(e.data)}}Ba.create=t=>new Ba({typeName:b.ZodUndefined,...X(t)});class ei extends ee{_parse(e){if(this._getType(e)!==R.null){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.null,received:n.parsedType}),V}return Ne(e.data)}}ei.create=t=>new ei({typeName:b.ZodNull,...X(t)});class lr extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Ne(e.data)}}lr.create=t=>new lr({typeName:b.ZodAny,...X(t)});class Ut extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ne(e.data)}}Ut.create=t=>new Ut({typeName:b.ZodUnknown,...X(t)});class mt extends ee{_parse(e){const r=this._getOrReturnCtx(e);return x(r,{code:w.invalid_type,expected:R.never,received:r.parsedType}),V}}mt.create=t=>new mt({typeName:b.ZodNever,...X(t)});class ti extends ee{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.void,received:n.parsedType}),V}return Ne(e.data)}}ti.create=t=>new ti({typeName:b.ZodVoid,...X(t)});class Ye extends ee{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==R.array)return x(r,{code:w.invalid_type,expected:R.array,received:r.parsedType}),V;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(x(r,{code:i?w.too_big:w.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(x(r,{code:w.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(x(r,{code:w.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new Qe(r,i,r.path,o)))).then(i=>xe.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new Qe(r,i,r.path,o)));return xe.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ye({...this._def,minLength:{value:e,message:N.toString(r)}})}max(e,r){return new Ye({...this._def,maxLength:{value:e,message:N.toString(r)}})}length(e,r){return new Ye({...this._def,exactLength:{value:e,message:N.toString(r)}})}nonempty(e){return this.min(1,e)}}Ye.create=(t,e)=>new Ye({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...X(e)});function Mt(t){if(t instanceof le){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=pt.create(Mt(n))}return new le({...t._def,shape:()=>e})}else return t instanceof Ye?new Ye({...t._def,type:Mt(t.element)}):t instanceof pt?pt.create(Mt(t.unwrap())):t instanceof Ht?Ht.create(Mt(t.unwrap())):t instanceof it?it.create(t.items.map(e=>Mt(e))):t}class le extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=te.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){const u=this._getOrReturnCtx(e);return x(u,{code:w.invalid_type,expected:R.object,received:u.parsedType}),V}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof mt&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const l=s[u],d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Qe(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof mt){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:a.data[l]}});else if(u==="strict")o.length>0&&(x(a,{code:w.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of o){const d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Qe(a,d,a.path,l)),alwaysSet:l in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>xe.mergeObjectSync(n,u)):xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new le({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:N.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new le({...this._def,unknownKeys:"strip"})}passthrough(){return new le({...this._def,unknownKeys:"passthrough"})}extend(e){return new le({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new le({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new le({...this._def,catchall:e})}pick(e){const r={};for(const n of te.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new le({...this._def,shape:()=>r})}omit(e){const r={};for(const n of te.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new le({...this._def,shape:()=>r})}deepPartial(){return Mt(this)}partial(e){const r={};for(const n of te.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new le({...this._def,shape:()=>r})}required(e){const r={};for(const n of te.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof pt;)s=s._def.innerType;r[n]=s}return new le({...this._def,shape:()=>r})}keyof(){return oc(te.objectKeys(this.shape))}}le.create=(t,e)=>new le({shape:()=>t,unknownKeys:"strip",catchall:mt.create(),typeName:b.ZodObject,...X(e)});le.strictCreate=(t,e)=>new le({shape:()=>t,unknownKeys:"strict",catchall:mt.create(),typeName:b.ZodObject,...X(e)});le.lazycreate=(t,e)=>new le({shape:t,unknownKeys:"strip",catchall:mt.create(),typeName:b.ZodObject,...X(e)});class Kr extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new De(o.ctx.common.issues));return x(r,{code:w.invalid_union,unionErrors:i}),V}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(c=>new De(c));return x(r,{code:w.invalid_union,unionErrors:o}),V}}get options(){return this._def.options}}Kr.create=(t,e)=>new Kr({options:t,typeName:b.ZodUnion,...X(e)});function za(t,e){const r=ft(t),n=ft(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){const a=te.objectKeys(e),s=te.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const c=za(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],c=za(i,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Yr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(Ks(s)||Ks(i))return V;const o=za(s.value,i.value);return o.valid?((Ys(s)||Ys(i))&&r.dirty(),{status:r.value,value:o.data}):(x(n,{code:w.invalid_intersection_types}),V)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Yr.create=(t,e,r)=>new Yr({left:t,right:e,typeName:b.ZodIntersection,...X(r)});class it extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return x(n,{code:w.invalid_type,expected:R.array,received:n.parsedType}),V;if(n.data.length<this._def.items.length)return x(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),V;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Qe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>xe.mergeArray(r,i)):xe.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new it({...this._def,rest:e})}}it.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new it({items:t,typeName:b.ZodTuple,rest:null,...X(e)})};class Xr extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return x(n,{code:w.invalid_type,expected:R.object,received:n.parsedType}),V;const a=[],s=this._def.keyType,i=this._def.valueType;for(const o in n.data)a.push({key:s._parse(new Qe(n,o,n.path,o)),value:i._parse(new Qe(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?xe.mergeObjectAsync(r,a):xe.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ee?new Xr({keyType:e,valueType:r,typeName:b.ZodRecord,...X(n)}):new Xr({keyType:nt.create(),valueType:e,typeName:b.ZodRecord,...X(r)})}}class ri extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return x(n,{code:w.invalid_type,expected:R.map,received:n.parsedType}),V;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new Qe(n,o,n.path,[u,"key"])),value:s._parse(new Qe(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return V;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return V;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}}ri.create=(t,e,r)=>new ri({valueType:e,keyType:t,typeName:b.ZodMap,...X(r)});class dr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return x(n,{code:w.invalid_type,expected:R.set,received:n.parsedType}),V;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(x(n,{code:w.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(x(n,{code:w.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const l of c){if(l.status==="aborted")return V;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>s._parse(new Qe(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new dr({...this._def,minSize:{value:e,message:N.toString(r)}})}max(e,r){return new dr({...this._def,maxSize:{value:e,message:N.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}dr.create=(t,e)=>new dr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...X(e)});class sr extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.function)return x(r,{code:w.invalid_type,expected:R.function,received:r.parsedType}),V;function n(o,c){return Ua({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Da(),cr].filter(u=>!!u),issueData:{code:w.invalid_arguments,argumentsError:c}})}function a(o,c){return Ua({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Da(),cr].filter(u=>!!u),issueData:{code:w.invalid_return_type,returnTypeError:c}})}const s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof fr){const o=this;return Ne(async function(...c){const u=new De([]),l=await o._def.args.parseAsync(c,s).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(i,this,l);return await o._def.returns._def.type.parseAsync(d,s).catch(h=>{throw u.addIssue(a(d,h)),u})})}else{const o=this;return Ne(function(...c){const u=o._def.args.safeParse(c,s);if(!u.success)throw new De([n(c,u.error)]);const l=Reflect.apply(i,this,u.data),d=o._def.returns.safeParse(l,s);if(!d.success)throw new De([a(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sr({...this._def,args:it.create(e).rest(Ut.create())})}returns(e){return new sr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new sr({args:e||it.create([]).rest(Ut.create()),returns:r||Ut.create(),typeName:b.ZodFunction,...X(n)})}}class ni extends ee{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}ni.create=(t,e)=>new ni({getter:t,typeName:b.ZodLazy,...X(e)});class qa extends ee{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return x(r,{received:r.data,code:w.invalid_literal,expected:this._def.value}),V}return{status:"valid",value:e.data}}get value(){return this._def.value}}qa.create=(t,e)=>new qa({value:t,typeName:b.ZodLiteral,...X(e)});function oc(t,e){return new qt({values:t,typeName:b.ZodEnum,...X(e)})}class qt extends ee{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return x(r,{expected:te.joinValues(n),received:r.parsedType,code:w.invalid_type}),V}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return x(r,{received:r.data,code:w.invalid_enum_value,options:n}),V}return Ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return qt.create(e,{...this._def,...r})}exclude(e,r=this._def){return qt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}qt.create=oc;class ai extends ee{_parse(e){const r=te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){const a=te.objectValues(r);return x(n,{expected:te.joinValues(a),received:n.parsedType,code:w.invalid_type}),V}if(this._cache||(this._cache=new Set(te.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=te.objectValues(r);return x(n,{received:n.data,code:w.invalid_enum_value,options:a}),V}return Ne(e.data)}get enum(){return this._def.values}}ai.create=(t,e)=>new ai({values:t,typeName:b.ZodNativeEnum,...X(e)});class fr extends ee{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return x(r,{code:w.invalid_type,expected:R.promise,received:r.parsedType}),V;const n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Ne(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}fr.create=(t,e)=>new fr({type:t,typeName:b.ZodPromise,...X(e)});class Gt extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{x(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return V;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?V:c.status==="dirty"||r.value==="dirty"?tr(c.value):c});{if(r.value==="aborted")return V;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?V:o.status==="dirty"||r.value==="dirty"?tr(o.value):o}}if(a.type==="refinement"){const i=o=>{const c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?V:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?V:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Bt(i))return V;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Bt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):V);te.assertNever(a)}}Gt.create=(t,e,r)=>new Gt({schema:t,typeName:b.ZodEffects,effect:e,...X(r)});Gt.createWithPreprocess=(t,e,r)=>new Gt({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...X(r)});class pt extends ee{_parse(e){return this._getType(e)===R.undefined?Ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pt.create=(t,e)=>new pt({innerType:t,typeName:b.ZodOptional,...X(e)});class Ht extends ee{_parse(e){return this._getType(e)===R.null?Ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ht.create=(t,e)=>new Ht({innerType:t,typeName:b.ZodNullable,...X(e)});class Ga extends ee{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Ga.create=(t,e)=>new Ga({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...X(e)});class Ha extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new De(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new De(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ha.create=(t,e)=>new Ha({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...X(e)});class si extends ee{_parse(e){if(this._getType(e)!==R.nan){const n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:R.nan,received:n.parsedType}),V}return{status:"valid",value:e.data}}}si.create=t=>new si({typeName:b.ZodNaN,...X(t)});class Ol extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class cs extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?V:s.status==="dirty"?(r.dirty(),tr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?V:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new cs({in:e,out:r,typeName:b.ZodPipeline})}}class Za extends ee{_parse(e){const r=this._def.innerType._parse(e),n=a=>(Bt(a)&&(a.value=Object.freeze(a.value)),a);return Jr(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Za.create=(t,e)=>new Za({innerType:t,typeName:b.ZodReadonly,...X(e)});function ii(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Rl(t,e={},r){return t?lr.create().superRefine((n,a)=>{const s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){const o=ii(e,n),c=o.fatal??r??!0;a.addIssue({code:"custom",...o,fatal:c})}});if(!s){const i=ii(e,n),o=i.fatal??r??!0;a.addIssue({code:"custom",...i,fatal:o})}}):lr.create()}var b;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(b||(b={}));const wg=(t,e={message:`Input not instance of ${t.name}`})=>Rl(r=>r instanceof t,e),kl=nt.create,bg=zt.create,Eg=Fa.create,Sg=Ba.create,oi=lr.create;Ut.create;mt.create;const Tg=Ye.create,$l=le.create,xg=Kr.create;Yr.create;it.create;const Ig=Xr.create,Ag=sr.create,Og=qa.create,Rg=qt.create,kg=fr.create;pt.create;Ht.create;var Cl=Object.defineProperty,me=(t,e)=>{for(var r in e)Cl(t,r,{get:e[r],enumerable:!0})};function ot(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function us(t){return ot(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ls(t){return ot(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function cc(t){return ot(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function ds(t){return ot(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function uc(t){if(ot(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function lc(t){const e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);const r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);const a={};for(const s of t.split(";").slice(1)){const i=s.split("=");if(i.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);const o=i[0].trim(),c=i[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);a[o]=c}return{type:r,subtype:n,parameters:a}}function Qr({dataUrl:t,asTypedArray:e=!1}){const r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let n;if(r){n=r[1].toLowerCase();const a=e?Uint8Array.from(atob(r[2]),s=>s.charCodeAt(0)):r[2];return{mime_type:n,data:a}}}function dc(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function fs(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var Tn,ci;function Nl(){return ci||(ci=1,Tn=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}),Tn}var Pl=Nl();const Ml=br(Pl);var Lr={exports:{}},ui;function Ll(){if(ui)return Lr.exports;ui=1;const t=/[\p{Lu}]/u,e=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,a=/[_.\- ]+/,s=new RegExp("^"+a.source),i=new RegExp(a.source+n.source,"gu"),o=new RegExp("\\d+"+n.source,"gu"),c=(f,h,p)=>{let m=!1,g=!1,y=!1;for(let v=0;v<f.length;v++){const _=f[v];m&&t.test(_)?(f=f.slice(0,v)+"-"+f.slice(v),m=!1,y=g,g=!0,v++):g&&y&&e.test(_)?(f=f.slice(0,v-1)+"-"+f.slice(v-1),y=g,g=!1,m=!0):(m=h(_)===_&&p(_)!==_,y=g,g=p(_)===_&&h(_)!==_)}return f},u=(f,h)=>(r.lastIndex=0,f.replace(r,p=>h(p))),l=(f,h)=>(i.lastIndex=0,o.lastIndex=0,f.replace(i,(p,m)=>h(m)).replace(o,p=>h(p))),d=(f,h)=>{if(!(typeof f=="string"||Array.isArray(f)))throw new TypeError("Expected the input to be `string | string[]`");if(h={pascalCase:!1,preserveConsecutiveUppercase:!1,...h},Array.isArray(f)?f=f.map(y=>y.trim()).filter(y=>y.length).join("-"):f=f.trim(),f.length===0)return"";const p=h.locale===!1?y=>y.toLowerCase():y=>y.toLocaleLowerCase(h.locale),m=h.locale===!1?y=>y.toUpperCase():y=>y.toLocaleUpperCase(h.locale);return f.length===1?h.pascalCase?m(f):p(f):(f!==p(f)&&(f=c(f,p,m)),f=f.replace(s,""),h.preserveConsecutiveUppercase?f=u(f,p):f=p(f),h.pascalCase&&(f=m(f.charAt(0))+f.slice(1)),l(f,m))};return Lr.exports=d,Lr.exports.default=d,Lr.exports}var jl=Ll();const Dl=br(jl);function Ul(t,e){return e?.[t]||Ml(t)}function $g(t,e){return e?.[t]||Dl(t)}function Fl(t,e,r){const n={};for(const a in t)Object.hasOwn(t,a)&&(n[e(a,r)]=t[a]);return n}var Bl={};me(Bl,{Serializable:()=>hr,get_lc_unique_name:()=>hs});function li(t){return Array.isArray(t)?[...t]:{...t}}function zl(t,e){const r=li(t);for(const[n,a]of Object.entries(e)){const[s,...i]=n.split(".").reverse();let o=r;for(const c of i.reverse()){if(o[c]===void 0)break;o[c]=li(o[c]),o=o[c]}o[s]!==void 0&&(o[s]={lc:1,type:"secret",id:[a]})}return r}function hs(t){const e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var hr=class fc{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,hs(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof fc||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const e={},r={},n=Object.keys(this.lc_kwargs).reduce((a,s)=>(a[s]=s in this?this[s]:this.lc_kwargs[s],a),{});for(let a=Object.getPrototypeOf(this);a;a=Object.getPrototypeOf(a))Object.assign(e,Reflect.get(a,"lc_aliases",this)),Object.assign(r,Reflect.get(a,"lc_secrets",this)),Object.assign(n,Reflect.get(a,"lc_attributes",this));return Object.keys(r).forEach(a=>{let s=this,i=n;const[o,...c]=a.split(".").reverse();for(const u of c.reverse()){if(!(u in s)||s[u]===void 0)return;(!(u in i)||i[u]===void 0)&&(typeof s[u]=="object"&&s[u]!=null?i[u]={}:Array.isArray(s[u])&&(i[u]=[])),s=s[u],i=i[u]}o in s&&s[o]!==void 0&&(i[o]=i[o]||s[o])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:Fl(Object.keys(r).length?zl(n,r):n,Ul,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function D(t,e){return W(t)&&t.type===e}function W(t){return typeof t=="object"&&t!==null}function Xe(t){return Array.isArray(t)}function k(t){return typeof t=="string"}function qe(t){return typeof t=="number"}function ps(t){return t instanceof Uint8Array}function di(t){try{return JSON.parse(t)}catch{return}}const pr=t=>t();function ql(t){if(t.type==="char_location"&&k(t.document_title)&&qe(t.start_char_index)&&qe(t.end_char_index)&&k(t.cited_text)){const{document_title:e,start_char_index:r,end_char_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="page_location"&&k(t.document_title)&&qe(t.start_page_number)&&qe(t.end_page_number)&&k(t.cited_text)){const{document_title:e,start_page_number:r,end_page_number:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="content_block_location"&&k(t.document_title)&&qe(t.start_block_index)&&qe(t.end_block_index)&&k(t.cited_text)){const{document_title:e,start_block_index:r,end_block_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:a}}if(t.type==="web_search_result_location"&&k(t.url)&&k(t.title)&&k(t.encrypted_index)&&k(t.cited_text)){const{url:e,title:r,encrypted_index:n,cited_text:a,...s}=t;return{...s,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:a}}if(t.type==="search_result_location"&&k(t.source)&&k(t.title)&&qe(t.start_block_index)&&qe(t.end_block_index)&&k(t.cited_text)){const{source:e,title:r,start_block_index:n,end_block_index:a,cited_text:s,...i}=t;return{...i,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:a,citedText:s}}}function hc(t){if(D(t,"document")&&W(t.source)&&"type"in t.source){if(t.source.type==="base64"&&k(t.source.media_type)&&k(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&k(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&k(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&k(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(D(t,"image")&&W(t.source)&&"type"in t.source){if(t.source.type==="base64"&&k(t.source.media_type)&&k(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&k(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&k(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function Gl(t){function*e(){for(const r of t){const n=hc(r);n?yield n:yield r}}return Array.from(e())}function fi(t){function*e(){const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r){if(D(n,"text")&&k(n.text)){const{text:a,citations:s,...i}=n;if(Xe(s)&&s.length){const o=s.reduce((c,u)=>{const l=ql(u);return l?[...c,l]:c},[]);yield{...i,type:"text",text:a,annotations:o};continue}else{yield{...i,type:"text",text:a};continue}}else if(D(n,"thinking")&&k(n.thinking)){const{thinking:a,signature:s,...i}=n;yield{...i,type:"reasoning",reasoning:a,signature:s};continue}else if(D(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(D(n,"tool_use")&&k(n.name)&&k(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(D(n,"input_json_delta")){if(Zl(t)&&t.tool_call_chunks?.length){const a=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:a.id,name:a.name,args:a.args,index:a.index};continue}}else if(D(n,"server_tool_use")&&k(n.name)&&k(n.id)){const{name:a,id:s}=n;if(a==="web_search"){const i=pr(()=>{if(typeof n.input=="string")return n.input;if(W(n.input)&&k(n.input.query))return n.input.query;if(k(n.partial_json)){const o=di(n.partial_json);if(o?.query)return o.query}return""});yield{id:s,type:"server_tool_call",name:"web_search",args:{query:i}};continue}else if(n.name==="code_execution"){const i=pr(()=>{if(typeof n.input=="string")return n.input;if(W(n.input)&&k(n.input.code))return n.input.code;if(k(n.partial_json)){const o=di(n.partial_json);if(o?.code)return o.code}return""});yield{id:s,type:"server_tool_call",name:"code_execution",args:{code:i}};continue}}else if(D(n,"web_search_tool_result")&&k(n.tool_use_id)&&Xe(n.content)){const{content:a,tool_use_id:s}=n,i=a.reduce((o,c)=>D(c,"web_search_result")?[...o,c.url]:o,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:s,status:"success",output:{urls:i}};continue}else if(D(n,"code_execution_tool_result")&&k(n.tool_use_id)&&W(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(D(n,"mcp_tool_result")&&k(n.tool_use_id)&&W(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(D(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(D(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(D(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{const a=hc(n);if(a){yield a;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}const Hl={translateContent:fi,translateContentChunk:fi};function Zl(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function Vl(t){return us(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ls(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:ds(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Jl(t){return t.map(Vl)}function Wl(t){return!!(D(t,"image_url")&&W(t.image_url)||D(t,"input_audio")&&W(t.input_audio)||D(t,"file")&&W(t.file))}function Kl(t){if(D(t,"image_url")&&W(t.image_url)&&k(t.image_url.url)){const e=Qr({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(D(t,"input_audio")&&W(t.input_audio)&&k(t.input_audio.data)&&k(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(D(t,"file")&&W(t.file)&&k(t.file.data)){const e=Qr({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(k(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function Yl(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...ms(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Xl(t){const e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...ms(t.content));for(const r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function ms(t){const e=[];for(const r of t)Wl(r)?e.push(Kl(r)):e.push(r);return e}function Ql(t){if(t.type==="url_citation"){const{url:e,title:r,start_index:n,end_index:a}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:a}}if(t.type==="file_citation"){const{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function pc(t){function*e(){W(t.additional_kwargs?.reasoning)&&Xe(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((a,s)=>W(s)&&k(s.text)?`${a}${s.text}`:a,"")});const r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(const n of r)if(D(n,"text")){const{text:a,annotations:s,...i}=n;Array.isArray(s)?yield{...i,type:"text",text:String(a),annotations:s.map(Ql)}:yield{...i,type:"text",text:String(a)}}for(const n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(W(t.additional_kwargs)&&Xe(t.additional_kwargs.tool_outputs))for(const n of t.additional_kwargs.tool_outputs){if(D(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(D(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(D(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(D(n,"code_interpreter_call")){if(k(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Xe(n.outputs)){const a=pr(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(const s of n.outputs)if(D(s,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:a??0,stderr:[0,void 0].includes(a)?void 0:String(s.logs),stdout:[0,void 0].includes(a)?String(s.logs):void 0}};continue}}continue}else if(D(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(D(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(D(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(D(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}W(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function ed(t){function*e(){yield*pc(t);for(const r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}const td={translateContent:t=>typeof t.content=="string"?Yl(t):pc(t),translateContentChunk:t=>typeof t.content=="string"?Xl(t):ed(t)};function rd(t,e="pretty"){return e==="pretty"?nd(t):JSON.stringify(t)}function nd(t){const e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),a="=".repeat(n),s=r.length%2===0?a:`${a}=`;if(e.push(`${a}${r}${s}`),t.type==="ai"){const i=t;if(i.tool_calls&&i.tool_calls.length>0){e.push("Tool Calls:");for(const o of i.tool_calls){e.push(` ${o.name} (${o.id})`),e.push(` Call ID: ${o.id}`),e.push(" Args:");for(const[c,u]of Object.entries(o.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){const i=t;i.name&&e.push(`Name: ${i.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
|
|
4
4
|
`)}const xn=Symbol.for("langchain.message");function yt(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>ot(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?Vt(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>ot(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function gs(t,e){return t==="error"||e==="error"?"error":"success"}function ad(t,e){function r(n,a){if(typeof n!="object"||n===null||n===void 0)return n;if(a>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(i=>r(i,a+1));const s={};for(const i of Object.keys(n))s[i]=r(n[i],a+1);return s}return JSON.stringify(r(t,0),null,2)}var tt=class extends hr{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[xn]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){const e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){const t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[Jl,ms,Gl].reduce((n,a)=>a(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&xn in t&&t[xn]===!0&&fs(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;const e=ad(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return rd(this,t)}};function mc(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function ve(t={},e={}){const r={...t};for(const[n,a]of Object.entries(e))if(r[n]==null)r[n]=a;else{if(a==null)continue;if(typeof r[n]!=typeof a||Array.isArray(r[n])!==Array.isArray(a))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?r[n]=a:r[n]+=a}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=ve(r[n],a);else if(Array.isArray(r[n]))r[n]=Vt(r[n],a);else{if(r[n]===a)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function Vt(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{const r=[...t];for(const n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){const a=r.findIndex(s=>{const i=typeof s=="object",o="index"in s&&s.index===n.index,c="id"in s&&"id"in n&&s?.id===n?.id,u=!("id"in s)||!s?.id||!("id"in n)||!n?.id;return i&&o&&(c||u)});a!==-1&&typeof r[a]=="object"&&r[a]!==null?r[a]=ve(r[a],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function ys(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as F,a as z,p as B,_ as k,C as w,G as j,c as K,b as U,R as L,d as P,e as V,m as H,f as S,g as Z,h as G,T as C,v as W,j as q,k as Y,l as O,o as Q,s as X,n as tt,q as et,r as I,t as N,u as E,w as at}from"./index-
|
|
1
|
+
import{i as F,a as z,p as B,_ as k,C as w,G as j,c as K,b as U,R as L,d as P,e as V,m as H,f as S,g as Z,h as G,T as C,v as W,j as q,k as Y,l as O,o as Q,s as X,n as tt,q as et,r as I,t as N,u as E,w as at}from"./index-I27vQsLz.js";import{O as M,B as st,a as nt,b as rt,i as ot,c as it,d as lt,e as ct}from"./index-FYQEmRnY.js";import{p as ut}from"./index-Dx3O2_mP.js";function R(t,e){if(t.function===void 0)return;let a;if(e?.partial)try{a=B(t.function.arguments??"{}")}catch{return}else try{a=JSON.parse(t.function.arguments)}catch(r){throw new M([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${r.message}`].join(`
|
|
2
2
|
`))}const s={name:t.function.name,args:a,type:"tool_call"};return e?.returnId&&(s.id=t.id),s}function ht(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function mt(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var x=class extends st{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){const a=t[0].message;let s;if(z(a)&&a.tool_calls?.length?s=a.tool_calls.map(n=>{const{id:h,...u}=n;return this.returnId?{id:h,...u}:u}):a.additional_kwargs.tool_calls!==void 0&&(s=JSON.parse(JSON.stringify(a.additional_kwargs.tool_calls)).map(h=>R(h,{returnId:this.returnId,partial:e}))),!s)return[];const r=[];for(const n of s)if(n!==void 0){const h={type:n.name,args:n.args,id:n.id};r.push(h)}return r}},dt=class extends x{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;const e=await F(this.zodSchema,t);if(e.success)return e.data;throw new M(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){const a=(await super.parsePartialResult(t)).filter(r=>r.type===this.keyName);let s=a;if(a.length)return this.returnId||(s=a.map(r=>r.args)),this.returnSingle?s[0]:s}async parseResult(t){const a=(await super.parsePartialResult(t,!1)).filter(n=>n.type===this.keyName);let s=a;return a.length?(this.returnId||(s=a.map(n=>n.args)),this.returnSingle?this._validateResult(s[0]):await Promise.all(s.map(n=>this._validateResult(n)))):void 0}},gt={};k(gt,{JsonOutputKeyToolsParser:()=>dt,JsonOutputToolsParser:()=>x,convertLangChainToolCallToOpenAI:()=>ht,makeInvalidToolCall:()=>mt,parseToolCall:()=>R});var pt={};k(pt,{BaseLLM:()=>J,LLM:()=>ft});var J=class v extends nt{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,a){const s=v._convertInputToPromptValue(e);return(await this.generatePrompt([s],a,a?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,a,s){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){const[a,s]=super._separateRunnableConfigFromCallOptions(e);return s.signal=a.signal,[a,s]}async*_streamIterator(e,a){if(this._streamResponseChunks===v.prototype._streamResponseChunks)yield this.invoke(e,a);else{const s=v._convertInputToPromptValue(e),[r,n]=this._separateRunnableConfigFromCallOptionsCompat(a),h=await w.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}),u={options:n,invocation_params:this?.invocationParams(n),batch_size:1},l=await h?.handleLLMStart(this.toJSON(),[s.toString()],r.runId,void 0,u,void 0,void 0,r.runName);let i=new j({text:""});try{for await(const o of this._streamResponseChunks(s.toString(),n,l?.[0]))i?i=i.concat(o):i=o,typeof o.text=="string"&&(yield o.text)}catch(o){throw await Promise.all((l??[]).map(c=>c?.handleLLMError(o))),o}await Promise.all((l??[]).map(o=>o?.handleLLMEnd({generations:[[i]]})))}}async generatePrompt(e,a,s){const r=e.map(n=>n.toString());return this.generate(r,a,s)}invocationParams(e){return{}}_flattenLLMResult(e){const a=[];for(let s=0;s<e.generations.length;s+=1){const r=e.generations[s];if(s===0)a.push({generations:[r],llmOutput:e.llmOutput});else{const n=e.llmOutput?{...e.llmOutput,tokenUsage:{}}:void 0;a.push({generations:[r],llmOutput:n})}}return a}async _generateUncached(e,a,s,r){let n;if(r!==void 0&&r.length===e.length)n=r;else{const i=await w.configure(s.callbacks,this.callbacks,s.tags,this.tags,s.metadata,this.metadata,{verbose:this.verbose}),o={options:a,invocation_params:this?.invocationParams(a),batch_size:e.length};n=await i?.handleLLMStart(this.toJSON(),e,s.runId,void 0,o,void 0,void 0,s?.runName)}const h=!!n?.[0].handlers.find(K);let u;if(h&&e.length===1&&this._streamResponseChunks!==v.prototype._streamResponseChunks)try{const i=await this._streamResponseChunks(e[0],a,n?.[0]);let o;for await(const c of i)o===void 0?o=c:o=U(o,c);if(o===void 0)throw new Error("Received empty response from chat model call.");u={generations:[[o]],llmOutput:{}},await n?.[0].handleLLMEnd(u)}catch(i){throw await n?.[0].handleLLMError(i),i}else{try{u=await this._generate(e,a,n?.[0])}catch(o){throw await Promise.all((n??[]).map(c=>c?.handleLLMError(o))),o}const i=this._flattenLLMResult(u);await Promise.all((n??[]).map((o,c)=>o?.handleLLMEnd(i[c])))}const l=n?.map(i=>i.runId)||void 0;return Object.defineProperty(u,L,{value:l?{runIds:l}:void 0,configurable:!0}),u}async _generateCached({prompts:e,cache:a,llmStringKey:s,parsedOptions:r,handledOptions:n,runId:h}){const u=await w.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}),l={options:r,invocation_params:this?.invocationParams(r),batch_size:e.length},i=await u?.handleLLMStart(this.toJSON(),e,h,void 0,l,void 0,void 0,n?.runName),o=[],p=(await Promise.allSettled(e.map(async(g,f)=>{const y=await a.lookup(g,s);return y==null&&o.push(f),y}))).map((g,f)=>({result:g,runManager:i?.[f]})).filter(({result:g})=>g.status==="fulfilled"&&g.value!=null||g.status==="rejected"),d=[];await Promise.all(p.map(async({result:g,runManager:f},y)=>{if(g.status==="fulfilled"){const _=g.value;return d[y]=_.map(b=>(b.generationInfo={...b.generationInfo,tokenUsage:{}},b)),_.length&&await f?.handleLLMNewToken(_[0].text),f?.handleLLMEnd({generations:[_]},void 0,void 0,void 0,{cached:!0})}else return await f?.handleLLMError(g.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(g.reason)}));const m={generations:d,missingPromptIndices:o,startedRunManagers:i};return Object.defineProperty(m,L,{value:i?{runIds:i?.map(g=>g.runId)}:void 0,configurable:!0}),m}async generate(e,a,s){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let r;Array.isArray(a)?r={stop:a}:r=a;const[n,h]=this._separateRunnableConfigFromCallOptionsCompat(r);if(n.callbacks=n.callbacks??s,!this.cache)return this._generateUncached(e,h,n);const{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(h),{generations:i,missingPromptIndices:o,startedRunManagers:c}=await this._generateCached({prompts:e,cache:u,llmStringKey:l,parsedOptions:h,handledOptions:n,runId:n.runId});let p={};if(o.length>0){const d=await this._generateUncached(o.map(m=>e[m]),h,n,c!==void 0?o.map(m=>c?.[m]):void 0);await Promise.all(d.generations.map(async(m,g)=>{const f=o[g];return i[f]=m,u.update(e[f],l,m)})),p=d.llmOutput??{}}return{generations:i,llmOutput:p}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},ft=class extends J{async _generate(t,e,a){return{generations:await Promise.all(t.map((r,n)=>this._call(r,{...e,promptIndex:n},a).then(h=>[{text:h}])))}}},vt={};k(vt,{BaseToolkit:()=>yt,DynamicStructuredTool:()=>$,DynamicTool:()=>D,StructuredTool:()=>T,Tool:()=>A,ToolInputParsingException:()=>C,isLangChainTool:()=>ct,isRunnableToolLike:()=>lt,isStructuredTool:()=>it,isStructuredToolParams:()=>ot,tool:()=>_t});var T=class extends rt{returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata}async invoke(t,e){let a,s=V(H(this.defaultConfig,e));return S(t)?(a=t.args,s={...s,toolCall:t}):a=t,this.call(a,s)}async call(t,e,a){const s=S(t)?t.args:t;let r;if(Z(this.schema))try{r=await G(this.schema,s)}catch(d){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
|
|
3
3
|
Details: ${d.message}`),d instanceof Error&&d.constructor.name==="ZodError"&&(m=`${m}
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as $n,O as bt,h as jn,f as Bn,e as Ln,R as xt}from"./index-CNOfsJmB.js";import{i as Un,J as nn,a as St,ae as kt,H as qn,I as Wn,D as A,z as Mt,K as Fn,x as be,g as Tt,B as Dn,L as Hn}from"./index-D4BJ-4dv.js";import"./index-IsrJH759.js";import"./index-DRz5BQNA.js";var Rt=class extends $n{static lc_name(){return"AnthropicToolsOutputParser"}lc_namespace=["langchain","anthropic","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(s.message)}`,t)}else e=t;if(this.zodSchema===void 0)return e;const n=await Un(this.zodSchema,e);if(n.success)return n.data;throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(t){const e=t.flatMap(r=>{const{message:i}=r;return Array.isArray(i.content)?sn(i.content)[0]:[]});if(e[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}};function sn(t){const e=[];for(const n of t)n.type==="tool_use"&&e.push({name:n.name,args:n.input,id:n.id,type:"tool_call"});return e}function Kn(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}function Jn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Xn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function Vn(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}const Qn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){const e=nn({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){const e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}},Gn=t=>t();function Yn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function Zn(t){function*e(){for(const n of t)Yn(n)&&(n.source==="char"?yield{type:"char_location",file_id:n.url??"",start_char_index:n.startIndex??0,end_char_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="page"?yield{type:"page_location",file_id:n.url??"",start_page_number:n.startIndex??0,end_page_number:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="block"?yield{type:"content_block_location",file_id:n.url??"",start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="url"?yield{type:"web_search_result_location",url:n.url??"",title:n.title??null,encrypted_index:String(n.startIndex??0),cited_text:n.citedText??""}:n.source==="search"&&(yield{type:"search_result_location",title:n.title??null,start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,search_result_index:0,source:n.source??"",cited_text:n.citedText??""}))}return Array.from(e())}function G(t){return typeof t=="string"?t:es(t)}function es(t){const e=[];for(let n=0,{length:s}=t;n<s;n++)e.push(String.fromCharCode(t[n]));return btoa(e.join(""))}function Ve(t){return(t??"").split(";")[0].toLowerCase()}function he(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function H(t,e){const n=he(e,"cache_control");n!==void 0&&(t.cache_control=n);const s=he(e,"citations");s!==void 0&&(t.citations=s);const r=he(e,"context");r!==void 0&&(t.context=r);const i=he(e,"title");return i!==void 0&&(t.title=i),t}function Qe(t,e){const n=he(e,"cache_control");return n!==void 0&&(t.cache_control=n),t}function At(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function ts(t){const e=[],n=t.response_metadata,s="model_provider"in n&&n?.model_provider==="anthropic";for(const r of t.contentBlocks)if(r.type==="text")r.annotations?e.push({type:"text",text:r.text,citations:Zn(r.annotations)}):e.push({type:"text",text:r.text});else if(r.type==="tool_call")e.push({type:"tool_use",id:r.id??"",name:r.name,input:r.args});else if(r.type==="tool_call_chunk"){const i=Gn(()=>{if(typeof r.args!="string")return r.args;try{return JSON.parse(r.args)}catch{return{}}});e.push({type:"tool_use",id:r.id??"",name:r.name??"",input:i})}else if(r.type==="reasoning"&&s)e.push({type:"thinking",thinking:r.reasoning,signature:String(r.signature)});else if(r.type==="server_tool_call"&&s)r.name==="web_search"?e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args}):r.name==="code_execution"&&e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args});else if(r.type==="server_tool_call_result"&&s)if(r.name==="web_search"&&Array.isArray(r.output.urls)){const i=r.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:r.toolCallId??"",content:i})}else r.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:r.toolCallId??"",content:r.output}):r.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:r.toolCallId??"",content:r.output});else{if(r.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(r.type==="file"){const i=r.metadata;if(r.fileId){e.push(H({type:"document",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){const a=Ve(r.mimeType);if(a==="application/pdf"||a===""){e.push(H({type:"document",source:{type:"url",url:r.url}},i));continue}}if(r.data){const a=Ve(r.mimeType);if(a===""||a==="application/pdf")e.push(H({type:"document",source:{type:"base64",data:G(r.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},i));else if(At(a))e.push(H({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:G(r.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(r.type==="image"){const i=r.metadata;if(r.fileId){e.push(Qe({type:"image",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){e.push(Qe({type:"image",source:{type:"url",url:r.url}},i));continue}if(r.data){const a=Ve(r.mimeType)||"image/png";At(a)&&e.push(Qe({type:"image",source:{type:"base64",data:G(r.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else r.type==="video"||(r.type==="text-plain"?r.data&&e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},r.metadata)):r.type==="non_standard"&&s&&e.push(r.value))}return e}function vt(t){const e=nn({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let n;try{n=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
|
|
1
|
+
import{g as $n,O as bt,h as jn,f as Bn,e as Ln,R as xt}from"./index-FYQEmRnY.js";import{i as Un,J as nn,a as St,ae as kt,H as qn,I as Wn,D as A,z as Mt,K as Fn,x as be,g as Tt,B as Dn,L as Hn}from"./index-I27vQsLz.js";import"./index-Dx3O2_mP.js";import"./index-DRz5BQNA.js";var Rt=class extends $n{static lc_name(){return"AnthropicToolsOutputParser"}lc_namespace=["langchain","anthropic","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(s.message)}`,t)}else e=t;if(this.zodSchema===void 0)return e;const n=await Un(this.zodSchema,e);if(n.success)return n.data;throw new bt(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(t){const e=t.flatMap(r=>{const{message:i}=r;return Array.isArray(i.content)?sn(i.content)[0]:[]});if(e[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}};function sn(t){const e=[];for(const n of t)n.type==="tool_use"&&e.push({name:n.name,args:n.input,id:n.id,type:"tool_call"});return e}function Kn(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}function Jn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Xn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function Vn(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}const Qn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){const e=nn({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){const e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}},Gn=t=>t();function Yn(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function Zn(t){function*e(){for(const n of t)Yn(n)&&(n.source==="char"?yield{type:"char_location",file_id:n.url??"",start_char_index:n.startIndex??0,end_char_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="page"?yield{type:"page_location",file_id:n.url??"",start_page_number:n.startIndex??0,end_page_number:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="block"?yield{type:"content_block_location",file_id:n.url??"",start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,document_title:n.title??null,document_index:0,cited_text:n.citedText??""}:n.source==="url"?yield{type:"web_search_result_location",url:n.url??"",title:n.title??null,encrypted_index:String(n.startIndex??0),cited_text:n.citedText??""}:n.source==="search"&&(yield{type:"search_result_location",title:n.title??null,start_block_index:n.startIndex??0,end_block_index:n.endIndex??0,search_result_index:0,source:n.source??"",cited_text:n.citedText??""}))}return Array.from(e())}function G(t){return typeof t=="string"?t:es(t)}function es(t){const e=[];for(let n=0,{length:s}=t;n<s;n++)e.push(String.fromCharCode(t[n]));return btoa(e.join(""))}function Ve(t){return(t??"").split(";")[0].toLowerCase()}function he(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function H(t,e){const n=he(e,"cache_control");n!==void 0&&(t.cache_control=n);const s=he(e,"citations");s!==void 0&&(t.citations=s);const r=he(e,"context");r!==void 0&&(t.context=r);const i=he(e,"title");return i!==void 0&&(t.title=i),t}function Qe(t,e){const n=he(e,"cache_control");return n!==void 0&&(t.cache_control=n),t}function At(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function ts(t){const e=[],n=t.response_metadata,s="model_provider"in n&&n?.model_provider==="anthropic";for(const r of t.contentBlocks)if(r.type==="text")r.annotations?e.push({type:"text",text:r.text,citations:Zn(r.annotations)}):e.push({type:"text",text:r.text});else if(r.type==="tool_call")e.push({type:"tool_use",id:r.id??"",name:r.name,input:r.args});else if(r.type==="tool_call_chunk"){const i=Gn(()=>{if(typeof r.args!="string")return r.args;try{return JSON.parse(r.args)}catch{return{}}});e.push({type:"tool_use",id:r.id??"",name:r.name??"",input:i})}else if(r.type==="reasoning"&&s)e.push({type:"thinking",thinking:r.reasoning,signature:String(r.signature)});else if(r.type==="server_tool_call"&&s)r.name==="web_search"?e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args}):r.name==="code_execution"&&e.push({type:"server_tool_use",name:r.name,id:r.id??"",input:r.args});else if(r.type==="server_tool_call_result"&&s)if(r.name==="web_search"&&Array.isArray(r.output.urls)){const i=r.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:r.toolCallId??"",content:i})}else r.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:r.toolCallId??"",content:r.output}):r.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:r.toolCallId??"",content:r.output});else{if(r.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(r.type==="file"){const i=r.metadata;if(r.fileId){e.push(H({type:"document",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){const a=Ve(r.mimeType);if(a==="application/pdf"||a===""){e.push(H({type:"document",source:{type:"url",url:r.url}},i));continue}}if(r.data){const a=Ve(r.mimeType);if(a===""||a==="application/pdf")e.push(H({type:"document",source:{type:"base64",data:G(r.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},i));else if(At(a))e.push(H({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:G(r.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(r.type==="image"){const i=r.metadata;if(r.fileId){e.push(Qe({type:"image",source:{type:"file",file_id:r.fileId}},i));continue}if(r.url){e.push(Qe({type:"image",source:{type:"url",url:r.url}},i));continue}if(r.data){const a=Ve(r.mimeType)||"image/png";At(a)&&e.push(Qe({type:"image",source:{type:"base64",data:G(r.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else r.type==="video"||(r.type==="text-plain"?r.data&&e.push(H({type:"document",source:{type:"text",data:G(r.data),media_type:"text/plain"}},r.metadata)):r.type==="non_standard"&&s&&e.push(r.value))}return e}function vt(t){const e=nn({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let n;try{n=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
|
|
2
2
|
|
|
3
3
|
`))}if(n.protocol==="http:"||n.protocol==="https:")return{type:"url",url:t};throw new Error([`Invalid image URL protocol: ${JSON.stringify(n.protocol)}. Anthropic only supports images as http, https, or base64-encoded data URLs on 'image_url' content blocks.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as St,g as zo}from"./index-
|
|
1
|
+
import{e as St,g as zo}from"./index-Dx3O2_mP.js";import{u as Go}from"./util-t-trnxQI.js";import{_ as $o}from"./__vite-browser-external-D7Ct-6yo.js";import{r as Yo}from"./index-DRz5BQNA.js";import{p as Vo}from"./path-C2bN6h38.js";function Ko(r,i){for(var g=0;g<i.length;g++){const E=i[g];if(typeof E!="string"&&!Array.isArray(E)){for(const d in E)if(d!=="default"&&!(d in r)){const l=Object.getOwnPropertyDescriptor(E,d);l&&Object.defineProperty(r,d,l.get?l:{enumerable:!0,get:()=>E[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var Pt={},ze={},Tt,rn;function ye(){if(rn)return Tt;rn=1;function r(m){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r(m)}function i(m,s,c){return Object.defineProperty(m,"prototype",{writable:!1}),m}function g(m,s){if(!(m instanceof s))throw new TypeError("Cannot call a class as a function")}function E(m,s,c){return s=p(s),d(m,_()?Reflect.construct(s,c||[],p(m).constructor):s.apply(m,c))}function d(m,s){if(s&&(r(s)=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l(m)}function l(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function h(m,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(s&&s.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),Object.defineProperty(m,"prototype",{writable:!1}),s&&x(m,s)}function t(m){var s=typeof Map=="function"?new Map:void 0;return t=function(a){if(a===null||!y(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(a))return s.get(a);s.set(a,o)}function o(){return u(a,arguments,p(this).constructor)}return o.prototype=Object.create(a.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),x(o,a)},t(m)}function u(m,s,c){if(_())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,s);var o=new(m.bind.apply(m,a));return c&&x(o,c.prototype),o}function _(){try{var m=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_=function(){return!!m})()}function y(m){try{return Function.toString.call(m).indexOf("[native code]")!==-1}catch{return typeof m=="function"}}function x(m,s){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(c,a){return c.__proto__=a,c},x(m,s)}function p(m){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},p(m)}var w=(function(m){function s(c){var a;return g(this,s),a=E(this,s,[`Format functions must be synchronous taking a two arguments: (info, opts)
|
|
2
2
|
Found: `.concat(c.toString().split(`
|
|
3
3
|
`)[0],`
|
|
4
4
|
`)]),Error.captureStackTrace(a,s),a}return h(s,m),i(s)})(t(Error));return Tt=function(m){if(m.length>2)throw new w(m);function s(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=a}s.prototype.transform=m;function c(a){return new s(a)}return c.Format=s,c},Tt}var Be={exports:{}},jt={exports:{}},Lt={exports:{}};const _e=St(Go);var Mt={exports:{}},nn;function Jo(){return nn||(nn=1,(function(r){var i={};r.exports=i;var g={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(g).forEach(function(E){var d=g[E],l=i[E]=[];l.open="\x1B["+d[0]+"m",l.close="\x1B["+d[1]+"m"})})(Mt)),Mt.exports}const be=St($o);var At,on;function Zo(){return on||(on=1,At=function(r,i){i=i||process.argv||[];var g=i.indexOf("--"),E=/^-{1,2}/.test(r)?"":"--",d=i.indexOf(E+r);return d!==-1&&(g===-1?!0:d<g)}),At}var Ct,an;function Qo(){if(an)return Ct;an=1;var r={},i=Zo(),g=r,E=void 0;i("no-color")||i("no-colors")||i("color=false")?E=!1:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(E=!0),"FORCE_COLOR"in g&&(E=g.FORCE_COLOR.length===0||parseInt(g.FORCE_COLOR,10)!==0);function d(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function l(t){if(E===!1)return 0;if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2;if(t&&!t.isTTY&&E!==!0)return 0;var u=E?1:0;if("CI"in g)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(y){return y in g})||g.CI_NAME==="codeship"?1:u;if("TEAMCITY_VERSION"in g)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(g.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in g){var _=parseInt((g.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(g.TERM_PROGRAM){case"iTerm.app":return _>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(g.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(g.TERM)||"COLORTERM"in g?1:(g.TERM==="dumb",u)}function h(t){var u=l(t);return d(u)}return Ct={supportsColor:h,stdout:h(process.stdout),stderr:h(process.stderr)},Ct}var It={exports:{}},un;function Xo(){return un||(un=1,(function(r){r.exports=function(g,E){var d="";g=g||"Run the trap, drop the bass",g=g.split("");var l={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return g.forEach(function(h){h=h.toLowerCase();var t=l[h]||[" "],u=Math.floor(Math.random()*t.length);typeof l[h]<"u"?d+=l[h][u]:d+=h}),d}})(It)),It.exports}var qt={exports:{}},sn;function ea(){return sn||(sn=1,(function(r){r.exports=function(g,E){g=g||" he is here ";var d={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},l=[].concat(d.up,d.down,d.mid);function h(_){var y=Math.floor(Math.random()*_);return y}function t(_){var y=!1;return l.filter(function(x){y=x===_}),y}function u(_,y){var x="",p,w;y=y||{},y.up=typeof y.up<"u"?y.up:!0,y.mid=typeof y.mid<"u"?y.mid:!0,y.down=typeof y.down<"u"?y.down:!0,y.size=typeof y.size<"u"?y.size:"maxi",_=_.split("");for(w in _)if(!t(w)){switch(x=x+_[w],p={up:0,down:0,mid:0},y.size){case"mini":p.up=h(8),p.mid=h(2),p.down=h(8);break;case"maxi":p.up=h(16)+3,p.mid=h(4)+1,p.down=h(64)+3;break;default:p.up=h(8)+1,p.mid=h(6)/2,p.down=h(8)+1;break}var m=["up","mid","down"];for(var s in m)for(var c=m[s],a=0;a<=p[c];a++)y[c]&&(x=x+d[c][h(d[c].length)])}return x}return u(g,E)}})(qt)),qt.exports}var Bt={exports:{}},fn;function ta(){return fn||(fn=1,(function(r){r.exports=function(i){return function(g,E,d){if(g===" ")return g;switch(E%3){case 0:return i.red(g);case 1:return i.white(g);case 2:return i.blue(g)}}}})(Bt)),Bt.exports}var Nt={exports:{}},ln;function ra(){return ln||(ln=1,(function(r){r.exports=function(i){return function(g,E,d){return E%2===0?g:i.inverse(g)}}})(Nt)),Nt.exports}var Ft={exports:{}},cn;function na(){return cn||(cn=1,(function(r){r.exports=function(i){var g=["red","yellow","green","blue","magenta"];return function(E,d,l){return E===" "?E:i[g[d++%g.length]](E)}}})(Ft)),Ft.exports}var Dt={exports:{}},hn;function ia(){return hn||(hn=1,(function(r){r.exports=function(i){var g=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(E,d,l){return E===" "?E:i[g[Math.round(Math.random()*(g.length-2))]](E)}}})(Dt)),Dt.exports}var pn;function oa(){return pn||(pn=1,(function(r){var i={};r.exports=i,i.themes={};var g=_e,E=i.styles=Jo(),d=Object.defineProperties,l=new RegExp(/[\r\n]+/g);i.supportsColor=Qo().supportsColor,typeof i.enabled>"u"&&(i.enabled=i.supportsColor()!==!1),i.enable=function(){i.enabled=!0},i.disable=function(){i.enabled=!1},i.stripColors=i.strip=function(s){return(""+s).replace(/\x1B\[\d+m/g,"")},i.stylize=function(c,a){if(!i.enabled)return c+"";var o=E[a];return!o&&a in i?i[a](c):o.open+c+o.close};var h=/[|\\{}()[\]^$+*?.]/g,t=function(s){if(typeof s!="string")throw new TypeError("Expected a string");return s.replace(h,"\\$&")};function u(s){var c=function a(){return x.apply(a,arguments)};return c._styles=s,c.__proto__=y,c}var _=(function(){var s={};return E.grey=E.gray,Object.keys(E).forEach(function(c){E[c].closeRe=new RegExp(t(E[c].close),"g"),s[c]={get:function(){return u(this._styles.concat(c))}}}),s})(),y=d(function(){},_);function x(){var s=Array.prototype.slice.call(arguments),c=s.map(function(S){return S!=null&&S.constructor===String?S:g.inspect(S)}).join(" ");if(!i.enabled||!c)return c;for(var a=c.indexOf(`
|
package/dist/client/index.html
CHANGED
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
rel="stylesheet"
|
|
28
28
|
/>
|
|
29
29
|
<title>Inspector | mcp-use</title>
|
|
30
|
-
<script type="module" crossorigin src="/inspector/assets/index-
|
|
30
|
+
<script type="module" crossorigin src="/inspector/assets/index-Dx3O2_mP.js"></script>
|
|
31
31
|
<link rel="stylesheet" crossorigin href="/inspector/assets/index-beDRbW3x.css">
|
|
32
|
-
<script>window.__INSPECTOR_VERSION__ = "0.12.
|
|
32
|
+
<script>window.__INSPECTOR_VERSION__ = "0.12.1-canary.1";</script>
|
|
33
33
|
</head>
|
|
34
34
|
<body>
|
|
35
35
|
<script>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/inspector",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.1-canary.1",
|
|
5
5
|
"description": "MCP Inspector - A tool for inspecting and debugging MCP servers",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/mcp-use/mcp-use.git",
|
|
12
|
-
"directory": "packages/inspector"
|
|
12
|
+
"directory": "libraries/typescript/packages/inspector"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/mcp-use/mcp-use/issues"
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"sonner": "^2.0.7",
|
|
84
84
|
"tailwind-merge": "^3.4.0",
|
|
85
85
|
"vite-express": "^0.21.1",
|
|
86
|
-
"mcp-use": "1.10.
|
|
86
|
+
"mcp-use": "1.10.1-canary.1"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|