@intelliweave/embedded 2.2.81 → 2.2.82
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/component/component.js +62 -24
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.js +1 -1
- package/dist/react/react.js +59 -21
- package/dist/script-tag/script-tag.js +62 -24
- package/dist/webpack/index.js +59 -21
- package/package.json +1 -1
- package/AGENTS.md +0 -12
|
@@ -87,9 +87,9 @@ New information found:
|
|
|
87
87
|
${o}
|
|
88
88
|
|
|
89
89
|
New tools available:
|
|
90
|
-
${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),o=encodeURIComponent(e.body),s=`mailto:${n}?subject=${i}&body=${o}`;try{window.location.href=s}catch(a){throw new Error(`Failed to open email client: ${a instanceof Error?a.message:String(a)}`)}return`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ve||(Ve={}));var OT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(OT||(OT={}));var Q=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mo=t=>{switch(typeof t){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(t)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(t)?Q.array:t===null?Q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Q.promise:typeof Map<"u"&&t instanceof Map?Q.map:typeof Set<"u"&&t instanceof Set?Q.set:typeof Date<"u"&&t instanceof Date?Q.date:Q.object;default:return Q.unknown}};var U=Ve.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"]);var bn=class t 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]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bn.create=t=>new bn(t);var A5=(t,e)=>{let r;switch(t.code){case U.invalid_type:t.received===Q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ve.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ve.joinValues(t.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ve.joinValues(t.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${Ve.joinValues(t.options)}, received '${t.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.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}"`:Ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case U.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 U.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 U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ve.assertNever(t)}return{message:r}},us=A5;var C5=us;function pp(){return C5}var rg=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function X(t,e){let r=pp(),n=rg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===us?void 0:us].filter(i=>!!i)});t.common.issues.push(n)}var Ar=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return be;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return be;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},be=Object.freeze({status:"aborted"}),Wc=t=>({status:"dirty",value:t}),Fr=t=>({status:"valid",value:t}),nw=t=>t.status==="aborted",iw=t=>t.status==="dirty",Pa=t=>t.status==="valid",fp=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var Rn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},NT=(t,e)=>{if(Pa(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;let r=new bn(t.common.issues);return this._error=r,this._error}}};function Pe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=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:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:i}}var Re=class{get description(){return this._def.description}_getType(e){return mo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ar,ctx:{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(fp(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parseSync({data:e,path:n.path,parent:n});return NT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Pa(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=>Pa(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(fp(i)?i:Promise.resolve(i));return NT(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:U.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ri({schema:this,typeName:ye.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 ti.create(this,this._def)}nullable(){return yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ps.create(this)}promise(){return Ta.create(this,this._def)}or(e){return Jc.create([this,e],this._def)}and(e){return Yc.create(this,e,this._def)}transform(e){return new ri({...Pe(this._def),schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new nu({...Pe(this._def),innerType:this,defaultValue:r,typeName:ye.ZodDefault})}brand(){return new ng({typeName:ye.ZodBranded,type:this,...Pe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new iu({...Pe(this._def),innerType:this,catchValue:r,typeName:ye.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ig.create(this,e)}readonly(){return ou.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},z5=/^c[^\s-]{8,}$/i,O5=/^[0-9a-z]+$/,N5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R5=/^[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,M5=/^[a-z0-9_-]{21}$/i,j5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D5=/^[-+]?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)?)??$/,L5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ow,F5=/^(?:(?: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])$/,Z5=/^(?:(?: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])$/,V5=/^(([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]))$/,q5=/^(([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])$/,B5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RT="((\\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])))",G5=new RegExp(`^${RT}$`);function MT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function H5(t){return new RegExp(`^${MT(t)}$`)}function X5(t){let e=`${RT}T${MT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function K5(t,e){return!!((e==="v4"||!e)&&F5.test(t)||(e==="v6"||!e)&&V5.test(t))}function J5(t,e){if(!j5.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Y5(t,e){return!!((e==="v4"||!e)&&Z5.test(t)||(e==="v6"||!e)&&q5.test(t))}var Hc=class t extends Re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.string,received:o.parsedType}),be}let n=new Ar,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?X(i,{code:U.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&X(i,{code:U.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")L5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"email",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ow||(ow=new RegExp(U5,"u")),ow.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"emoji",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")R5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"uuid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")M5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"nanoid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")z5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cuid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")O5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cuid2",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")N5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"ulid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),X(i,{validation:"url",code:U.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"regex",code:U.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?X5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?G5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?H5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?D5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"duration",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?K5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"ip",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?J5(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"jwt",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Y5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cidr",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?B5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"base64",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?W5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"base64url",code:U.invalid_string,message:o.message}),n.dirty()):Ve.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:U.invalid_string,...re.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.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,...re.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,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...re.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...re.errToObj(r)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Hc.create=t=>new Hc({checks:[],typeName:ye.ZodString,coerce:t?.coerce??!1,...Pe(t)});function Q5(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var mp=class t extends Re{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)!==Q.number){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.number,received:o.parsedType}),be}let n,i=new Ar;for(let o of this._def.checks)o.kind==="int"?Ve.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),X(n,{code:U.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Q5(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_finite,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let 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"&&Ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let 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)}};mp.create=t=>new mp({checks:[],typeName:ye.ZodNumber,coerce:t?.coerce||!1,...Pe(t)});var hp=class t extends Re{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)!==Q.bigint)return this._getInvalidInput(e);let n,i=new Ar;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return X(r,{code:U.invalid_type,expected:Q.bigint,received:r.parsedType}),be}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};hp.create=t=>new hp({checks:[],typeName:ye.ZodBigInt,coerce:t?.coerce??!1,...Pe(t)});var gp=class extends Re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.boolean,received:n.parsedType}),be}return Fr(e.data)}};gp.create=t=>new gp({typeName:ye.ZodBoolean,coerce:t?.coerce||!1,...Pe(t)});var yp=class t extends Re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.date,received:o.parsedType}),be}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_date}),be}let n=new Ar,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Ve.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(r)})}get minDate(){let e=null;for(let 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(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};yp.create=t=>new yp({checks:[],coerce:t?.coerce||!1,typeName:ye.ZodDate,...Pe(t)});var bp=class extends Re{_parse(e){if(this._getType(e)!==Q.symbol){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.symbol,received:n.parsedType}),be}return Fr(e.data)}};bp.create=t=>new bp({typeName:ye.ZodSymbol,...Pe(t)});var Xc=class extends Re{_parse(e){if(this._getType(e)!==Q.undefined){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.undefined,received:n.parsedType}),be}return Fr(e.data)}};Xc.create=t=>new Xc({typeName:ye.ZodUndefined,...Pe(t)});var Kc=class extends Re{_parse(e){if(this._getType(e)!==Q.null){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.null,received:n.parsedType}),be}return Fr(e.data)}};Kc.create=t=>new Kc({typeName:ye.ZodNull,...Pe(t)});var vp=class extends Re{constructor(){super(...arguments),this._any=!0}_parse(e){return Fr(e.data)}};vp.create=t=>new vp({typeName:ye.ZodAny,...Pe(t)});var ds=class extends Re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fr(e.data)}};ds.create=t=>new ds({typeName:ye.ZodUnknown,...Pe(t)});var Ti=class extends Re{_parse(e){let r=this._getOrReturnCtx(e);return X(r,{code:U.invalid_type,expected:Q.never,received:r.parsedType}),be}};Ti.create=t=>new Ti({typeName:ye.ZodNever,...Pe(t)});var _p=class extends Re{_parse(e){if(this._getType(e)!==Q.undefined){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.void,received:n.parsedType}),be}return Fr(e.data)}};_p.create=t=>new _p({typeName:ye.ZodVoid,...Pe(t)});var ps=class t extends Re{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Q.array)return X(r,{code:U.invalid_type,expected:Q.array,received:r.parsedType}),be;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(X(r,{code:s?U.too_big:U.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(X(r,{code:U.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(X(r,{code:U.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Rn(r,s,r.path,a)))).then(s=>Ar.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Rn(r,s,r.path,a)));return Ar.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:re.toString(r)}})}nonempty(e){return this.min(1,e)}};ps.create=(t,e)=>new ps({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ye.ZodArray,...Pe(e)});function Gc(t){if(t instanceof vn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ti.create(Gc(n))}return new vn({...t._def,shape:()=>e})}else return t instanceof ps?new ps({...t._def,type:Gc(t.element)}):t instanceof ti?ti.create(Gc(t.unwrap())):t instanceof yo?yo.create(Gc(t.unwrap())):t instanceof go?go.create(t.items.map(e=>Gc(e))):t}var vn=class t extends Re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Q.object){let c=this._getOrReturnCtx(e);return X(c,{code:U.invalid_type,expected:Q.object,received:c.parsedType}),be}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ti&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Rn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ti){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(X(i,{code:U.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Rn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Ar.mergeObjectSync(n,c)):Ar.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ye.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ve.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ve.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Gc(this)}partial(e){let r={};for(let n of Ve.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ve.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ti;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return jT(Ve.objectKeys(this.shape))}};vn.create=(t,e)=>new vn({shape:()=>t,unknownKeys:"strip",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});vn.strictCreate=(t,e)=>new vn({shape:()=>t,unknownKeys:"strict",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});vn.lazycreate=(t,e)=>new vn({shape:t,unknownKeys:"strip",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});var Jc=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new bn(a.ctx.common.issues));return X(r,{code:U.invalid_union,unionErrors:s}),be}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new bn(l));return X(r,{code:U.invalid_union,unionErrors:a}),be}}get options(){return this._def.options}};Jc.create=(t,e)=>new Jc({options:t,typeName:ye.ZodUnion,...Pe(e)});var ho=t=>t instanceof Qc?ho(t.schema):t instanceof ri?ho(t.innerType()):t instanceof eu?[t.value]:t instanceof tu?t.options:t instanceof ru?Ve.objectValues(t.enum):t instanceof nu?ho(t._def.innerType):t instanceof Xc?[void 0]:t instanceof Kc?[null]:t instanceof ti?[void 0,...ho(t.unwrap())]:t instanceof yo?[null,...ho(t.unwrap())]:t instanceof ng||t instanceof ou?ho(t.unwrap()):t instanceof iu?ho(t._def.innerType):[],sw=class t extends Re{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.object)return X(r,{code:U.invalid_type,expected:Q.object,received:r.parsedType}),be;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(X(r,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=ho(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:ye.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Pe(n)})}};function aw(t,e){let r=mo(t),n=mo(e);if(t===e)return{valid:!0,data:t};if(r===Q.object&&n===Q.object){let i=Ve.objectKeys(e),o=Ve.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=aw(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===Q.array&&n===Q.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=aw(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===Q.date&&n===Q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Yc=class extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(nw(o)||nw(s))return be;let a=aw(o.value,s.value);return a.valid?((iw(o)||iw(s))&&r.dirty(),{status:r.value,value:a.data}):(X(n,{code:U.invalid_intersection_types}),be)};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(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Yc.create=(t,e,r)=>new Yc({left:t,right:e,typeName:ye.ZodIntersection,...Pe(r)});var go=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return X(n,{code:U.invalid_type,expected:Q.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return X(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&n.data.length>this._def.items.length&&(X(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Rn(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Ar.mergeArray(r,s)):Ar.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};go.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:t,typeName:ye.ZodTuple,rest:null,...Pe(e)})};var lw=class t extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return X(n,{code:U.invalid_type,expected:Q.object,received:n.parsedType}),be;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Rn(n,a,n.path,a)),value:s._parse(new Rn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ar.mergeObjectAsync(r,i):Ar.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Re?new t({keyType:e,valueType:r,typeName:ye.ZodRecord,...Pe(n)}):new t({keyType:Hc.create(),valueType:e,typeName:ye.ZodRecord,...Pe(r)})}},wp=class extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return X(n,{code:U.invalid_type,expected:Q.map,received:n.parsedType}),be;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new Rn(n,a,n.path,[c,"key"])),value:o._parse(new Rn(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return be;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return be;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};wp.create=(t,e,r)=>new wp({valueType:e,keyType:t,typeName:ye.ZodMap,...Pe(r)});var xp=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return X(n,{code:U.invalid_type,expected:Q.set,received:n.parsedType}),be;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(X(n,{code:U.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(X(n,{code:U.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return be;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>o._parse(new Rn(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};xp.create=(t,e)=>new xp({valueType:t,minSize:null,maxSize:null,typeName:ye.ZodSet,...Pe(e)});var cw=class t extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.function)return X(r,{code:U.invalid_type,expected:Q.function,received:r.parsedType}),be;function n(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pp(),us].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:l}})}function i(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pp(),us].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:l}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ta){let a=this;return Fr(async function(...l){let c=new bn([]),u=await a._def.args.parseAsync(l,o).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{let a=this;return Fr(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new bn([n(l,c.error)]);let u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new bn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:go.create(e).rest(ds.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||go.create([]).rest(ds.create()),returns:r||ds.create(),typeName:ye.ZodFunction,...Pe(n)})}},Qc=class extends Re{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Qc.create=(t,e)=>new Qc({getter:t,typeName:ye.ZodLazy,...Pe(e)});var eu=class extends Re{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return X(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:e.data}}get value(){return this._def.value}};eu.create=(t,e)=>new eu({value:t,typeName:ye.ZodLiteral,...Pe(e)});function jT(t,e){return new tu({values:t,typeName:ye.ZodEnum,...Pe(e)})}var tu=class t extends Re{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return X(r,{expected:Ve.joinValues(n),received:r.parsedType,code:U.invalid_type}),be}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return X(r,{received:r.data,code:U.invalid_enum_value,options:n}),be}return Fr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};tu.create=jT;var ru=class extends Re{_parse(e){let r=Ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){let i=Ve.objectValues(r);return X(n,{expected:Ve.joinValues(i),received:n.parsedType,code:U.invalid_type}),be}if(this._cache||(this._cache=new Set(Ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ve.objectValues(r);return X(n,{received:n.data,code:U.invalid_enum_value,options:i}),be}return Fr(e.data)}get enum(){return this._def.values}};ru.create=(t,e)=>new ru({values:t,typeName:ye.ZodNativeEnum,...Pe(e)});var Ta=class extends Re{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.promise&&r.common.async===!1)return X(r,{code:U.invalid_type,expected:Q.promise,received:r.parsedType}),be;let n=r.parsedType===Q.promise?r.data:Promise.resolve(r.data);return Fr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ta.create=(t,e)=>new Ta({type:t,typeName:ye.ZodPromise,...Pe(e)});var ri=class extends Re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{X(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return be;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?be:l.status==="dirty"?Wc(l.value):r.value==="dirty"?Wc(l.value):l});{if(r.value==="aborted")return be;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?be:a.status==="dirty"?Wc(a.value):r.value==="dirty"?Wc(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?be:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?be:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Pa(s))return be;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Pa(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):be);Ve.assertNever(i)}};ri.create=(t,e,r)=>new ri({schema:t,typeName:ye.ZodEffects,effect:e,...Pe(r)});ri.createWithPreprocess=(t,e,r)=>new ri({schema:e,effect:{type:"preprocess",transform:t},typeName:ye.ZodEffects,...Pe(r)});var ti=class extends Re{_parse(e){return this._getType(e)===Q.undefined?Fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ti.create=(t,e)=>new ti({innerType:t,typeName:ye.ZodOptional,...Pe(e)});var yo=class extends Re{_parse(e){return this._getType(e)===Q.null?Fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yo.create=(t,e)=>new yo({innerType:t,typeName:ye.ZodNullable,...Pe(e)});var nu=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};nu.create=(t,e)=>new nu({innerType:t,typeName:ye.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pe(e)});var iu=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};iu.create=(t,e)=>new iu({innerType:t,typeName:ye.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pe(e)});var kp=class extends Re{_parse(e){if(this._getType(e)!==Q.nan){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.nan,received:n.parsedType}),be}return{status:"valid",value:e.data}}};kp.create=t=>new kp({typeName:ye.ZodNaN,...Pe(t)});var ng=class extends Re{_parse(e){let{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}},ig=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?be:o.status==="dirty"?(r.dirty(),Wc(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?be:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ye.ZodPipeline})}},ou=class extends Re{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Pa(i)&&(i.value=Object.freeze(i.value)),i);return fp(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};ou.create=(t,e)=>new ou({innerType:t,typeName:ye.ZodReadonly,...Pe(e)});var Xme={object:vn.lazycreate},ye;(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"})(ye||(ye={}));var Kme=Hc.create,Jme=mp.create,Yme=kp.create,Qme=hp.create,ehe=gp.create,the=yp.create,rhe=bp.create,nhe=Xc.create,ihe=Kc.create,ohe=vp.create,she=ds.create,ahe=Ti.create,lhe=_p.create,che=ps.create,eF=vn.create,uhe=vn.strictCreate,dhe=Jc.create,phe=sw.create,fhe=Yc.create,mhe=go.create,hhe=lw.create,ghe=wp.create,yhe=xp.create,bhe=cw.create,vhe=Qc.create,_he=eu.create,whe=tu.create,xhe=ru.create,khe=Ta.create,She=ri.create,$he=ti.create,Ihe=yo.create,Ehe=ri.createWithPreprocess,Phe=ig.create;var sg=Object.freeze({status:"aborted"});function M(t,e,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);let c=s.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let f=u[d];f in a||(a[f]=c[f].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var l;let c=r?.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Ai=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},su=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},og={};function Cr(t){return t&&Object.assign(og,t),og}var V={};gd(V,{BIGINT_FORMAT_RANGES:()=>FT,Class:()=>dw,NUMBER_FORMAT_RANGES:()=>yw,aborted:()=>gs,allowsEval:()=>mw,assert:()=>aF,assertEqual:()=>nF,assertIs:()=>oF,assertNever:()=>sF,assertNotEqual:()=>iF,assignProp:()=>fs,base64ToUint8Array:()=>VT,base64urlToUint8Array:()=>SF,cached:()=>lu,captureStackTrace:()=>cg,cleanEnum:()=>kF,cleanRegex:()=>Ip,clone:()=>Jr,cloneDef:()=>cF,createTransparentProxy:()=>hF,defineLazy:()=>dt,esc:()=>lg,escapeRegex:()=>Ci,extend:()=>bF,finalizeIssue:()=>ni,floatSafeRemainder:()=>pw,getElementAtPath:()=>uF,getEnumValues:()=>ag,getLengthableOrigin:()=>Ep,getParsedType:()=>mF,getSizableOrigin:()=>ZT,hexToUint8Array:()=>IF,isObject:()=>Aa,isPlainObject:()=>hs,issue:()=>cu,joinValues:()=>ve,jsonStringifyReplacer:()=>au,merge:()=>_F,mergeDefs:()=>ms,normalizeParams:()=>ue,nullish:()=>$p,numKeys:()=>fF,objectClone:()=>lF,omit:()=>yF,optionalKeys:()=>gw,partial:()=>wF,pick:()=>gF,prefixIssues:()=>bo,primitiveTypes:()=>UT,promiseAllObject:()=>dF,propertyKeyTypes:()=>hw,randomString:()=>pF,required:()=>xF,safeExtend:()=>vF,shallowClone:()=>LT,slugify:()=>fw,stringifyPrimitive:()=>_e,uint8ArrayToBase64:()=>qT,uint8ArrayToBase64url:()=>$F,uint8ArrayToHex:()=>EF,unwrapMessage:()=>Sp});function nF(t){return t}function iF(t){return t}function oF(t){}function sF(t){throw new Error}function aF(t){}function ag(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function ve(t,e="|"){return t.map(r=>_e(r)).join(e)}function au(t,e){return typeof e=="bigint"?e.toString():e}function lu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $p(t){return t==null}function Ip(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function pw(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}var DT=Symbol("evaluating");function dt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==DT)return n===void 0&&(n=DT,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function lF(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function fs(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ms(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function cF(t){return ms(t._zod.def)}function uF(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function dF(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function pF(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function lg(t){return JSON.stringify(t)}function fw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Aa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var mw=lu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function hs(t){if(Aa(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Aa(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(t){return hs(t)?{...t}:Array.isArray(t)?[...t]:t}function fF(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var mF=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},hw=new Set(["string","number","symbol"]),UT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ci(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ue(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function hF(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function _e(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function gw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var yw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},FT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function gF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(i[o]=r.shape[o])}return fs(this,"shape",i),i},checks:[]});return Jr(t,n)}function yF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete i[o]}return fs(this,"shape",i),i},checks:[]});return Jr(t,n)}function bF(t,e){if(!hs(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ms(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return fs(this,"shape",o),o},checks:[]});return Jr(t,i)}function vF(t,e){if(!hs(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return fs(this,"shape",n),n},checks:t._zod.def.checks};return Jr(t,r)}function _F(t,e){let r=ms(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return fs(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Jr(t,r)}function wF(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(let s in i)o[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return fs(this,"shape",o),o},checks:[]});return Jr(e,n)}function xF(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return fs(this,"shape",o),o},checks:[]});return Jr(e,n)}function gs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function bo(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Sp(t){return typeof t=="string"?t:t?.message}function ni(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Sp(t.inst?._zod.def?.error?.(t))??Sp(e?.error?.(t))??Sp(r.customError?.(t))??Sp(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function ZT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ep(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function cu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function kF(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function VT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function qT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function SF(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return VT(e+r)}function $F(t){return qT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function IF(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function EF(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var dw=class{constructor(...e){}};var BT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,au,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ug=M("$ZodError",BT),bw=M("$ZodError",BT,{Parent:Error});function dg(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function pg(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(e(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(t),r}var fg=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ai;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ni(l,o,Cr())));throw cg(a,i?.callee),a}return s.value};var mg=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ni(l,o,Cr())));throw cg(a,i?.callee),a}return s.value};var Pp=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ai;return o.issues.length?{success:!1,error:new(t??ug)(o.issues.map(s=>ni(s,i,Cr())))}:{success:!0,data:o.value}},uu=Pp(bw),Tp=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>ni(s,i,Cr())))}:{success:!0,data:o.value}},Ap=Tp(bw),WT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return fg(t)(e,r,i)};var GT=t=>(e,r,n)=>fg(t)(e,r,n);var HT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mg(t)(e,r,i)};var XT=t=>async(e,r,n)=>mg(t)(e,r,n);var KT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pp(t)(e,r,i)};var JT=t=>(e,r,n)=>Pp(t)(e,r,n);var YT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tp(t)(e,r,i)};var QT=t=>async(e,r,n)=>Tp(t)(e,r,n);var eA=/^[cC][^\s-]{8,}$/,tA=/^[0-9a-z]+$/,rA=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nA=/^[0-9a-vA-V]{20}$/,iA=/^[A-Za-z0-9]{27}$/,oA=/^[a-zA-Z0-9_-]{21}$/,sA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var aA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vw=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var lA=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var TF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cA(){return new RegExp(TF,"u")}var uA=/^(?:(?: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])$/,dA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var pA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,fA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_w=/^[A-Za-z0-9_-]*$/;var hA=/^\+(?:[0-9]){6,14}[0-9]$/,gA="(?:(?:\\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])))",yA=new RegExp(`^${gA}$`);function bA(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vA(t){return new RegExp(`^${bA(t)}$`)}function _A(t){let e=bA({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${gA}T(?:${n})$`)}var wA=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},xA=/^-?\d+n?$/,kA=/^-?\d+$/,SA=/^-?\d+(?:\.\d+)?/,$A=/^(?:true|false)$/i,IA=/^null$/i;var EA=/^[^A-Z]*$/,PA=/^[^a-z]*$/;var cr=M("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),TA={number:"number",bigint:"bigint",object:"date"},ww=M("$ZodCheckLessThan",(t,e)=>{cr.init(t,e);let r=TA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),xw=M("$ZodCheckGreaterThan",(t,e)=>{cr.init(t,e);let r=TA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),AA=M("$ZodCheckMultipleOf",(t,e)=>{cr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):pw(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),CA=M("$ZodCheckNumberFormat",(t,e)=>{cr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=yw[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=kA)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var zA=M("$ZodCheckMaxLength",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=Ep(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),OA=M("$ZodCheckMinLength",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=Ep(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),NA=M("$ZodCheckLengthEquals",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=Ep(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Cp=M("$ZodCheckStringFormat",(t,e)=>{var r,n;cr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),RA=M("$ZodCheckRegex",(t,e)=>{Cp.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),MA=M("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=EA),Cp.init(t,e)}),jA=M("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=PA),Cp.init(t,e)}),DA=M("$ZodCheckIncludes",(t,e)=>{cr.init(t,e);let r=Ci(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),LA=M("$ZodCheckStartsWith",(t,e)=>{cr.init(t,e);let r=new RegExp(`^${Ci(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),UA=M("$ZodCheckEndsWith",(t,e)=>{cr.init(t,e);let r=new RegExp(`.*${Ci(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var FA=M("$ZodCheckOverwrite",(t,e)=>{cr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var hg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
90
|
+
${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),o=encodeURIComponent(e.body),s=`mailto:${n}?subject=${i}&body=${o}`;try{window.location.href=s}catch(a){throw new Error(`Failed to open email client: ${a instanceof Error?a.message:String(a)}`)}return`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ve||(Ve={}));var OT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(OT||(OT={}));var Q=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mo=t=>{switch(typeof t){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(t)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(t)?Q.array:t===null?Q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Q.promise:typeof Map<"u"&&t instanceof Map?Q.map:typeof Set<"u"&&t instanceof Set?Q.set:typeof Date<"u"&&t instanceof Date?Q.date:Q.object;default:return Q.unknown}};var U=Ve.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"]);var bn=class t 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]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bn.create=t=>new bn(t);var A5=(t,e)=>{let r;switch(t.code){case U.invalid_type:t.received===Q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ve.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ve.joinValues(t.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ve.joinValues(t.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${Ve.joinValues(t.options)}, received '${t.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.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}"`:Ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case U.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 U.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 U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ve.assertNever(t)}return{message:r}},us=A5;var C5=us;function pp(){return C5}var rg=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function X(t,e){let r=pp(),n=rg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===us?void 0:us].filter(i=>!!i)});t.common.issues.push(n)}var Ar=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return be;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return be;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},be=Object.freeze({status:"aborted"}),Wc=t=>({status:"dirty",value:t}),Fr=t=>({status:"valid",value:t}),nw=t=>t.status==="aborted",iw=t=>t.status==="dirty",Pa=t=>t.status==="valid",fp=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var Rn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},NT=(t,e)=>{if(Pa(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;let r=new bn(t.common.issues);return this._error=r,this._error}}};function Pe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=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:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:i}}var Re=class{get description(){return this._def.description}_getType(e){return mo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ar,ctx:{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(fp(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parseSync({data:e,path:n.path,parent:n});return NT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Pa(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=>Pa(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(fp(i)?i:Promise.resolve(i));return NT(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:U.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ri({schema:this,typeName:ye.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 ti.create(this,this._def)}nullable(){return yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ps.create(this)}promise(){return Ta.create(this,this._def)}or(e){return Jc.create([this,e],this._def)}and(e){return Yc.create(this,e,this._def)}transform(e){return new ri({...Pe(this._def),schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new nu({...Pe(this._def),innerType:this,defaultValue:r,typeName:ye.ZodDefault})}brand(){return new ng({typeName:ye.ZodBranded,type:this,...Pe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new iu({...Pe(this._def),innerType:this,catchValue:r,typeName:ye.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ig.create(this,e)}readonly(){return ou.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},z5=/^c[^\s-]{8,}$/i,O5=/^[0-9a-z]+$/,N5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R5=/^[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,M5=/^[a-z0-9_-]{21}$/i,j5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D5=/^[-+]?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)?)??$/,L5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ow,F5=/^(?:(?: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])$/,Z5=/^(?:(?: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])$/,V5=/^(([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]))$/,q5=/^(([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])$/,B5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RT="((\\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])))",G5=new RegExp(`^${RT}$`);function MT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function H5(t){return new RegExp(`^${MT(t)}$`)}function X5(t){let e=`${RT}T${MT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function K5(t,e){return!!((e==="v4"||!e)&&F5.test(t)||(e==="v6"||!e)&&V5.test(t))}function J5(t,e){if(!j5.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Y5(t,e){return!!((e==="v4"||!e)&&Z5.test(t)||(e==="v6"||!e)&&q5.test(t))}var Hc=class t extends Re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.string,received:o.parsedType}),be}let n=new Ar,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?X(i,{code:U.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&X(i,{code:U.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")L5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"email",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ow||(ow=new RegExp(U5,"u")),ow.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"emoji",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")R5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"uuid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")M5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"nanoid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")z5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cuid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")O5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cuid2",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")N5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"ulid",code:U.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),X(i,{validation:"url",code:U.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"regex",code:U.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?X5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?G5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?H5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{code:U.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?D5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"duration",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?K5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"ip",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?J5(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"jwt",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Y5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"cidr",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?B5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"base64",code:U.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?W5.test(e.data)||(i=this._getOrReturnCtx(e,i),X(i,{validation:"base64url",code:U.invalid_string,message:o.message}),n.dirty()):Ve.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:U.invalid_string,...re.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.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,...re.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,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...re.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...re.errToObj(r)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Hc.create=t=>new Hc({checks:[],typeName:ye.ZodString,coerce:t?.coerce??!1,...Pe(t)});function Q5(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var mp=class t extends Re{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)!==Q.number){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.number,received:o.parsedType}),be}let n,i=new Ar;for(let o of this._def.checks)o.kind==="int"?Ve.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),X(n,{code:U.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Q5(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_finite,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let 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"&&Ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let 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)}};mp.create=t=>new mp({checks:[],typeName:ye.ZodNumber,coerce:t?.coerce||!1,...Pe(t)});var hp=class t extends Re{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)!==Q.bigint)return this._getInvalidInput(e);let n,i=new Ar;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),X(n,{code:U.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return X(r,{code:U.invalid_type,expected:Q.bigint,received:r.parsedType}),be}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};hp.create=t=>new hp({checks:[],typeName:ye.ZodBigInt,coerce:t?.coerce??!1,...Pe(t)});var gp=class extends Re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.boolean,received:n.parsedType}),be}return Fr(e.data)}};gp.create=t=>new gp({typeName:ye.ZodBoolean,coerce:t?.coerce||!1,...Pe(t)});var yp=class t extends Re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_type,expected:Q.date,received:o.parsedType}),be}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return X(o,{code:U.invalid_date}),be}let n=new Ar,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),X(i,{code:U.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Ve.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(r)})}get minDate(){let e=null;for(let 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(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};yp.create=t=>new yp({checks:[],coerce:t?.coerce||!1,typeName:ye.ZodDate,...Pe(t)});var bp=class extends Re{_parse(e){if(this._getType(e)!==Q.symbol){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.symbol,received:n.parsedType}),be}return Fr(e.data)}};bp.create=t=>new bp({typeName:ye.ZodSymbol,...Pe(t)});var Xc=class extends Re{_parse(e){if(this._getType(e)!==Q.undefined){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.undefined,received:n.parsedType}),be}return Fr(e.data)}};Xc.create=t=>new Xc({typeName:ye.ZodUndefined,...Pe(t)});var Kc=class extends Re{_parse(e){if(this._getType(e)!==Q.null){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.null,received:n.parsedType}),be}return Fr(e.data)}};Kc.create=t=>new Kc({typeName:ye.ZodNull,...Pe(t)});var vp=class extends Re{constructor(){super(...arguments),this._any=!0}_parse(e){return Fr(e.data)}};vp.create=t=>new vp({typeName:ye.ZodAny,...Pe(t)});var ds=class extends Re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fr(e.data)}};ds.create=t=>new ds({typeName:ye.ZodUnknown,...Pe(t)});var Ti=class extends Re{_parse(e){let r=this._getOrReturnCtx(e);return X(r,{code:U.invalid_type,expected:Q.never,received:r.parsedType}),be}};Ti.create=t=>new Ti({typeName:ye.ZodNever,...Pe(t)});var _p=class extends Re{_parse(e){if(this._getType(e)!==Q.undefined){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.void,received:n.parsedType}),be}return Fr(e.data)}};_p.create=t=>new _p({typeName:ye.ZodVoid,...Pe(t)});var ps=class t extends Re{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Q.array)return X(r,{code:U.invalid_type,expected:Q.array,received:r.parsedType}),be;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(X(r,{code:s?U.too_big:U.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(X(r,{code:U.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(X(r,{code:U.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Rn(r,s,r.path,a)))).then(s=>Ar.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Rn(r,s,r.path,a)));return Ar.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:re.toString(r)}})}nonempty(e){return this.min(1,e)}};ps.create=(t,e)=>new ps({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ye.ZodArray,...Pe(e)});function Gc(t){if(t instanceof vn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ti.create(Gc(n))}return new vn({...t._def,shape:()=>e})}else return t instanceof ps?new ps({...t._def,type:Gc(t.element)}):t instanceof ti?ti.create(Gc(t.unwrap())):t instanceof yo?yo.create(Gc(t.unwrap())):t instanceof go?go.create(t.items.map(e=>Gc(e))):t}var vn=class t extends Re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Q.object){let c=this._getOrReturnCtx(e);return X(c,{code:U.invalid_type,expected:Q.object,received:c.parsedType}),be}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ti&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Rn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ti){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(X(i,{code:U.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Rn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Ar.mergeObjectSync(n,c)):Ar.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ye.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ve.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ve.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Gc(this)}partial(e){let r={};for(let n of Ve.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ve.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ti;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return jT(Ve.objectKeys(this.shape))}};vn.create=(t,e)=>new vn({shape:()=>t,unknownKeys:"strip",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});vn.strictCreate=(t,e)=>new vn({shape:()=>t,unknownKeys:"strict",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});vn.lazycreate=(t,e)=>new vn({shape:t,unknownKeys:"strip",catchall:Ti.create(),typeName:ye.ZodObject,...Pe(e)});var Jc=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new bn(a.ctx.common.issues));return X(r,{code:U.invalid_union,unionErrors:s}),be}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new bn(l));return X(r,{code:U.invalid_union,unionErrors:a}),be}}get options(){return this._def.options}};Jc.create=(t,e)=>new Jc({options:t,typeName:ye.ZodUnion,...Pe(e)});var ho=t=>t instanceof Qc?ho(t.schema):t instanceof ri?ho(t.innerType()):t instanceof eu?[t.value]:t instanceof tu?t.options:t instanceof ru?Ve.objectValues(t.enum):t instanceof nu?ho(t._def.innerType):t instanceof Xc?[void 0]:t instanceof Kc?[null]:t instanceof ti?[void 0,...ho(t.unwrap())]:t instanceof yo?[null,...ho(t.unwrap())]:t instanceof ng||t instanceof ou?ho(t.unwrap()):t instanceof iu?ho(t._def.innerType):[],sw=class t extends Re{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.object)return X(r,{code:U.invalid_type,expected:Q.object,received:r.parsedType}),be;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(X(r,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=ho(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:ye.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Pe(n)})}};function aw(t,e){let r=mo(t),n=mo(e);if(t===e)return{valid:!0,data:t};if(r===Q.object&&n===Q.object){let i=Ve.objectKeys(e),o=Ve.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=aw(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===Q.array&&n===Q.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=aw(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===Q.date&&n===Q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Yc=class extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(nw(o)||nw(s))return be;let a=aw(o.value,s.value);return a.valid?((iw(o)||iw(s))&&r.dirty(),{status:r.value,value:a.data}):(X(n,{code:U.invalid_intersection_types}),be)};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(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Yc.create=(t,e,r)=>new Yc({left:t,right:e,typeName:ye.ZodIntersection,...Pe(r)});var go=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return X(n,{code:U.invalid_type,expected:Q.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return X(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&n.data.length>this._def.items.length&&(X(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Rn(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Ar.mergeArray(r,s)):Ar.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};go.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:t,typeName:ye.ZodTuple,rest:null,...Pe(e)})};var lw=class t extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return X(n,{code:U.invalid_type,expected:Q.object,received:n.parsedType}),be;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Rn(n,a,n.path,a)),value:s._parse(new Rn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ar.mergeObjectAsync(r,i):Ar.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Re?new t({keyType:e,valueType:r,typeName:ye.ZodRecord,...Pe(n)}):new t({keyType:Hc.create(),valueType:e,typeName:ye.ZodRecord,...Pe(r)})}},wp=class extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return X(n,{code:U.invalid_type,expected:Q.map,received:n.parsedType}),be;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new Rn(n,a,n.path,[c,"key"])),value:o._parse(new Rn(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return be;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return be;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};wp.create=(t,e,r)=>new wp({valueType:e,keyType:t,typeName:ye.ZodMap,...Pe(r)});var xp=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return X(n,{code:U.invalid_type,expected:Q.set,received:n.parsedType}),be;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(X(n,{code:U.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(X(n,{code:U.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return be;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>o._parse(new Rn(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};xp.create=(t,e)=>new xp({valueType:t,minSize:null,maxSize:null,typeName:ye.ZodSet,...Pe(e)});var cw=class t extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.function)return X(r,{code:U.invalid_type,expected:Q.function,received:r.parsedType}),be;function n(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pp(),us].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:l}})}function i(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pp(),us].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:l}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ta){let a=this;return Fr(async function(...l){let c=new bn([]),u=await a._def.args.parseAsync(l,o).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{let a=this;return Fr(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new bn([n(l,c.error)]);let u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new bn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:go.create(e).rest(ds.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||go.create([]).rest(ds.create()),returns:r||ds.create(),typeName:ye.ZodFunction,...Pe(n)})}},Qc=class extends Re{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Qc.create=(t,e)=>new Qc({getter:t,typeName:ye.ZodLazy,...Pe(e)});var eu=class extends Re{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return X(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:e.data}}get value(){return this._def.value}};eu.create=(t,e)=>new eu({value:t,typeName:ye.ZodLiteral,...Pe(e)});function jT(t,e){return new tu({values:t,typeName:ye.ZodEnum,...Pe(e)})}var tu=class t extends Re{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return X(r,{expected:Ve.joinValues(n),received:r.parsedType,code:U.invalid_type}),be}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return X(r,{received:r.data,code:U.invalid_enum_value,options:n}),be}return Fr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};tu.create=jT;var ru=class extends Re{_parse(e){let r=Ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){let i=Ve.objectValues(r);return X(n,{expected:Ve.joinValues(i),received:n.parsedType,code:U.invalid_type}),be}if(this._cache||(this._cache=new Set(Ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ve.objectValues(r);return X(n,{received:n.data,code:U.invalid_enum_value,options:i}),be}return Fr(e.data)}get enum(){return this._def.values}};ru.create=(t,e)=>new ru({values:t,typeName:ye.ZodNativeEnum,...Pe(e)});var Ta=class extends Re{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.promise&&r.common.async===!1)return X(r,{code:U.invalid_type,expected:Q.promise,received:r.parsedType}),be;let n=r.parsedType===Q.promise?r.data:Promise.resolve(r.data);return Fr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ta.create=(t,e)=>new Ta({type:t,typeName:ye.ZodPromise,...Pe(e)});var ri=class extends Re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{X(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return be;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?be:l.status==="dirty"?Wc(l.value):r.value==="dirty"?Wc(l.value):l});{if(r.value==="aborted")return be;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?be:a.status==="dirty"?Wc(a.value):r.value==="dirty"?Wc(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?be:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?be:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Pa(s))return be;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Pa(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):be);Ve.assertNever(i)}};ri.create=(t,e,r)=>new ri({schema:t,typeName:ye.ZodEffects,effect:e,...Pe(r)});ri.createWithPreprocess=(t,e,r)=>new ri({schema:e,effect:{type:"preprocess",transform:t},typeName:ye.ZodEffects,...Pe(r)});var ti=class extends Re{_parse(e){return this._getType(e)===Q.undefined?Fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ti.create=(t,e)=>new ti({innerType:t,typeName:ye.ZodOptional,...Pe(e)});var yo=class extends Re{_parse(e){return this._getType(e)===Q.null?Fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yo.create=(t,e)=>new yo({innerType:t,typeName:ye.ZodNullable,...Pe(e)});var nu=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};nu.create=(t,e)=>new nu({innerType:t,typeName:ye.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pe(e)});var iu=class extends Re{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};iu.create=(t,e)=>new iu({innerType:t,typeName:ye.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pe(e)});var kp=class extends Re{_parse(e){if(this._getType(e)!==Q.nan){let n=this._getOrReturnCtx(e);return X(n,{code:U.invalid_type,expected:Q.nan,received:n.parsedType}),be}return{status:"valid",value:e.data}}};kp.create=t=>new kp({typeName:ye.ZodNaN,...Pe(t)});var ng=class extends Re{_parse(e){let{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}},ig=class t extends Re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?be:o.status==="dirty"?(r.dirty(),Wc(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?be:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ye.ZodPipeline})}},ou=class extends Re{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Pa(i)&&(i.value=Object.freeze(i.value)),i);return fp(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};ou.create=(t,e)=>new ou({innerType:t,typeName:ye.ZodReadonly,...Pe(e)});var Xme={object:vn.lazycreate},ye;(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"})(ye||(ye={}));var Kme=Hc.create,Jme=mp.create,Yme=kp.create,Qme=hp.create,ehe=gp.create,the=yp.create,rhe=bp.create,nhe=Xc.create,ihe=Kc.create,ohe=vp.create,she=ds.create,ahe=Ti.create,lhe=_p.create,che=ps.create,e6=vn.create,uhe=vn.strictCreate,dhe=Jc.create,phe=sw.create,fhe=Yc.create,mhe=go.create,hhe=lw.create,ghe=wp.create,yhe=xp.create,bhe=cw.create,vhe=Qc.create,_he=eu.create,whe=tu.create,xhe=ru.create,khe=Ta.create,She=ri.create,$he=ti.create,Ihe=yo.create,Ehe=ri.createWithPreprocess,Phe=ig.create;var sg=Object.freeze({status:"aborted"});function M(t,e,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);let c=s.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let f=u[d];f in a||(a[f]=c[f].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var l;let c=r?.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Ai=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},su=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},og={};function Cr(t){return t&&Object.assign(og,t),og}var V={};gd(V,{BIGINT_FORMAT_RANGES:()=>FT,Class:()=>dw,NUMBER_FORMAT_RANGES:()=>yw,aborted:()=>gs,allowsEval:()=>mw,assert:()=>a6,assertEqual:()=>n6,assertIs:()=>o6,assertNever:()=>s6,assertNotEqual:()=>i6,assignProp:()=>fs,base64ToUint8Array:()=>VT,base64urlToUint8Array:()=>S6,cached:()=>lu,captureStackTrace:()=>cg,cleanEnum:()=>k6,cleanRegex:()=>Ip,clone:()=>Jr,cloneDef:()=>c6,createTransparentProxy:()=>h6,defineLazy:()=>dt,esc:()=>lg,escapeRegex:()=>Ci,extend:()=>b6,finalizeIssue:()=>ni,floatSafeRemainder:()=>pw,getElementAtPath:()=>u6,getEnumValues:()=>ag,getLengthableOrigin:()=>Ep,getParsedType:()=>m6,getSizableOrigin:()=>ZT,hexToUint8Array:()=>I6,isObject:()=>Aa,isPlainObject:()=>hs,issue:()=>cu,joinValues:()=>ve,jsonStringifyReplacer:()=>au,merge:()=>_6,mergeDefs:()=>ms,normalizeParams:()=>ue,nullish:()=>$p,numKeys:()=>f6,objectClone:()=>l6,omit:()=>y6,optionalKeys:()=>gw,partial:()=>w6,pick:()=>g6,prefixIssues:()=>bo,primitiveTypes:()=>UT,promiseAllObject:()=>d6,propertyKeyTypes:()=>hw,randomString:()=>p6,required:()=>x6,safeExtend:()=>v6,shallowClone:()=>LT,slugify:()=>fw,stringifyPrimitive:()=>_e,uint8ArrayToBase64:()=>qT,uint8ArrayToBase64url:()=>$6,uint8ArrayToHex:()=>E6,unwrapMessage:()=>Sp});function n6(t){return t}function i6(t){return t}function o6(t){}function s6(t){throw new Error}function a6(t){}function ag(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function ve(t,e="|"){return t.map(r=>_e(r)).join(e)}function au(t,e){return typeof e=="bigint"?e.toString():e}function lu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $p(t){return t==null}function Ip(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function pw(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}var DT=Symbol("evaluating");function dt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==DT)return n===void 0&&(n=DT,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function l6(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function fs(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ms(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function c6(t){return ms(t._zod.def)}function u6(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function d6(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function p6(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function lg(t){return JSON.stringify(t)}function fw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Aa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var mw=lu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function hs(t){if(Aa(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Aa(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(t){return hs(t)?{...t}:Array.isArray(t)?[...t]:t}function f6(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var m6=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},hw=new Set(["string","number","symbol"]),UT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ci(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ue(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function h6(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function _e(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function gw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var yw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},FT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function g6(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(i[o]=r.shape[o])}return fs(this,"shape",i),i},checks:[]});return Jr(t,n)}function y6(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete i[o]}return fs(this,"shape",i),i},checks:[]});return Jr(t,n)}function b6(t,e){if(!hs(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ms(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return fs(this,"shape",o),o},checks:[]});return Jr(t,i)}function v6(t,e){if(!hs(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return fs(this,"shape",n),n},checks:t._zod.def.checks};return Jr(t,r)}function _6(t,e){let r=ms(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return fs(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Jr(t,r)}function w6(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(let s in i)o[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return fs(this,"shape",o),o},checks:[]});return Jr(e,n)}function x6(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return fs(this,"shape",o),o},checks:[]});return Jr(e,n)}function gs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function bo(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Sp(t){return typeof t=="string"?t:t?.message}function ni(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Sp(t.inst?._zod.def?.error?.(t))??Sp(e?.error?.(t))??Sp(r.customError?.(t))??Sp(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function ZT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ep(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function cu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function k6(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function VT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function qT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function S6(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return VT(e+r)}function $6(t){return qT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function I6(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function E6(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var dw=class{constructor(...e){}};var BT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,au,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ug=M("$ZodError",BT),bw=M("$ZodError",BT,{Parent:Error});function dg(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function pg(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(e(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(t),r}var fg=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ai;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ni(l,o,Cr())));throw cg(a,i?.callee),a}return s.value};var mg=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ni(l,o,Cr())));throw cg(a,i?.callee),a}return s.value};var Pp=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ai;return o.issues.length?{success:!1,error:new(t??ug)(o.issues.map(s=>ni(s,i,Cr())))}:{success:!0,data:o.value}},uu=Pp(bw),Tp=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>ni(s,i,Cr())))}:{success:!0,data:o.value}},Ap=Tp(bw),WT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return fg(t)(e,r,i)};var GT=t=>(e,r,n)=>fg(t)(e,r,n);var HT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mg(t)(e,r,i)};var XT=t=>async(e,r,n)=>mg(t)(e,r,n);var KT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pp(t)(e,r,i)};var JT=t=>(e,r,n)=>Pp(t)(e,r,n);var YT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tp(t)(e,r,i)};var QT=t=>async(e,r,n)=>Tp(t)(e,r,n);var eA=/^[cC][^\s-]{8,}$/,tA=/^[0-9a-z]+$/,rA=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nA=/^[0-9a-vA-V]{20}$/,iA=/^[A-Za-z0-9]{27}$/,oA=/^[a-zA-Z0-9_-]{21}$/,sA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var aA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vw=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var lA=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var T6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cA(){return new RegExp(T6,"u")}var uA=/^(?:(?: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])$/,dA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var pA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,fA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_w=/^[A-Za-z0-9_-]*$/;var hA=/^\+(?:[0-9]){6,14}[0-9]$/,gA="(?:(?:\\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])))",yA=new RegExp(`^${gA}$`);function bA(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vA(t){return new RegExp(`^${bA(t)}$`)}function _A(t){let e=bA({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${gA}T(?:${n})$`)}var wA=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},xA=/^-?\d+n?$/,kA=/^-?\d+$/,SA=/^-?\d+(?:\.\d+)?/,$A=/^(?:true|false)$/i,IA=/^null$/i;var EA=/^[^A-Z]*$/,PA=/^[^a-z]*$/;var cr=M("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),TA={number:"number",bigint:"bigint",object:"date"},ww=M("$ZodCheckLessThan",(t,e)=>{cr.init(t,e);let r=TA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),xw=M("$ZodCheckGreaterThan",(t,e)=>{cr.init(t,e);let r=TA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),AA=M("$ZodCheckMultipleOf",(t,e)=>{cr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):pw(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),CA=M("$ZodCheckNumberFormat",(t,e)=>{cr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=yw[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=kA)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var zA=M("$ZodCheckMaxLength",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=Ep(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),OA=M("$ZodCheckMinLength",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=Ep(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),NA=M("$ZodCheckLengthEquals",(t,e)=>{var r;cr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$p(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=Ep(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Cp=M("$ZodCheckStringFormat",(t,e)=>{var r,n;cr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),RA=M("$ZodCheckRegex",(t,e)=>{Cp.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),MA=M("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=EA),Cp.init(t,e)}),jA=M("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=PA),Cp.init(t,e)}),DA=M("$ZodCheckIncludes",(t,e)=>{cr.init(t,e);let r=Ci(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),LA=M("$ZodCheckStartsWith",(t,e)=>{cr.init(t,e);let r=new RegExp(`^${Ci(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),UA=M("$ZodCheckEndsWith",(t,e)=>{cr.init(t,e);let r=new RegExp(`.*${Ci(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var FA=M("$ZodCheckOverwrite",(t,e)=>{cr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var hg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
91
91
|
`).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,i.join(`
|
|
92
|
-
`))}};var VA={major:4,minor:1,patch:13};var st=M("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=VA;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(s,a,l)=>{let c=gs(s),u;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(c)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&l?.async===!1)throw new Ai;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(c||(c=gs(s,f)))});else{if(s.issues.length===f)continue;c||(c=gs(s,f))}}return u?u.then(()=>s):s},o=(s,a,l)=>{if(gs(s))return s.aborted=!0,s;let c=i(a,n,l);if(c instanceof Promise){if(l.async===!1)throw new Ai;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let c=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>o(u,s,a)):o(c,s,a)}let l=t._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ai;return l.then(c=>i(c,n,a))}return i(l,n,a)}}t["~standard"]={validate:i=>{try{let o=uu(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Ap(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),du=M("$ZodString",(t,e)=>{st.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??wA(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),vt=M("$ZodStringFormat",(t,e)=>{Cp.init(t,e),du.init(t,e)}),Sw=M("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=aA),vt.init(t,e)}),$w=M("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=vw(n))}else e.pattern??(e.pattern=vw());vt.init(t,e)}),Iw=M("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=lA),vt.init(t,e)}),Ew=M("$ZodURL",(t,e)=>{vt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Pw=M("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=cA()),vt.init(t,e)}),Tw=M("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=oA),vt.init(t,e)}),Aw=M("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=eA),vt.init(t,e)}),Cw=M("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=tA),vt.init(t,e)}),zw=M("$ZodULID",(t,e)=>{e.pattern??(e.pattern=rA),vt.init(t,e)}),Ow=M("$ZodXID",(t,e)=>{e.pattern??(e.pattern=nA),vt.init(t,e)}),Nw=M("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=iA),vt.init(t,e)}),Rw=M("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=_A(e)),vt.init(t,e)}),Mw=M("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yA),vt.init(t,e)}),jw=M("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=vA(e)),vt.init(t,e)}),Dw=M("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=sA),vt.init(t,e)}),Lw=M("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=uA),vt.init(t,e),t._zod.bag.format="ipv4"}),Uw=M("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=dA),vt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Fw=M("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=pA),vt.init(t,e)}),Zw=M("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=fA),vt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function eC(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Vw=M("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=mA),vt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{eC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function
|
|
92
|
+
`))}};var VA={major:4,minor:1,patch:13};var st=M("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=VA;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(s,a,l)=>{let c=gs(s),u;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(c)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&l?.async===!1)throw new Ai;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(c||(c=gs(s,f)))});else{if(s.issues.length===f)continue;c||(c=gs(s,f))}}return u?u.then(()=>s):s},o=(s,a,l)=>{if(gs(s))return s.aborted=!0,s;let c=i(a,n,l);if(c instanceof Promise){if(l.async===!1)throw new Ai;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let c=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>o(u,s,a)):o(c,s,a)}let l=t._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ai;return l.then(c=>i(c,n,a))}return i(l,n,a)}}t["~standard"]={validate:i=>{try{let o=uu(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Ap(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),du=M("$ZodString",(t,e)=>{st.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??wA(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),vt=M("$ZodStringFormat",(t,e)=>{Cp.init(t,e),du.init(t,e)}),Sw=M("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=aA),vt.init(t,e)}),$w=M("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=vw(n))}else e.pattern??(e.pattern=vw());vt.init(t,e)}),Iw=M("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=lA),vt.init(t,e)}),Ew=M("$ZodURL",(t,e)=>{vt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Pw=M("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=cA()),vt.init(t,e)}),Tw=M("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=oA),vt.init(t,e)}),Aw=M("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=eA),vt.init(t,e)}),Cw=M("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=tA),vt.init(t,e)}),zw=M("$ZodULID",(t,e)=>{e.pattern??(e.pattern=rA),vt.init(t,e)}),Ow=M("$ZodXID",(t,e)=>{e.pattern??(e.pattern=nA),vt.init(t,e)}),Nw=M("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=iA),vt.init(t,e)}),Rw=M("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=_A(e)),vt.init(t,e)}),Mw=M("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yA),vt.init(t,e)}),jw=M("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=vA(e)),vt.init(t,e)}),Dw=M("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=sA),vt.init(t,e)}),Lw=M("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=uA),vt.init(t,e),t._zod.bag.format="ipv4"}),Uw=M("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=dA),vt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Fw=M("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=pA),vt.init(t,e)}),Zw=M("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=fA),vt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function eC(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Vw=M("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=mA),vt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{eC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function A6(t){if(!_w.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return eC(r)}var qw=M("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=_w),vt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{A6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Bw=M("$ZodE164",(t,e)=>{e.pattern??(e.pattern=hA),vt.init(t,e)});function C6(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var Ww=M("$ZodJWT",(t,e)=>{vt.init(t,e),t._zod.check=r=>{C6(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var bg=M("$ZodNumber",(t,e)=>{st.init(t,e),t._zod.pattern=t._zod.bag.pattern??SA,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),Gw=M("$ZodNumberFormat",(t,e)=>{CA.init(t,e),bg.init(t,e)}),vg=M("$ZodBoolean",(t,e)=>{st.init(t,e),t._zod.pattern=$A,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),Hw=M("$ZodBigInt",(t,e)=>{st.init(t,e),t._zod.pattern=xA,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var Xw=M("$ZodNull",(t,e)=>{st.init(t,e),t._zod.pattern=IA,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),Kw=M("$ZodAny",(t,e)=>{st.init(t,e),t._zod.parse=r=>r}),Jw=M("$ZodUnknown",(t,e)=>{st.init(t,e),t._zod.parse=r=>r}),Yw=M("$ZodNever",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var Qw=M("$ZodDate",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:t}),r}});function qA(t,e,r){t.issues.length&&e.issues.push(...bo(r,t.issues)),e.value[r]=t.value}var ex=M("$ZodArray",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],l=e.element._zod.run({value:a,issues:[]},n);l instanceof Promise?o.push(l.then(c=>qA(c,r,s))):qA(l,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function yg(t,e,r,n){t.issues.length&&e.issues.push(...bo(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function tC(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=gw(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function rC(t,e,r,n,i,o){let s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type;for(let u in e){if(a.has(u))continue;if(c==="never"){s.push(u);continue}let d=l.run({value:e[u],issues:[]},n);d instanceof Promise?t.push(d.then(f=>yg(f,r,u,e))):yg(d,r,u,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}var nC=M("$ZodObject",(t,e)=>{if(st.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}let n=lu(()=>tC(e));dt(t._zod,"propValues",()=>{let a=e.shape,l={};for(let c in a){let u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(let d of u.values)l[c].add(d)}}return l});let i=Aa,o=e.catchall,s;t._zod.parse=(a,l)=>{s??(s=n.value);let c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};let u=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:c[f],issues:[]},l);m instanceof Promise?u.push(m.then(h=>yg(h,a,f,c))):yg(m,a,f,c)}return o?rC(u,c,a,l,n.value,t):u.length?Promise.all(u).then(()=>a):a}}),iC=M("$ZodObjectJIT",(t,e)=>{nC.init(t,e);let r=t._zod.parse,n=lu(()=>tC(e)),i=f=>{let p=new hg(["shape","payload","ctx"]),m=n.value,h=_=>{let C=lg(_);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),g=0;for(let _ of m.keys)y[_]=`key_${g++}`;p.write("const newResult = {};");for(let _ of m.keys){let C=y[_],I=lg(_);p.write(`const ${C} = ${h(_)};`),p.write(`
|
|
93
93
|
if (${C}.issues.length) {
|
|
94
94
|
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
95
95
|
...iss,
|
|
@@ -106,11 +106,11 @@ ${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"ope
|
|
|
106
106
|
newResult[${I}] = ${C}.value;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(_,C)=>b(f,_,C)},o,s=Aa,a=!og.jitless,c=a&&mw.value,u=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=i(e.shape)),f=o(f,p),u?rC([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function BA(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!gs(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ni(s,n,Cr())))}),e)}var _g=M("$ZodUnion",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),dt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),dt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),dt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Ip(o.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,o)=>{if(r)return n(i,o);let s=!1,a=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(l=>BA(l,i,t,o)):BA(a,i,t,o)}}),tx=M("$ZodDiscriminatedUnion",(t,e)=>{_g.init(t,e);let r=t._zod.parse;dt(t._zod,"propValues",()=>{let i={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,l]of Object.entries(s)){i[a]||(i[a]=new Set);for(let c of l)i[a].add(c)}}return i});let n=lu(()=>{let i=e.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of a){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,s)}}return o});t._zod.parse=(i,o)=>{let s=i.value;if(!Aa(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(i,o):e.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),i)}}),rx=M("$ZodIntersection",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([l,c])=>WA(r,l,c)):WA(r,o,s)}});function kw(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(hs(t)&&hs(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=kw(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=e[n],s=kw(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function WA(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),gs(t))return t;let n=kw(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var nx=M("$ZodRecord",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!hs(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...bo(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...bo(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>ni(u,n,Cr())),input:a,path:[a],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[a],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...bo(a,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...bo(a,c.issues)),r.value[l.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var ix=M("$ZodEnum",(t,e)=>{st.init(t,e);let r=ag(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>hw.has(typeof i)).map(i=>typeof i=="string"?Ci(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),ox=M("$ZodLiteral",(t,e)=>{if(st.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Ci(n):n?Ci(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var sx=M("$ZodTransform",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new su(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new Ai;return r.value=i,r}});function GA(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var ax=M("$ZodOptional",(t,e)=>{st.init(t,e),t._zod.optin="optional",t._zod.optout="optional",dt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),dt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ip(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>GA(o,r.value)):GA(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),lx=M("$ZodNullable",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.innerType._zod.optin),dt(t._zod,"optout",()=>e.innerType._zod.optout),dt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ip(r.source)}|null)$`):void 0}),dt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),cx=M("$ZodDefault",(t,e)=>{st.init(t,e),t._zod.optin="optional",dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>HA(o,e)):HA(i,e)}});function HA(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var ux=M("$ZodPrefault",(t,e)=>{st.init(t,e),t._zod.optin="optional",dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),dx=M("$ZodNonOptional",(t,e)=>{st.init(t,e),dt(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>XA(o,t)):XA(i,t)}});function XA(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var px=M("$ZodCatch",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.innerType._zod.optin),dt(t._zod,"optout",()=>e.innerType._zod.optout),dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ni(s,n,Cr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>ni(o,n,Cr()))},input:r.value}),r.issues=[]),r)}});var fx=M("$ZodPipe",(t,e)=>{st.init(t,e),dt(t._zod,"values",()=>e.in._zod.values),dt(t._zod,"optin",()=>e.in._zod.optin),dt(t._zod,"optout",()=>e.out._zod.optout),dt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>gg(s,e.in,n)):gg(o,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>gg(o,e.out,n)):gg(i,e.out,n)}});function gg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var mx=M("$ZodReadonly",(t,e)=>{st.init(t,e),dt(t._zod,"propValues",()=>e.innerType._zod.propValues),dt(t._zod,"values",()=>e.innerType._zod.values),dt(t._zod,"optin",()=>e.innerType?._zod?.optin),dt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(KA):KA(i)}});function KA(t){return t.value=Object.freeze(t.value),t}var hx=M("$ZodCustom",(t,e)=>{cr.init(t,e),st.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>JA(o,r,n,t));JA(i,r,n,t)}});function JA(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(cu(i))}}var OF=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},NF=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${OF(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${_e(n.values[0])}`:`Invalid option: expected one of ${ve(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${ve(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function gx(){return{localeError:NF()}}var oC;var wg=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function bx(){return new wg}(oC=globalThis).__zod_globalRegistry??(oC.__zod_globalRegistry=bx());var vo=globalThis.__zod_globalRegistry;function vx(t,e){return new t({type:"string",...ue(e)})}function _x(t,e){return new t({type:"string",coerce:!0,...ue(e)})}function wx(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ue(e)})}function xg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ue(e)})}function xx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ue(e)})}function kx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ue(e)})}function Sx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ue(e)})}function $x(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ue(e)})}function kg(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ue(e)})}function Ix(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ue(e)})}function Ex(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ue(e)})}function Px(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ue(e)})}function Tx(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ue(e)})}function Ax(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ue(e)})}function Cx(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ue(e)})}function zx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ue(e)})}function Ox(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ue(e)})}function Nx(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ue(e)})}function Rx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ue(e)})}function Mx(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ue(e)})}function jx(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ue(e)})}function Dx(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ue(e)})}function Lx(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ue(e)})}function Ux(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ue(e)})}function Fx(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ue(e)})}function Zx(t,e){return new t({type:"string",format:"date",check:"string_format",...ue(e)})}function Vx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ue(e)})}function qx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ue(e)})}function Bx(t,e){return new t({type:"number",checks:[],...ue(e)})}function Wx(t,e){return new t({type:"number",coerce:!0,checks:[],...ue(e)})}function Gx(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ue(e)})}function Hx(t,e){return new t({type:"boolean",...ue(e)})}function Xx(t,e){return new t({type:"boolean",coerce:!0,...ue(e)})}function Kx(t,e){return new t({type:"bigint",coerce:!0,...ue(e)})}function Jx(t,e){return new t({type:"null",...ue(e)})}function Yx(t){return new t({type:"any"})}function Qx(t){return new t({type:"unknown"})}function e0(t,e){return new t({type:"never",...ue(e)})}function t0(t,e){return new t({type:"date",coerce:!0,...ue(e)})}function za(t,e){return new ww({check:"less_than",...ue(e),value:t,inclusive:!1})}function ii(t,e){return new ww({check:"less_than",...ue(e),value:t,inclusive:!0})}function Oa(t,e){return new xw({check:"greater_than",...ue(e),value:t,inclusive:!1})}function _n(t,e){return new xw({check:"greater_than",...ue(e),value:t,inclusive:!0})}function pu(t,e){return new AA({check:"multiple_of",...ue(e),value:t})}function zp(t,e){return new zA({check:"max_length",...ue(e),maximum:t})}function Na(t,e){return new OA({check:"min_length",...ue(e),minimum:t})}function Op(t,e){return new NA({check:"length_equals",...ue(e),length:t})}function Sg(t,e){return new RA({check:"string_format",format:"regex",...ue(e),pattern:t})}function $g(t){return new MA({check:"string_format",format:"lowercase",...ue(t)})}function Ig(t){return new jA({check:"string_format",format:"uppercase",...ue(t)})}function Eg(t,e){return new DA({check:"string_format",format:"includes",...ue(e),includes:t})}function Pg(t,e){return new LA({check:"string_format",format:"starts_with",...ue(e),prefix:t})}function Tg(t,e){return new UA({check:"string_format",format:"ends_with",...ue(e),suffix:t})}function _o(t){return new FA({check:"overwrite",tx:t})}function Ag(t){return _o(e=>e.normalize(t))}function Cg(){return _o(t=>t.trim())}function zg(){return _o(t=>t.toLowerCase())}function Og(){return _o(t=>t.toUpperCase())}function r0(){return _o(t=>fw(t))}function aC(t,e,r){return new t({type:"array",element:e,...ue(r)})}function n0(t,e,r){let n=ue(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function i0(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ue(r)})}function o0(t){let e=DF(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(cu(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(cu(i))}},t(r.value,r)));return e}function DF(t,e){let r=new cr({check:"custom",...ue(e)});return r._zod.check=t,r}function fu(t){return!!t._zod}function si(t,e){return fu(t)?uu(t,e):t.safeParse(e)}function Ng(t){if(!t)return;let e;if(fu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function gC(t){if(fu(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Np={};gd(Np,{ZodISODate:()=>l0,ZodISODateTime:()=>s0,ZodISODuration:()=>p0,ZodISOTime:()=>u0,date:()=>c0,datetime:()=>a0,duration:()=>f0,time:()=>d0});var s0=M("ZodISODateTime",(t,e)=>{Rw.init(t,e),At.init(t,e)});function a0(t){return Fx(s0,t)}var l0=M("ZodISODate",(t,e)=>{Mw.init(t,e),At.init(t,e)});function c0(t){return Zx(l0,t)}var u0=M("ZodISOTime",(t,e)=>{jw.init(t,e),At.init(t,e)});function d0(t){return Vx(u0,t)}var p0=M("ZodISODuration",(t,e)=>{Dw.init(t,e),At.init(t,e)});function f0(t){return qx(p0,t)}var bC=(t,e)=>{ug.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>pg(t,r)},flatten:{value:r=>dg(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,au,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,au,2)}},isEmpty:{get(){return t.issues.length===0}}})},Ive=M("ZodError",bC),wn=M("ZodError",bC,{Parent:Error});var vC=fg(wn),_C=mg(wn),wC=Pp(wn),xC=Tp(wn),kC=WT(wn),SC=GT(wn),$C=HT(wn),IC=XT(wn),EC=KT(wn),PC=JT(wn),TC=YT(wn),AC=QT(wn);var _t=M("ZodType",(t,e)=>(st.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(V.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Jr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>vC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>wC(t,r,n),t.parseAsync=async(r,n)=>_C(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>xC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>kC(t,r,n),t.decode=(r,n)=>SC(t,r,n),t.encodeAsync=async(r,n)=>$C(t,r,n),t.decodeAsync=async(r,n)=>IC(t,r,n),t.safeEncode=(r,n)=>EC(t,r,n),t.safeDecode=(r,n)=>PC(t,r,n),t.safeEncodeAsync=async(r,n)=>TC(t,r,n),t.safeDecodeAsync=async(r,n)=>AC(t,r,n),t.refine=(r,n)=>t.check(_Z(r,n)),t.superRefine=r=>t.check(wZ(r)),t.overwrite=r=>t.check(_o(r)),t.optional=()=>Mt(t),t.nullable=()=>OC(t),t.nullish=()=>Mt(OC(t)),t.nonoptional=r=>mZ(t,r),t.array=()=>B(t),t.or=r=>wt([t,r]),t.and=r=>jg(t,r),t.transform=r=>h0(t,ZC(r)),t.default=r=>dZ(t,r),t.prefault=r=>fZ(t,r),t.catch=r=>gZ(t,r),t.pipe=r=>h0(t,r),t.readonly=()=>vZ(t),t.describe=r=>{let n=t.clone();return vo.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return vo.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return vo.get(t);let n=t.clone();return vo.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),NC=M("_ZodString",(t,e)=>{du.init(t,e),_t.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Sg(...n)),t.includes=(...n)=>t.check(Eg(...n)),t.startsWith=(...n)=>t.check(Pg(...n)),t.endsWith=(...n)=>t.check(Tg(...n)),t.min=(...n)=>t.check(Na(...n)),t.max=(...n)=>t.check(zp(...n)),t.length=(...n)=>t.check(Op(...n)),t.nonempty=(...n)=>t.check(Na(1,...n)),t.lowercase=n=>t.check($g(n)),t.uppercase=n=>t.check(Ig(n)),t.trim=()=>t.check(Cg()),t.normalize=(...n)=>t.check(Ag(...n)),t.toLowerCase=()=>t.check(zg()),t.toUpperCase=()=>t.check(Og()),t.slugify=()=>t.check(r0())}),g0=M("ZodString",(t,e)=>{du.init(t,e),NC.init(t,e),t.email=r=>t.check(wx(R6,r)),t.url=r=>t.check(kg(RC,r)),t.jwt=r=>t.check(Ux(K6,r)),t.emoji=r=>t.check(Ix(M6,r)),t.guid=r=>t.check(xg(CC,r)),t.uuid=r=>t.check(xx(Rg,r)),t.uuidv4=r=>t.check(kx(Rg,r)),t.uuidv6=r=>t.check(Sx(Rg,r)),t.uuidv7=r=>t.check($x(Rg,r)),t.nanoid=r=>t.check(Ex(j6,r)),t.guid=r=>t.check(xg(CC,r)),t.cuid=r=>t.check(Px(D6,r)),t.cuid2=r=>t.check(Tx(L6,r)),t.ulid=r=>t.check(Ax(U6,r)),t.base64=r=>t.check(jx(G6,r)),t.base64url=r=>t.check(Dx(H6,r)),t.xid=r=>t.check(Cx(F6,r)),t.ksuid=r=>t.check(zx(Z6,r)),t.ipv4=r=>t.check(Ox(V6,r)),t.ipv6=r=>t.check(Nx(q6,r)),t.cidrv4=r=>t.check(Rx(B6,r)),t.cidrv6=r=>t.check(Mx(W6,r)),t.e164=r=>t.check(Lx(X6,r)),t.datetime=r=>t.check(a0(r)),t.date=r=>t.check(c0(r)),t.time=r=>t.check(d0(r)),t.duration=r=>t.check(f0(r))});function S(t){return vx(g0,t)}var At=M("ZodStringFormat",(t,e)=>{vt.init(t,e),NC.init(t,e)}),R6=M("ZodEmail",(t,e)=>{Iw.init(t,e),At.init(t,e)});var CC=M("ZodGUID",(t,e)=>{Sw.init(t,e),At.init(t,e)});var Rg=M("ZodUUID",(t,e)=>{$w.init(t,e),At.init(t,e)});var RC=M("ZodURL",(t,e)=>{Ew.init(t,e),At.init(t,e)});function MC(t){return kg(RC,t)}var M6=M("ZodEmoji",(t,e)=>{Pw.init(t,e),At.init(t,e)});var j6=M("ZodNanoID",(t,e)=>{Tw.init(t,e),At.init(t,e)});var D6=M("ZodCUID",(t,e)=>{Aw.init(t,e),At.init(t,e)});var L6=M("ZodCUID2",(t,e)=>{Cw.init(t,e),At.init(t,e)});var U6=M("ZodULID",(t,e)=>{zw.init(t,e),At.init(t,e)});var F6=M("ZodXID",(t,e)=>{Ow.init(t,e),At.init(t,e)});var Z6=M("ZodKSUID",(t,e)=>{Nw.init(t,e),At.init(t,e)});var V6=M("ZodIPv4",(t,e)=>{Lw.init(t,e),At.init(t,e)});var q6=M("ZodIPv6",(t,e)=>{Uw.init(t,e),At.init(t,e)});var B6=M("ZodCIDRv4",(t,e)=>{Fw.init(t,e),At.init(t,e)});var W6=M("ZodCIDRv6",(t,e)=>{Zw.init(t,e),At.init(t,e)});var G6=M("ZodBase64",(t,e)=>{Vw.init(t,e),At.init(t,e)});var H6=M("ZodBase64URL",(t,e)=>{qw.init(t,e),At.init(t,e)});var X6=M("ZodE164",(t,e)=>{Bw.init(t,e),At.init(t,e)});var K6=M("ZodJWT",(t,e)=>{Ww.init(t,e),At.init(t,e)});var Mg=M("ZodNumber",(t,e)=>{bg.init(t,e),_t.init(t,e),t.gt=(n,i)=>t.check(Oa(n,i)),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.lt=(n,i)=>t.check(za(n,i)),t.lte=(n,i)=>t.check(ii(n,i)),t.max=(n,i)=>t.check(ii(n,i)),t.int=n=>t.check(zC(n)),t.safe=n=>t.check(zC(n)),t.positive=n=>t.check(Oa(0,n)),t.nonnegative=n=>t.check(_n(0,n)),t.negative=n=>t.check(za(0,n)),t.nonpositive=n=>t.check(ii(0,n)),t.multipleOf=(n,i)=>t.check(pu(n,i)),t.step=(n,i)=>t.check(pu(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function rt(t){return Bx(Mg,t)}var J6=M("ZodNumberFormat",(t,e)=>{Gw.init(t,e),Mg.init(t,e)});function zC(t){return Gx(J6,t)}var y0=M("ZodBoolean",(t,e)=>{vg.init(t,e),_t.init(t,e)});function ht(t){return Hx(y0,t)}var jC=M("ZodBigInt",(t,e)=>{Hw.init(t,e),_t.init(t,e),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.gt=(n,i)=>t.check(Oa(n,i)),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.lt=(n,i)=>t.check(za(n,i)),t.lte=(n,i)=>t.check(ii(n,i)),t.max=(n,i)=>t.check(ii(n,i)),t.positive=n=>t.check(Oa(BigInt(0),n)),t.negative=n=>t.check(za(BigInt(0),n)),t.nonpositive=n=>t.check(ii(BigInt(0),n)),t.nonnegative=n=>t.check(_n(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(pu(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var Y6=M("ZodNull",(t,e)=>{Xw.init(t,e),_t.init(t,e)});function b0(t){return Jx(Y6,t)}var Q6=M("ZodAny",(t,e)=>{Kw.init(t,e),_t.init(t,e)});function DC(){return Yx(Q6)}var eZ=M("ZodUnknown",(t,e)=>{Jw.init(t,e),_t.init(t,e)});function Ct(){return Qx(eZ)}var tZ=M("ZodNever",(t,e)=>{Yw.init(t,e),_t.init(t,e)});function rZ(t){return e0(tZ,t)}var LC=M("ZodDate",(t,e)=>{Qw.init(t,e),_t.init(t,e),t.min=(n,i)=>t.check(_n(n,i)),t.max=(n,i)=>t.check(ii(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var nZ=M("ZodArray",(t,e)=>{ex.init(t,e),_t.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Na(r,n)),t.nonempty=r=>t.check(Na(1,r)),t.max=(r,n)=>t.check(zp(r,n)),t.length=(r,n)=>t.check(Op(r,n)),t.unwrap=()=>t.element});function B(t,e){return aC(nZ,t,e)}var UC=M("ZodObject",(t,e)=>{iC.init(t,e),_t.init(t,e),V.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Yr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ct()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ct()}),t.strict=()=>t.clone({...t._zod.def,catchall:rZ()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>V.extend(t,r),t.safeExtend=r=>V.safeExtend(t,r),t.merge=r=>V.merge(t,r),t.pick=r=>V.pick(t,r),t.omit=r=>V.omit(t,r),t.partial=(...r)=>V.partial(VC,t,r[0]),t.required=(...r)=>V.required(qC,t,r[0])});function G(t,e){let r={type:"object",shape:t??{},...V.normalizeParams(e)};return new UC(r)}function nr(t,e){return new UC({type:"object",shape:t,catchall:Ct(),...V.normalizeParams(e)})}var FC=M("ZodUnion",(t,e)=>{_g.init(t,e),_t.init(t,e),t.options=e.options});function wt(t,e){return new FC({type:"union",options:t,...V.normalizeParams(e)})}var iZ=M("ZodDiscriminatedUnion",(t,e)=>{FC.init(t,e),tx.init(t,e)});function v0(t,e,r){return new iZ({type:"union",options:e,discriminator:t,...V.normalizeParams(r)})}var oZ=M("ZodIntersection",(t,e)=>{rx.init(t,e),_t.init(t,e)});function jg(t,e){return new oZ({type:"intersection",left:t,right:e})}var sZ=M("ZodRecord",(t,e)=>{nx.init(t,e),_t.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function zt(t,e,r){return new sZ({type:"record",keyType:t,valueType:e,...V.normalizeParams(r)})}var m0=M("ZodEnum",(t,e)=>{ix.init(t,e),_t.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new m0({...e,checks:[],...V.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new m0({...e,checks:[],...V.normalizeParams(i),entries:o})}});function Yr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new m0({type:"enum",entries:r,...V.normalizeParams(e)})}var aZ=M("ZodLiteral",(t,e)=>{ox.init(t,e),_t.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ie(t,e){return new aZ({type:"literal",values:Array.isArray(t)?t:[t],...V.normalizeParams(e)})}var lZ=M("ZodTransform",(t,e)=>{sx.init(t,e),_t.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new su(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(V.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function ZC(t){return new lZ({type:"transform",transform:t})}var VC=M("ZodOptional",(t,e)=>{ax.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Mt(t){return new VC({type:"optional",innerType:t})}var cZ=M("ZodNullable",(t,e)=>{lx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function OC(t){return new cZ({type:"nullable",innerType:t})}var uZ=M("ZodDefault",(t,e)=>{cx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function dZ(t,e){return new uZ({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var pZ=M("ZodPrefault",(t,e)=>{ux.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function fZ(t,e){return new pZ({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var qC=M("ZodNonOptional",(t,e)=>{dx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mZ(t,e){return new qC({type:"nonoptional",innerType:t,...V.normalizeParams(e)})}var hZ=M("ZodCatch",(t,e)=>{px.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function gZ(t,e){return new hZ({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var yZ=M("ZodPipe",(t,e)=>{fx.init(t,e),_t.init(t,e),t.in=e.in,t.out=e.out});function h0(t,e){return new yZ({type:"pipe",in:t,out:e})}var bZ=M("ZodReadonly",(t,e)=>{mx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vZ(t){return new bZ({type:"readonly",innerType:t})}var BC=M("ZodCustom",(t,e)=>{hx.init(t,e),_t.init(t,e)});function WC(t,e){return n0(BC,t??(()=>!0),e)}function _Z(t,e={}){return i0(BC,t,e)}function wZ(t){return o0(t)}function _0(t,e){return h0(ZC(t),e)}var HC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var GC;GC||(GC={});var Dg={};gd(Dg,{bigint:()=>$Z,boolean:()=>SZ,date:()=>IZ,number:()=>kZ,string:()=>xZ});function xZ(t){return _x(g0,t)}function kZ(t){return Wx(Mg,t)}function SZ(t){return Xx(y0,t)}function $Z(t){return Kx(jC,t)}function IZ(t){return t0(LC,t)}Cr(gx());var hu="2025-11-25";var KC=[hu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Ug="2.0",yr=WC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),JC=wt([S(),rt().int()]),YC=S(),Wve=nr({ttl:wt([rt(),b0()]).optional(),pollInterval:rt().optional()}),PZ=G({ttl:rt().optional()}),TZ=G({taskId:S()}),x0=nr({progressToken:JC.optional(),[ys]:TZ.optional()}),xn=G({_meta:x0.optional()}),Rp=xn.extend({task:PZ.optional()}),QC=t=>Rp.safeParse(t).success,br=G({method:S(),params:xn.loose().optional()}),Mn=G({_meta:x0.optional()}),jn=G({method:S(),params:Mn.loose().optional()}),vr=nr({_meta:x0.optional()}),Fg=wt([S(),rt().int()]),ez=G({jsonrpc:ie(Ug),id:Fg,...br.shape}).strict(),Mp=t=>ez.safeParse(t).success,tz=G({jsonrpc:ie(Ug),...jn.shape}).strict(),rz=t=>tz.safeParse(t).success,k0=G({jsonrpc:ie(Ug),id:Fg,result:vr}).strict(),Ra=t=>k0.safeParse(t).success;var ke;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ke||(ke={}));var S0=G({jsonrpc:ie(Ug),id:Fg.optional(),error:G({code:rt().int(),message:S(),data:Ct().optional()})}).strict();var nz=t=>S0.safeParse(t).success;var Zg=wt([ez,tz,k0,S0]),Gve=wt([k0,S0]),Ma=vr.strict(),AZ=Mn.extend({requestId:Fg.optional(),reason:S().optional()}),Vg=jn.extend({method:ie("notifications/cancelled"),params:AZ}),CZ=G({src:S(),mimeType:S().optional(),sizes:B(S()).optional(),theme:Yr(["light","dark"]).optional()}),jp=G({icons:B(CZ).optional()}),mu=G({name:S(),title:S().optional()}),iz=mu.extend({...mu.shape,...jp.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),zZ=jg(G({applyDefaults:ht().optional()}),zt(S(),Ct())),OZ=_0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,jg(G({form:zZ.optional(),url:yr.optional()}),zt(S(),Ct()).optional())),NZ=nr({list:yr.optional(),cancel:yr.optional(),requests:nr({sampling:nr({createMessage:yr.optional()}).optional(),elicitation:nr({create:yr.optional()}).optional()}).optional()}),RZ=nr({list:yr.optional(),cancel:yr.optional(),requests:nr({tools:nr({call:yr.optional()}).optional()}).optional()}),MZ=G({experimental:zt(S(),yr).optional(),sampling:G({context:yr.optional(),tools:yr.optional()}).optional(),elicitation:OZ.optional(),roots:G({listChanged:ht().optional()}).optional(),tasks:NZ.optional()}),jZ=xn.extend({protocolVersion:S(),capabilities:MZ,clientInfo:iz}),DZ=br.extend({method:ie("initialize"),params:jZ});var LZ=G({experimental:zt(S(),yr).optional(),logging:yr.optional(),completions:yr.optional(),prompts:G({listChanged:ht().optional()}).optional(),resources:G({subscribe:ht().optional(),listChanged:ht().optional()}).optional(),tools:G({listChanged:ht().optional()}).optional(),tasks:RZ.optional()}),$0=vr.extend({protocolVersion:S(),capabilities:LZ,serverInfo:iz,instructions:S().optional()}),oz=jn.extend({method:ie("notifications/initialized"),params:Mn.optional()}),sz=t=>oz.safeParse(t).success,qg=br.extend({method:ie("ping"),params:xn.optional()}),UZ=G({progress:rt(),total:Mt(rt()),message:Mt(S())}),FZ=G({...Mn.shape,...UZ.shape,progressToken:JC}),Bg=jn.extend({method:ie("notifications/progress"),params:FZ}),ZZ=xn.extend({cursor:YC.optional()}),Dp=br.extend({params:ZZ.optional()}),Lp=vr.extend({nextCursor:YC.optional()}),VZ=Yr(["working","input_required","completed","failed","cancelled"]),Up=G({taskId:S(),status:VZ,ttl:wt([rt(),b0()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:Mt(rt()),statusMessage:Mt(S())}),ja=vr.extend({task:Up}),qZ=Mn.merge(Up),Fp=jn.extend({method:ie("notifications/tasks/status"),params:qZ}),Wg=br.extend({method:ie("tasks/get"),params:xn.extend({taskId:S()})}),Gg=vr.merge(Up),Hg=br.extend({method:ie("tasks/result"),params:xn.extend({taskId:S()})}),Hve=vr.loose(),Xg=Dp.extend({method:ie("tasks/list")}),Kg=Lp.extend({tasks:B(Up)}),Jg=br.extend({method:ie("tasks/cancel"),params:xn.extend({taskId:S()})}),az=vr.merge(Up),lz=G({uri:S(),mimeType:Mt(S()),_meta:zt(S(),Ct()).optional()}),cz=lz.extend({text:S()}),I0=S().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),uz=lz.extend({blob:I0}),Zp=Yr(["user","assistant"]),gu=G({audience:B(Zp).optional(),priority:rt().min(0).max(1).optional(),lastModified:Np.datetime({offset:!0}).optional()}),dz=G({...mu.shape,...jp.shape,uri:S(),description:Mt(S()),mimeType:Mt(S()),annotations:gu.optional(),_meta:Mt(nr({}))}),BZ=G({...mu.shape,...jp.shape,uriTemplate:S(),description:Mt(S()),mimeType:Mt(S()),annotations:gu.optional(),_meta:Mt(nr({}))}),WZ=Dp.extend({method:ie("resources/list")}),E0=Lp.extend({resources:B(dz)}),GZ=Dp.extend({method:ie("resources/templates/list")}),P0=Lp.extend({resourceTemplates:B(BZ)}),T0=xn.extend({uri:S()}),HZ=T0,XZ=br.extend({method:ie("resources/read"),params:HZ}),A0=vr.extend({contents:B(wt([cz,uz]))}),C0=jn.extend({method:ie("notifications/resources/list_changed"),params:Mn.optional()}),KZ=T0,JZ=br.extend({method:ie("resources/subscribe"),params:KZ}),YZ=T0,QZ=br.extend({method:ie("resources/unsubscribe"),params:YZ}),e9=Mn.extend({uri:S()}),t9=jn.extend({method:ie("notifications/resources/updated"),params:e9}),r9=G({name:S(),description:Mt(S()),required:Mt(ht())}),n9=G({...mu.shape,...jp.shape,description:Mt(S()),arguments:Mt(B(r9)),_meta:Mt(nr({}))}),i9=Dp.extend({method:ie("prompts/list")}),z0=Lp.extend({prompts:B(n9)}),o9=xn.extend({name:S(),arguments:zt(S(),S()).optional()}),s9=br.extend({method:ie("prompts/get"),params:o9}),O0=G({type:ie("text"),text:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),N0=G({type:ie("image"),data:I0,mimeType:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),R0=G({type:ie("audio"),data:I0,mimeType:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),a9=G({type:ie("tool_use"),name:S(),id:S(),input:zt(S(),Ct()),_meta:zt(S(),Ct()).optional()}),l9=G({type:ie("resource"),resource:wt([cz,uz]),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),c9=dz.extend({type:ie("resource_link")}),M0=wt([O0,N0,R0,c9,l9]),u9=G({role:Zp,content:M0}),j0=vr.extend({description:S().optional(),messages:B(u9)}),D0=jn.extend({method:ie("notifications/prompts/list_changed"),params:Mn.optional()}),d9=G({title:S().optional(),readOnlyHint:ht().optional(),destructiveHint:ht().optional(),idempotentHint:ht().optional(),openWorldHint:ht().optional()}),p9=G({taskSupport:Yr(["required","optional","forbidden"]).optional()}),pz=G({...mu.shape,...jp.shape,description:S().optional(),inputSchema:G({type:ie("object"),properties:zt(S(),yr).optional(),required:B(S()).optional()}).catchall(Ct()),outputSchema:G({type:ie("object"),properties:zt(S(),yr).optional(),required:B(S()).optional()}).catchall(Ct()).optional(),annotations:d9.optional(),execution:p9.optional(),_meta:zt(S(),Ct()).optional()}),f9=Dp.extend({method:ie("tools/list")}),L0=Lp.extend({tools:B(pz)}),yu=vr.extend({content:B(M0).default([]),structuredContent:zt(S(),Ct()).optional(),isError:ht().optional()}),Xve=yu.or(vr.extend({toolResult:Ct()})),m9=Rp.extend({name:S(),arguments:zt(S(),Ct()).optional()}),h9=br.extend({method:ie("tools/call"),params:m9}),Vp=jn.extend({method:ie("notifications/tools/list_changed"),params:Mn.optional()}),fz=G({autoRefresh:ht().default(!0),debounceMs:rt().int().nonnegative().default(300)}),mz=Yr(["debug","info","notice","warning","error","critical","alert","emergency"]),g9=xn.extend({level:mz}),y9=br.extend({method:ie("logging/setLevel"),params:g9}),b9=Mn.extend({level:mz,logger:S().optional(),data:Ct()}),U0=jn.extend({method:ie("notifications/message"),params:b9}),v9=G({name:S().optional()}),_9=G({hints:B(v9).optional(),costPriority:rt().min(0).max(1).optional(),speedPriority:rt().min(0).max(1).optional(),intelligencePriority:rt().min(0).max(1).optional()}),w9=G({mode:Yr(["auto","required","none"]).optional()}),x9=G({type:ie("tool_result"),toolUseId:S().describe("The unique identifier for the corresponding tool call."),content:B(M0).default([]),structuredContent:G({}).loose().optional(),isError:ht().optional(),_meta:zt(S(),Ct()).optional()}),k9=v0("type",[O0,N0,R0]),Lg=v0("type",[O0,N0,R0,a9,x9]),S9=G({role:Zp,content:wt([Lg,B(Lg)]),_meta:zt(S(),Ct()).optional()}),$9=Rp.extend({messages:B(S9),modelPreferences:_9.optional(),systemPrompt:S().optional(),includeContext:Yr(["none","thisServer","allServers"]).optional(),temperature:rt().optional(),maxTokens:rt().int(),stopSequences:B(S()).optional(),metadata:yr.optional(),tools:B(pz).optional(),toolChoice:w9.optional()}),F0=br.extend({method:ie("sampling/createMessage"),params:$9}),Z0=vr.extend({model:S(),stopReason:Mt(Yr(["endTurn","stopSequence","maxTokens"]).or(S())),role:Zp,content:k9}),V0=vr.extend({model:S(),stopReason:Mt(Yr(["endTurn","stopSequence","maxTokens","toolUse"]).or(S())),role:Zp,content:wt([Lg,B(Lg)])}),I9=G({type:ie("boolean"),title:S().optional(),description:S().optional(),default:ht().optional()}),E9=G({type:ie("string"),title:S().optional(),description:S().optional(),minLength:rt().optional(),maxLength:rt().optional(),format:Yr(["email","uri","date","date-time"]).optional(),default:S().optional()}),P9=G({type:Yr(["number","integer"]),title:S().optional(),description:S().optional(),minimum:rt().optional(),maximum:rt().optional(),default:rt().optional()}),T9=G({type:ie("string"),title:S().optional(),description:S().optional(),enum:B(S()),default:S().optional()}),A9=G({type:ie("string"),title:S().optional(),description:S().optional(),oneOf:B(G({const:S(),title:S()})),default:S().optional()}),C9=G({type:ie("string"),title:S().optional(),description:S().optional(),enum:B(S()),enumNames:B(S()).optional(),default:S().optional()}),z9=wt([T9,A9]),O9=G({type:ie("array"),title:S().optional(),description:S().optional(),minItems:rt().optional(),maxItems:rt().optional(),items:G({type:ie("string"),enum:B(S())}),default:B(S()).optional()}),N9=G({type:ie("array"),title:S().optional(),description:S().optional(),minItems:rt().optional(),maxItems:rt().optional(),items:G({anyOf:B(G({const:S(),title:S()}))}),default:B(S()).optional()}),R9=wt([O9,N9]),M9=wt([C9,z9,R9]),j9=wt([M9,I9,E9,P9]),D9=Rp.extend({mode:ie("form").optional(),message:S(),requestedSchema:G({type:ie("object"),properties:zt(S(),j9),required:B(S()).optional()})}),L9=Rp.extend({mode:ie("url"),message:S(),elicitationId:S(),url:S().url()}),U9=wt([D9,L9]),q0=br.extend({method:ie("elicitation/create"),params:U9}),F9=Mn.extend({elicitationId:S()}),Z9=jn.extend({method:ie("notifications/elicitation/complete"),params:F9}),B0=vr.extend({action:Yr(["accept","decline","cancel"]),content:_0(t=>t===null?void 0:t,zt(S(),wt([S(),rt(),ht(),B(S())])).optional())}),V9=G({type:ie("ref/resource"),uri:S()});var q9=G({type:ie("ref/prompt"),name:S()}),B9=xn.extend({ref:wt([q9,V9]),argument:G({name:S(),value:S()}),context:G({arguments:zt(S(),S()).optional()}).optional()}),W9=br.extend({method:ie("completion/complete"),params:B9});var W0=vr.extend({completion:nr({values:B(S()).max(100),total:Mt(rt().int()),hasMore:Mt(ht())})}),G9=G({uri:S().startsWith("file://"),name:S().optional(),_meta:zt(S(),Ct()).optional()}),H9=br.extend({method:ie("roots/list"),params:xn.optional()}),X9=vr.extend({roots:B(G9)}),K9=jn.extend({method:ie("notifications/roots/list_changed"),params:Mn.optional()}),Kve=wt([qg,DZ,W9,y9,s9,i9,WZ,GZ,XZ,JZ,QZ,h9,f9,Wg,Hg,Xg,Jg]),Jve=wt([Vg,Bg,oz,K9,Fp]),Yve=wt([Ma,Z0,V0,B0,X9,Gg,Kg,ja]),Qve=wt([qg,F0,q0,H9,Wg,Hg,Xg,Jg]),e_e=wt([Vg,Bg,U0,t9,C0,Vp,D0,Fp,Z9]),t_e=wt([Ma,$0,W0,j0,z0,E0,P0,A0,yu,L0,Gg,Kg,ja]),me=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ke.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new w0(i.elicitations,r)}return new t(e,r,n)}},w0=class extends me{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ke.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function bs(t){return t==="completed"||t==="failed"||t==="cancelled"}var R_e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function G0(t){let r=Ng(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=gC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function H0(t,e){let r=si(t,e);if(!r.success)throw r.error;return r.data}var r3=6e4,Yg=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Vg,r=>{this._oncancel(r)}),this.setNotificationHandler(Bg,r=>{this._onprogress(r)}),this.setRequestHandler(qg,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wg,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new me(ke.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Hg,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(a.type==="response"||a.type==="error"){let l=a.message,c=l.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(l);else{let d=l,f=new me(d.error.code,d.error.message,d.error.data);u(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new me(ke.InvalidParams,`Task not found: ${o}`);if(!bs(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(bs(s.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[ys]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Xg,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new me(ke.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Jg,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new me(ke.InvalidParams,`Task not found: ${r.params.taskId}`);if(bs(i.status))throw new me(ke.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new me(ke.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof me?i:new me(ke.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),me.fromError(ke.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{i?.(o,s),Ra(o)||nz(o)?this._onresponse(o):Mp(o)?this._onrequest(o,s):rz(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=me.fromError(ke.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,o=e.params?._meta?.[ys]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ke.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=QC(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,c={signal:s.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,f)=>{if(s.signal.aborted)throw new me(ke.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:e.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let m=p.relatedTask?.taskId??o;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(u,d,p)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:l,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ke.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),s(l);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ra(e))n(e);else{let s=new me(e.error.code,e.error.message,e.error.data);n(s)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Ra(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),Ra(e))i(e);else{let s=me.fromError(e.error.code,e.error.message,e.error.data);i(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(s){yield{type:"error",error:s instanceof me?s:new me(ke.InternalError,String(s))}}return}let o;try{let s=await this.request(e,ja,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new me(ke.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},bs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new me(ke.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new me(ke.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let l=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(c=>setTimeout(c,l)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof me?s:new me(ke.InternalError,String(s))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:l}=n??{};return new Promise((c,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),l&&(p.params={...p.params,_meta:{...p.params?._meta||{},[ys]:l}});let m=b=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(b)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let _=b instanceof me?b:new me(ke.RequestTimeout,String(b));u(_)};this._responseHandlers.set(f,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let _=si(r,b.result);_.success?c(_.data):u(_.error)}catch(_){u(_)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??r3,y=()=>m(me.fromError(ke.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let g=l?.taskId;if(g){let b=_=>{let C=this._responseHandlers.get(f);C?C(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,b),this._enqueueTaskMessage(g,{type:"request",message:p,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),u(_)})}else this._transport.send(p,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(b=>{this._cleanupTimeout(f),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gg,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Kg,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},az,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ys]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ys]:r.relatedTask}}}),this._transport?.send(a,r).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ys]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let n=G0(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let s=H0(e,i);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=G0(e);this._notificationHandlers.set(n,i=>{let o=H0(e,i);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&Mp(i.message)){let o=i.message.id,s=this._requestResolvers.get(o);s?(s(new me(ke.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new me(ke.InvalidRequest,"Request cancelled"));return}let s=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(s),o(new me(ke.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new me(ke.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,s)=>{await n.storeTaskResult(i,o,s,r);let a=await n.getTask(i,r);if(a){let l=Fp.parse({method:"notifications/tasks/status",params:a});await this.notification(l),bs(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,s)=>{let a=await n.getTask(i,r);if(!a)throw new me(ke.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(bs(a.status))throw new me(ke.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,s,r);let l=await n.getTask(i,r);if(l){let c=Fp.parse({method:"notifications/tasks/status",params:l});await this.notification(c),bs(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function hz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gz(t,e){let r={...t};for(let n in e){let i=n,o=e[i];if(o===void 0)continue;let s=r[i];hz(s)&&hz(o)?r[i]={...s,...o}:r[i]=o}return r}var yj=Ev(ZN(),1),bj=Ev(gj(),1);function LJ(){let t=new yj.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bj.default)(t),t}var pb=class{constructor(e){this._ajv=e??LJ()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var fb=class{constructor(e){this._client=e}async*callToolStream(e,r=yu,n){let i=this._client,o={...n,task:n?.task??(i.isToolTask(e.name)?{}:void 0)},s=i.requestStream({method:"tools/call",params:e},r,o),a=i.getToolOutputValidator(e.name);for await(let l of s){if(l.type==="result"&&a){let c=l.result;if(!c.structuredContent&&!c.isError){yield{type:"error",error:new me(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(c.structuredContent)try{let u=a(c.structuredContent);if(!u.valid){yield{type:"error",error:new me(ke.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof me){yield{type:"error",error:u};return}yield{type:"error",error:new me(ke.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield l}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function vj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function _j(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function mb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let o=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[i]=o.default),r[i]!==void 0&&mb(o,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&mb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&mb(r,e)}}function UJ(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var hb=class extends Yg{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new pb,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Vp,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",D0,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",C0,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new fb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=gz(this._capabilities,e)}setRequestHandler(e,r){let i=Ng(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(fu(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(l,c)=>{let u=si(q0,l);if(!u.success){let b=u.error instanceof Error?u.error.message:String(u.error);throw new me(ke.InvalidParams,`Invalid elicitation request: ${b}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:p}=UJ(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new me(ke.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!p)throw new me(ke.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(l,c));if(d.task){let b=si(ja,m);if(!b.success){let _=b.error instanceof Error?b.error.message:String(b.error);throw new me(ke.InvalidParams,`Invalid task creation result: ${_}`)}return b.data}let h=si(B0,m);if(!h.success){let b=h.error instanceof Error?h.error.message:String(h.error);throw new me(ke.InvalidParams,`Invalid elicitation result: ${b}`)}let y=h.data,g=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&g&&this._capabilities.elicitation?.form?.applyDefaults)try{mb(g,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(l,c)=>{let u=si(F0,l);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new me(ke.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,f=await Promise.resolve(r(l,c));if(d.task){let y=si(ja,f);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new me(ke.InvalidParams,`Invalid task creation result: ${g}`)}return y.data}let m=d.tools||d.toolChoice?V0:Z0,h=si(m,f);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new me(ke.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:hu,capabilities:this._capabilities,clientInfo:this._clientInfo}},$0,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!KC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){vj(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&_j(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ma,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},W0,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ma,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},j0,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},z0,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},E0,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},P0,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},A0,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ma,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ma,r)}async callTool(e,r=yu,n){if(this.isToolTaskRequired(e.name))throw new me(ke.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new me(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let s=o(i.structuredContent);if(!s.valid)throw new me(ke.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof me?s:new me(ke.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let i=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,i)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},L0,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,i){let o=fz.safeParse(n);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:l}=n,c=async()=>{if(!s){l(null,null);return}try{let d=await i();l(null,d)}catch(d){let f=d instanceof Error?d:new Error(String(d));l(f,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let f=setTimeout(c,a);this._listChangedDebounceTimers.set(e,f)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function gb(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function wj(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...gb(e.headers),...gb(n.headers)}:e.headers};return t(r,i)}:t}var yI;yI=globalThis.crypto;async function FJ(t){return(await yI).getRandomValues(new Uint8Array(t))}async function ZJ(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await FJ(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function VJ(t){return await ZJ(t)}async function qJ(t){let e=await(await yI).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function bI(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await VJ(t),r=await qJ(e);return{code_verifier:e,code_challenge:r}}var Ir=MC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:HC.custom,message:"URL must be parseable",fatal:!0}),sg}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),kj=nr({resource:S().url(),authorization_servers:B(Ir).optional(),jwks_uri:S().url().optional(),scopes_supported:B(S()).optional(),bearer_methods_supported:B(S()).optional(),resource_signing_alg_values_supported:B(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:ht().optional(),authorization_details_types_supported:B(S()).optional(),dpop_signing_alg_values_supported:B(S()).optional(),dpop_bound_access_tokens_required:ht().optional()}),vI=nr({issuer:S(),authorization_endpoint:Ir,token_endpoint:Ir,registration_endpoint:Ir.optional(),scopes_supported:B(S()).optional(),response_types_supported:B(S()),response_modes_supported:B(S()).optional(),grant_types_supported:B(S()).optional(),token_endpoint_auth_methods_supported:B(S()).optional(),token_endpoint_auth_signing_alg_values_supported:B(S()).optional(),service_documentation:Ir.optional(),revocation_endpoint:Ir.optional(),revocation_endpoint_auth_methods_supported:B(S()).optional(),revocation_endpoint_auth_signing_alg_values_supported:B(S()).optional(),introspection_endpoint:S().optional(),introspection_endpoint_auth_methods_supported:B(S()).optional(),introspection_endpoint_auth_signing_alg_values_supported:B(S()).optional(),code_challenge_methods_supported:B(S()).optional(),client_id_metadata_document_supported:ht().optional()}),BJ=nr({issuer:S(),authorization_endpoint:Ir,token_endpoint:Ir,userinfo_endpoint:Ir.optional(),jwks_uri:Ir,registration_endpoint:Ir.optional(),scopes_supported:B(S()).optional(),response_types_supported:B(S()),response_modes_supported:B(S()).optional(),grant_types_supported:B(S()).optional(),acr_values_supported:B(S()).optional(),subject_types_supported:B(S()),id_token_signing_alg_values_supported:B(S()),id_token_encryption_alg_values_supported:B(S()).optional(),id_token_encryption_enc_values_supported:B(S()).optional(),userinfo_signing_alg_values_supported:B(S()).optional(),userinfo_encryption_alg_values_supported:B(S()).optional(),userinfo_encryption_enc_values_supported:B(S()).optional(),request_object_signing_alg_values_supported:B(S()).optional(),request_object_encryption_alg_values_supported:B(S()).optional(),request_object_encryption_enc_values_supported:B(S()).optional(),token_endpoint_auth_methods_supported:B(S()).optional(),token_endpoint_auth_signing_alg_values_supported:B(S()).optional(),display_values_supported:B(S()).optional(),claim_types_supported:B(S()).optional(),claims_supported:B(S()).optional(),service_documentation:S().optional(),claims_locales_supported:B(S()).optional(),ui_locales_supported:B(S()).optional(),claims_parameter_supported:ht().optional(),request_parameter_supported:ht().optional(),request_uri_parameter_supported:ht().optional(),require_request_uri_registration:ht().optional(),op_policy_uri:Ir.optional(),op_tos_uri:Ir.optional(),client_id_metadata_document_supported:ht().optional()}),Sj=G({...BJ.shape,...vI.pick({code_challenge_methods_supported:!0}).shape}),$j=G({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:Dg.number().optional(),scope:S().optional(),refresh_token:S().optional()}).strip(),Ij=G({error:S(),error_description:S().optional(),error_uri:S().optional()}),xj=Ir.optional().or(ie("").transform(()=>{})),WJ=G({redirect_uris:B(Ir),token_endpoint_auth_method:S().optional(),grant_types:B(S()).optional(),response_types:B(S()).optional(),client_name:S().optional(),client_uri:Ir.optional(),logo_uri:xj,scope:S().optional(),contacts:B(S()).optional(),tos_uri:xj,policy_uri:S().optional(),jwks_uri:Ir.optional(),jwks:DC().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),GJ=G({client_id:S(),client_secret:S().optional(),client_id_issued_at:rt().optional(),client_secret_expires_at:rt().optional()}).strip(),Ej=WJ.merge(GJ),b$e=G({error:S(),error_description:S().optional()}).strip(),v$e=G({token:S(),token_type_hint:S().optional()}).strip();function Pj(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Tj({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var qt=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Kf=class extends qt{};Kf.errorCode="invalid_request";var il=class extends qt{};il.errorCode="invalid_client";var ol=class extends qt{};ol.errorCode="invalid_grant";var sl=class extends qt{};sl.errorCode="unauthorized_client";var Jf=class extends qt{};Jf.errorCode="unsupported_grant_type";var Yf=class extends qt{};Yf.errorCode="invalid_scope";var Qf=class extends qt{};Qf.errorCode="access_denied";var Co=class extends qt{};Co.errorCode="server_error";var em=class extends qt{};em.errorCode="temporarily_unavailable";var tm=class extends qt{};tm.errorCode="unsupported_response_type";var rm=class extends qt{};rm.errorCode="unsupported_token_type";var nm=class extends qt{};nm.errorCode="invalid_token";var im=class extends qt{};im.errorCode="method_not_allowed";var om=class extends qt{};om.errorCode="too_many_requests";var al=class extends qt{};al.errorCode="invalid_client_metadata";var sm=class extends qt{};sm.errorCode="insufficient_scope";var am=class extends qt{};am.errorCode="invalid_target";var Aj={[Kf.errorCode]:Kf,[il.errorCode]:il,[ol.errorCode]:ol,[sl.errorCode]:sl,[Jf.errorCode]:Jf,[Yf.errorCode]:Yf,[Qf.errorCode]:Qf,[Co.errorCode]:Co,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[im.errorCode]:im,[om.errorCode]:om,[al.errorCode]:al,[sm.errorCode]:sm,[am.errorCode]:am};var zo=class extends Error{constructor(e){super(e??"Unauthorized")}};function HJ(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var _I="code",wI="S256";function XJ(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&HJ(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function KJ(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":JJ(i,o,r);return;case"client_secret_post":YJ(i,o,n);return;case"none":QJ(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function JJ(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function YJ(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function QJ(t,e){e.set("client_id",t)}async function zj(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Ij.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=Aj[i]||Co;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Co(i)}}async function lm(t,e){try{return await xI(t,e)}catch(r){if(r instanceof il||r instanceof sl)return await t.invalidateCredentials?.("all"),await xI(t,e);if(r instanceof ol)return await t.invalidateCredentials?.("tokens"),await xI(t,e);throw r}}async function xI(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s=await t.discoveryState?.(),a,l,c,u=i;if(!u&&s?.resourceMetadataUrl&&(u=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(l=s.authorizationServerUrl,a=s.resourceMetadata,c=s.authorizationServerMetadata??await Nj(l,{fetchFn:o}),!a)try{a=await Oj(e,{resourceMetadataUrl:u},o)}catch{}(c!==s.authorizationServerMetadata||a!==s.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let b=await s7(e,{resourceMetadataUrl:u,fetchFn:o});l=b.authorizationServerUrl,c=b.authorizationServerMetadata,a=b.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await t7(e,t,a),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let b=c?.client_id_metadata_document_supported===!0,_=t.clientMetadataUrl;if(_&&!e7(_))throw new al(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${_}`);if(b&&_)f={client_id:_},await t.saveClientInformation?.(f);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let I=await d7(l,{metadata:c,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(I),f=I}}let p=!t.redirectUrl;if(r!==void 0||p){let b=await u7(t,l,{metadata:c,resource:d,authorizationCode:r,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}let m=await t.tokens();if(m?.refresh_token)try{let b=await c7(l,{metadata:c,clientInformation:f,refreshToken:m.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}catch(b){if(!(!(b instanceof qt)||b instanceof Co))throw b}let h=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await a7(l,{metadata:c,clientInformation:f,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function e7(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function t7(t,e,r){let n=Pj(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Tj({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function SI(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=kI(t,"resource_metadata")||void 0,o;if(i)try{o=new URL(i)}catch{}let s=kI(t,"scope")||void 0,a=kI(t,"error")||void 0;return{resourceMetadataUrl:o,scope:s,error:a}}function kI(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function Oj(t,e,r=fetch){let n=await i7(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return kj.parse(await n.json())}async function $I(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?$I(t,void 0,r):void 0;throw n}}function r7(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Cj(t,e,r=fetch){return await $I(t,{"MCP-Protocol-Version":e},r)}function n7(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function i7(t,e,r,n){let i=new URL(t),o=n?.protocolVersion??hu,s;if(n?.metadataUrl)s=new URL(n.metadataUrl);else{let l=r7(e,i.pathname);s=new URL(l,n?.metadataServerUrl??i),s.search=i.search}let a=await Cj(s,o,r);if(!n?.metadataUrl&&n7(a,i.pathname)){let l=new URL(`/.well-known/${e}`,i);a=await Cj(l,o,r)}return a}function o7(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Nj(t,{fetchFn:e=fetch,protocolVersion:r=hu}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=o7(t);for(let{url:o,type:s}of i){let a=await $I(o,n,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?vI.parse(await a.json()):Sj.parse(await a.json())}}}async function s7(t,e){let r,n;try{r=await Oj(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",t)));let i=await Nj(n,{fetchFn:e?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:i,resourceMetadata:r}}async function a7(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(_I))throw new Error(`Incompatible auth server: does not support response type ${_I}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(wI))throw new Error(`Incompatible auth server: does not support code challenge method ${wI}`)}else a=new URL("/authorize",t);let l=await bI(),c=l.code_verifier,u=l.code_challenge;return a.searchParams.set("response_type",_I),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",wI),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:c}}function l7(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Rj(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:o,fetchFn:s}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),i)await i(l,r,a,e);else if(n){let u=e?.token_endpoint_auth_methods_supported??[],d=XJ(n,u);KJ(d,n,l,r)}let c=await(s??fetch)(a,{method:"POST",headers:l,body:r});if(!c.ok)throw await zj(c);return $j.parse(await c.json())}async function c7(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await Rj(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:i,fetchFn:s});return{refresh_token:n,...l}}async function u7(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:o}={}){let s=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(s)),!a){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();a=l7(i,c,t.redirectUrl)}let l=await t.clientInformation();return Rj(e,{metadata:r,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:o})}async function d7(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await zj(o);return Ej.parse(await o.json())}var yb=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function II(t){}function Mj(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=II,onError:r=II,onRetry:n=II,onComment:i}=t,o="",s=!0,a,l="",c="";function u(h){let y=s?h.replace(/^\xEF\xBB\xBF/,""):h,[g,b]=p7(`${o}${y}`);for(let _ of g)d(_);o=b,s=!1}function d(h){if(h===""){p();return}if(h.startsWith(":")){i&&i(h.slice(h.startsWith(": ")?2:1));return}let y=h.indexOf(":");if(y!==-1){let g=h.slice(0,y),b=h[y+1]===" "?2:1,_=h.slice(y+b);f(g,_,h);return}f(h,"",h)}function f(h,y,g){switch(h){case"event":c=y;break;case"data":l=`${l}${y}
|
|
109
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(_,C)=>b(f,_,C)},o,s=Aa,a=!og.jitless,c=a&&mw.value,u=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=i(e.shape)),f=o(f,p),u?rC([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function BA(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!gs(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ni(s,n,Cr())))}),e)}var _g=M("$ZodUnion",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),dt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),dt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),dt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Ip(o.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,o)=>{if(r)return n(i,o);let s=!1,a=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(l=>BA(l,i,t,o)):BA(a,i,t,o)}}),tx=M("$ZodDiscriminatedUnion",(t,e)=>{_g.init(t,e);let r=t._zod.parse;dt(t._zod,"propValues",()=>{let i={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,l]of Object.entries(s)){i[a]||(i[a]=new Set);for(let c of l)i[a].add(c)}}return i});let n=lu(()=>{let i=e.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of a){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,s)}}return o});t._zod.parse=(i,o)=>{let s=i.value;if(!Aa(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(i,o):e.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),i)}}),rx=M("$ZodIntersection",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([l,c])=>WA(r,l,c)):WA(r,o,s)}});function kw(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(hs(t)&&hs(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=kw(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=e[n],s=kw(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function WA(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),gs(t))return t;let n=kw(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var nx=M("$ZodRecord",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!hs(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...bo(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...bo(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>ni(u,n,Cr())),input:a,path:[a],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[a],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...bo(a,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...bo(a,c.issues)),r.value[l.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var ix=M("$ZodEnum",(t,e)=>{st.init(t,e);let r=ag(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>hw.has(typeof i)).map(i=>typeof i=="string"?Ci(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),ox=M("$ZodLiteral",(t,e)=>{if(st.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Ci(n):n?Ci(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var sx=M("$ZodTransform",(t,e)=>{st.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new su(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new Ai;return r.value=i,r}});function GA(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var ax=M("$ZodOptional",(t,e)=>{st.init(t,e),t._zod.optin="optional",t._zod.optout="optional",dt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),dt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ip(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>GA(o,r.value)):GA(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),lx=M("$ZodNullable",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.innerType._zod.optin),dt(t._zod,"optout",()=>e.innerType._zod.optout),dt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ip(r.source)}|null)$`):void 0}),dt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),cx=M("$ZodDefault",(t,e)=>{st.init(t,e),t._zod.optin="optional",dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>HA(o,e)):HA(i,e)}});function HA(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var ux=M("$ZodPrefault",(t,e)=>{st.init(t,e),t._zod.optin="optional",dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),dx=M("$ZodNonOptional",(t,e)=>{st.init(t,e),dt(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>XA(o,t)):XA(i,t)}});function XA(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var px=M("$ZodCatch",(t,e)=>{st.init(t,e),dt(t._zod,"optin",()=>e.innerType._zod.optin),dt(t._zod,"optout",()=>e.innerType._zod.optout),dt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ni(s,n,Cr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>ni(o,n,Cr()))},input:r.value}),r.issues=[]),r)}});var fx=M("$ZodPipe",(t,e)=>{st.init(t,e),dt(t._zod,"values",()=>e.in._zod.values),dt(t._zod,"optin",()=>e.in._zod.optin),dt(t._zod,"optout",()=>e.out._zod.optout),dt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>gg(s,e.in,n)):gg(o,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>gg(o,e.out,n)):gg(i,e.out,n)}});function gg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var mx=M("$ZodReadonly",(t,e)=>{st.init(t,e),dt(t._zod,"propValues",()=>e.innerType._zod.propValues),dt(t._zod,"values",()=>e.innerType._zod.values),dt(t._zod,"optin",()=>e.innerType?._zod?.optin),dt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(KA):KA(i)}});function KA(t){return t.value=Object.freeze(t.value),t}var hx=M("$ZodCustom",(t,e)=>{cr.init(t,e),st.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>JA(o,r,n,t));JA(i,r,n,t)}});function JA(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(cu(i))}}var O6=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N6=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${O6(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${_e(n.values[0])}`:`Invalid option: expected one of ${ve(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${ve(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function gx(){return{localeError:N6()}}var oC;var wg=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function bx(){return new wg}(oC=globalThis).__zod_globalRegistry??(oC.__zod_globalRegistry=bx());var vo=globalThis.__zod_globalRegistry;function vx(t,e){return new t({type:"string",...ue(e)})}function _x(t,e){return new t({type:"string",coerce:!0,...ue(e)})}function wx(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ue(e)})}function xg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ue(e)})}function xx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ue(e)})}function kx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ue(e)})}function Sx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ue(e)})}function $x(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ue(e)})}function kg(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ue(e)})}function Ix(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ue(e)})}function Ex(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ue(e)})}function Px(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ue(e)})}function Tx(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ue(e)})}function Ax(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ue(e)})}function Cx(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ue(e)})}function zx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ue(e)})}function Ox(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ue(e)})}function Nx(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ue(e)})}function Rx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ue(e)})}function Mx(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ue(e)})}function jx(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ue(e)})}function Dx(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ue(e)})}function Lx(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ue(e)})}function Ux(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ue(e)})}function Fx(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ue(e)})}function Zx(t,e){return new t({type:"string",format:"date",check:"string_format",...ue(e)})}function Vx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ue(e)})}function qx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ue(e)})}function Bx(t,e){return new t({type:"number",checks:[],...ue(e)})}function Wx(t,e){return new t({type:"number",coerce:!0,checks:[],...ue(e)})}function Gx(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ue(e)})}function Hx(t,e){return new t({type:"boolean",...ue(e)})}function Xx(t,e){return new t({type:"boolean",coerce:!0,...ue(e)})}function Kx(t,e){return new t({type:"bigint",coerce:!0,...ue(e)})}function Jx(t,e){return new t({type:"null",...ue(e)})}function Yx(t){return new t({type:"any"})}function Qx(t){return new t({type:"unknown"})}function e0(t,e){return new t({type:"never",...ue(e)})}function t0(t,e){return new t({type:"date",coerce:!0,...ue(e)})}function za(t,e){return new ww({check:"less_than",...ue(e),value:t,inclusive:!1})}function ii(t,e){return new ww({check:"less_than",...ue(e),value:t,inclusive:!0})}function Oa(t,e){return new xw({check:"greater_than",...ue(e),value:t,inclusive:!1})}function _n(t,e){return new xw({check:"greater_than",...ue(e),value:t,inclusive:!0})}function pu(t,e){return new AA({check:"multiple_of",...ue(e),value:t})}function zp(t,e){return new zA({check:"max_length",...ue(e),maximum:t})}function Na(t,e){return new OA({check:"min_length",...ue(e),minimum:t})}function Op(t,e){return new NA({check:"length_equals",...ue(e),length:t})}function Sg(t,e){return new RA({check:"string_format",format:"regex",...ue(e),pattern:t})}function $g(t){return new MA({check:"string_format",format:"lowercase",...ue(t)})}function Ig(t){return new jA({check:"string_format",format:"uppercase",...ue(t)})}function Eg(t,e){return new DA({check:"string_format",format:"includes",...ue(e),includes:t})}function Pg(t,e){return new LA({check:"string_format",format:"starts_with",...ue(e),prefix:t})}function Tg(t,e){return new UA({check:"string_format",format:"ends_with",...ue(e),suffix:t})}function _o(t){return new FA({check:"overwrite",tx:t})}function Ag(t){return _o(e=>e.normalize(t))}function Cg(){return _o(t=>t.trim())}function zg(){return _o(t=>t.toLowerCase())}function Og(){return _o(t=>t.toUpperCase())}function r0(){return _o(t=>fw(t))}function aC(t,e,r){return new t({type:"array",element:e,...ue(r)})}function n0(t,e,r){let n=ue(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function i0(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ue(r)})}function o0(t){let e=D6(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(cu(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(cu(i))}},t(r.value,r)));return e}function D6(t,e){let r=new cr({check:"custom",...ue(e)});return r._zod.check=t,r}function fu(t){return!!t._zod}function si(t,e){return fu(t)?uu(t,e):t.safeParse(e)}function Ng(t){if(!t)return;let e;if(fu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function gC(t){if(fu(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Np={};gd(Np,{ZodISODate:()=>l0,ZodISODateTime:()=>s0,ZodISODuration:()=>p0,ZodISOTime:()=>u0,date:()=>c0,datetime:()=>a0,duration:()=>f0,time:()=>d0});var s0=M("ZodISODateTime",(t,e)=>{Rw.init(t,e),At.init(t,e)});function a0(t){return Fx(s0,t)}var l0=M("ZodISODate",(t,e)=>{Mw.init(t,e),At.init(t,e)});function c0(t){return Zx(l0,t)}var u0=M("ZodISOTime",(t,e)=>{jw.init(t,e),At.init(t,e)});function d0(t){return Vx(u0,t)}var p0=M("ZodISODuration",(t,e)=>{Dw.init(t,e),At.init(t,e)});function f0(t){return qx(p0,t)}var bC=(t,e)=>{ug.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>pg(t,r)},flatten:{value:r=>dg(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,au,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,au,2)}},isEmpty:{get(){return t.issues.length===0}}})},Ive=M("ZodError",bC),wn=M("ZodError",bC,{Parent:Error});var vC=fg(wn),_C=mg(wn),wC=Pp(wn),xC=Tp(wn),kC=WT(wn),SC=GT(wn),$C=HT(wn),IC=XT(wn),EC=KT(wn),PC=JT(wn),TC=YT(wn),AC=QT(wn);var _t=M("ZodType",(t,e)=>(st.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(V.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Jr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>vC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>wC(t,r,n),t.parseAsync=async(r,n)=>_C(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>xC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>kC(t,r,n),t.decode=(r,n)=>SC(t,r,n),t.encodeAsync=async(r,n)=>$C(t,r,n),t.decodeAsync=async(r,n)=>IC(t,r,n),t.safeEncode=(r,n)=>EC(t,r,n),t.safeDecode=(r,n)=>PC(t,r,n),t.safeEncodeAsync=async(r,n)=>TC(t,r,n),t.safeDecodeAsync=async(r,n)=>AC(t,r,n),t.refine=(r,n)=>t.check(_Z(r,n)),t.superRefine=r=>t.check(wZ(r)),t.overwrite=r=>t.check(_o(r)),t.optional=()=>Mt(t),t.nullable=()=>OC(t),t.nullish=()=>Mt(OC(t)),t.nonoptional=r=>mZ(t,r),t.array=()=>B(t),t.or=r=>wt([t,r]),t.and=r=>jg(t,r),t.transform=r=>h0(t,ZC(r)),t.default=r=>dZ(t,r),t.prefault=r=>fZ(t,r),t.catch=r=>gZ(t,r),t.pipe=r=>h0(t,r),t.readonly=()=>vZ(t),t.describe=r=>{let n=t.clone();return vo.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return vo.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return vo.get(t);let n=t.clone();return vo.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),NC=M("_ZodString",(t,e)=>{du.init(t,e),_t.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Sg(...n)),t.includes=(...n)=>t.check(Eg(...n)),t.startsWith=(...n)=>t.check(Pg(...n)),t.endsWith=(...n)=>t.check(Tg(...n)),t.min=(...n)=>t.check(Na(...n)),t.max=(...n)=>t.check(zp(...n)),t.length=(...n)=>t.check(Op(...n)),t.nonempty=(...n)=>t.check(Na(1,...n)),t.lowercase=n=>t.check($g(n)),t.uppercase=n=>t.check(Ig(n)),t.trim=()=>t.check(Cg()),t.normalize=(...n)=>t.check(Ag(...n)),t.toLowerCase=()=>t.check(zg()),t.toUpperCase=()=>t.check(Og()),t.slugify=()=>t.check(r0())}),g0=M("ZodString",(t,e)=>{du.init(t,e),NC.init(t,e),t.email=r=>t.check(wx(RF,r)),t.url=r=>t.check(kg(RC,r)),t.jwt=r=>t.check(Ux(KF,r)),t.emoji=r=>t.check(Ix(MF,r)),t.guid=r=>t.check(xg(CC,r)),t.uuid=r=>t.check(xx(Rg,r)),t.uuidv4=r=>t.check(kx(Rg,r)),t.uuidv6=r=>t.check(Sx(Rg,r)),t.uuidv7=r=>t.check($x(Rg,r)),t.nanoid=r=>t.check(Ex(jF,r)),t.guid=r=>t.check(xg(CC,r)),t.cuid=r=>t.check(Px(DF,r)),t.cuid2=r=>t.check(Tx(LF,r)),t.ulid=r=>t.check(Ax(UF,r)),t.base64=r=>t.check(jx(GF,r)),t.base64url=r=>t.check(Dx(HF,r)),t.xid=r=>t.check(Cx(FF,r)),t.ksuid=r=>t.check(zx(ZF,r)),t.ipv4=r=>t.check(Ox(VF,r)),t.ipv6=r=>t.check(Nx(qF,r)),t.cidrv4=r=>t.check(Rx(BF,r)),t.cidrv6=r=>t.check(Mx(WF,r)),t.e164=r=>t.check(Lx(XF,r)),t.datetime=r=>t.check(a0(r)),t.date=r=>t.check(c0(r)),t.time=r=>t.check(d0(r)),t.duration=r=>t.check(f0(r))});function S(t){return vx(g0,t)}var At=M("ZodStringFormat",(t,e)=>{vt.init(t,e),NC.init(t,e)}),RF=M("ZodEmail",(t,e)=>{Iw.init(t,e),At.init(t,e)});var CC=M("ZodGUID",(t,e)=>{Sw.init(t,e),At.init(t,e)});var Rg=M("ZodUUID",(t,e)=>{$w.init(t,e),At.init(t,e)});var RC=M("ZodURL",(t,e)=>{Ew.init(t,e),At.init(t,e)});function MC(t){return kg(RC,t)}var MF=M("ZodEmoji",(t,e)=>{Pw.init(t,e),At.init(t,e)});var jF=M("ZodNanoID",(t,e)=>{Tw.init(t,e),At.init(t,e)});var DF=M("ZodCUID",(t,e)=>{Aw.init(t,e),At.init(t,e)});var LF=M("ZodCUID2",(t,e)=>{Cw.init(t,e),At.init(t,e)});var UF=M("ZodULID",(t,e)=>{zw.init(t,e),At.init(t,e)});var FF=M("ZodXID",(t,e)=>{Ow.init(t,e),At.init(t,e)});var ZF=M("ZodKSUID",(t,e)=>{Nw.init(t,e),At.init(t,e)});var VF=M("ZodIPv4",(t,e)=>{Lw.init(t,e),At.init(t,e)});var qF=M("ZodIPv6",(t,e)=>{Uw.init(t,e),At.init(t,e)});var BF=M("ZodCIDRv4",(t,e)=>{Fw.init(t,e),At.init(t,e)});var WF=M("ZodCIDRv6",(t,e)=>{Zw.init(t,e),At.init(t,e)});var GF=M("ZodBase64",(t,e)=>{Vw.init(t,e),At.init(t,e)});var HF=M("ZodBase64URL",(t,e)=>{qw.init(t,e),At.init(t,e)});var XF=M("ZodE164",(t,e)=>{Bw.init(t,e),At.init(t,e)});var KF=M("ZodJWT",(t,e)=>{Ww.init(t,e),At.init(t,e)});var Mg=M("ZodNumber",(t,e)=>{bg.init(t,e),_t.init(t,e),t.gt=(n,i)=>t.check(Oa(n,i)),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.lt=(n,i)=>t.check(za(n,i)),t.lte=(n,i)=>t.check(ii(n,i)),t.max=(n,i)=>t.check(ii(n,i)),t.int=n=>t.check(zC(n)),t.safe=n=>t.check(zC(n)),t.positive=n=>t.check(Oa(0,n)),t.nonnegative=n=>t.check(_n(0,n)),t.negative=n=>t.check(za(0,n)),t.nonpositive=n=>t.check(ii(0,n)),t.multipleOf=(n,i)=>t.check(pu(n,i)),t.step=(n,i)=>t.check(pu(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function rt(t){return Bx(Mg,t)}var JF=M("ZodNumberFormat",(t,e)=>{Gw.init(t,e),Mg.init(t,e)});function zC(t){return Gx(JF,t)}var y0=M("ZodBoolean",(t,e)=>{vg.init(t,e),_t.init(t,e)});function ht(t){return Hx(y0,t)}var jC=M("ZodBigInt",(t,e)=>{Hw.init(t,e),_t.init(t,e),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.gt=(n,i)=>t.check(Oa(n,i)),t.gte=(n,i)=>t.check(_n(n,i)),t.min=(n,i)=>t.check(_n(n,i)),t.lt=(n,i)=>t.check(za(n,i)),t.lte=(n,i)=>t.check(ii(n,i)),t.max=(n,i)=>t.check(ii(n,i)),t.positive=n=>t.check(Oa(BigInt(0),n)),t.negative=n=>t.check(za(BigInt(0),n)),t.nonpositive=n=>t.check(ii(BigInt(0),n)),t.nonnegative=n=>t.check(_n(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(pu(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var YF=M("ZodNull",(t,e)=>{Xw.init(t,e),_t.init(t,e)});function b0(t){return Jx(YF,t)}var QF=M("ZodAny",(t,e)=>{Kw.init(t,e),_t.init(t,e)});function DC(){return Yx(QF)}var eZ=M("ZodUnknown",(t,e)=>{Jw.init(t,e),_t.init(t,e)});function Ct(){return Qx(eZ)}var tZ=M("ZodNever",(t,e)=>{Yw.init(t,e),_t.init(t,e)});function rZ(t){return e0(tZ,t)}var LC=M("ZodDate",(t,e)=>{Qw.init(t,e),_t.init(t,e),t.min=(n,i)=>t.check(_n(n,i)),t.max=(n,i)=>t.check(ii(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var nZ=M("ZodArray",(t,e)=>{ex.init(t,e),_t.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Na(r,n)),t.nonempty=r=>t.check(Na(1,r)),t.max=(r,n)=>t.check(zp(r,n)),t.length=(r,n)=>t.check(Op(r,n)),t.unwrap=()=>t.element});function B(t,e){return aC(nZ,t,e)}var UC=M("ZodObject",(t,e)=>{iC.init(t,e),_t.init(t,e),V.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Yr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ct()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ct()}),t.strict=()=>t.clone({...t._zod.def,catchall:rZ()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>V.extend(t,r),t.safeExtend=r=>V.safeExtend(t,r),t.merge=r=>V.merge(t,r),t.pick=r=>V.pick(t,r),t.omit=r=>V.omit(t,r),t.partial=(...r)=>V.partial(VC,t,r[0]),t.required=(...r)=>V.required(qC,t,r[0])});function G(t,e){let r={type:"object",shape:t??{},...V.normalizeParams(e)};return new UC(r)}function nr(t,e){return new UC({type:"object",shape:t,catchall:Ct(),...V.normalizeParams(e)})}var FC=M("ZodUnion",(t,e)=>{_g.init(t,e),_t.init(t,e),t.options=e.options});function wt(t,e){return new FC({type:"union",options:t,...V.normalizeParams(e)})}var iZ=M("ZodDiscriminatedUnion",(t,e)=>{FC.init(t,e),tx.init(t,e)});function v0(t,e,r){return new iZ({type:"union",options:e,discriminator:t,...V.normalizeParams(r)})}var oZ=M("ZodIntersection",(t,e)=>{rx.init(t,e),_t.init(t,e)});function jg(t,e){return new oZ({type:"intersection",left:t,right:e})}var sZ=M("ZodRecord",(t,e)=>{nx.init(t,e),_t.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function zt(t,e,r){return new sZ({type:"record",keyType:t,valueType:e,...V.normalizeParams(r)})}var m0=M("ZodEnum",(t,e)=>{ix.init(t,e),_t.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new m0({...e,checks:[],...V.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new m0({...e,checks:[],...V.normalizeParams(i),entries:o})}});function Yr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new m0({type:"enum",entries:r,...V.normalizeParams(e)})}var aZ=M("ZodLiteral",(t,e)=>{ox.init(t,e),_t.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ie(t,e){return new aZ({type:"literal",values:Array.isArray(t)?t:[t],...V.normalizeParams(e)})}var lZ=M("ZodTransform",(t,e)=>{sx.init(t,e),_t.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new su(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(V.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function ZC(t){return new lZ({type:"transform",transform:t})}var VC=M("ZodOptional",(t,e)=>{ax.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Mt(t){return new VC({type:"optional",innerType:t})}var cZ=M("ZodNullable",(t,e)=>{lx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function OC(t){return new cZ({type:"nullable",innerType:t})}var uZ=M("ZodDefault",(t,e)=>{cx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function dZ(t,e){return new uZ({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var pZ=M("ZodPrefault",(t,e)=>{ux.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function fZ(t,e){return new pZ({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var qC=M("ZodNonOptional",(t,e)=>{dx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mZ(t,e){return new qC({type:"nonoptional",innerType:t,...V.normalizeParams(e)})}var hZ=M("ZodCatch",(t,e)=>{px.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function gZ(t,e){return new hZ({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var yZ=M("ZodPipe",(t,e)=>{fx.init(t,e),_t.init(t,e),t.in=e.in,t.out=e.out});function h0(t,e){return new yZ({type:"pipe",in:t,out:e})}var bZ=M("ZodReadonly",(t,e)=>{mx.init(t,e),_t.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vZ(t){return new bZ({type:"readonly",innerType:t})}var BC=M("ZodCustom",(t,e)=>{hx.init(t,e),_t.init(t,e)});function WC(t,e){return n0(BC,t??(()=>!0),e)}function _Z(t,e={}){return i0(BC,t,e)}function wZ(t){return o0(t)}function _0(t,e){return h0(ZC(t),e)}var HC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var GC;GC||(GC={});var Dg={};gd(Dg,{bigint:()=>$Z,boolean:()=>SZ,date:()=>IZ,number:()=>kZ,string:()=>xZ});function xZ(t){return _x(g0,t)}function kZ(t){return Wx(Mg,t)}function SZ(t){return Xx(y0,t)}function $Z(t){return Kx(jC,t)}function IZ(t){return t0(LC,t)}Cr(gx());var hu="2025-11-25";var KC=[hu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Ug="2.0",yr=WC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),JC=wt([S(),rt().int()]),YC=S(),Wve=nr({ttl:wt([rt(),b0()]).optional(),pollInterval:rt().optional()}),PZ=G({ttl:rt().optional()}),TZ=G({taskId:S()}),x0=nr({progressToken:JC.optional(),[ys]:TZ.optional()}),xn=G({_meta:x0.optional()}),Rp=xn.extend({task:PZ.optional()}),QC=t=>Rp.safeParse(t).success,br=G({method:S(),params:xn.loose().optional()}),Mn=G({_meta:x0.optional()}),jn=G({method:S(),params:Mn.loose().optional()}),vr=nr({_meta:x0.optional()}),Fg=wt([S(),rt().int()]),ez=G({jsonrpc:ie(Ug),id:Fg,...br.shape}).strict(),Mp=t=>ez.safeParse(t).success,tz=G({jsonrpc:ie(Ug),...jn.shape}).strict(),rz=t=>tz.safeParse(t).success,k0=G({jsonrpc:ie(Ug),id:Fg,result:vr}).strict(),Ra=t=>k0.safeParse(t).success;var ke;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ke||(ke={}));var S0=G({jsonrpc:ie(Ug),id:Fg.optional(),error:G({code:rt().int(),message:S(),data:Ct().optional()})}).strict();var nz=t=>S0.safeParse(t).success;var Zg=wt([ez,tz,k0,S0]),Gve=wt([k0,S0]),Ma=vr.strict(),AZ=Mn.extend({requestId:Fg.optional(),reason:S().optional()}),Vg=jn.extend({method:ie("notifications/cancelled"),params:AZ}),CZ=G({src:S(),mimeType:S().optional(),sizes:B(S()).optional(),theme:Yr(["light","dark"]).optional()}),jp=G({icons:B(CZ).optional()}),mu=G({name:S(),title:S().optional()}),iz=mu.extend({...mu.shape,...jp.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),zZ=jg(G({applyDefaults:ht().optional()}),zt(S(),Ct())),OZ=_0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,jg(G({form:zZ.optional(),url:yr.optional()}),zt(S(),Ct()).optional())),NZ=nr({list:yr.optional(),cancel:yr.optional(),requests:nr({sampling:nr({createMessage:yr.optional()}).optional(),elicitation:nr({create:yr.optional()}).optional()}).optional()}),RZ=nr({list:yr.optional(),cancel:yr.optional(),requests:nr({tools:nr({call:yr.optional()}).optional()}).optional()}),MZ=G({experimental:zt(S(),yr).optional(),sampling:G({context:yr.optional(),tools:yr.optional()}).optional(),elicitation:OZ.optional(),roots:G({listChanged:ht().optional()}).optional(),tasks:NZ.optional()}),jZ=xn.extend({protocolVersion:S(),capabilities:MZ,clientInfo:iz}),DZ=br.extend({method:ie("initialize"),params:jZ});var LZ=G({experimental:zt(S(),yr).optional(),logging:yr.optional(),completions:yr.optional(),prompts:G({listChanged:ht().optional()}).optional(),resources:G({subscribe:ht().optional(),listChanged:ht().optional()}).optional(),tools:G({listChanged:ht().optional()}).optional(),tasks:RZ.optional()}),$0=vr.extend({protocolVersion:S(),capabilities:LZ,serverInfo:iz,instructions:S().optional()}),oz=jn.extend({method:ie("notifications/initialized"),params:Mn.optional()}),sz=t=>oz.safeParse(t).success,qg=br.extend({method:ie("ping"),params:xn.optional()}),UZ=G({progress:rt(),total:Mt(rt()),message:Mt(S())}),FZ=G({...Mn.shape,...UZ.shape,progressToken:JC}),Bg=jn.extend({method:ie("notifications/progress"),params:FZ}),ZZ=xn.extend({cursor:YC.optional()}),Dp=br.extend({params:ZZ.optional()}),Lp=vr.extend({nextCursor:YC.optional()}),VZ=Yr(["working","input_required","completed","failed","cancelled"]),Up=G({taskId:S(),status:VZ,ttl:wt([rt(),b0()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:Mt(rt()),statusMessage:Mt(S())}),ja=vr.extend({task:Up}),qZ=Mn.merge(Up),Fp=jn.extend({method:ie("notifications/tasks/status"),params:qZ}),Wg=br.extend({method:ie("tasks/get"),params:xn.extend({taskId:S()})}),Gg=vr.merge(Up),Hg=br.extend({method:ie("tasks/result"),params:xn.extend({taskId:S()})}),Hve=vr.loose(),Xg=Dp.extend({method:ie("tasks/list")}),Kg=Lp.extend({tasks:B(Up)}),Jg=br.extend({method:ie("tasks/cancel"),params:xn.extend({taskId:S()})}),az=vr.merge(Up),lz=G({uri:S(),mimeType:Mt(S()),_meta:zt(S(),Ct()).optional()}),cz=lz.extend({text:S()}),I0=S().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),uz=lz.extend({blob:I0}),Zp=Yr(["user","assistant"]),gu=G({audience:B(Zp).optional(),priority:rt().min(0).max(1).optional(),lastModified:Np.datetime({offset:!0}).optional()}),dz=G({...mu.shape,...jp.shape,uri:S(),description:Mt(S()),mimeType:Mt(S()),annotations:gu.optional(),_meta:Mt(nr({}))}),BZ=G({...mu.shape,...jp.shape,uriTemplate:S(),description:Mt(S()),mimeType:Mt(S()),annotations:gu.optional(),_meta:Mt(nr({}))}),WZ=Dp.extend({method:ie("resources/list")}),E0=Lp.extend({resources:B(dz)}),GZ=Dp.extend({method:ie("resources/templates/list")}),P0=Lp.extend({resourceTemplates:B(BZ)}),T0=xn.extend({uri:S()}),HZ=T0,XZ=br.extend({method:ie("resources/read"),params:HZ}),A0=vr.extend({contents:B(wt([cz,uz]))}),C0=jn.extend({method:ie("notifications/resources/list_changed"),params:Mn.optional()}),KZ=T0,JZ=br.extend({method:ie("resources/subscribe"),params:KZ}),YZ=T0,QZ=br.extend({method:ie("resources/unsubscribe"),params:YZ}),e9=Mn.extend({uri:S()}),t9=jn.extend({method:ie("notifications/resources/updated"),params:e9}),r9=G({name:S(),description:Mt(S()),required:Mt(ht())}),n9=G({...mu.shape,...jp.shape,description:Mt(S()),arguments:Mt(B(r9)),_meta:Mt(nr({}))}),i9=Dp.extend({method:ie("prompts/list")}),z0=Lp.extend({prompts:B(n9)}),o9=xn.extend({name:S(),arguments:zt(S(),S()).optional()}),s9=br.extend({method:ie("prompts/get"),params:o9}),O0=G({type:ie("text"),text:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),N0=G({type:ie("image"),data:I0,mimeType:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),R0=G({type:ie("audio"),data:I0,mimeType:S(),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),a9=G({type:ie("tool_use"),name:S(),id:S(),input:zt(S(),Ct()),_meta:zt(S(),Ct()).optional()}),l9=G({type:ie("resource"),resource:wt([cz,uz]),annotations:gu.optional(),_meta:zt(S(),Ct()).optional()}),c9=dz.extend({type:ie("resource_link")}),M0=wt([O0,N0,R0,c9,l9]),u9=G({role:Zp,content:M0}),j0=vr.extend({description:S().optional(),messages:B(u9)}),D0=jn.extend({method:ie("notifications/prompts/list_changed"),params:Mn.optional()}),d9=G({title:S().optional(),readOnlyHint:ht().optional(),destructiveHint:ht().optional(),idempotentHint:ht().optional(),openWorldHint:ht().optional()}),p9=G({taskSupport:Yr(["required","optional","forbidden"]).optional()}),pz=G({...mu.shape,...jp.shape,description:S().optional(),inputSchema:G({type:ie("object"),properties:zt(S(),yr).optional(),required:B(S()).optional()}).catchall(Ct()),outputSchema:G({type:ie("object"),properties:zt(S(),yr).optional(),required:B(S()).optional()}).catchall(Ct()).optional(),annotations:d9.optional(),execution:p9.optional(),_meta:zt(S(),Ct()).optional()}),f9=Dp.extend({method:ie("tools/list")}),L0=Lp.extend({tools:B(pz)}),yu=vr.extend({content:B(M0).default([]),structuredContent:zt(S(),Ct()).optional(),isError:ht().optional()}),Xve=yu.or(vr.extend({toolResult:Ct()})),m9=Rp.extend({name:S(),arguments:zt(S(),Ct()).optional()}),h9=br.extend({method:ie("tools/call"),params:m9}),Vp=jn.extend({method:ie("notifications/tools/list_changed"),params:Mn.optional()}),fz=G({autoRefresh:ht().default(!0),debounceMs:rt().int().nonnegative().default(300)}),mz=Yr(["debug","info","notice","warning","error","critical","alert","emergency"]),g9=xn.extend({level:mz}),y9=br.extend({method:ie("logging/setLevel"),params:g9}),b9=Mn.extend({level:mz,logger:S().optional(),data:Ct()}),U0=jn.extend({method:ie("notifications/message"),params:b9}),v9=G({name:S().optional()}),_9=G({hints:B(v9).optional(),costPriority:rt().min(0).max(1).optional(),speedPriority:rt().min(0).max(1).optional(),intelligencePriority:rt().min(0).max(1).optional()}),w9=G({mode:Yr(["auto","required","none"]).optional()}),x9=G({type:ie("tool_result"),toolUseId:S().describe("The unique identifier for the corresponding tool call."),content:B(M0).default([]),structuredContent:G({}).loose().optional(),isError:ht().optional(),_meta:zt(S(),Ct()).optional()}),k9=v0("type",[O0,N0,R0]),Lg=v0("type",[O0,N0,R0,a9,x9]),S9=G({role:Zp,content:wt([Lg,B(Lg)]),_meta:zt(S(),Ct()).optional()}),$9=Rp.extend({messages:B(S9),modelPreferences:_9.optional(),systemPrompt:S().optional(),includeContext:Yr(["none","thisServer","allServers"]).optional(),temperature:rt().optional(),maxTokens:rt().int(),stopSequences:B(S()).optional(),metadata:yr.optional(),tools:B(pz).optional(),toolChoice:w9.optional()}),F0=br.extend({method:ie("sampling/createMessage"),params:$9}),Z0=vr.extend({model:S(),stopReason:Mt(Yr(["endTurn","stopSequence","maxTokens"]).or(S())),role:Zp,content:k9}),V0=vr.extend({model:S(),stopReason:Mt(Yr(["endTurn","stopSequence","maxTokens","toolUse"]).or(S())),role:Zp,content:wt([Lg,B(Lg)])}),I9=G({type:ie("boolean"),title:S().optional(),description:S().optional(),default:ht().optional()}),E9=G({type:ie("string"),title:S().optional(),description:S().optional(),minLength:rt().optional(),maxLength:rt().optional(),format:Yr(["email","uri","date","date-time"]).optional(),default:S().optional()}),P9=G({type:Yr(["number","integer"]),title:S().optional(),description:S().optional(),minimum:rt().optional(),maximum:rt().optional(),default:rt().optional()}),T9=G({type:ie("string"),title:S().optional(),description:S().optional(),enum:B(S()),default:S().optional()}),A9=G({type:ie("string"),title:S().optional(),description:S().optional(),oneOf:B(G({const:S(),title:S()})),default:S().optional()}),C9=G({type:ie("string"),title:S().optional(),description:S().optional(),enum:B(S()),enumNames:B(S()).optional(),default:S().optional()}),z9=wt([T9,A9]),O9=G({type:ie("array"),title:S().optional(),description:S().optional(),minItems:rt().optional(),maxItems:rt().optional(),items:G({type:ie("string"),enum:B(S())}),default:B(S()).optional()}),N9=G({type:ie("array"),title:S().optional(),description:S().optional(),minItems:rt().optional(),maxItems:rt().optional(),items:G({anyOf:B(G({const:S(),title:S()}))}),default:B(S()).optional()}),R9=wt([O9,N9]),M9=wt([C9,z9,R9]),j9=wt([M9,I9,E9,P9]),D9=Rp.extend({mode:ie("form").optional(),message:S(),requestedSchema:G({type:ie("object"),properties:zt(S(),j9),required:B(S()).optional()})}),L9=Rp.extend({mode:ie("url"),message:S(),elicitationId:S(),url:S().url()}),U9=wt([D9,L9]),q0=br.extend({method:ie("elicitation/create"),params:U9}),F9=Mn.extend({elicitationId:S()}),Z9=jn.extend({method:ie("notifications/elicitation/complete"),params:F9}),B0=vr.extend({action:Yr(["accept","decline","cancel"]),content:_0(t=>t===null?void 0:t,zt(S(),wt([S(),rt(),ht(),B(S())])).optional())}),V9=G({type:ie("ref/resource"),uri:S()});var q9=G({type:ie("ref/prompt"),name:S()}),B9=xn.extend({ref:wt([q9,V9]),argument:G({name:S(),value:S()}),context:G({arguments:zt(S(),S()).optional()}).optional()}),W9=br.extend({method:ie("completion/complete"),params:B9});var W0=vr.extend({completion:nr({values:B(S()).max(100),total:Mt(rt().int()),hasMore:Mt(ht())})}),G9=G({uri:S().startsWith("file://"),name:S().optional(),_meta:zt(S(),Ct()).optional()}),H9=br.extend({method:ie("roots/list"),params:xn.optional()}),X9=vr.extend({roots:B(G9)}),K9=jn.extend({method:ie("notifications/roots/list_changed"),params:Mn.optional()}),Kve=wt([qg,DZ,W9,y9,s9,i9,WZ,GZ,XZ,JZ,QZ,h9,f9,Wg,Hg,Xg,Jg]),Jve=wt([Vg,Bg,oz,K9,Fp]),Yve=wt([Ma,Z0,V0,B0,X9,Gg,Kg,ja]),Qve=wt([qg,F0,q0,H9,Wg,Hg,Xg,Jg]),e_e=wt([Vg,Bg,U0,t9,C0,Vp,D0,Fp,Z9]),t_e=wt([Ma,$0,W0,j0,z0,E0,P0,A0,yu,L0,Gg,Kg,ja]),me=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ke.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new w0(i.elicitations,r)}return new t(e,r,n)}},w0=class extends me{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ke.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function bs(t){return t==="completed"||t==="failed"||t==="cancelled"}var R_e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function G0(t){let r=Ng(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=gC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function H0(t,e){let r=si(t,e);if(!r.success)throw r.error;return r.data}var r3=6e4,Yg=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Vg,r=>{this._oncancel(r)}),this.setNotificationHandler(Bg,r=>{this._onprogress(r)}),this.setRequestHandler(qg,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wg,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new me(ke.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Hg,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(a.type==="response"||a.type==="error"){let l=a.message,c=l.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(l);else{let d=l,f=new me(d.error.code,d.error.message,d.error.data);u(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new me(ke.InvalidParams,`Task not found: ${o}`);if(!bs(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(bs(s.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[ys]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Xg,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new me(ke.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Jg,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new me(ke.InvalidParams,`Task not found: ${r.params.taskId}`);if(bs(i.status))throw new me(ke.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new me(ke.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof me?i:new me(ke.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),me.fromError(ke.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{i?.(o,s),Ra(o)||nz(o)?this._onresponse(o):Mp(o)?this._onrequest(o,s):rz(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=me.fromError(ke.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,o=e.params?._meta?.[ys]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ke.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=QC(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,c={signal:s.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,f)=>{if(s.signal.aborted)throw new me(ke.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:e.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let m=p.relatedTask?.taskId??o;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(u,d,p)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:l,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ke.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),s(l);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ra(e))n(e);else{let s=new me(e.error.code,e.error.message,e.error.data);n(s)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Ra(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),Ra(e))i(e);else{let s=me.fromError(e.error.code,e.error.message,e.error.data);i(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(s){yield{type:"error",error:s instanceof me?s:new me(ke.InternalError,String(s))}}return}let o;try{let s=await this.request(e,ja,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new me(ke.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},bs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new me(ke.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new me(ke.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let l=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(c=>setTimeout(c,l)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof me?s:new me(ke.InternalError,String(s))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:l}=n??{};return new Promise((c,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),l&&(p.params={...p.params,_meta:{...p.params?._meta||{},[ys]:l}});let m=b=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(b)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let _=b instanceof me?b:new me(ke.RequestTimeout,String(b));u(_)};this._responseHandlers.set(f,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let _=si(r,b.result);_.success?c(_.data):u(_.error)}catch(_){u(_)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??r3,y=()=>m(me.fromError(ke.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let g=l?.taskId;if(g){let b=_=>{let C=this._responseHandlers.get(f);C?C(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,b),this._enqueueTaskMessage(g,{type:"request",message:p,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),u(_)})}else this._transport.send(p,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(b=>{this._cleanupTimeout(f),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gg,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Kg,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},az,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ys]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ys]:r.relatedTask}}}),this._transport?.send(a,r).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ys]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let n=G0(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let s=H0(e,i);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=G0(e);this._notificationHandlers.set(n,i=>{let o=H0(e,i);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&Mp(i.message)){let o=i.message.id,s=this._requestResolvers.get(o);s?(s(new me(ke.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new me(ke.InvalidRequest,"Request cancelled"));return}let s=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(s),o(new me(ke.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new me(ke.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,s)=>{await n.storeTaskResult(i,o,s,r);let a=await n.getTask(i,r);if(a){let l=Fp.parse({method:"notifications/tasks/status",params:a});await this.notification(l),bs(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,s)=>{let a=await n.getTask(i,r);if(!a)throw new me(ke.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(bs(a.status))throw new me(ke.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,s,r);let l=await n.getTask(i,r);if(l){let c=Fp.parse({method:"notifications/tasks/status",params:l});await this.notification(c),bs(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function hz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gz(t,e){let r={...t};for(let n in e){let i=n,o=e[i];if(o===void 0)continue;let s=r[i];hz(s)&&hz(o)?r[i]={...s,...o}:r[i]=o}return r}var yj=Ev(ZN(),1),bj=Ev(gj(),1);function LJ(){let t=new yj.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bj.default)(t),t}var pb=class{constructor(e){this._ajv=e??LJ()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var fb=class{constructor(e){this._client=e}async*callToolStream(e,r=yu,n){let i=this._client,o={...n,task:n?.task??(i.isToolTask(e.name)?{}:void 0)},s=i.requestStream({method:"tools/call",params:e},r,o),a=i.getToolOutputValidator(e.name);for await(let l of s){if(l.type==="result"&&a){let c=l.result;if(!c.structuredContent&&!c.isError){yield{type:"error",error:new me(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(c.structuredContent)try{let u=a(c.structuredContent);if(!u.valid){yield{type:"error",error:new me(ke.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof me){yield{type:"error",error:u};return}yield{type:"error",error:new me(ke.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield l}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function vj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function _j(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function mb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let o=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[i]=o.default),r[i]!==void 0&&mb(o,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&mb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&mb(r,e)}}function UJ(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var hb=class extends Yg{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new pb,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Vp,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",D0,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",C0,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new fb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=gz(this._capabilities,e)}setRequestHandler(e,r){let i=Ng(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(fu(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(l,c)=>{let u=si(q0,l);if(!u.success){let b=u.error instanceof Error?u.error.message:String(u.error);throw new me(ke.InvalidParams,`Invalid elicitation request: ${b}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:p}=UJ(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new me(ke.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!p)throw new me(ke.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(l,c));if(d.task){let b=si(ja,m);if(!b.success){let _=b.error instanceof Error?b.error.message:String(b.error);throw new me(ke.InvalidParams,`Invalid task creation result: ${_}`)}return b.data}let h=si(B0,m);if(!h.success){let b=h.error instanceof Error?h.error.message:String(h.error);throw new me(ke.InvalidParams,`Invalid elicitation result: ${b}`)}let y=h.data,g=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&g&&this._capabilities.elicitation?.form?.applyDefaults)try{mb(g,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(l,c)=>{let u=si(F0,l);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new me(ke.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,f=await Promise.resolve(r(l,c));if(d.task){let y=si(ja,f);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new me(ke.InvalidParams,`Invalid task creation result: ${g}`)}return y.data}let m=d.tools||d.toolChoice?V0:Z0,h=si(m,f);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new me(ke.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:hu,capabilities:this._capabilities,clientInfo:this._clientInfo}},$0,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!KC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){vj(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&_j(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ma,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},W0,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ma,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},j0,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},z0,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},E0,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},P0,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},A0,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ma,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ma,r)}async callTool(e,r=yu,n){if(this.isToolTaskRequired(e.name))throw new me(ke.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new me(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let s=o(i.structuredContent);if(!s.valid)throw new me(ke.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof me?s:new me(ke.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let i=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,i)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},L0,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,i){let o=fz.safeParse(n);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:l}=n,c=async()=>{if(!s){l(null,null);return}try{let d=await i();l(null,d)}catch(d){let f=d instanceof Error?d:new Error(String(d));l(f,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let f=setTimeout(c,a);this._listChangedDebounceTimers.set(e,f)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function gb(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function wj(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...gb(e.headers),...gb(n.headers)}:e.headers};return t(r,i)}:t}var yI;yI=globalThis.crypto;async function FJ(t){return(await yI).getRandomValues(new Uint8Array(t))}async function ZJ(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await FJ(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function VJ(t){return await ZJ(t)}async function qJ(t){let e=await(await yI).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function bI(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await VJ(t),r=await qJ(e);return{code_verifier:e,code_challenge:r}}var Ir=MC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:HC.custom,message:"URL must be parseable",fatal:!0}),sg}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),kj=nr({resource:S().url(),authorization_servers:B(Ir).optional(),jwks_uri:S().url().optional(),scopes_supported:B(S()).optional(),bearer_methods_supported:B(S()).optional(),resource_signing_alg_values_supported:B(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:ht().optional(),authorization_details_types_supported:B(S()).optional(),dpop_signing_alg_values_supported:B(S()).optional(),dpop_bound_access_tokens_required:ht().optional()}),vI=nr({issuer:S(),authorization_endpoint:Ir,token_endpoint:Ir,registration_endpoint:Ir.optional(),scopes_supported:B(S()).optional(),response_types_supported:B(S()),response_modes_supported:B(S()).optional(),grant_types_supported:B(S()).optional(),token_endpoint_auth_methods_supported:B(S()).optional(),token_endpoint_auth_signing_alg_values_supported:B(S()).optional(),service_documentation:Ir.optional(),revocation_endpoint:Ir.optional(),revocation_endpoint_auth_methods_supported:B(S()).optional(),revocation_endpoint_auth_signing_alg_values_supported:B(S()).optional(),introspection_endpoint:S().optional(),introspection_endpoint_auth_methods_supported:B(S()).optional(),introspection_endpoint_auth_signing_alg_values_supported:B(S()).optional(),code_challenge_methods_supported:B(S()).optional(),client_id_metadata_document_supported:ht().optional()}),BJ=nr({issuer:S(),authorization_endpoint:Ir,token_endpoint:Ir,userinfo_endpoint:Ir.optional(),jwks_uri:Ir,registration_endpoint:Ir.optional(),scopes_supported:B(S()).optional(),response_types_supported:B(S()),response_modes_supported:B(S()).optional(),grant_types_supported:B(S()).optional(),acr_values_supported:B(S()).optional(),subject_types_supported:B(S()),id_token_signing_alg_values_supported:B(S()),id_token_encryption_alg_values_supported:B(S()).optional(),id_token_encryption_enc_values_supported:B(S()).optional(),userinfo_signing_alg_values_supported:B(S()).optional(),userinfo_encryption_alg_values_supported:B(S()).optional(),userinfo_encryption_enc_values_supported:B(S()).optional(),request_object_signing_alg_values_supported:B(S()).optional(),request_object_encryption_alg_values_supported:B(S()).optional(),request_object_encryption_enc_values_supported:B(S()).optional(),token_endpoint_auth_methods_supported:B(S()).optional(),token_endpoint_auth_signing_alg_values_supported:B(S()).optional(),display_values_supported:B(S()).optional(),claim_types_supported:B(S()).optional(),claims_supported:B(S()).optional(),service_documentation:S().optional(),claims_locales_supported:B(S()).optional(),ui_locales_supported:B(S()).optional(),claims_parameter_supported:ht().optional(),request_parameter_supported:ht().optional(),request_uri_parameter_supported:ht().optional(),require_request_uri_registration:ht().optional(),op_policy_uri:Ir.optional(),op_tos_uri:Ir.optional(),client_id_metadata_document_supported:ht().optional()}),Sj=G({...BJ.shape,...vI.pick({code_challenge_methods_supported:!0}).shape}),$j=G({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:Dg.number().optional(),scope:S().optional(),refresh_token:S().optional()}).strip(),Ij=G({error:S(),error_description:S().optional(),error_uri:S().optional()}),xj=Ir.optional().or(ie("").transform(()=>{})),WJ=G({redirect_uris:B(Ir),token_endpoint_auth_method:S().optional(),grant_types:B(S()).optional(),response_types:B(S()).optional(),client_name:S().optional(),client_uri:Ir.optional(),logo_uri:xj,scope:S().optional(),contacts:B(S()).optional(),tos_uri:xj,policy_uri:S().optional(),jwks_uri:Ir.optional(),jwks:DC().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),GJ=G({client_id:S(),client_secret:S().optional(),client_id_issued_at:rt().optional(),client_secret_expires_at:rt().optional()}).strip(),Ej=WJ.merge(GJ),b$e=G({error:S(),error_description:S().optional()}).strip(),v$e=G({token:S(),token_type_hint:S().optional()}).strip();function Pj(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Tj({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var qt=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Kf=class extends qt{};Kf.errorCode="invalid_request";var il=class extends qt{};il.errorCode="invalid_client";var ol=class extends qt{};ol.errorCode="invalid_grant";var sl=class extends qt{};sl.errorCode="unauthorized_client";var Jf=class extends qt{};Jf.errorCode="unsupported_grant_type";var Yf=class extends qt{};Yf.errorCode="invalid_scope";var Qf=class extends qt{};Qf.errorCode="access_denied";var Co=class extends qt{};Co.errorCode="server_error";var em=class extends qt{};em.errorCode="temporarily_unavailable";var tm=class extends qt{};tm.errorCode="unsupported_response_type";var rm=class extends qt{};rm.errorCode="unsupported_token_type";var nm=class extends qt{};nm.errorCode="invalid_token";var im=class extends qt{};im.errorCode="method_not_allowed";var om=class extends qt{};om.errorCode="too_many_requests";var al=class extends qt{};al.errorCode="invalid_client_metadata";var sm=class extends qt{};sm.errorCode="insufficient_scope";var am=class extends qt{};am.errorCode="invalid_target";var Aj={[Kf.errorCode]:Kf,[il.errorCode]:il,[ol.errorCode]:ol,[sl.errorCode]:sl,[Jf.errorCode]:Jf,[Yf.errorCode]:Yf,[Qf.errorCode]:Qf,[Co.errorCode]:Co,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[im.errorCode]:im,[om.errorCode]:om,[al.errorCode]:al,[sm.errorCode]:sm,[am.errorCode]:am};var zo=class extends Error{constructor(e){super(e??"Unauthorized")}};function HJ(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var _I="code",wI="S256";function XJ(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&HJ(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function KJ(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":JJ(i,o,r);return;case"client_secret_post":YJ(i,o,n);return;case"none":QJ(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function JJ(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function YJ(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function QJ(t,e){e.set("client_id",t)}async function zj(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Ij.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=Aj[i]||Co;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Co(i)}}async function lm(t,e){try{return await xI(t,e)}catch(r){if(r instanceof il||r instanceof sl)return await t.invalidateCredentials?.("all"),await xI(t,e);if(r instanceof ol)return await t.invalidateCredentials?.("tokens"),await xI(t,e);throw r}}async function xI(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s=await t.discoveryState?.(),a,l,c,u=i;if(!u&&s?.resourceMetadataUrl&&(u=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(l=s.authorizationServerUrl,a=s.resourceMetadata,c=s.authorizationServerMetadata??await Nj(l,{fetchFn:o}),!a)try{a=await Oj(e,{resourceMetadataUrl:u},o)}catch{}(c!==s.authorizationServerMetadata||a!==s.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let b=await s7(e,{resourceMetadataUrl:u,fetchFn:o});l=b.authorizationServerUrl,c=b.authorizationServerMetadata,a=b.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await t7(e,t,a),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let b=c?.client_id_metadata_document_supported===!0,_=t.clientMetadataUrl;if(_&&!e7(_))throw new al(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${_}`);if(b&&_)f={client_id:_},await t.saveClientInformation?.(f);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let I=await d7(l,{metadata:c,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(I),f=I}}let p=!t.redirectUrl;if(r!==void 0||p){let b=await u7(t,l,{metadata:c,resource:d,authorizationCode:r,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}let m=await t.tokens();if(m?.refresh_token)try{let b=await c7(l,{metadata:c,clientInformation:f,refreshToken:m.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}catch(b){if(!(!(b instanceof qt)||b instanceof Co))throw b}let h=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await a7(l,{metadata:c,clientInformation:f,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function e7(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function t7(t,e,r){let n=Pj(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Tj({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function SI(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=kI(t,"resource_metadata")||void 0,o;if(i)try{o=new URL(i)}catch{}let s=kI(t,"scope")||void 0,a=kI(t,"error")||void 0;return{resourceMetadataUrl:o,scope:s,error:a}}function kI(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function Oj(t,e,r=fetch){let n=await i7(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return kj.parse(await n.json())}async function $I(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?$I(t,void 0,r):void 0;throw n}}function r7(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Cj(t,e,r=fetch){return await $I(t,{"MCP-Protocol-Version":e},r)}function n7(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function i7(t,e,r,n){let i=new URL(t),o=n?.protocolVersion??hu,s;if(n?.metadataUrl)s=new URL(n.metadataUrl);else{let l=r7(e,i.pathname);s=new URL(l,n?.metadataServerUrl??i),s.search=i.search}let a=await Cj(s,o,r);if(!n?.metadataUrl&&n7(a,i.pathname)){let l=new URL(`/.well-known/${e}`,i);a=await Cj(l,o,r)}return a}function o7(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Nj(t,{fetchFn:e=fetch,protocolVersion:r=hu}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=o7(t);for(let{url:o,type:s}of i){let a=await $I(o,n,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?vI.parse(await a.json()):Sj.parse(await a.json())}}}async function s7(t,e){let r,n;try{r=await Oj(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",t)));let i=await Nj(n,{fetchFn:e?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:i,resourceMetadata:r}}async function a7(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(_I))throw new Error(`Incompatible auth server: does not support response type ${_I}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(wI))throw new Error(`Incompatible auth server: does not support code challenge method ${wI}`)}else a=new URL("/authorize",t);let l=await bI(),c=l.code_verifier,u=l.code_challenge;return a.searchParams.set("response_type",_I),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",wI),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:c}}function l7(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Rj(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:o,fetchFn:s}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),i)await i(l,r,a,e);else if(n){let u=e?.token_endpoint_auth_methods_supported??[],d=XJ(n,u);KJ(d,n,l,r)}let c=await(s??fetch)(a,{method:"POST",headers:l,body:r});if(!c.ok)throw await zj(c);return $j.parse(await c.json())}async function c7(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await Rj(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:i,fetchFn:s});return{refresh_token:n,...l}}async function u7(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:o}={}){let s=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(s)),!a){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();a=l7(i,c,t.redirectUrl)}let l=await t.clientInformation();return Rj(e,{metadata:r,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:o})}async function d7(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await zj(o);return Ej.parse(await o.json())}var yb=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function II(t){}function Mj(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=II,onError:r=II,onRetry:n=II,onComment:i}=t,o="",s=!0,a,l="",c="";function u(h){let y=s?h.replace(/^\xEF\xBB\xBF/,""):h,[g,b]=p7(`${o}${y}`);for(let _ of g)d(_);o=b,s=!1}function d(h){if(h===""){p();return}if(h.startsWith(":")){i&&i(h.slice(h.startsWith(": ")?2:1));return}let y=h.indexOf(":");if(y!==-1){let g=h.slice(0,y),b=h[y+1]===" "?2:1,_=h.slice(y+b);f(g,_,h);return}f(h,"",h)}function f(h,y,g){switch(h){case"event":c=y;break;case"data":l=`${l}${y}
|
|
110
110
|
`;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new yb(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:g}));break;default:r(new yb(`Unknown field "${h.length>20?`${h.slice(0,20)}\u2026`:h}"`,{type:"unknown-field",field:h,value:y,line:g}));break}}function p(){l.length>0&&e({id:a,event:c||void 0,data:l.endsWith(`
|
|
111
111
|
`)?l.slice(0,-1):l}),a=void 0,l="",c=""}function m(h={}){o&&h.consume&&d(o),s=!0,a=void 0,l="",c="",o=""}return{feed:u,reset:m}}function p7(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
112
112
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
113
|
-
`&&n++}}return[e,r]}var bb=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=Mj({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}};var f7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Os=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},vb=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=wj(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??f7}async _authThenStart(){if(!this._authProvider)throw new zo("No auth provider");let e;try{e=await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new zo;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=gb(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let i=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Os(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s,a=!1,l=!1;(async()=>{try{let u=e.pipeThrough(new TextDecoderStream).pipeThrough(new bb({onRetry:p=>{this._serverRetryMs=p}})).getReader();for(;;){let{value:p,done:m}=await u.read();if(m)break;if(p.id&&(s=p.id,a=!0,i?.(p.id)),!!p.data&&(!p.event||p.event==="message"))try{let h=Zg.parse(JSON.parse(p.data));Ra(h)&&(l=!0,o!==void 0&&(h.id=o)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(p){this.onerror?.(new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new zo("No auth provider");if(await lm(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new zo("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:i}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Mp(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,s),l=a.headers.get("mcp-session-id");if(l&&(this._sessionId=l),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Os(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:p,scope:m}=SI(a);if(this._resourceMetadataUrl=p,this._scope=m,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new zo;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:p,scope:m,error:h}=SI(a);if(h==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new Os(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),p&&(this._resourceMetadataUrl=p),this._lastUpscopingHeader=y??void 0,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new zo;return this.send(e)}}throw new Os(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),sz(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let u=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type");if(u)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:i},!1);else if(d?.includes("application/json")){let f=await a.json(),p=Array.isArray(f)?f.map(m=>Zg.parse(m)):[Zg.parse(f)];for(let m of p)this.onmessage?.(m)}else throw await a.body?.cancel(),new Os(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Os(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var Ns={name:"@intelliweave/embedded",version:"2.2.81",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && vitest run","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.97","@types/lodash":"^4.17.24","@types/react":"^19.2.14",bestzip:"^2.2.2","cross-env":"^10.1.0","find-cache-dir":"^6.0.0",lodash:"^4.17.23","onnxruntime-web":"^1.24.3",react:"^19.2.4","replace-in-file":"^8.4.0",tsup:"^8.5.1",tsx:"^4.21.0",typedoc:"^0.28.18",vitest:"^4.1.0"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.80.0","@modelcontextprotocol/sdk":"^1.27.1","@types/json-schema":"^7.0.15",minisearch:"^7.2.0",openai:"^6.32.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.1","rehype-stringify":"^10.0.1","remark-gfm":"^4.0.1","remark-parse":"^11.0.0","remark-rehype":"^11.1.2",unified:"^11.0.5","utility-types":"^3.11.0",uuid:"^13.0.0"}};var ur=new Oe("MCPKnowledgeClient"),h7="https://intelliweave-mcp-proxy-828827766277.us-central1.run.app",_b=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){ur.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new URL(this.config.baseURL),n={};this.config.headers&&(n={...n,...this.config.headers}),this.config.proxy?.enabled&&(n["Mcp-Target-Url"]=r.toString(),n["IntelliWeave-Api-Key"]=this.config.proxy.apiKey||"",r=new URL(this.config.proxy.url||h7));let i=new hb({name:Ns.name,version:Ns.version}),o=new vb(r,{requestInit:{headers:n}});return await i.connect(o),ur.debug("Connected with HTTP streaming mode"),i});return await this.disconnect(),this.client=e,e.onerror=r=>{ur.error(`MCP client error: ${r.message}`)},e.onclose=()=>{ur.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(U0,r=>{r.params.level=="critical"?ur.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?ur.error(`[Server] ${r.params.data}`):r.params.level=="error"?ur.error(`[Server] ${r.params.data}`):r.params.level=="warning"?ur.warn(`[Server] ${r.params.data}`):r.params.level=="info"?ur.info(`[Server] ${r.params.data}`):r.params.level=="debug"?ur.debug(`[Server] ${r.params.data}`):ur.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(Vp,r=>{ur.debug("Tool list changed",r),this.fetchTools()}),ur.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let o=await this.client.listTools({cursor:r});r=o.nextCursor;for(let s of o.tools||[])e.push(s);if(!o?.tools?.length||!r)break}let n=[],i=this.config.id||"mcp";for(let o of e){let s=!!(this.config.searchToolName&&o.name==this.config.searchToolName&&!this.config.searchToolVisible),a=`${i}_${o.name}`;n.push({id:a,name:o.name,content:o.description||"",type:"action",isContext:!0,parameters:o.inputSchema,action:l=>this.performToolCall(o.name,l),disabled:s})}ur.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,ur.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(o=>o.name==this.config.searchToolName);if(!n)return ur.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let o=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let o=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=i[o];r.push({id:this.config.id+":"+this.config.searchToolName+":"+o,name:`Search result ${o+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),ur.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw ur.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var g7=new Oe("Statistics"),cm=[];async function Gr(t,e){let r={...e,event_id:hr(),event_date:new Date().toISOString(),sdk_version:Ns.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(cm.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),cm.length===0))return;let n=cm.slice();cm.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){g7.warn("Failed to submit analytics event:",i),cm.push(...n);return}}var Rs=new Oe("KnowledgeBase"),y7=8*1024,EI=1,wb=class t{constructor(e){this._sources=[];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.allowWindowSources=!0;this.allowGlobalConfigSources=!0;this.allowRagSearch=!0;this.ai=e,this.ensureInternalKnowledge()}ensureInternalKnowledge(){this._sources=this._sources.filter(e=>e.id!=="core.internal"),this._sources.push({id:"core.internal",query:async()=>zT(this.ai)})}reset(){this._windowSources=[],this.manualEntries=[],this.lastResults=[],this._sources=[],this.ensureInternalKnowledge()}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${EI++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return this.allowGlobalConfigSources&&Et().knowledgeBaseSources&&(e=e.concat(Et().knowledgeBaseSources)),this.allowWindowSources&&typeof document<"u"&&(e=e.concat(this._windowSources)),e=e.filter(r=>!r.disabled),e}async search(e){Rs.debug(`Searching knowledge base for: ${e}`);let r=Date.now(),n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],this.allowWindowSources&&typeof document<"u"?(document.dispatchEvent(n),this._windowSources=n.sources):this._windowSources=[];let o=(await Promise.all(this.sources.map(async d=>{try{let f=Date.now(),p=await d.query(e);return Rs.debug(`Source '${d.id}' took ${Date.now()-f}ms`),p||[]}catch(f){return Rs.warn(`Knowledge source '${d.id}' failed:`,f),[]}}))).flat();o=o.concat(n.entries),o=o.concat(this.manualEntries),this.allowGlobalConfigSources&&Et().knowledgeBase&&(o=o.concat(Et().knowledgeBase)),o=o.filter(d=>d&&!d.disabled);let s=new Map;for(let d of o)d.id&&s.set(d.id,(s.get(d.id)||0)+1);for(let[d,f]of s)if(f>1){Rs.warn(`Duplicate knowledge base item ID detected: '${d}' appears ${f} times. Adding suffixes to make them unique.`);let p=1,m=!0;for(let h of o)if(h.id===d){if(m){m=!1;continue}h.id=`${d}(${p})`,p++}}for(let d=0;d<o.length;d++){let f=o[d];f.id=f.id||`temp.${d}`,f._functionID=f.id.replaceAll(/[^a-zA-Z0-9_]/g,"_")}let a=new dp({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});a.addAll(o);let c=a.search(e).map(d=>o.find(f=>f.id==d.id)).filter(Boolean),u=0;c=c.filter(d=>{if(d.isContext)return!0;let f=(d.content||"").length;return u+f>y7?!1:(u+=f,!0)});for(let d of o)d.isContext&&(c.find(f=>f.id===d.id)||c.push(d));return this.lastResults=c,Gr(this.ai,{event_type:"kb_search",value:c.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),Rs.debug("Found results:",c),c}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${EI++}`),Rs.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],o=!0,s=async(l,c)=>{Rs.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let f=await d.json();return a(f.updateItems||[]),f.response},a=l=>{for(let c of l){if(!c.id){Rs.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>s(c,d)})}};this.registerSource(r,async l=>{if(o&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return o=!d.noCache,i.includes(l)||i.push(l),a(d.items),n})}clone(e){let r=new t(e);return r._sources=this._sources.slice(),r._windowSources=this._windowSources.slice(),r.manualEntries=this.manualEntries.slice(),r.allowGlobalConfigSources=this.allowGlobalConfigSources,r.allowWindowSources=this.allowWindowSources,r.allowRagSearch=this.allowRagSearch,r.ensureInternalKnowledge(),r}registerMCPSource(e){e.id||(e.id=`external.${EI++}`);let r=new _b(e);return this.registerSource(e.id,n=>r.search(n)),r}};var xb=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
113
|
+
`&&n++}}return[e,r]}var bb=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=Mj({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}};var f7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Os=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},vb=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=wj(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??f7}async _authThenStart(){if(!this._authProvider)throw new zo("No auth provider");let e;try{e=await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new zo;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=gb(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let i=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Os(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s,a=!1,l=!1;(async()=>{try{let u=e.pipeThrough(new TextDecoderStream).pipeThrough(new bb({onRetry:p=>{this._serverRetryMs=p}})).getReader();for(;;){let{value:p,done:m}=await u.read();if(m)break;if(p.id&&(s=p.id,a=!0,i?.(p.id)),!!p.data&&(!p.event||p.event==="message"))try{let h=Zg.parse(JSON.parse(p.data));Ra(h)&&(l=!0,o!==void 0&&(h.id=o)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(p){this.onerror?.(new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new zo("No auth provider");if(await lm(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new zo("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:i}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Mp(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,s),l=a.headers.get("mcp-session-id");if(l&&(this._sessionId=l),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Os(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:p,scope:m}=SI(a);if(this._resourceMetadataUrl=p,this._scope=m,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new zo;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:p,scope:m,error:h}=SI(a);if(h==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new Os(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),p&&(this._resourceMetadataUrl=p),this._lastUpscopingHeader=y??void 0,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new zo;return this.send(e)}}throw new Os(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),sz(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let u=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type");if(u)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:i},!1);else if(d?.includes("application/json")){let f=await a.json(),p=Array.isArray(f)?f.map(m=>Zg.parse(m)):[Zg.parse(f)];for(let m of p)this.onmessage?.(m)}else throw await a.body?.cancel(),new Os(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Os(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var Ns={name:"@intelliweave/embedded",version:"2.2.82",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && vitest run","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.97","@types/lodash":"^4.17.24","@types/react":"^19.2.14",bestzip:"^2.2.2","cross-env":"^10.1.0","find-cache-dir":"^6.0.0",lodash:"^4.17.23","onnxruntime-web":"^1.24.3",react:"^19.2.4","replace-in-file":"^8.4.0",tsup:"^8.5.1",tsx:"^4.21.0",typedoc:"^0.28.18",vitest:"^4.1.0"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.80.0","@modelcontextprotocol/sdk":"^1.27.1","@types/json-schema":"^7.0.15",minisearch:"^7.2.0",openai:"^6.32.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.1","rehype-stringify":"^10.0.1","remark-gfm":"^4.0.1","remark-parse":"^11.0.0","remark-rehype":"^11.1.2",unified:"^11.0.5","utility-types":"^3.11.0",uuid:"^13.0.0"}};var ur=new Oe("MCPKnowledgeClient"),h7="https://intelliweave-mcp-proxy-828827766277.us-central1.run.app",_b=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){ur.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new URL(this.config.baseURL),n={};this.config.headers&&(n={...n,...this.config.headers}),this.config.proxy?.enabled&&(n["Mcp-Target-Url"]=r.toString(),n["IntelliWeave-Api-Key"]=this.config.proxy.apiKey||"",r=new URL(this.config.proxy.url||h7));let i=new hb({name:Ns.name,version:Ns.version}),o=new vb(r,{requestInit:{headers:n}});return await i.connect(o),ur.debug("Connected with HTTP streaming mode"),i});return await this.disconnect(),this.client=e,e.onerror=r=>{ur.error(`MCP client error: ${r.message}`)},e.onclose=()=>{ur.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(U0,r=>{r.params.level=="critical"?ur.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?ur.error(`[Server] ${r.params.data}`):r.params.level=="error"?ur.error(`[Server] ${r.params.data}`):r.params.level=="warning"?ur.warn(`[Server] ${r.params.data}`):r.params.level=="info"?ur.info(`[Server] ${r.params.data}`):r.params.level=="debug"?ur.debug(`[Server] ${r.params.data}`):ur.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(Vp,r=>{ur.debug("Tool list changed",r),this.fetchTools()}),ur.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let o=await this.client.listTools({cursor:r});r=o.nextCursor;for(let s of o.tools||[])e.push(s);if(!o?.tools?.length||!r)break}let n=[],i=this.config.id||"mcp";for(let o of e){let s=!!(this.config.searchToolName&&o.name==this.config.searchToolName&&!this.config.searchToolVisible),a=`${i}_${o.name}`;n.push({id:a,name:o.name,content:o.description||"",type:"action",isContext:!0,parameters:o.inputSchema,action:l=>this.performToolCall(o.name,l),disabled:s})}ur.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,ur.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(o=>o.name==this.config.searchToolName);if(!n)return ur.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let o=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let o=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=i[o];r.push({id:this.config.id+":"+this.config.searchToolName+":"+o,name:`Search result ${o+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),ur.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw ur.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var g7=new Oe("Statistics"),cm=[];async function Gr(t,e){let r={...e,event_id:hr(),event_date:new Date().toISOString(),sdk_version:Ns.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(cm.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),cm.length===0))return;let n=cm.slice();cm.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){g7.warn("Failed to submit analytics event:",i),cm.push(...n);return}}var Rs=new Oe("KnowledgeBase"),y7=8*1024,EI=1,wb=class t{constructor(e){this._sources=[];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.allowWindowSources=!0;this.allowGlobalConfigSources=!0;this.allowRagSearch=!0;this.ai=e,this.ensureInternalKnowledge()}ensureInternalKnowledge(){this._sources=this._sources.filter(e=>e.id!=="core.internal"),this._sources.push({id:"core.internal",query:async()=>zT(this.ai)})}reset(){this._windowSources=[],this.manualEntries=[],this.lastResults=[],this._sources=[],this.ensureInternalKnowledge()}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${EI++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return this.allowGlobalConfigSources&&Et().knowledgeBaseSources&&(e=e.concat(Et().knowledgeBaseSources)),this.allowWindowSources&&typeof document<"u"&&(e=e.concat(this._windowSources)),e=e.filter(r=>!r.disabled),e}async search(e){Rs.debug(`Searching knowledge base for: ${e}`);let r=Date.now(),n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],this.allowWindowSources&&typeof document<"u"?(document.dispatchEvent(n),this._windowSources=n.sources):this._windowSources=[];let o=(await Promise.all(this.sources.map(async d=>{try{let f=Date.now(),p=await d.query(e);return Rs.debug(`Source '${d.id}' took ${Date.now()-f}ms`),p||[]}catch(f){return Rs.warn(`Knowledge source '${d.id}' failed:`,f),[]}}))).flat();o=o.concat(n.entries),o=o.concat(this.manualEntries),this.allowGlobalConfigSources&&Et().knowledgeBase&&(o=o.concat(Et().knowledgeBase)),o=o.filter(d=>d&&!d.disabled);let s=new Map;for(let d of o)d.id&&s.set(d.id,(s.get(d.id)||0)+1);for(let[d,f]of s)if(f>1){Rs.warn(`Duplicate knowledge base item ID detected: '${d}' appears ${f} times. Adding suffixes to make them unique.`);let p=1,m=!0;for(let h of o)if(h.id===d){if(m){m=!1;continue}h.id=`${d}(${p})`,p++}}for(let d=0;d<o.length;d++){let f=o[d];f.id=f.id||`temp.${d}`,f._functionID=f.id.replaceAll(/[^a-zA-Z0-9_]/g,"_")}let a=new dp({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});a.addAll(o);let c=a.search(e).map(d=>o.find(f=>f.id==d.id)).filter(Boolean),u=0;c=c.filter(d=>{if(d.isContext)return!0;let f=(d.content||"").length;return u+f>y7?!1:(u+=f,!0)});for(let d of o)d.isContext&&(c.find(f=>f.id===d.id)||c.push(d));return this.lastResults=c,Gr(this.ai,{event_type:"kb_search",value:c.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),Rs.debug("Found results:",c),c}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${EI++}`),Rs.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],o=!0,s=async(l,c)=>{Rs.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let f=await d.json();return a(f.updateItems||[]),f.response},a=l=>{for(let c of l){if(!c.id){Rs.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>s(c,d)})}};this.registerSource(r,async l=>{if(o&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return o=!d.noCache,i.includes(l)||i.push(l),a(d.items),n})}clone(e){let r=new t(e);return r._sources=this._sources.slice(),r._windowSources=this._windowSources.slice(),r.manualEntries=this.manualEntries.slice(),r.allowGlobalConfigSources=this.allowGlobalConfigSources,r.allowWindowSources=this.allowWindowSources,r.allowRagSearch=this.allowRagSearch,r.ensureInternalKnowledge(),r}registerMCPSource(e){e.id||(e.id=`external.${EI++}`);let r=new _b(e);return this.registerSource(e.id,n=>r.search(n)),r}};var xb=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
114
114
|
|
|
115
115
|
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(r.toLowerCase().includes("true"))return!0;if(r.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+r)}async choose(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
116
116
|
|
|
@@ -348,7 +348,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
348
348
|
color: #061017;
|
|
349
349
|
opacity: 1;
|
|
350
350
|
}
|
|
351
|
-
:host([layout="widget"]) #send-button
|
|
351
|
+
:host([layout="widget"]) #send-button
|
|
352
352
|
background: var(--iw-send-btn-gradient, linear-gradient(135deg, #0b7aa1, 55%, #a34b0d));
|
|
353
353
|
opacity: 1;
|
|
354
354
|
}
|
|
@@ -741,14 +741,14 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
741
741
|
|
|
742
742
|
#root #poweredby {
|
|
743
743
|
width: 100%;
|
|
744
|
-
height:
|
|
744
|
+
height: 18px;
|
|
745
745
|
background-color: rgba(0, 0, 0, 0.3);
|
|
746
746
|
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
747
747
|
display: flex;
|
|
748
748
|
align-items: center;
|
|
749
749
|
justify-content: center;
|
|
750
750
|
overflow: hidden;
|
|
751
|
-
font-size:
|
|
751
|
+
font-size: 10px;
|
|
752
752
|
color: var(--intelliweave-text-color, white);
|
|
753
753
|
opacity: 0.7;
|
|
754
754
|
border-bottom-right-radius: 16px;
|
|
@@ -1043,26 +1043,32 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
1045
|
:host a, :host a:visited {
|
|
1046
|
-
color: rgba(128, 192, 255, 1);
|
|
1047
|
-
text-decoration:
|
|
1046
|
+
color: var(--intelliweave-text-color, rgba(128, 192, 255, 1));
|
|
1047
|
+
text-decoration: underline;
|
|
1048
|
+
font-weight: bold;
|
|
1048
1049
|
}
|
|
1049
1050
|
#root.layout-fullscreen #interaction-bar {
|
|
1051
|
+
/* Make the fullscreen input treatment read as a full-width bottom banner. */
|
|
1050
1052
|
width: 100%;
|
|
1051
|
-
max-width:
|
|
1052
|
-
margin:
|
|
1053
|
-
border-radius:
|
|
1053
|
+
max-width: none;
|
|
1054
|
+
margin: 0;
|
|
1055
|
+
border-radius: 0;
|
|
1054
1056
|
overflow: hidden;
|
|
1057
|
+
flex: 0 0 auto;
|
|
1055
1058
|
}
|
|
1056
1059
|
#root.layout-fullscreen #interaction-bar {
|
|
1057
1060
|
background: var(--intelliweave-fullscreen-input-section-bg, var(--intelliweave-interaction-bg, rgba(32, 38, 44, 0.9)));
|
|
1058
1061
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
|
1059
1062
|
backdrop-filter: blur(16px);
|
|
1060
1063
|
-webkit-backdrop-filter: blur(16px);
|
|
1064
|
+
padding: 8px 15% 6px;
|
|
1061
1065
|
}
|
|
1062
1066
|
@media (max-width: 768px) {
|
|
1063
1067
|
#root.layout-fullscreen #interaction-bar {
|
|
1064
|
-
|
|
1065
|
-
|
|
1068
|
+
/* Keep the fullscreen input banner edge-to-edge on mobile too. */
|
|
1069
|
+
width: 100%;
|
|
1070
|
+
margin-bottom: 0;
|
|
1071
|
+
padding: 8px 12px 8px;
|
|
1066
1072
|
}
|
|
1067
1073
|
}
|
|
1068
1074
|
|
|
@@ -1296,6 +1302,13 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1296
1302
|
}
|
|
1297
1303
|
#root.layout-fullscreen #fullscreen-header {
|
|
1298
1304
|
border-bottom: none;
|
|
1305
|
+
align-items: center;
|
|
1306
|
+
/* Align the persona logo with the fullscreen conversation column. */
|
|
1307
|
+
padding: 24px 15% 16px;
|
|
1308
|
+
}
|
|
1309
|
+
#root.layout-fullscreen.container-mode #fullscreen-header {
|
|
1310
|
+
/* Container embeds should keep their compact local padding. */
|
|
1311
|
+
padding: 14px 14px 12px;
|
|
1299
1312
|
}
|
|
1300
1313
|
#root.open #fullscreen-header {
|
|
1301
1314
|
display: flex;
|
|
@@ -1457,6 +1470,8 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1457
1470
|
border-radius: 16px;
|
|
1458
1471
|
background: var(--intelliweave-assistant-bubble-bg, linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)));
|
|
1459
1472
|
color: var(--intelliweave-assistant-bubble-text, inherit);
|
|
1473
|
+
font-size: 15px;
|
|
1474
|
+
line-height: 1.6;
|
|
1460
1475
|
text-align: left;
|
|
1461
1476
|
}
|
|
1462
1477
|
#root.layout-fullscreen:not(.container-mode) #web-weaver-embed-inner > .input {
|
|
@@ -1471,8 +1486,8 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1471
1486
|
border-color: var(--intelliweave-user-bubble-border, rgba(34, 211, 238, 0.25));
|
|
1472
1487
|
background: var(--intelliweave-user-bubble-bg, linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(34, 211, 238, 0.07)));
|
|
1473
1488
|
color: var(--intelliweave-user-bubble-text, inherit);
|
|
1474
|
-
font-size:
|
|
1475
|
-
line-height: 1.
|
|
1489
|
+
font-size: 15px;
|
|
1490
|
+
line-height: 1.6;
|
|
1476
1491
|
opacity: 1;
|
|
1477
1492
|
}
|
|
1478
1493
|
#root.layout-fullscreen:not(.container-mode) #web-weaver-embed-inner > .output,
|
|
@@ -1494,8 +1509,8 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1494
1509
|
border-color: var(--intelliweave-assistant-bubble-border, rgba(255, 255, 255, 0.12));
|
|
1495
1510
|
background: var(--intelliweave-assistant-bubble-bg, linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)));
|
|
1496
1511
|
color: var(--intelliweave-assistant-bubble-text, inherit);
|
|
1497
|
-
font-size:
|
|
1498
|
-
line-height: 1.
|
|
1512
|
+
font-size: 15px;
|
|
1513
|
+
line-height: 1.6;
|
|
1499
1514
|
opacity: 1;
|
|
1500
1515
|
}
|
|
1501
1516
|
#root.layout-fullscreen:not(.container-mode) #web-weaver-embed-inner > .output-container {
|
|
@@ -1516,8 +1531,8 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1516
1531
|
border-color: var(--intelliweave-assistant-bubble-border, rgba(255, 255, 255, 0.12));
|
|
1517
1532
|
background: var(--intelliweave-assistant-bubble-bg, linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)));
|
|
1518
1533
|
color: var(--intelliweave-assistant-bubble-text, inherit);
|
|
1519
|
-
font-size:
|
|
1520
|
-
line-height: 1.
|
|
1534
|
+
font-size: 15px;
|
|
1535
|
+
line-height: 1.6;
|
|
1521
1536
|
opacity: 1;
|
|
1522
1537
|
}
|
|
1523
1538
|
#web-weaver-embed-inner .output-container {
|
|
@@ -1540,15 +1555,31 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1540
1555
|
}
|
|
1541
1556
|
#web-weaver-embed-inner .output strong,
|
|
1542
1557
|
#web-weaver-embed-inner .info-block-text strong {
|
|
1543
|
-
color
|
|
1558
|
+
/* Bold markdown should keep the configured message text color in light themes. */
|
|
1559
|
+
color: inherit;
|
|
1544
1560
|
font-weight: 950;
|
|
1545
1561
|
}
|
|
1562
|
+
#web-weaver-embed-inner .output h1,
|
|
1563
|
+
#web-weaver-embed-inner .output h2,
|
|
1564
|
+
#web-weaver-embed-inner .output h3,
|
|
1565
|
+
#web-weaver-embed-inner .output h4,
|
|
1566
|
+
#web-weaver-embed-inner .output h5,
|
|
1567
|
+
#web-weaver-embed-inner .output h6,
|
|
1568
|
+
#web-weaver-embed-inner .info-block-text h1,
|
|
1569
|
+
#web-weaver-embed-inner .info-block-text h2,
|
|
1570
|
+
#web-weaver-embed-inner .info-block-text h3,
|
|
1571
|
+
#web-weaver-embed-inner .info-block-text h4,
|
|
1572
|
+
#web-weaver-embed-inner .info-block-text h5,
|
|
1573
|
+
#web-weaver-embed-inner .info-block-text h6 {
|
|
1574
|
+
/* Headings should not switch to the old forced light color. */
|
|
1575
|
+
color: inherit;
|
|
1576
|
+
}
|
|
1546
1577
|
#web-weaver-embed-inner .output code,
|
|
1547
1578
|
#web-weaver-embed-inner .info-block-text code {
|
|
1548
1579
|
padding: 0.08rem 0.28rem;
|
|
1549
1580
|
border-radius: 6px;
|
|
1550
1581
|
background: rgba(255, 255, 255, 0.08);
|
|
1551
|
-
color: #67E8F9;
|
|
1582
|
+
color: var(--intelliweave-text-color, #67E8F9);
|
|
1552
1583
|
font-size: 0.78em;
|
|
1553
1584
|
}
|
|
1554
1585
|
#web-weaver-embed-inner .suggestion-button {
|
|
@@ -1582,6 +1613,8 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1582
1613
|
border-color: var(--intelliweave-suggestion-button-border, rgba(236, 72, 153, 0.22));
|
|
1583
1614
|
background: var(--intelliweave-suggestion-button-bg, linear-gradient(135deg, rgba(236, 72, 153, 0.11), rgba(34, 211, 238, 0.07)));
|
|
1584
1615
|
color: var(--intelliweave-suggestion-button-text, inherit);
|
|
1616
|
+
/* Match the slightly larger fullscreen chat text scale. */
|
|
1617
|
+
font-size: 14px;
|
|
1585
1618
|
}
|
|
1586
1619
|
#root.layout-fullscreen #web-weaver-embed-inner .suggestion-button:hover {
|
|
1587
1620
|
border-color: var(--intelliweave-suggestion-button-hover-border, rgba(236, 72, 153, 0.42));
|
|
@@ -1607,13 +1640,14 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1607
1640
|
#poweredby {
|
|
1608
1641
|
display: none;
|
|
1609
1642
|
width: 100%;
|
|
1610
|
-
height
|
|
1643
|
+
/* Give the powered-by footer enough height to read clearly below the fullscreen input banner. */
|
|
1644
|
+
height: 28px;
|
|
1611
1645
|
align-items: center;
|
|
1612
1646
|
justify-content: center;
|
|
1613
1647
|
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
1614
1648
|
background: rgba(7, 11, 13, 0.38);
|
|
1615
1649
|
color: rgba(230, 241, 245, 0.62);
|
|
1616
|
-
font-size:
|
|
1650
|
+
font-size: 10px;
|
|
1617
1651
|
}
|
|
1618
1652
|
#root.open #poweredby {
|
|
1619
1653
|
display: flex;
|
|
@@ -1644,6 +1678,10 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
1644
1678
|
left: max(0px, env(safe-area-inset-left)) !important;
|
|
1645
1679
|
border-radius: 0;
|
|
1646
1680
|
}
|
|
1681
|
+
#root.layout-fullscreen #fullscreen-header {
|
|
1682
|
+
/* Avoid over-indenting the header on small screens. */
|
|
1683
|
+
padding: 14px 12px 12px;
|
|
1684
|
+
}
|
|
1647
1685
|
#dock-main .dock-title {
|
|
1648
1686
|
max-width: 112px;
|
|
1649
1687
|
overflow: hidden;
|