@hallohuman/hightea 0.1.30 → 0.1.31

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.
@@ -0,0 +1,58 @@
1
+ import{constants as mp}from"node:fs";import{access as fp,stat as hp}from"node:fs/promises";import{delimiter as gp,isAbsolute as _p,join as yp}from"node:path";import{installLine as $c,knownAgents as Mc}from"@ahpd/sdk";function Pe(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Zt(e,t="|"){return e.map((n)=>jt(n)).join(t)}function De(e,t){if(typeof t==="bigint")return t.toString();return t}class rr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function $e(e){return new rr(e)}function or(e){return e===null||e===void 0}function Ye(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function sr(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}function Q(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Me(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ce(e){return Me(e._zod.def)??e._zod.def.shape}function ir(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Q(this,t,r),r},enumerable:!0,configurable:!0})}function ar(e,t,n){if(t in e)Q(e,t,n);else e[t]=n}function ye(e,t,n,r){let o=ce(t);for(let s of n){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)ir(e,s,()=>{let m=t._zod.def.shape[s];return r?r(m,s):m});else ar(e,s,r?r(i.value,s):i.value)}}function Qc(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)ir(e,n,()=>t[n]);else ar(e,n,r.value)}}function V(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function cr(e){return JSON.stringify(e)}function ur(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ft="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function be(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var dr=$e(()=>{if(G.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ee(e){if(be(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(be(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Bt(e){if(Ee(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var lr=new Set(["string","number","symbol"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oe(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function I(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function jt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function pr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Qe=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Jt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function eu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return ye(s,e,et(e,t)),oe(e,V(n,{shape:s,checks:[]}))}function et(e,t){let n=ce(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])r.push(o)}return r}function tu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(et(e,t)),i={};return ye(i,e,Reflect.ownKeys(ce(e)).filter((m)=>!s.has(m))),oe(e,V(n,{shape:i,checks:[]}))}function nu(e,t){if(!Ee(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=ce(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return oe(e,V(e._zod.def,{shape:mr(e,t)}))}function mr(e,t){let n={};return ye(n,e,Reflect.ownKeys(ce(e))),Qc(n,t),n}function ru(e,t){if(!Ee(t))throw Error("Invalid input to safeExtend: expected a plain object");return oe(e,V(e._zod.def,{shape:mr(e,t)}))}function ou(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};ye(n,e,Reflect.ownKeys(ce(e))),ye(n,t,Reflect.ownKeys(ce(t)));let r=V(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return oe(e,r)}function fr(e,t,n,r="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let m=n?new Set(et(t,n)):void 0,f={};return ye(f,t,Reflect.ownKeys(ce(t)),e&&((h,_)=>m&&!m.has(_)?h:new e({type:"optional",innerType:h}))),oe(t,V(t._zod.def,{shape:f,checks:[]}))}function su(e,t,n){let r=n?new Set(et(t,n)):void 0,o={};return ye(o,t,Reflect.ownKeys(ce(t)),(s,i)=>r&&!r.has(i)?s:new e({type:"nonoptional",innerType:s})),oe(t,V(t._zod.def,{shape:o}))}function se(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function hr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function fe(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Le(e){return typeof e==="string"?e:e?.message}function Gt(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;if(o>=0)t.push([o,n])}return t}function tt(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ie(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Le(e.inst?._zod.def?.error?.(e))??Le(s?.(e))??Le(t?.error?.(e))??Le(n.customError?.(e))??Le(n.localeError?.(e))??"Invalid input",m={};for(let f of Object.keys(e)){if(f==="inst"||f==="schema"||f==="continue"||f==="input"||f==="__proto__")continue;m[f]=e[f]}if(m.path??(m.path=[]),m.message=i,t?.reportInput)m.input=e.input;return m}var iu=/[\uD800-\uDBFF]/;function nt(e){let t=e.length;if(!iu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function rt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function gr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Se(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function _r(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else au(e,n,r.value)}}function ue(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ot(e,t,n){return ue(e,t,n,!1)}function yr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ue(this,n,r(this))},set(o){ue(this,n,o)}})}return t}function au(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ue(this,t,n.bind(this))},set(r){ue(this,t,r)}})}function cu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ht,pe=!1,uu={configurable:!0,get(){pe=!0;return}};function L(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ht!==e._zod){Ht=void 0;return}Ht=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,uu);let o=pe;pe=!1;try{let s=n(this);if(pe)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return pe=pe||o,s}catch(s){throw delete this[t],pe=pe||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function du(e,t,n,r){let o=cu(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:s})}})}var lu="~constantCatch";function Er(e){let t=()=>e;return t[lu]=!0,t}var Sr;var qt={value:void 0,enumerable:!1},wr="captureStackTrace"in Error?Error:null;function pu(e){let t=wr;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return wr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function E(e,t,n,r){let o={};function s(A){this.def=A,this.constr=S,this.traits=new Set}s.prototype=o;let i=n,m=i&&new WeakSet;function f(A,T){if(!A._zod){qt.value=new s(T);try{Object.defineProperty(A,"_zod",qt)}finally{qt.value=void 0}}else if(A._zod.traits.has(e))return;if(A._zod.traits.add(e),t(A,T),m){let O=Object.getPrototypeOf(A),C=A._zod.constr.prototype,P=O;while(P&&P!==C)P=Object.getPrototypeOf(P);let Y=P??O;if(!m.has(Y))m.add(Y),_r(Y,i)}let v=S.prototype;for(let O in v){if(!Object.prototype.hasOwnProperty.call(v,O))continue;if(!(O in A))A[O]=v[O].bind(A)}}let h=r?.Parent??Object;class _ extends h{}Object.defineProperty(_,"name",{value:e});function S(A){let T=r?.Parent?pu(_):this;f(T,A);let v=T._zod.deferred;if(v){for(let C of v)C();T._zod.deferred=void 0}let O=globalThis.__zod_globalConfig?.postProcessor;if(O)O(T);return T}return Object.defineProperty(S,"init",{value:f}),Object.defineProperty(S,Symbol.hasInstance,{value:(A)=>{if(r?.Parent&&A instanceof r.Parent)return!0;return A?._zod?.traits?.has(e)}}),Object.defineProperty(S,"name",{value:e}),S}class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ze extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Sr=globalThis).__zod_globalConfig??(Sr.__zod_globalConfig={});var G=globalThis.__zod_globalConfig;function K(e){if(e)Object.assign(G,e);return G}function mu(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,De,2)),e.message}function fu(e){this._zod.message=e}var hu={get:mu,set:fu,enumerable:!0,configurable:!0},Kt={value:void 0,enumerable:!1},Tr=new WeakSet([Object.prototype,Error.prototype]),Ar=(e,t)=>{e.name="$ZodError",Kt.value=t,Object.defineProperty(e,"issues",Kt),Kt.value=void 0,Object.defineProperty(e,"message",hu);let n=Object.getPrototypeOf(e);if(!Tr.has(n))Tr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},vr=E("$ZodError",Ar),Hp=E("$ZodError",Ar,void 0,{Parent:Error});function gu(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function kr(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)gu(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function br(e,t=(n)=>n.message){let n={_errors:[]},r=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((m)=>r({issues:m},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{let m=[...s,...i.path];if(m.length===0)n._errors.push(t(i));else{let f=n,h=0;while(h<m.length){let _=m[h],S=h===m.length-1;if(_==="_errors"){if(S)f._errors.push(t(i));h++;continue}if(!Object.prototype.hasOwnProperty.call(f,_))Object.defineProperty(f,_,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let A=f[_];if(S)A._errors.push(t(i));f=A,h++}}}};return r(e),n}function st(e,t){return{callee:t?.callee??e,Err:t?.Err}}var it=(e)=>{let t=(n,r,o,s)=>{let i=o?{...o,async:!1}:{async:!1},m=n._zod.run({value:r,issues:[]},i);if(m instanceof Promise)throw new ae;if(m.issues.length){let f=new(s?.Err??e)(m.issues.map((h)=>ie(h,i,K())));throw Ft(f,s?.callee??t),f}return m.value};return t};var at=(e)=>{let t=async(n,r,o,s)=>{let i=o?{...o,async:!0}:{async:!0},m=n._zod.run({value:r,issues:[]},i);if(m instanceof Promise)m=await m;if(m.issues.length){let f=new(s?.Err??e)(m.issues.map((h)=>ie(h,i,K())));throw Ft(f,s?.callee??t),f}return m.value};return t};var ct=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new ae;return s.issues.length?Ir(e,s.issues,o):{success:!0,data:s.value}};function Ir(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>ie(o,n,K()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var ut=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?Ir(e,s.issues,o):{success:!0,data:s.value}};var _u=Symbol.for("zod.compile.invalid"),yu=Symbol.for("zod.compile.fallback"),Xt=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_u)return!0;if(r.definite===!0&&n===void 0)return!1}return Eu(e,t,n)};function Eu(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)r[yu]=!0,s=o({value:t,issues:[]},r);else s=e._zod.run({value:t,issues:[]},r);if(s instanceof Promise)throw new ae;return s.issues.length===0}var Yt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},Rr=(e)=>{let t=it(e),n=(r,o,s,i)=>{let m=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,o,m,st(n,i))};return n};var xr=(e)=>{let t=it(e),n=(r,o,s,i)=>t(r,o,s,st(n,i));return n};var Or=(e)=>{let t=at(e),n=async(r,o,s,i)=>{let m=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,o,m,st(n,i))};return n};var Nr=(e)=>{let t=at(e),n=async(r,o,s,i)=>await t(r,o,s,st(n,i));return n};var Cr=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ct(e)(t,n,o)};var Lr=(e)=>(t,n,r)=>ct(e)(t,n,r);var Pr=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ut(e)(t,n,o)};var Dr=(e)=>async(t,n,r)=>ut(e)(t,n,r);var $r=/^[cC][0-9a-z]{6,}$/,Mr=/^[0-9a-z]+$/,zr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ur=/^[0-9a-vA-V]{20}$/,Wr=/^[A-Za-z0-9]{27}$/,Hr=/^[a-zA-Z0-9_-]{21}$/;function Zr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Fr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Br=/^([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})$/,en=(e)=>{if(!e)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var jr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Su="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Jr(){return new RegExp(Su,"u")}var Gr=/^(?:(?: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])$/,qr=/^(([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 Vr=/^((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])$/,Kr=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Qr=/^https?$/,eo=/^\+[1-9]\d{6,14}$/;var to="(?:(?:\\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])))";function wu(e){return new RegExp(`^${e}$`)}var no=wu(to);function Qt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ro(e){return new RegExp(`^${Qt(e)}$`)}function oo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Qt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Qt({precision:e.precision})}`:n;return new RegExp(`^${to}T(?:${r})$`)}var so=/^[\s\S]{0,}$/;var tn=/^-?\d+$/,Ue=/^-?\d+(?:\.\d+)?$/,io=/^(?:true|false)$/i;var ao=/^[^A-Z]*$/,co=/^[^a-z]*$/;var B=E("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var nn=(e)=>{let t=e.value;return!or(t)&&t.length!==void 0},dt={number:"number",bigint:"bigint",object:"date"},rn=E("$ZodCheckLessThan",(e,t)=>{B.init(e,t);let n=dt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:dt[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),on=E("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);let n=dt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:dt[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uo=E("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):sr(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lo=E("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Qe[t.format];e._zod.check=(i)=>{let m=i.value;if(n){if(!Number.isInteger(m)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){if(m>0)i.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else i.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(m<o)i.issues.push({origin:"number",input:m,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(m>s)i.issues.push({origin:"number",input:m,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var po=E("$ZodCheckMaxLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=(r)=>{let o=r.value,s=o.length;if((typeof o==="string"&&s>t.maximum?nt(o):s)<=t.maximum)return;let m=rt(o);r.issues.push({origin:m,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mo=E("$ZodCheckMinLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=(r)=>{let o=r.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?nt(o):s)>=t.minimum)return;let m=rt(o);r.issues.push({origin:m,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fo=E("$ZodCheckLengthEquals",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=(r)=>{let o=r.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?nt(o):s;if(i===t.length)return;let m=rt(o),f=i>t.length;r.issues.push({origin:m,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),He=E("$ZodCheckStringFormat",(e,t)=>{var n,r;if(B.init(e,t),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),ho=E("$ZodCheckRegex",(e,t)=>{He.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),go=E("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ao),He.init(e,t)}),_o=E("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=co),He.init(e,t)}),yo=E("$ZodCheckIncludes",(e,t)=>{B.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Eo=E("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);let n=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),So=E("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);let n=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var wo=E("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class sn{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
2
+ `).filter((s)=>s),r=Math.min(...n.map((s)=>s.length-s.trimStart().length)),o=n.map((s)=>s.slice(r)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
3
+ ${t.join(`
4
+ `)}
5
+ };`)(...Object.values(this.closed))}}var Ao={major:4,minor:6,patch:7};var U=E("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ao;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(m,f,h)=>{if(m.memo)return m;let _=se(m),S;for(let A of f){if(A._zod.def.when){if(hr(m))continue;if(!A._zod.def.when(m))continue}else if(_)continue;let T=m.issues.length,v=A._zod.check(m);if(v instanceof Promise&&h?.async===!1)throw new ae;if(S||v instanceof Promise)S=(S??Promise.resolve()).then(async()=>{if(await v,m.issues.length===T)return;if(tt(m.issues,T,e),!_)_=se(m,T)});else{if(m.issues.length===T)continue;if(tt(m.issues,T,e),!_)_=se(m,T)}}if(S)return S.then(()=>m);return m},i=(m,f,h)=>{if(se(m))return m.aborted=!0,m;let _=s(f,o,h);if(_ instanceof Promise){if(h.async===!1)throw new ae;return _.then((S)=>e._zod.parse(S,h))}return e._zod.parse(_,h)};e._zod.run=(m,f)=>{if(f.skipChecks)return e._zod.parse(m,f);if(f.direction==="backward"){let _=e._zod.parse({value:m.value,issues:[]},{...f,skipChecks:!0});if(_ instanceof Promise)return _.then((S)=>i(S,m,f));return i(_,m,f)}let h=e._zod.parse(m,f);if(h instanceof Promise){if(f.async===!1)throw new ae;return h.then((_)=>s(_,o,f))}return s(h,o,f)}}},{get "~standard"(){return ot(this,"~standard",cn(this))},set "~standard"(e){ue(this,"~standard",e)}}),Po=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>ie(n,t,K()))}:{value:e.value};async function Tu(e,t){let n={async:!0};return Po(await e._zod.run({value:t,issues:[]},n),n)}function cn(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Po(r,n)}catch(r){}return Tu(e,t)},vendor:"zod",version:1}}var ft=E("$ZodString",(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??so,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),z=E("$ZodStringFormat",(e,t)=>{He.init(e,t),ft.init(e,t)}),Do=E("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Br),z.init(e,t)}),$o=E("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=en(r))}else t.pattern??(t.pattern=en());z.init(e,t)}),Mo=E("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jr),z.init(e,t)}),zo=1,pt=2;function Uo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Au(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Uo(e)||pt;return vu(e,t)}function vu(e,t){if(!t.normalize&&t.protocol?.source===Qr.source&&!/^https?:\/\//i.test(e))return zo;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??pt}return new URL(e)}catch{return pt}}var ku=/[\t\n\r]/g;function vo(e){return e.replace(ku,"")}function bu(e,t){return t.lastIndex=0,t.test(e.hostname)}function Iu(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Wo=E("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Au(r,t);if(o===zo){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===pt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=vo(r);return}if(t.hostname&&!bu(o,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Iu(o,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?o.href:vo(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ho=E("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Jr()),z.init(e,t)}),Zo=E("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Hr:Zr(t.length)),z.init(e,t)}),Fo=E("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$r),z.init(e,t)}),Bo=E("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Mr),z.init(e,t)}),jo=E("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zr),z.init(e,t)}),Jo=E("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ur),z.init(e,t)}),Go=E("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wr),z.init(e,t)}),qo=E("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=oo(t)),z.init(e,t)}),Vo=E("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=no),z.init(e,t)}),Ko=E("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ro(t)),z.init(e,t)}),Xo=E("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fr),z.init(e,t)}),Yo=E("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gr),z.init(e,t)}),Ru=/^[0-9a-fA-F:.]+$/;function Qo(e){if(!Ru.test(e))return!1;return Uo(`http://[${e}]`)}var es=E("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qr),z.init(e,t),e._zod.check=(n)=>{if(!Qo(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var ts=E("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vr),z.init(e,t)});function xu(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return Qo(n)}var ns=E("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Kr),z.init(e,t),e._zod.check=(n)=>{if(!xu(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function rs(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var un=/^[0-9a-zA-Z+/]*={0,2}$/,os=E("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=un),z.init(e,t),e._zod.check=(n)=>{if(rs(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ht=/^[A-Za-z0-9_-]*$/;function Ou(e){if(!ht.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return rs(n)}var ss=E("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ht),z.init(e,t),e._zod.check=(n)=>{if(Ou(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),is=E("$ZodE164",(e,t)=>{t.pattern??(t.pattern=eo),z.init(e,t)});function Nu(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var as=E("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=(n)=>{if(Nu(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var dn=E("$ZodNumber",(e,t)=>{U.init(e,t),e._zod.pattern=Ue,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(i){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),cs=E("$ZodNumberFormat",(e,t)=>{lo.init(e,t),dn.init(e,t)}),us=E("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=io,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var ds=E("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=(n)=>n}),ls=E("$ZodNever",(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Cu(e,t){let n=Gt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let m=t(s.value);if(m>r&&!i?.skipChecks&&i?.direction!=="backward"){for(let[f,h]of Gt(e._zod.def.checks))if(m>f&&h._zod.def.when(s)){let _=s.issues.length;return h._zod.check(s),s.issues[_].continue=!1,tt(s.issues,_,e),s}}return o(s,i)}}var Lu=(e)=>Array.isArray(e)?e.length:-1;function ko(e,t,n){if(e.issues.length)t.issues.push(...fe(n,e.issues));t.value[n]=e.value}var ps=E("$ZodArray",(e,t)=>{U.init(e,t);let n=G.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),o):Array(s.length);let i=[],m=o?.abortEarly;for(let f=0;f<s.length;f++){let h=s[f],_=t.element._zod.run({value:h,issues:[]},o);if(_ instanceof Promise)i.push(_.then((S)=>ko(S,r,f)));else if(ko(_,r,f),m&&_.issues.length!==0&&se(_))break}if(i.length)return Promise.all(i).then(()=>r);return r},Cu(e,Lu)});function mt(e,t,n,r,o,s){let i=n in r,m=s==="optional";if(!i&&m&&o==="optional")return;if(e.issues.length){if(o!==void 0&&m&&!i)return;t.issues.push(...fe(n,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(i||o==="defaulted"&&!m)t.value[n]=void 0}else t.value[n]=e.value}var Pu=[];function ms(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Pu,o=r.length?[...t,...r]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=pr(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function fs(e,t,n,r,o,s,i){let m=[],f=o.keySet,h=o.catchall._zod,_=h.def.type,{optin:S,optout:A}=h,T=0;for(let v in t){if(i&&n.issues.length!==T){if(se(n,T))break;T=n.issues.length}if(f.has(v))continue;if(v==="__proto__"){if(_==="never")m.push(v);continue}if(_==="never"){m.push(v);continue}let O=h.run({value:t[v],issues:[]},r);if(O instanceof Promise)e.push(O.then((C)=>mt(C,n,v,t,S,A)));else mt(O,n,v,t,S,A)}if(m.length)n.issues.push({code:"unrecognized_keys",keys:m,input:t,inst:s,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Du=E("$ZodObject",(e,t)=>{U.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let h=()=>{let _={...r};return Object.defineProperty(t,"shape",{value:_}),h.raw=_,_};h.raw=r,Object.defineProperty(t,"shape",{get:h})}let o=$e(()=>ms(t));L(e,"propValues",(h)=>{let _=h.def.shape,S={};for(let A in _){let T=_[A]._zod;if(T.values){if(!Object.prototype.hasOwnProperty.call(S,A))Q(S,A,new Set);for(let v of T.values)S[A].add(v);if(T.optin!==void 0)S[A].add(void 0)}}return S});let s=be,i=t.catchall,m,f=G.memoizer;f?.attach(e),e._zod.parse=(h,_)=>{m??(m=o.value);let S=h.value;if(!s(S))return h.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),h;h.value=f?f.alloc(e,h,{},_):{};let A=[],T=m.shape,v=_?.abortEarly,O=h.issues.length;for(let C of m.allKeys){if(v&&h.issues.length!==O){if(se(h,O))break;O=h.issues.length}if(C==="__proto__")continue;let P=T[C],Y=P._zod.optin,Ne=P._zod.optout,Ce=P._zod.run({value:S[C],issues:[]},_);if(Ce instanceof Promise)A.push(Ce.then((F)=>mt(F,h,C,S,Y,Ne)));else mt(Ce,h,C,S,Y,Ne)}if(!i)return A.length?Promise.all(A).then(()=>h):h;return fs(A,S,h,_,o.value,e,v===!0)}}),hs=E("$ZodObjectJIT",(e,t)=>{Du.init(e,t);let n=e._zod.parse,r=$e(()=>ms(t)),o=G.memoizer,s=(T)=>{let v=r.value,O=v.symbolKeys,C=new sn(["payload","ctx"],{shape:T,inst:e,memo:o,syms:O}),P=(F)=>`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`,Y=(F,M)=>`
6
+ let ${F}_ab = false;
7
+ for (let i = 0; i < ${F}.issues.length; i++) {
8
+ const iss = ${F}.issues[i];
9
+ iss.path = iss.path ? [${M}, ...iss.path] : [${M}];
10
+ payload.issues.push(iss);
11
+ if (iss.continue !== true) ${F}_ab = true;
12
+ }
13
+ if (${F}_ab && ctx && ctx.abortEarly) {
14
+ payload.value = newResult;
15
+ return payload;
16
+ }`;C.write("const input = payload.value;");let Ne=Object.create(null),Ce=0;for(let F of v.allKeys)Ne[F]=`key_${Ce++}`;C.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let F of v.allKeys){if(F==="__proto__")continue;let M=Ne[F],re=typeof F==="symbol"?`syms[${O.indexOf(F)}]`:cr(F),$t=`${re} in input`,tr=T[F],Mt=tr?._zod?.optin,nr=Mt!==void 0,Uc=tr?._zod?.optout==="optional";if(C.write(`const ${M} = ${P(re)};`),nr&&Uc){let Wc=Mt==="optional"?`${M}_present`:`${M}.value !== undefined || ${M}_present`;C.write(`
17
+ const ${M}_present = ${$t};
18
+ if (!${M}.issues.length || ${M}_present) {
19
+ if (${M}.issues.length) {${Y(M,re)}
20
+ }
21
+
22
+ if (${Wc}) {
23
+ newResult[${re}] = ${M}.value;
24
+ }
25
+ }
26
+
27
+ `)}else if(!nr)C.write(`
28
+ const ${M}_present = ${$t};
29
+ if (${M}.issues.length) {${Y(M,re)}
30
+ }
31
+ if (!${M}_present && !${M}.issues.length) {
32
+ payload.issues.push({
33
+ code: "invalid_type",
34
+ expected: "nonoptional",
35
+ input: undefined,
36
+ path: [${re}]
37
+ });
38
+ if (ctx && ctx.abortEarly) {
39
+ payload.value = newResult;
40
+ return payload;
41
+ }
42
+ }
43
+
44
+ if (${M}_present) {
45
+ newResult[${re}] = ${M}.value;
46
+ }
47
+
48
+ `);else if(C.write(`
49
+ if (${M}.issues.length) {${Y(M,re)}
50
+ }
51
+ `),Mt==="defaulted")C.write(`newResult[${re}] = ${M}.value;`);else C.write(`
52
+ if (${M}.value !== undefined || ${$t}) {
53
+ newResult[${re}] = ${M}.value;
54
+ }
55
+ `)}return C.write("payload.value = newResult;"),C.write("return payload;"),C.compile()},i,m=be,f=!G.jitless,_=f&&dr.value,S=t.catchall,A;e._zod.parse=(T,v)=>{A??(A=r.value);let O=T.value;if(!m(O))return T.issues.push({expected:"object",code:"invalid_type",input:O,inst:e}),T;if(f&&_&&v?.async===!1&&v.jitless!==!0){if(!i)i=s(t.shape);if(T=i(T,v),!S)return T;return fs([],O,T,v,A,e,v?.abortEarly===!0)}return n(T,v)}});function bo(e,t,n,r){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!se(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((i)=>ie(i,r,K())))}),t}var ln=E("$ZodUnion",(e,t)=>{U.init(e,t),L(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),L(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),L(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),L(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Ye(s.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1,i=[];for(let m of t.options){let f=m._zod.run({value:r.value,issues:[]},o);if(f instanceof Promise)i.push(f),s=!0;else{if(f.issues.length===0)return f;i.push(f)}}if(!s)return bo(i,r,e,o);return Promise.all(i).then((m)=>bo(m,r,e,o))}});function $u(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var gs=E("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ln.init(e,t);let n=e._zod.parse;L(e,"propValues",(o)=>{let s={},i=0;for(let m of o.def.options){let f=m._zod.propValues;if(!f||Object.keys(f).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(m)}"`);if(f[o.def.discriminator]?.has(void 0))i++;for(let[h,_]of Object.entries(f)){if(!Object.prototype.hasOwnProperty.call(s,h))Q(s,h,new Set);for(let S of _)s[h].add(S)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=Me(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let r=$e(()=>$u(t));e._zod.parse=(o,s)=>{let i=o.value;if(!be(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let m=i?.[t.discriminator],f=r.value.get(m);if(f&&(m!==void 0||s.direction!=="backward"))return f._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return n(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((h)=>r.value.get(h)!==null),input:i,path:[t.discriminator],inst:e}),o}}),_s=E("$ZodIntersection",(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([f,h])=>Io(n,f,h));return Io(n,s,i)}});function an(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ee(e)&&Ee(t)){let n=Object.keys(t),r=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let s of r){if(s==="__proto__")continue;let i=an(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t[r],i=an(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Io(e,t,n){let r=new Map,o,s=new Map,i=(h,_)=>{let S;if(h.code==="unrecognized_keys"&&!h.path?.length)o??(o=h),S=h.keys;else if(h.code==="invalid_key"&&h.origin==="record"&&h.path?.length===1){let A=String(h.path[0]);if(!s.has(A))s.set(A,h);S=[A]}else return!1;for(let A of S){if(!r.has(A))r.set(A,{});r.get(A)[_]=!0}return!0};for(let h of t.issues)if(!i(h,"l"))e.issues.push(h);for(let h of n.issues)if(!i(h,"r"))e.issues.push(h);let m=[...r].filter(([,h])=>h.l&&h.r).map(([h])=>h);if(m.length){let h=o?m.filter((_)=>o.keys.includes(_)):[];if(h.length)e.issues.push({...o,keys:h});for(let _ of m)if(!h.includes(_)&&s.has(_))e.issues.push(s.get(_))}let f=an(t.value,n.value);if(!f.valid){if(se(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`)}return e.value=f.data,e}var ys=E("$ZodRecord",(e,t)=>{U.init(e,t);let n=G.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let s=r.value;if(!Ee(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let i=[],m=t.keyType._zod.values;if(m&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let f=new Set;for(let _ of m)if(typeof _==="string"||typeof _==="number"||typeof _==="symbol"){if(f.add(typeof _==="number"?_.toString():_),_==="__proto__")continue;let S=t.keyType._zod.run({value:_,issues:[]},o);if(S instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(S.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:S.issues.map((v)=>ie(v,o,K())),input:_,path:[_],inst:e});continue}let A=S.value;if(A==="__proto__")continue;let T=t.valueType._zod.run({value:s[_],issues:[]},o);if(T instanceof Promise)i.push(T.then((v)=>{if(v.issues.length)r.issues.push(...fe(_,v.issues));r.value[A]=v.value}));else{if(T.issues.length)r.issues.push(...fe(_,T.issues));r.value[A]=T.value}}let h;for(let _ in s)if(!f.has(_))if(t.mode==="loose"){if(_==="__proto__")continue;r.value[_]=s[_]}else h=h??[],h.push(_);if(h&&h.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:h,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let f;for(let h of Reflect.ownKeys(s)){if(h==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,h))continue;let _=t.keyType._zod.run({value:h,issues:[]},o);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof h==="string"&&Ue.test(h)&&_.issues.length){let v=t.keyType._zod.run({value:Number(h),issues:[]},o);if(v instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(v.issues.length===0)_=v}if(_.issues.length){if(t.mode==="loose")r.value[h]=s[h];else if(m)f=f??[],f.push(h);else r.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((v)=>ie(v,o,K())),input:h,path:[h],inst:e});continue}let A=_.value;if(A==="__proto__")continue;let T=t.valueType._zod.run({value:s[h],issues:[]},o);if(T instanceof Promise)i.push(T.then((v)=>{if(v.issues.length)r.issues.push(...fe(h,v.issues));r.value[A]=v.value}));else{if(T.issues.length)r.issues.push(...fe(h,T.issues));r.value[A]=T.value}}if(f&&f.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:f,continue:!0})}if(i.length)return Promise.all(i).then(()=>r);return r}});var Es=E("$ZodEnum",(e,t)=>{U.init(e,t);let n=Pe(t.entries),r=new Set(n);e._zod.values=r,L(e,"pattern",(o)=>{let s=Pe(o.def.entries).filter((i)=>lr.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>me(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Ss=E("$ZodLiteral",(e,t)=>{U.init(e,t);let n=new Set(t.values);e._zod.values=n,L(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?me(s):s?me(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let s=r.value;if(n.has(s))return r;return r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}});var ws=E("$ZodTransform",(e,t)=>{U.init(e,t),e._zod.optin="optional",G.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ze(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(n.value=i,n));if(o instanceof Promise)throw new ae;return n.value=o,n}});function Ro(e,t){return e.value=t.issues.length?void 0:t.value,e}var pn=E("$ZodOptional",(e,t)=>{U.init(e,t),L(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",L(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),L(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ye(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((s)=>Ro(n,s));return Ro(n,o)}return t.innerType._zod.run(n,r)}}),Ts=E("$ZodExactOptional",(e,t)=>{pn.init(e,t),L(e,"values",(n)=>n.def.innerType._zod.values),L(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),As=E("$ZodNullable",(e,t)=>{U.init(e,t),L(e,"optin",(n)=>n.def.innerType._zod.optin),L(e,"optout",(n)=>n.def.innerType._zod.optout),L(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ye(r.source)}|null)$`):void 0}),L(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),vs=E("$ZodDefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",L(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>xo(s,t));return xo(o,t)}});function xo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var ks=E("$ZodPrefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",L(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),bs=E("$ZodNonOptional",(e,t)=>{U.init(e,t),L(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>Oo(s,e));return Oo(o,e)}});function Oo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function No(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>ie(o,r,K()))},input:e.value}),e}var Is=E("$ZodCatch",(e,t)=>{U.init(e,t),L(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),L(e,"optout",(n)=>n.def.innerType._zod.optout),L(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((s)=>No(n,s,t,r));return No(n,o,t,r)}});var Rs=E("$ZodPipe",(e,t)=>{U.init(e,t),L(e,"values",(n)=>n.def.in._zod.values),L(e,"optin",(n)=>n.def.in._zod.optin),L(e,"optout",(n)=>n.def.out._zod.optout),L(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(n,r);if(s instanceof Promise)return s.then((i)=>lt(i,t.in,r));return lt(s,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>lt(s,t.out,r));return lt(o,t.out,r)}});function lt(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var xs=E("$ZodReadonly",(e,t)=>{U.init(e,t),L(e,"propValues",(n)=>n.def.innerType._zod.propValues),L(e,"values",(n)=>n.def.innerType._zod.values),L(e,"optin",(n)=>n.def.innerType?._zod?.optin),L(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(Co);return Co(o)}});function Co(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Os=E("$ZodCustom",(e,t)=>{B.init(e,t),U.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((s)=>Lo(s,n,r,e));Lo(o,n,r,e);return}});function Lo(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Se(o))}}class Cs extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var fn="~memo",Ns=[];function Ls(e){return e!==null&&typeof e==="object"}function mn(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Ps=new WeakMap,Ze=0,yt=1,Fe=2;function Et(e,t,n){let r=Ps.get(e);if(r!==void 0)return r?Fe:Ze;if(t.has(e))return Fe;t.add(e);let o=Ze,s=(_)=>{if(o!==Fe&&_?._zod){let S=Et(_,t,n);if(S>o)o=S}},i=(_,S)=>{let A=Ze;for(let T of Reflect.ownKeys(_)){let v=Object.getOwnPropertyDescriptor(_,T);if(S&&!v.enumerable)continue;let O=v.get?yt:v.value?._zod?Et(v.value,t,n):Ze;if(O>A)A=O}return A},m=(_)=>{if(_>o)o=_},f=e._zod.def,h=f.type;switch(h){case"object":{let _=Me(f);m(_?i(_,!0):yt),s(f.catchall);break}case"array":s(f.element);break;case"tuple":for(let _ of f.items)s(_);s(f.rest);break;case"record":case"map":s(f.keyType),s(f.valueType);break;case"set":s(f.valueType);break;case"union":for(let _ of f.options)s(_);break;case"intersection":s(f.left),s(f.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(f.innerType);break;case"pipe":s(f.in),s(f.out);break;case"function":s(f.input),s(f.output);break;case"lazy":{let _=f._cachedInner??(n?e._zod.innerType:void 0);m(_?Et(_,t,!1):yt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let _ in f){let S=Object.getOwnPropertyDescriptor(f,_);if(!S||S.get)continue;let A=S.value;if(!A||typeof A!=="object")continue;if(A._zod)s(A);else if(Array.isArray(A))for(let T of A)s(T)}}return t.delete(e),Mu(e,o)}function Mu(e,t){if(t!==yt)Ps.set(e,t===Fe);return t}function zu(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var gt,_t=[],Uu={alloc(e,t,n){let r=gt;if(!r)return n;gt=void 0;let o={value:n,issues:null};return r.set(t.value,o),_t.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,s)=>{if(s.direction!=="backward"&&Wu(s,o.value))throw new Cs;return n(o,s)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,m=(f,h)=>{if(n===void 0){let P=Et(e,new Set,!1);if(P===Ze){if(e._zod.parse=i,e._zod.run===m)e._zod.run=i;return i(f,h)}if(P===Fe||r)n=!0;else r=!0}let _=f.value;if(!Ls(_))return i(f,h);let S=h[fn];if(!S)S={buckets:new WeakMap,backEdges:void 0},h[fn]=S;let A;if(o===h)A=s;else A=zu(S,e),o=h,s=A;let T=A.get(_);if(T){if(f.value=T.value,T.issues){if(T.issues.length)f.issues.push(...mn(T.issues))}else f.memo=!0,S.backEdges??(S.backEdges=new WeakSet),S.backEdges.add(T.value);return f}gt=A;let v=_t.length,O=i(f,h);gt=void 0;let C=_t.length>v?_t.pop():void 0;if(O instanceof Promise)return O.then((P)=>{if(C)C.issues=P.issues.length?mn(P.issues):Ns;return P});if(C)C.issues=O.issues.length?mn(O.issues):Ns;return O};if(e._zod.parse=m,e._zod.run===i)e._zod.run=m})}};function Ds(){return Uu}function Wu(e,t){let n=e[fn]?.backEdges;return n!==void 0&&Ls(t)&&n.has(t)}var Hu=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let n={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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return r[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=o(s.expected),m=gr(s.input),f=o(m,s.input);return`Invalid input: expected ${i}, received ${f}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${jt(s.values[0])}`;return`Invalid option: expected one of ${Zt(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",m=t(s.origin);if(m)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${m.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",m=t(s.origin);if(m)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${m.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${n[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Zt(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((m)=>`'${m}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function hn(){return{localeError:Hu()}}var $s;class Ms{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zu(){return new Ms}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=Zu());var we=globalThis.__zod_globalRegistry;function zs(e){if(e.checks)e.checks=[...e.checks];return e}function Us(e,t){return new e(zs({type:"string",...I(t)}))}function Ws(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function Hs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Zs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Bs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function js(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function Js(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Gs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function qs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Vs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Ks(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Xs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Ys(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Qs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function ei(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function ti(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function ni(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function ri(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function si(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function ii(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function ai(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function ci(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function ui(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function di(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function li(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function pi(e,t){return new e(zs({type:"number",checks:[],...I(t)}))}function mi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function fi(e,t){return new e({type:"boolean",...I(t)})}function hi(e){return new e({type:"unknown"})}function gi(e,t){return new e({type:"never",...I(t)})}function St(e,t){return new rn({check:"less_than",...I(t),value:e,inclusive:!1})}function Be(e,t){return new rn({check:"less_than",...I(t),value:e,inclusive:!0})}function wt(e,t){return new on({check:"greater_than",...I(t),value:e,inclusive:!1})}function je(e,t){return new on({check:"greater_than",...I(t),value:e,inclusive:!0})}function Tt(e,t){return new uo({check:"multiple_of",...I(t),value:e})}function At(e,t){return new po({check:"max_length",...I(t),maximum:e})}function Ie(e,t){return new mo({check:"min_length",...I(t),minimum:e})}function vt(e,t){return new fo({check:"length_equals",...I(t),length:e})}function gn(e,t){return new ho({check:"string_format",format:"regex",...I(t),pattern:e})}function _n(e){return new go({check:"string_format",format:"lowercase",...I(e)})}function yn(e){return new _o({check:"string_format",format:"uppercase",...I(e)})}function En(e,t){return new yo({check:"string_format",format:"includes",...I(t),includes:e})}function Sn(e,t){return new Eo({check:"string_format",format:"starts_with",...I(t),prefix:e})}function wn(e,t){return new So({check:"string_format",format:"ends_with",...I(t),suffix:e})}function he(e){return new wo({check:"overwrite",tx:e})}function Tn(e){return he((t)=>t.normalize(e))}function An(){return he((e)=>e.trim())}function vn(){return he((e)=>e.toLowerCase())}function kn(){return he((e)=>e.toUpperCase())}function bn(){return he((e)=>ur(e))}function _i(e,t,n){return new e({type:"array",element:t,...I(n)})}function yi(e,t,n){return new e({type:"custom",check:"custom",fn:t,...I(n)})}function Ei(e,t){let n=Fu((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Se(o,r.value,n._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Se(s))}},e(r.value,r)),t);return n}function Fu(e,t){let n=new B({check:"custom",...I(t)});return n._zod.check=e,n}function Je(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))Q(e,r,n[r]);return e}function Rn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??we,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function de(e,t,n,r,o){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(o);return Object.assign(n,s),!0}function Z(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let m=e._zod.toJSONSchema?.();if(m)i.schema=m;else{let _={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,_);else{let A=i.schema,T=t.processors[o.type];if(!T)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);T(e,t,A,_)}let S=e._zod.parent;if(S){if(!i.ref)i.ref=S;Z(S,t,_),t.seen.get(S).isParent=!0}}let f=t.metadataRegistry.get(e);if(f)Je(i.schema,f);if(t.io==="input"&&J(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(r=i.schema).default??(r.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Si(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function xn(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let i of e.seen.entries()){let m=e.metadataRegistry.get(i[0])?.id;if(m){let f=r.get(m);if(f&&f!==i[0])throw Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,i[0])}}let o=(i)=>{let m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let S=e.external.registry.get(i[0])?.id,A=e.external.uri??((v)=>v);if(S)return{ref:A(S)};let T=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=T,{defId:T,ref:`${A("__shared")}#/${m}/${Si(T)}`}}let f="#",h=`${f}/${m}/`;if(i[1]===n&&!i[1].schema.id)return{ref:f};let _=i[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:h+Si(_)}},s=(i)=>{if(i[1].schema.$ref)return;let m=i[1],{ref:f,defId:h}=o(i);if(m.def={...m.schema},h)m.defId=h;let _=m.schema;for(let S in _)delete _[S];_.$ref=f};if(e.cycles==="throw")for(let i of e.seen.entries()){let m=i[1];if(m.cycle)throw Error(`Cycle detected: #/${m.cycle?.join("/")}/<root>
56
+
57
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let m=i[1];if(t===i[0]){s(i);continue}if(e.external){let h=e.external.registry.get(i[0])?.id;if(t!==i[0]&&h){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(m.cycle){s(i);continue}if(m.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Ai(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;Ai(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let s=r.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!n.includes(i))n.push(i)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var vi=new Set(["type","properties","required","additionalProperties"]),wi=["oneOf","anyOf"];function Ti(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function In(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!vi.has(i))return null;t.push(s)}let n={},r=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(n,i))continue;let m=[];for(let h of t){let _=h.properties?.[i]??Ti(h);if(_===null||_===void 0)continue;if(!m.some((S)=>JSON.stringify(S)===JSON.stringify(_)))m.push(_)}let f=m.length===1?m[0]:In(m)??{allOf:m};Q(n,i,f)}for(let i of s.required??[])r.add(i)}let o={type:"object",properties:n};if(r.size)o.required=[...r];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let m=Ti(i);if(m&&!s.some((f)=>JSON.stringify(f)===JSON.stringify(m)))s.push(m)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function Bu(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of vi)if(o in e)return;let n=t.filter((o)=>wi.some((s)=>Array.isArray(o[s]))),r=null;if(!n.length)r=In(t);else{let o=n[0],s=wi.find((f)=>Array.isArray(o[f]));if(Object.keys(o).length!==1)return;let i=t.filter((f)=>f!==o),m=o[s].map((f)=>In([...i,f]));if(m.some((f)=>!f))return;r={[s]:m}}if(!r)return;delete e.allOf,Je(e,r)}function On(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(m)=>{let f=e.seen.get(m);if(f.ref===null)return;let h=f.def??f.schema,_={...h},S=f.ref;if(f.ref=null,S){r(S);let T=e.seen.get(S),v=T.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))h.allOf=h.allOf??[],h.allOf.push(v);else Je(h,v);if(Je(h,_),m._zod.parent===S)for(let C in h){if(C==="$ref"||C==="allOf")continue;if(!(C in _))delete h[C]}if(v.$ref&&T.def)for(let C in h){if(C==="$ref"||C==="allOf")continue;if(C in T.def&&JSON.stringify(h[C])===JSON.stringify(T.def[C]))delete h[C]}}let A=m._zod.parent;if(A&&A!==S){r(A);let T=e.seen.get(A);if(T?.schema.$ref){if(h.$ref=T.schema.$ref,T.def)for(let v in h){if(v==="$ref"||v==="allOf")continue;if(v in T.def&&JSON.stringify(h[v])===JSON.stringify(T.def[v]))delete h[v]}}}e.override({zodSchema:m,jsonSchema:h,path:f.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let m of[...e.seen.entries()].reverse())r(m[0]);if(e.target!=="openapi-3.0")for(let m of e.seen.entries())Ai(m[1].def??m[1].schema);for(let m of e.deferred)m();if(e.intersections.length){let m=new Map;for(let f of e.seen.values())for(let h of[f.schema,f.def]){let _=h?.allOf;if(!Array.isArray(_))continue;let S=m.get(_);if(S)S.push(h);else m.set(_,[h])}for(let f of e.intersections)for(let h of m.get(f)??[])Bu(h)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let m=e.external.registry.get(t)?.id;if(!m)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(m)}Je(o,n.defId?n.schema:n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let m of e.seen.entries()){let f=m[1];if(f.def&&f.defId){if(f.def.id===f.defId)delete f.def.id;Q(i,f.defId,f.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let m=JSON.parse(JSON.stringify(o));return Object.defineProperty(m,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ge(t,"input",e.processors),output:Ge(t,"output",e.processors)}},enumerable:!1,writable:!1}),m}catch(m){throw Error("Error converting schema to JSON.")}}function J(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return J(r.element,n);if(r.type==="set")return J(r.valueType,n);if(r.type==="lazy")return J(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return J(r.innerType,n);if(r.type==="intersection")return J(r.left,n)||J(r.right,n);if(r.type==="record"||r.type==="map")return J(r.keyType,n)||J(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return J(r.in,n)||J(r.out,n)}if(r.type==="object"){for(let o in r.shape)if(J(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(J(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(J(o,n))return!0;if(r.rest&&J(r.rest,n))return!0;return!1}return!1}var ki=(e,t={})=>(n)=>{let r=Rn({...n,processors:t});return Z(e,r),xn(r,e),On(r,e)},Ge=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:s}=r??{},i=Rn({...o??{},target:s,io:t,processors:n});return Z(e,i),xn(i,e),On(i,e)};var Re=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},xe=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},bi=(e,t)=>{Re(e,"minimum",t),xe(e,"maximum",t)},Oi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Ni=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Ci=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Li=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ii=(e,t)=>Re(e,"minimum",t.minimum),Ri=(e,t)=>xe(e,"maximum",t.maximum),xi=(e)=>(t,n)=>{Li(t,n.format);let[r,o]=e[n.format];Re(t,"minimum",r),xe(t,"maximum",o)},ju={greater_than:(e,t)=>Re(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Oi(e,t.value),number_format:xi(Qe),bigint_format:xi(Jt),min_length:Ii,max_length:Ri,length_equals:(e,t)=>bi(e,t.length),min_size:Ii,max_size:Ri,size_equals:(e,t)=>bi(e,t.size),string_format:(e,t)=>{if(Li(e,t.format),t.pattern)Ni(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Ci(e,t.mime)};function ee(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let s of r)ju[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Re(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Re(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)xe(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)xe(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Oi(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Ci(t,o.mime);for(let s of o.patterns??[])Ni(t,s);return t}var Ju={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gu=new Map([[un,Xr],[ht,Yr]]),Pi=(e)=>Gu.get(e)??e,Di=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:s,maximum:i,format:m,patterns:f,contentEncoding:h,laxFormat:_}=ee(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(m){if(o.format=Ju[m]??m,o.format==="")delete o.format;if(m==="time"||_)delete o.format}if(h)o.contentEncoding=h;if(f&&f.size>0){let S=[...f].map(Pi);if(S.length===1)o.pattern=S[0].source;else if(S.length>1)o.allOf=[...S.map((A)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:A.source}))]}},$i=(e,t,n,r)=>{let o=n,{minimum:s,maximum:i,multipleOf:m,exclusiveMaximum:f,exclusiveMinimum:h,isInt:_}=ee(e);o.type=_?"integer":"number";let S=typeof h==="number"&&h>=(s??Number.NEGATIVE_INFINITY),A=typeof f==="number"&&f<=(i??Number.POSITIVE_INFINITY),T=t.target==="draft-04"||t.target==="openapi-3.0";if(S)if(T)o.minimum=h,o.exclusiveMinimum=!0;else o.exclusiveMinimum=h;else if(typeof s==="number")o.minimum=s;if(A)if(T)o.maximum=f,o.exclusiveMaximum=!0;else o.exclusiveMaximum=f;else if(typeof i==="number")o.maximum=i;if(m){let v=new Set;for(let P of m)if(Number.isFinite(P)&&P!==0)v.add(Math.abs(P));else de(e,t,o,r,`A multipleOf divisor of ${P} cannot be represented in JSON Schema`);let[O,...C]=v;if(O!==void 0)o.multipleOf=O;if(C.length)o.allOf=[...o.allOf??[],...C.map((P)=>({multipleOf:P}))]}},Mi=(e,t,n,r)=>{n.type="boolean"};var zi=(e,t,n,r)=>{n.not={}};var Ui=(e,t,n,r)=>{};var Wi=(e,t,n,r)=>{let o=e._zod.def,s=Pe(o.entries);if(s.length===0){n.not={};return}if(s.every((i)=>typeof i==="number"))n.type="number";if(s.every((i)=>typeof i==="string"))n.type="string";n.enum=s},Hi=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(de(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(de(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[i];else n.const=i}else{if(s.every((i)=>typeof i==="number"))n.type="number";if(s.every((i)=>typeof i==="string"))n.type="string";if(s.every((i)=>typeof i==="boolean"))n.type="boolean";if(s.every((i)=>i===null))n.type="null";n.enum=s}};var Zi=(e,t,n,r)=>{de(e,t,n,r,"Custom types cannot be represented in JSON Schema")};var Fi=(e,t,n,r)=>{de(e,t,n,r,"Transforms cannot be represented in JSON Schema")};var Bi=(e,t,n,r)=>{let o=n,s=e._zod.def,{minimum:i,maximum:m}=ee(e);if(typeof i==="number")o.minItems=i;if(typeof m==="number")o.maxItems=m;o.type="array",o.items=Z(s.element,t,{...r,path:[...r.path,"items"]})};function kt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return kt(t.out);if(t.type==="catch")return kt(t.innerType);return e._zod.optin}var ji=(e,t,n,r)=>{let o=n,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&de(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let h in i)Q(o.properties,h,Z(i[h],t,{...r,path:[...r.path,"properties",h]}));let f=[];for(let h of Object.keys(i)){let _=s.shape[h];if(t.io==="input"?kt(_)===void 0:_._zod.optout===void 0)f.push(h)}if(f.length>0)o.required=f;if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=Z(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},Ji=(e,t,n,r)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((m,f)=>Z(m,t,{...r,path:[...r.path,s?"oneOf":"anyOf",f]}));if(s)n.oneOf=i;else n.anyOf=i},Gi=(e,t,n,r)=>{let o=e._zod.def,s=Z(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Z(o.right,t,{...r,path:[...r.path,"allOf",1]}),m=(h)=>("allOf"in h)&&Object.keys(h).length===1,f=[...m(s)?s.allOf:[s],...m(i)?i.allOf:[i]];n.allOf=f,t.intersections.push(f)};function Nn(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let v=e.get(t)?.def;if(!v)return t;let O=Nn(e,v,n);return O===v?t:O}for(let v of["anyOf","oneOf"]){let O=t[v];if(!Array.isArray(O))continue;let C=O.map((P)=>Nn(e,P,n));if(C.some((P,Y)=>P!==O[Y]))t={...t,[v]:C}}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some((v)=>v==="number"||v==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((v)=>typeof v==="number"))return t;let{minimum:i,maximum:m,exclusiveMinimum:f,exclusiveMaximum:h,multipleOf:_,format:S,id:A,...T}=t;if(T.enum)T.enum=T.enum.map((v)=>typeof v==="number"?String(v):v);else if(typeof T.const==="number")T.const=String(T.const);if(!o)return T;if(T.type="string",!s)T.pattern=(r.includes("number")?Ue:tn).source;return T}var Cn=new WeakMap;function qu(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of Cn.get(e)??[]){let o=e.seen.get(r),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;let i=Nn(t,s,new Set);if(i!==s)n.set(s,i)}if(!n.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let s=o&&n.get(o.propertyNames);if(s)o.propertyNames=s}}var qi=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="object";let i=s.keyType,m=ee(i).patterns;if(s.mode==="loose"&&m&&m.size>0){let _=Z(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let S of m)Q(o.patternProperties,Pi(S).source,_)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Z(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let _=Cn.get(t);if(!_)_=[],Cn.set(t,_),t.deferred.push(()=>qu(t));_.push(e)}o.additionalProperties=Z(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let f=i._zod.values,h=t.io==="input"&&kt(s.valueType)!==void 0;if(f&&!s.partial&&!h){let _=[...f].filter((S)=>typeof S==="string"||typeof S==="number");if(_.length>0)o.required=_.map(String)}},Vi=(e,t,n,r)=>{let o=e._zod.def,s=Z(o.innerType,t,r),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},Ki=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},Ln=Symbol();function Xi(e,t,n,r,o){let s=!1,i=JSON.stringify(e,(m,f)=>{if(typeof f!=="bigint")return f;return s=!0,null});if(!s)return JSON.parse(i);return de(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),Ln}var Yi=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType;let i=Xi(o.defaultValue,e,t,n,r);if(i!==Ln)n.default=i},Qi=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Xi(o.defaultValue,e,t,n,r);if(i!==Ln)n._prefault=i},ea=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{de(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i},ta=(e,t,n,r)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;Z(i,t,r);let m=t.seen.get(e);m.ref=i},na=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0};var Pn=(e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType};var ra=new WeakSet([Object.prototype,Error.prototype]);function bt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var nd=(e,t)=>{vr.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(ra.has(n))return;ra.add(n),bt(n,"format",(r)=>(o)=>br(r,o)),bt(n,"flatten",(r)=>(o)=>kr(r,o)),bt(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,De,2)}),bt(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,De,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var X=E("ZodError",nd,void 0,{Parent:Error});var oa=it(X),sa=at(X),ia=ct(X),aa=ut(X),ca=Rr(X),ua=xr(X),da=Or(X),la=Nr(X),pa=Cr(X),ma=Lr(X),fa=Pr(X),ha=Dr(X);function od(){if(!G.localeError)K(hn())}function Rt(){if(!G.memoizer)K({memoizer:Ds()})}var W=E("ZodType",(e,t)=>(od(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(V(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return oe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(el(e,t))},superRefine(e,t){return this.check(tl(e,t))},overwrite(e){return this.check(he(e))},optional(){return ya(this)},exactOptional(){return Hd(this)},nullable(){return Ea(this)},nullish(){return ya(Ea(this))},nonoptional(e){return Gd(this,e)},array(){return ne(this)},or(e){return Te([this,e])},and(e){return Md(this,e)},transform(e){return Sa(this,Wd(e))},default(e){return Bd(this,e)},prefault(e){return Jd(this,e)},catch(e){return Vd(this,e)},pipe(e){return Sa(this,e)},readonly(){return Yd(this)},describe(e){let t=this.clone();return we.add(t,{description:e}),t},meta(...e){if(e.length===0)return we.get(this);let t=this.clone();return we.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ot(this,"~standard",{...cn(this),jsonSchema:{input:Ge(this,"input"),output:Ge(this,"output")}})},set "~standard"(e){ue(this,"~standard",e)},parse:function e(t,n){return oa(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await sa(this,t,n,{callee:e})},safeParse(e,t){return ia(this,e,t)},async safeParseAsync(e,t){return aa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ue(this,"spa",e)},validate(e,t){return Xt(this,e,t)},validateAsync(e,t){return Yt(this,e,t)},encode:function e(t,n){return ca(this,t,n,{callee:e})},decode:function e(t,n){return ua(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await da(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await la(this,t,n,{callee:e})},safeEncode(e,t){return pa(this,e,t)},safeDecode(e,t){return ma(this,e,t)},async safeEncodeAsync(e,t){return fa(this,e,t)},async safeDecodeAsync(e,t){return ha(this,e,t)},toJSONSchema(e){return ki(this,{})(e)},get description(){return we.get(this)?.description},get _def(){return this._zod.def}}),wa=E("_ZodString",(e,t)=>{ft.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Di(e,n,r,o)},yr({format:(e)=>ee(e).format??null,minLength:(e)=>ee(e).minimum??null,maxLength:(e)=>ee(e).maximum??null},{regex(...e){return this.check(gn(...e))},includes(...e){return this.check(En(...e))},startsWith(...e){return this.check(Sn(...e))},endsWith(...e){return this.check(wn(...e))},min(...e){return this.check(Ie(...e))},max(...e){return this.check(At(...e))},length(...e){return this.check(vt(...e))},nonempty(...e){return this.check(Ie(1,...e))},lowercase(e){return this.check(_n(e))},uppercase(e){return this.check(yn(e))},trim(){return this.check(An())},normalize(...e){return this.check(Tn(...e))},toLowerCase(){return this.check(vn())},toUpperCase(){return this.check(kn())},slugify(){return this.check(bn())}})),sd=E("ZodString",(e,t)=>{ft.init(e,t),wa.init(e,t)},{email(e){return this.check(Ws(dd,e))},url(e){return this.check(Js(pd,e))},jwt(e){return this.check(ai(Id,e))},emoji(e){return this.check(Gs(md,e))},guid(e){return this.check(Hs(ld,e))},uuid(e){return this.check(Zs(It,e))},uuidv4(e){return this.check(Fs(It,e))},uuidv6(e){return this.check(Bs(It,e))},uuidv7(e){return this.check(js(It,e))},nanoid(e){return this.check(qs(fd,e))},cuid(e){return this.check(Vs(hd,e))},cuid2(e){return this.check(Ks(gd,e))},ulid(e){return this.check(Xs(_d,e))},base64(e){return this.check(oi(vd,e))},base64url(e){return this.check(si(kd,e))},xid(e){return this.check(Ys(yd,e))},ksuid(e){return this.check(Qs(Ed,e))},ipv4(e){return this.check(ei(Sd,e))},ipv6(e){return this.check(ti(wd,e))},cidrv4(e){return this.check(ni(Td,e))},cidrv6(e){return this.check(ri(Ad,e))},e164(e){return this.check(ii(bd,e))},datetime(e){return this.check(ci(id,e))},date(e){return this.check(ui(ad,e))},time(e){return this.check(di(cd,e))},duration(e){return this.check(li(ud,e))}});function w(e){return Us(sd,e)}var H=E("ZodStringFormat",(e,t)=>{z.init(e,t),wa.init(e,t)}),id=E("ZodISODateTime",(e,t)=>{qo.init(e,t),H.init(e,t)}),ad=E("ZodISODate",(e,t)=>{Vo.init(e,t),H.init(e,t)}),cd=E("ZodISOTime",(e,t)=>{Ko.init(e,t),H.init(e,t)}),ud=E("ZodISODuration",(e,t)=>{Xo.init(e,t),H.init(e,t)}),dd=E("ZodEmail",(e,t)=>{Mo.init(e,t),H.init(e,t)});var ld=E("ZodGUID",(e,t)=>{Do.init(e,t),H.init(e,t)});var It=E("ZodUUID",(e,t)=>{$o.init(e,t),H.init(e,t)});var pd=E("ZodURL",(e,t)=>{Wo.init(e,t),H.init(e,t)});var md=E("ZodEmoji",(e,t)=>{Ho.init(e,t),H.init(e,t)});var fd=E("ZodNanoID",(e,t)=>{Zo.init(e,t),H.init(e,t)});var hd=E("ZodCUID",(e,t)=>{Fo.init(e,t),H.init(e,t)});var gd=E("ZodCUID2",(e,t)=>{Bo.init(e,t),H.init(e,t)});var _d=E("ZodULID",(e,t)=>{jo.init(e,t),H.init(e,t)});var yd=E("ZodXID",(e,t)=>{Jo.init(e,t),H.init(e,t)});var Ed=E("ZodKSUID",(e,t)=>{Go.init(e,t),H.init(e,t)});var Sd=E("ZodIPv4",(e,t)=>{Yo.init(e,t),H.init(e,t)});var wd=E("ZodIPv6",(e,t)=>{es.init(e,t),H.init(e,t)});var Td=E("ZodCIDRv4",(e,t)=>{ts.init(e,t),H.init(e,t)});var Ad=E("ZodCIDRv6",(e,t)=>{ns.init(e,t),H.init(e,t)});var vd=E("ZodBase64",(e,t)=>{os.init(e,t),H.init(e,t)});var kd=E("ZodBase64URL",(e,t)=>{ss.init(e,t),H.init(e,t)});var bd=E("ZodE164",(e,t)=>{is.init(e,t),H.init(e,t)});var Id=E("ZodJWT",(e,t)=>{as.init(e,t),H.init(e,t)});var Ta=E("ZodNumber",(e,t)=>{dn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$i(e,n,r,o),e.isFinite=!0},yr({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=ee(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=ee(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=ee(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>ee(e).format??null},{gt(e,t){return this.check(wt(e,t))},gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},lt(e,t){return this.check(St(e,t))},lte(e,t){return this.check(Be(e,t))},max(e,t){return this.check(Be(e,t))},int(e){return this.check(ga(e))},safe(e){return this.check(ga(e))},positive(e){return this.check(wt(0,e))},nonnegative(e){return this.check(je(0,e))},negative(e){return this.check(St(0,e))},nonpositive(e){return this.check(Be(0,e))},multipleOf(e,t){return this.check(Tt(e,t))},step(e,t){return this.check(Tt(e,t))},finite(){return this}}));function le(e){return pi(Ta,e)}var Rd=E("ZodNumberFormat",(e,t)=>{cs.init(e,t),Ta.init(e,t)});function ga(e){return mi(Rd,e)}var xd=E("ZodBoolean",(e,t)=>{us.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mi(e,n,r,o)});function qe(e){return fi(xd,e)}var Od=E("ZodUnknown",(e,t)=>{ds.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ui(e,n,r,o)});function ge(){return hi(Od)}var Nd=E("ZodNever",(e,t)=>{ls.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zi(e,n,r,o)});function Cd(e){return gi(Nd,e)}var Ld=E("ZodArray",(e,t)=>{Rt(),ps.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bi(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Ie(e,t))},nonempty(e){return this.check(Ie(1,e))},max(e,t){return this.check(At(e,t))},length(e,t){return this.check(vt(e,t))},unwrap(){return this.element}});function ne(e,t){return _i(Ld,e,t)}var Pd=E("ZodObject",(e,t)=>{Rt(),hs.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ji(e,n,r,o),du(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(V(this._zod.def,{catchall:e}))},passthrough(){return this.clone(V(this._zod.def,{catchall:ge()}))},loose(){return this.clone(V(this._zod.def,{catchall:ge()}))},strict(){return this.clone(V(this._zod.def,{catchall:Cd()}))},strip(){return this.clone(V(this._zod.def,{catchall:void 0}))},extend(e){return nu(this,e)},safeExtend(e){return ru(this,e)},merge(e){return ou(this,e)},pick(e){return eu(this,e)},omit(e){return tu(this,e)},partial(...e){return fr(ba,this,e[0])},exactPartial(...e){return fr(Ia,this,e[0],"exactPartial")},required(...e){return su(Ra,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},...I(t)};return new Pd(n)}var Aa=E("ZodUnion",(e,t)=>{ln.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ji(e,n,r,o),e.options=t.options});function Te(e,t){return new Aa({type:"union",options:e,...I(t)})}var Dd=E("ZodDiscriminatedUnion",(e,t)=>{Aa.init(e,t),gs.init(e,t)});function va(e,t,n){return new Dd({type:"union",options:t,discriminator:e,...I(n)})}var $d=E("ZodIntersection",(e,t)=>{_s.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gi(e,n,r,o)});function Md(e,t){return new $d({type:"intersection",left:e,right:t})}var _a=E("ZodRecord",(e,t)=>{Rt(),ys.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qi(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function ka(e,t,n){if(!t||!t._zod)return new _a({type:"record",keyType:w(),valueType:e,...I(t)});return new _a({type:"record",keyType:e,valueType:t,...I(n)})}var $n=E("ZodEnum",(e,t)=>{Es.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Wi(e,r,o,s),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let s={};for(let i of r)if(n.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new $n({...t,checks:[],...I(o),entries:s})},e.exclude=(r,o)=>{let s={...t.entries};for(let i of r)if(n.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new $n({...t,checks:[],...I(o),entries:s})}});function q(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new $n({type:"enum",entries:n,...I(t)})}var zd=E("ZodLiteral",(e,t)=>{Ss.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hi(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function D(e,t){return new zd({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}var Ud=E("ZodTransform",(e,t)=>{Rt(),ws.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fi(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ze(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(Se(s,n.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=e),n.issues.push(Se(i))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((s)=>(n.value=s,n));return n.value=o,n}});function Wd(e){return new Ud({type:"transform",transform:e})}var ba=E("ZodOptional",(e,t)=>{pn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ya(e){return new ba({type:"optional",innerType:e})}var Ia=E("ZodExactOptional",(e,t)=>{Ts.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Hd(e){return new Ia({type:"optional",innerType:e})}var Zd=E("ZodNullable",(e,t)=>{As.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vi(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ea(e){return new Zd({type:"nullable",innerType:e})}var Fd=E("ZodDefault",(e,t)=>{vs.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yi(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Bd(e,t){return new Fd({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bt(t)}})}var jd=E("ZodPrefault",(e,t)=>{ks.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qi(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Jd(e,t){return new jd({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bt(t)}})}var Ra=E("ZodNonOptional",(e,t)=>{bs.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ki(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gd(e,t){return new Ra({type:"nonoptional",innerType:e,...I(t)})}var qd=E("ZodCatch",(e,t)=>{Is.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ea(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vd(e,t){return new qd({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Er(t)})}var Kd=E("ZodPipe",(e,t)=>{Rs.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ta(e,n,r,o),e.in=t.in,e.out=t.out});function Sa(e,t){return new Kd({type:"pipe",in:e,out:t})}var Xd=E("ZodReadonly",(e,t)=>{xs.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>na(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yd(e){return new Xd({type:"readonly",innerType:e})}var Qd=E("ZodCustom",(e,t)=>{Os.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zi(e,n,r,o)});function el(e,t={}){return yi(Qd,e,t)}function tl(e,t){return Ei(e,t)}var Oa=60000,nl={JOIN_LINK_INVALID:410,JOIN_LINK_NOT_FOUND:404,ROLE_NOT_ALLOWED:400,NOT_A_MEMBER:403,PEOPLE_LIMIT:409,AGENTS_LIMIT:409,FORBIDDEN:403,HOST_REGISTRATION_CANCELLED:410,HOST_REGISTRATION_CONFLICT:409,AGENT_HOST_CONFLICT:409,HOST_REGISTRATION_MISSING:409,HOST_REGISTRATION_UNSETTLED:503,INVALID_REQUEST:400,BAD_ORIGIN:403,UNAUTHENTICATED:401,WORKSPACE_NOT_FOUND:404},rl={HOST_REGISTRATION_CONFLICT:"this code was redeemed by a different host registration; a computer that already has a host in this workspace joins with the claim it already holds, or the owner mints a new code",AGENT_HOST_CONFLICT:"an agent in this code already rides another active host; revoke that host, then mint a new code",HOST_REGISTRATION_CANCELLED:"the owner cancelled this registration; mint a new code",HOST_REGISTRATION_MISSING:"this workspace no longer holds the pending registration; mint a new code",HOST_REGISTRATION_UNSETTLED:`this workspace has not answered the registration within ${Oa/1000} seconds; the code is unspent, so run the same command again in a minute, or mint a new code`};function g(e){return typeof e==="string"&&Object.hasOwn(nl,e)}var Oe=w().min(1).max(256),xt=w().regex(/^sha256:[a-f0-9]{64}$/u),Ot=w().min(1).max(64),ol=w().trim().min(1).max(64).regex(/^[^\u0000-\u001f\u007f]+$/u,"a name carries no control characters");var sl=ol,Na=sl,Ve=["codex","gemini","copilot","opencode","kilo","goose","pi","dsh","copapo","devin","cursor","amp","qwen","cline","omp"],Ke={codex:"Codex",gemini:"Gemini",copilot:"Copilot",opencode:"OpenCode",kilo:"Kilo",goose:"Goose",pi:"Pi",dsh:"dsh",copapo:"copapo",devin:"Devin",cursor:"Cursor",amp:"Amp",qwen:"Qwen Code",cline:"Cline",omp:"omp"},k=(e)=>typeof e==="string"&&Object.hasOwn(Ke,e),il=q(Ve),al=b({code:w(),credentialHash:xt,pluginVersion:Ot,ahpdVersion:Ot,name:Na.optional(),app:il.optional(),hostId:w().min(1).max(128).optional()}).strict(),xa=b({workspaceId:Oe,hostId:Oe,ownerAccountId:Oe,credentialHash:xt,agentMemberIds:ne(Oe),pluginVersion:Ot,ahpdVersion:Ot,registrationFingerprint:xt,name:Na.optional()}).strict(),Ca=b({workspaceId:Oe,hostId:Oe,registrationFingerprint:xt,state:q(["registered","cancelled"])}).strict(),cl=Te([b({ok:D(!0),value:Ca}).strict(),b({ok:D(!1),code:q(["HOST_REGISTRATION_CONFLICT","AGENT_HOST_CONFLICT","HOST_REGISTRATION_MISSING"]),message:w()}).strict()]),ph=Te([b({kind:D("register"),command:xa}).strict(),b({kind:D("cancel"),cancellation:Te([b({kind:D("pending"),command:xa}).strict(),b({kind:D("registered"),receipt:Ca}).strict()])}).strict()]);var ul="0123456789ABCDEFGHJKMNPQRSTVWXYZ",dl=12;var ll=/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/u,pl=/^[0-9A-F]{4}$/u,ml=/^(?=.{1,64}$)[A-Za-z0-9][A-Za-z0-9._-]*(?: [A-Za-z0-9._-]+)*$/u,wh=b({browser:w().trim().regex(ml),publicKey:w().regex(ll),personName:w().trim().min(1).max(120).nullable(),check:w().regex(pl)});function fl(e,t){let n=e.toUpperCase().replace(/[\s-]/g,"").replace(/O/g,"0").replace(/[IL]/g,"1");if(n.length!==t)return null;for(let r of n)if(!ul.includes(r))return null;return n}function c(e){return fl(e,dl)}var $a="ht_session",Ma="ht_auth_state";var wl=`${Ma}=; Path=/auth; HttpOnly; Secure; SameSite=Lax; Max-Age=0`,Tl=`${$a}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`;var Wa;(function(e){e.Snapshot="snapshot",e.Replay="replay",e.Live="live"})(Wa||(Wa={}));var Ha;(function(e){e.Enabled="enabled",e.Disabled="disabled",e.Unconfigured="unconfigured"})(Ha||(Ha={}));var Mn;(function(e){e.Creating="creating",e.Ready="ready",e.Failed="failed"})(Mn||(Mn={}));var Nt;(function(e){e[e.Idle=1]="Idle",e[e.Error=2]="Error",e[e.InProgress=8]="InProgress",e[e.InputNeeded=24]="InputNeeded",e[e.IsRead=32]="IsRead",e[e.IsArchived=64]="IsArchived"})(Nt||(Nt={}));var Za;(function(e){e.Automation="automation"})(Za||(Za={}));var zn;(function(e){e.ChatInput="chatInput",e.ToolConfirmation="toolConfirmation",e.ToolClientExecution="toolClientExecution",e.ToolAuthentication="toolAuthentication"})(zn||(zn={}));var Un;(function(e){e.Plugin="plugin",e.Directory="directory",e.Agent="agent",e.Skill="skill",e.Prompt="prompt",e.Rule="rule",e.Hook="hook",e.McpServer="mcpServer"})(Un||(Un={}));var Fa;(function(e){e.Global="global",e.Workspace="workspace",e.Session="session"})(Fa||(Fa={}));var Ba;(function(e){e.Loading="loading",e.Loaded="loaded",e.Degraded="degraded",e.Error="error"})(Ba||(Ba={}));var Wn;(function(e){e.Starting="starting",e.Ready="ready",e.AuthRequired="authRequired",e.Error="error",e.Stopped="stopped"})(Wn||(Wn={}));var ja;(function(e){e.Required="required",e.Expired="expired",e.InsufficientScope="insufficientScope"})(ja||(ja={}));var Ja;(function(e){e.Shell="shell",e.Subagent="subagent"})(Ja||(Ja={}));var Ga;(function(e){e.User="user",e.Fork="fork",e.SideChat="sideChat",e.Tool="tool"})(Ga||(Ga={}));var qa;(function(e){e.Full="full",e.ReadOnly="read-only",e.Hidden="hidden"})(qa||(qa={}));var Hn;(function(e){e.Steering="steering",e.Queued="queued"})(Hn||(Hn={}));var Va;(function(e){e.Accept="accept",e.Decline="decline",e.Cancel="cancel"})(Va||(Va={}));var Ka;(function(e){e.Text="text",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.SingleSelect="single-select",e.MultiSelect="multi-select"})(Ka||(Ka={}));var Xa;(function(e){e.Text="text",e.Number="number",e.Boolean="boolean",e.Selected="selected",e.SelectedMany="selected-many"})(Xa||(Xa={}));var Ya;(function(e){e.Draft="draft",e.Submitted="submitted",e.Skipped="skipped"})(Ya||(Ya={}));var Zn;(function(e){e.Complete="complete",e.Cancelled="cancelled",e.Error="error"})(Zn||(Zn={}));var Qa;(function(e){e.Simple="simple",e.EmbeddedResource="embeddedResource",e.Resource="resource",e.Annotations="annotations",e.Chat="chat"})(Qa||(Qa={}));var ec;(function(e){e.User="user",e.Agent="agent",e.Tool="tool",e.Automation="automation",e.SystemNotification="systemNotification"})(ec||(ec={}));var Fn;(function(e){e.Markdown="markdown",e.ContentRef="contentRef",e.ToolCall="toolCall",e.Reasoning="reasoning",e.SystemNotification="systemNotification",e.InputRequest="inputRequest",e.Error="error"})(Fn||(Fn={}));var Bn;(function(e){e.Streaming="streaming",e.PendingConfirmation="pending-confirmation",e.Running="running",e.AuthRequired="auth-required",e.PendingResultConfirmation="pending-result-confirmation",e.Completed="completed",e.Cancelled="cancelled"})(Bn||(Bn={}));var jn;(function(e){e.NotNeeded="not-needed",e.UserAction="user-action",e.Setting="setting"})(jn||(jn={}));var tc;(function(e){e.Judge="judge"})(tc||(tc={}));var nc;(function(e){e.Loading="loading",e.Complete="complete"})(nc||(nc={}));var Jn;(function(e){e.Denied="denied",e.Skipped="skipped",e.ResultDenied="result-denied"})(Jn||(Jn={}));var rc;(function(e){e.Approve="approve",e.Deny="deny"})(rc||(rc={}));var Gn;(function(e){e.Client="client",e.MCP="mcp"})(Gn||(Gn={}));var oc;(function(e){e.Text="text",e.EmbeddedResource="embeddedResource",e.Resource="resource",e.FileEdit="fileEdit",e.Terminal="terminal",e.Subagent="subagent"})(oc||(oc={}));var qn;(function(e){e.Running="running",e.Exited="exited"})(qn||(qn={}));var sc;(function(e){e.Client="client",e.Session="session"})(sc||(sc={}));var Vn;(function(e){e.Computing="computing",e.Recomputing="recomputing",e.Ready="ready",e.Error="error"})(Vn||(Vn={}));var ic;(function(e){e[e.Editing=1]="Editing"})(ic||(ic={}));var Kn;(function(e){e.Idle="idle",e.Running="running",e.Error="error",e.Disabled="disabled"})(Kn||(Kn={}));var ac;(function(e){e.Changeset="changeset",e.Resource="resource",e.Range="range"})(ac||(ac={}));var cc;(function(e){e.Added="added",e.Updated="updated",e.Deleted="deleted"})(cc||(cc={}));var uc;(function(e){e.Update="update",e.Remove="remove",e.Run="run"})(uc||(uc={}));var dc;(function(e){e.Skip="skip",e.RunOnce="runOnce"})(dc||(dc={}));var lc;(function(e){e.Schedule="schedule",e.Event="event"})(lc||(lc={}));var pc;(function(e){e.AfterRuns="afterRuns",e.AfterDate="afterDate"})(pc||(pc={}));var mc;(function(e){e.Pending="pending",e.Running="running",e.Completed="completed",e.Failed="failed",e.Cancelled="cancelled"})(mc||(mc={}));var fc;(function(e){e.Manual="manual",e.Trigger="trigger"})(fc||(fc={}));var p;(function(e){e.RootAgentsChanged="root/agentsChanged",e.RootActiveSessionsChanged="root/activeSessionsChanged",e.SessionReady="session/ready",e.SessionCreationFailed="session/creationFailed",e.SessionChatAdded="session/chatAdded",e.SessionChatRemoved="session/chatRemoved",e.SessionChatUpdated="session/chatUpdated",e.SessionChatsReordered="session/chatsReordered",e.SessionDefaultChatChanged="session/defaultChatChanged",e.ChatTurnStarted="chat/turnStarted",e.ChatDelta="chat/delta",e.ChatResponsePart="chat/responsePart",e.ChatToolCallStart="chat/toolCallStart",e.ChatToolCallDelta="chat/toolCallDelta",e.ChatToolCallReady="chat/toolCallReady",e.ChatToolCallConfirmed="chat/toolCallConfirmed",e.ChatToolCallComplete="chat/toolCallComplete",e.ChatToolCallResultConfirmed="chat/toolCallResultConfirmed",e.ChatToolCallContentChanged="chat/toolCallContentChanged",e.ChatToolCallAuthRequired="chat/toolCallAuthRequired",e.ChatToolCallAuthResolved="chat/toolCallAuthResolved",e.ChatTurnComplete="chat/turnComplete",e.ChatTurnCancelled="chat/turnCancelled",e.ChatError="chat/error",e.ChatTurnResume="chat/turnResume",e.ChatActivityChanged="chat/activityChanged",e.ChatBackgroundWorkSet="chat/backgroundWorkSet",e.ChatBackgroundWorkRemoved="chat/backgroundWorkRemoved",e.ChatMovableChanged="chat/movableChanged",e.ChatChangesetsChanged="chat/changesetsChanged",e.ChatCanvasesChanged="chat/canvasesChanged",e.CanvasStateChanged="canvas/stateChanged",e.ChatWorkingDirectorySet="chat/workingDirectorySet",e.ChatWorkingDirectoryRemoved="chat/workingDirectoryRemoved",e.SessionTitleChanged="session/titleChanged",e.ChatUsage="chat/usage",e.ChatReasoning="chat/reasoning",e.SessionServerToolsChanged="session/serverToolsChanged",e.SessionActiveClientSet="session/activeClientSet",e.SessionActiveClientRemoved="session/activeClientRemoved",e.SessionWorkingDirectorySet="session/workingDirectorySet",e.SessionWorkingDirectoryRemoved="session/workingDirectoryRemoved",e.SessionWorkingDirectoryReplaced="session/workingDirectoryReplaced",e.SessionInputNeededSet="session/inputNeededSet",e.SessionInputNeededRemoved="session/inputNeededRemoved",e.ChatPendingMessageSet="chat/pendingMessageSet",e.ChatPendingMessageRemoved="chat/pendingMessageRemoved",e.ChatQueuedMessagesReordered="chat/queuedMessagesReordered",e.ChatDraftChanged="chat/draftChanged",e.ChatIsReadChanged="chat/isReadChanged",e.ChatIsArchivedChanged="chat/isArchivedChanged",e.ChatConfigChanged="chat/configChanged",e.ChatMoved="chat/moved",e.ChatInputRequested="chat/inputRequested",e.ChatInputAnswerChanged="chat/inputAnswerChanged",e.ChatInputCompleted="chat/inputCompleted",e.SessionCustomizationsChanged="session/customizationsChanged",e.SessionCustomizationToggled="session/customizationToggled",e.SessionCustomizationUpdated="session/customizationUpdated",e.SessionCustomizationRemoved="session/customizationRemoved",e.SessionMcpServerStateChanged="session/mcpServerStateChanged",e.SessionMcpServerStartRequested="session/mcpServerStartRequested",e.SessionMcpServerStopRequested="session/mcpServerStopRequested",e.SessionMcpServerBackgroundRequested="session/mcpServerBackgroundRequested",e.ChatTruncated="chat/truncated",e.ChatTurnsLoaded="chat/turnsLoaded",e.SessionIsReadChanged="session/isReadChanged",e.SessionIsArchivedChanged="session/isArchivedChanged",e.SessionActivityChanged="session/activityChanged",e.SessionChangesetsChanged="session/changesetsChanged",e.SessionConfigChanged="session/configChanged",e.SessionMetaChanged="session/metaChanged",e.ChangesetStatusChanged="changeset/statusChanged",e.ChangesetFileSet="changeset/fileSet",e.ChangesetFileRemoved="changeset/fileRemoved",e.ChangesetFilesReviewChanged="changeset/filesReviewChanged",e.ChangesetContentChanged="changeset/contentChanged",e.ChangesetOperationsChanged="changeset/operationsChanged",e.ChangesetOperationStatusChanged="changeset/operationStatusChanged",e.ChangesetCleared="changeset/cleared",e.AnnotationsSet="annotations/set",e.AnnotationsUpdated="annotations/updated",e.AnnotationsRemoved="annotations/removed",e.AnnotationsEntrySet="annotations/entrySet",e.AnnotationsEntryRemoved="annotations/entryRemoved",e.RootTerminalsChanged="root/terminalsChanged",e.RootConfigChanged="root/configChanged",e.TerminalData="terminal/data",e.TerminalInput="terminal/input",e.TerminalResized="terminal/resized",e.TerminalClaimed="terminal/claimed",e.TerminalTitleChanged="terminal/titleChanged",e.TerminalCwdChanged="terminal/cwdChanged",e.TerminalExited="terminal/exited",e.TerminalCleared="terminal/cleared",e.TerminalCommandDetectionAvailable="terminal/commandDetectionAvailable",e.TerminalCommandExecuted="terminal/commandExecuted",e.TerminalCommandFinished="terminal/commandFinished",e.ResourceWatchChanged="resourceWatch/changed",e.AutomationCreateRequested="automation/createRequested",e.AutomationUpdateRequested="automation/updateRequested",e.AutomationSet="automation/set",e.AutomationRemoved="automation/removed",e.AutomationRunLifecycleChanged="automationRun/lifecycleChanged",e.AutomationRunSessionSet="automationRun/sessionSet",e.AutomationRunSessionRemoved="automationRun/sessionRemoved",e.AutomationRunPrimarySessionChanged="automationRun/primarySessionChanged",e.AutomationRunCancelRequested="automationRun/cancelRequested"})(p||(p={}));var bl={[p.RootAgentsChanged]:!1,[p.RootActiveSessionsChanged]:!1,[p.RootTerminalsChanged]:!1,[p.RootConfigChanged]:!0,[p.SessionReady]:!1,[p.SessionCreationFailed]:!1,[p.SessionChatAdded]:!1,[p.SessionChatRemoved]:!1,[p.SessionChatUpdated]:!1,[p.SessionChatsReordered]:!1,[p.SessionDefaultChatChanged]:!1,[p.SessionTitleChanged]:!0,[p.SessionServerToolsChanged]:!1,[p.SessionActiveClientSet]:!0,[p.SessionActiveClientRemoved]:!0,[p.SessionWorkingDirectorySet]:!0,[p.SessionWorkingDirectoryRemoved]:!0,[p.SessionWorkingDirectoryReplaced]:!0,[p.SessionInputNeededSet]:!1,[p.SessionInputNeededRemoved]:!1,[p.SessionCustomizationsChanged]:!1,[p.SessionCustomizationToggled]:!0,[p.SessionCustomizationUpdated]:!1,[p.SessionCustomizationRemoved]:!1,[p.SessionMcpServerStateChanged]:!1,[p.SessionMcpServerStartRequested]:!0,[p.SessionMcpServerStopRequested]:!0,[p.SessionMcpServerBackgroundRequested]:!0,[p.SessionIsReadChanged]:!0,[p.SessionIsArchivedChanged]:!0,[p.SessionActivityChanged]:!1,[p.SessionChangesetsChanged]:!1,[p.SessionConfigChanged]:!0,[p.SessionMetaChanged]:!1,[p.ChatTurnStarted]:!0,[p.ChatDelta]:!1,[p.ChatResponsePart]:!1,[p.ChatToolCallStart]:!1,[p.ChatToolCallDelta]:!1,[p.ChatToolCallReady]:!1,[p.ChatToolCallConfirmed]:!0,[p.ChatToolCallComplete]:!0,[p.ChatToolCallResultConfirmed]:!0,[p.ChatToolCallContentChanged]:!0,[p.ChatToolCallAuthRequired]:!1,[p.ChatToolCallAuthResolved]:!1,[p.ChatTurnComplete]:!1,[p.ChatTurnCancelled]:!0,[p.ChatError]:!1,[p.ChatTurnResume]:!0,[p.ChatActivityChanged]:!1,[p.ChatBackgroundWorkSet]:!1,[p.ChatBackgroundWorkRemoved]:!1,[p.ChatMovableChanged]:!1,[p.ChatChangesetsChanged]:!1,[p.ChatCanvasesChanged]:!1,[p.CanvasStateChanged]:!1,[p.ChatWorkingDirectorySet]:!0,[p.ChatWorkingDirectoryRemoved]:!0,[p.ChatUsage]:!1,[p.ChatReasoning]:!1,[p.ChatPendingMessageSet]:!0,[p.ChatPendingMessageRemoved]:!0,[p.ChatQueuedMessagesReordered]:!0,[p.ChatDraftChanged]:!0,[p.ChatIsReadChanged]:!0,[p.ChatIsArchivedChanged]:!0,[p.ChatConfigChanged]:!0,[p.ChatMoved]:!1,[p.ChatInputRequested]:!1,[p.ChatInputAnswerChanged]:!0,[p.ChatInputCompleted]:!0,[p.ChatTruncated]:!0,[p.ChatTurnsLoaded]:!1,[p.ChangesetStatusChanged]:!1,[p.ChangesetFileSet]:!1,[p.ChangesetFileRemoved]:!1,[p.ChangesetFilesReviewChanged]:!0,[p.ChangesetContentChanged]:!1,[p.ChangesetOperationsChanged]:!1,[p.ChangesetOperationStatusChanged]:!1,[p.ChangesetCleared]:!1,[p.AnnotationsSet]:!0,[p.AnnotationsUpdated]:!0,[p.AnnotationsRemoved]:!0,[p.AnnotationsEntrySet]:!0,[p.AnnotationsEntryRemoved]:!0,[p.TerminalData]:!1,[p.TerminalInput]:!0,[p.TerminalResized]:!0,[p.TerminalClaimed]:!0,[p.TerminalTitleChanged]:!0,[p.TerminalCwdChanged]:!1,[p.TerminalExited]:!1,[p.TerminalCleared]:!0,[p.TerminalCommandDetectionAvailable]:!1,[p.TerminalCommandExecuted]:!1,[p.TerminalCommandFinished]:!1,[p.ResourceWatchChanged]:!1,[p.AutomationCreateRequested]:!0,[p.AutomationUpdateRequested]:!0,[p.AutomationSet]:!1,[p.AutomationRemoved]:!0,[p.AutomationRunLifecycleChanged]:!1,[p.AutomationRunSessionSet]:!1,[p.AutomationRunSessionRemoved]:!1,[p.AutomationRunPrimarySessionChanged]:!1,[p.AutomationRunCancelRequested]:!0};var Il=["channel/credit","tcp/reset","unsubscribe"],g_=new Set(Il);var hc;(function(e){e.Posix="posix",e.Windows="windows"})(hc||(hc={}));var gc;(function(e){e.Replay="replay",e.Snapshot="snapshot"})(gc||(gc={}));var _c;(function(e){e.Base64="base64",e.Utf8="utf-8"})(_c||(_c={}));var yc;(function(e){e.Truncate="truncate",e.Append="append",e.Insert="insert"})(yc||(yc={}));var Ec;(function(e){e.File="file",e.Directory="directory",e.Symlink="symlink"})(Ec||(Ec={}));var Sc;(function(e){e.McpServer="mcpServer"})(Sc||(Sc={}));var wc;(function(e){e.UserMessage="userMessage"})(wc||(wc={}));var Tc;(function(e){e.Fork="fork",e.SideChat="sideChat"})(Tc||(Tc={}));var Ac;(function(e){e.Session="session",e.NewSession="newSession"})(Ac||(Ac={}));var vc;(function(e){e.Resource="resource",e.Range="range"})(vc||(vc={}));var kc;(function(e){e.Required="required",e.Expired="expired"})(kc||(kc={}));var F_=Object.freeze(["1.0.0","0.9.0"]);var B_={[p.RootAgentsChanged]:"0.1.0",[p.RootActiveSessionsChanged]:"0.1.0",[p.SessionReady]:"0.1.0",[p.SessionCreationFailed]:"0.1.0",[p.SessionChatAdded]:"0.4.0",[p.SessionChatRemoved]:"0.4.0",[p.SessionChatUpdated]:"0.4.0",[p.SessionChatsReordered]:"0.9.0",[p.SessionDefaultChatChanged]:"0.4.0",[p.SessionTitleChanged]:"0.1.0",[p.SessionServerToolsChanged]:"0.1.0",[p.SessionActiveClientSet]:"0.5.0",[p.SessionActiveClientRemoved]:"0.5.0",[p.SessionWorkingDirectorySet]:"0.7.0",[p.SessionWorkingDirectoryRemoved]:"0.7.0",[p.SessionWorkingDirectoryReplaced]:"0.8.0",[p.SessionInputNeededSet]:"0.5.1",[p.SessionInputNeededRemoved]:"0.5.1",[p.SessionCustomizationsChanged]:"0.1.0",[p.SessionCustomizationToggled]:"0.1.0",[p.SessionCustomizationUpdated]:"0.1.0",[p.SessionCustomizationRemoved]:"0.2.0",[p.SessionMcpServerStateChanged]:"0.3.0",[p.SessionMcpServerStartRequested]:"0.5.2",[p.SessionMcpServerStopRequested]:"0.5.2",[p.SessionMcpServerBackgroundRequested]:"0.9.0",[p.SessionIsReadChanged]:"0.1.0",[p.SessionIsArchivedChanged]:"0.1.0",[p.SessionActivityChanged]:"0.1.0",[p.SessionChangesetsChanged]:"0.2.0",[p.SessionConfigChanged]:"0.1.0",[p.SessionMetaChanged]:"0.1.0",[p.ChatTurnStarted]:"0.4.0",[p.ChatDelta]:"0.4.0",[p.ChatResponsePart]:"0.4.0",[p.ChatToolCallStart]:"0.4.0",[p.ChatToolCallDelta]:"0.4.0",[p.ChatToolCallReady]:"0.4.0",[p.ChatToolCallConfirmed]:"0.4.0",[p.ChatToolCallComplete]:"0.4.0",[p.ChatToolCallResultConfirmed]:"0.4.0",[p.ChatToolCallContentChanged]:"0.4.0",[p.ChatToolCallAuthRequired]:"0.6.0",[p.ChatToolCallAuthResolved]:"0.6.0",[p.ChatTurnComplete]:"0.4.0",[p.ChatTurnCancelled]:"0.4.0",[p.ChatError]:"0.4.0",[p.ChatTurnResume]:"0.9.0",[p.ChatActivityChanged]:"0.5.0",[p.ChatBackgroundWorkSet]:"0.9.0",[p.ChatBackgroundWorkRemoved]:"0.9.0",[p.ChatMovableChanged]:"0.9.0",[p.ChatChangesetsChanged]:"0.9.0",[p.ChatCanvasesChanged]:"0.10.0",[p.CanvasStateChanged]:"0.10.0",[p.ChatWorkingDirectorySet]:"0.7.0",[p.ChatWorkingDirectoryRemoved]:"0.7.0",[p.ChatUsage]:"0.4.0",[p.ChatReasoning]:"0.4.0",[p.ChatPendingMessageSet]:"0.4.0",[p.ChatPendingMessageRemoved]:"0.4.0",[p.ChatQueuedMessagesReordered]:"0.4.0",[p.ChatDraftChanged]:"0.5.0",[p.ChatIsReadChanged]:"0.9.0",[p.ChatIsArchivedChanged]:"0.9.0",[p.ChatConfigChanged]:"1.1.0",[p.ChatMoved]:"1.1.0",[p.ChatInputRequested]:"0.4.0",[p.ChatInputAnswerChanged]:"0.4.0",[p.ChatInputCompleted]:"0.4.0",[p.ChatTruncated]:"0.4.0",[p.ChatTurnsLoaded]:"0.5.1",[p.ChangesetStatusChanged]:"0.2.0",[p.ChangesetFileSet]:"0.2.0",[p.ChangesetFileRemoved]:"0.2.0",[p.ChangesetFilesReviewChanged]:"0.6.0",[p.ChangesetContentChanged]:"0.4.0",[p.ChangesetOperationsChanged]:"0.2.0",[p.ChangesetOperationStatusChanged]:"0.3.0",[p.ChangesetCleared]:"0.2.0",[p.AnnotationsSet]:"0.4.0",[p.AnnotationsUpdated]:"0.4.0",[p.AnnotationsRemoved]:"0.4.0",[p.AnnotationsEntrySet]:"0.4.0",[p.AnnotationsEntryRemoved]:"0.4.0",[p.RootTerminalsChanged]:"0.1.0",[p.RootConfigChanged]:"0.1.0",[p.TerminalData]:"0.1.0",[p.TerminalInput]:"0.1.0",[p.TerminalResized]:"0.1.0",[p.TerminalClaimed]:"0.1.0",[p.TerminalTitleChanged]:"0.1.0",[p.TerminalCwdChanged]:"0.1.0",[p.TerminalExited]:"0.1.0",[p.TerminalCleared]:"0.1.0",[p.TerminalCommandDetectionAvailable]:"0.1.0",[p.TerminalCommandExecuted]:"0.1.0",[p.TerminalCommandFinished]:"0.1.0",[p.ResourceWatchChanged]:"0.2.0",[p.AutomationCreateRequested]:"0.8.0",[p.AutomationUpdateRequested]:"0.8.0",[p.AutomationSet]:"0.8.0",[p.AutomationRemoved]:"0.8.0",[p.AutomationRunLifecycleChanged]:"0.8.0",[p.AutomationRunSessionSet]:"0.8.0",[p.AutomationRunSessionRemoved]:"0.8.0",[p.AutomationRunPrimarySessionChanged]:"0.8.0",[p.AutomationRunCancelRequested]:"0.8.0"};var Yn=["SOURCE_UNBOUND","SOURCE_UNAVAILABLE","SERVICE_IDENTITY_UNAVAILABLE","SERVICE_IDENTITY_NOT_GRANTED","AGENT_NOT_MAPPED","NOT_MAPPED","INVALID_ADDRESS","HOST_OFFLINE","SOURCE_GAP","FRAME_TOO_LARGE","ITEM_TOO_LARGE","STALE_EXPECTATION","SOURCE_READER_RESTARTING"];var Wl=1000;var j=w().min(1).max(256),ke=w().min(1).max(1024),Hl=w().regex(/^(0|[1-9][0-9]{0,17})$/u),Pt=b({epoch:j,ordinal:Hl}).strict(),ve={workspaceId:j,sourceId:j,hostId:j},Ic=b({address:ke,version:j,scope:j,columns:b({title:w().max(4096),state:j,owner:j.nullable(),parent:ke.nullable(),project:ke.nullable(),labels:ne(j).max(256),url:w().max(2048).nullable(),updatedAt:w().max(64).nullable()}).strict(),extra:ge()}).strict(),Qn=b({position:Pt,change:va("op",[b({op:D("upsert"),row:Ic}).strict(),b({op:D("delete"),address:ke}).strict()])}).strict(),Zl=b({address:ke}).strict(),Fl=b({page:w().min(1).max(4096).optional(),limit:le().int().min(1).max(Wl)}).strict(),Bl=b({address:ke,ownerMemberId:j,expectedOwner:j.nullable(),intentId:j,ifRevision:w().min(1).max(256).optional()}).strict(),jl=b({on:qe()}).strict(),Jl=b({memberId:j}).strict(),Ct=(e,t)=>b({...ve,caller:Jl,op:D(e),args:t}).strict(),Qy=va("op",[Ct("read",Zl),Ct("list",Fl),Ct("assign",Bl),Ct("watch",jl)]),Gl=b({generation:j,snapshot:j,base:Pt,rows:ne(Ic),next:w().min(1).max(4096).nullable(),complete:qe(),progressAsOf:w().min(1).max(64).optional(),progressStale:b({since:w().min(1).max(64),reason:w().min(1).max(4096)}).strict().optional()}).strict().refine((e)=>e.rows.length>0||e.complete&&e.next===null,{message:"a page carries at least one item"}).refine((e)=>e.complete===(e.next===null),{message:"a page is complete exactly when it has no next token"}),ql=b({intentId:j,result:ge(),observation:Qn,revision:j.nullable().optional()}).strict(),Xn={read:b({observation:Qn}).strict(),list:Gl,assign:ql,watch:b({on:qe()}).strict()},bc=q(Yn),Vl=["OPERATION_NOT_ALLOWLISTED","OPERATION_SHAPE_INVALID"],Lt=(e)=>Te([b({...ve,op:D(e),outcome:q(["applied","noop"]),body:Xn[e]}).strict(),b({...ve,op:D(e),outcome:q(["applied","noop"]),code:D("SOURCE_READER_RESTARTING"),body:Xn[e]}).strict(),b({...ve,op:D(e),outcome:D("rejected"),code:bc,body:Xn[e]}).strict(),b({...ve,op:D(e),outcome:q(["unknown","refused"]),code:Te([bc.exclude(["ITEM_TOO_LARGE"]),q(Vl)])}).strict(),b({...ve,op:D(e),outcome:D("refused"),code:D("ITEM_TOO_LARGE"),item:ke}).strict()]),eE=Te([Lt("read"),Lt("list"),Lt("assign"),Lt("watch")]),tE=b({...ve,position:Pt,observations:ne(Qn).min(1)}).strict().refine((e)=>{let{observations:t,position:n}=e,r=t[t.length-1];if(r===void 0||r.position.epoch!==n.epoch||r.position.ordinal!==n.ordinal)return!1;return t.every((o,s)=>o.position.epoch===n.epoch&&(s===0||BigInt(o.position.ordinal)===BigInt(t[s-1].position.ordinal)+1n))},{message:"a push is one epoch of consecutive ordinals, numbered by its last"}),nE=b({applied:Pt.nullable(),seq:le().int().min(0),relist:qe()}).strict();var Dt="x-hh-records";var Kl=`${Dt}/changed`;var sE=b({address:w().min(1).max(1024),ownerMemberId:w().min(1).max(256),expectedOwner:w().min(1).max(256).nullable().optional(),ifRevision:w().min(1).max(256),intentId:w().min(1).max(256)}).strict(),Rc=w().min(1).max(256),xc=w().min(1).max(1024),Oc=b({address:xc,revision:w().min(1).max(256),scope:w().min(1).max(256),columns:ka(w(),ge()),extra:ge().optional()}).strict(),iE=b({source:Rc,epoch:w().min(1).max(256),records:ne(Oc)}).strict(),Xl=b({type:D(Kl),source:Rc,revision:w().min(1).max(256),address:xc,deleted:D(!0).optional(),record:Oc.optional()}).strict(),aE=b({channel:w().min(1),serverSeq:le().int().min(0).optional(),action:Xl}),cE=new RegExp(`^${Dt}://[^/?#]+$`,"u");var Yl=b({id:w().min(1),revision:le().int().min(0),state:w(),operations:ne(w())}).passthrough();var er=le().int().min(0),lE=b({id:w().min(1),engine:w().min(1),owner:w().min(1),name:w().min(1),description:w().optional(),tags:ne(w()).optional(),model:ge().optional(),config:ka(w(),ge()),ifRevision:er}).passthrough(),pE=b({id:w().min(1),ifRevision:er}).strict(),mE=b({id:w().min(1),ifRevision:er}).strict(),Nc=-32602,fE=b({code:D(Nc),message:w(),data:b({staleRevision:le().int().min(1),row:Yl})}),hE=b({code:D(Nc),message:w(),data:b({staleRevision:D(0)})});var Ql=["subscribe","x-ahpd/invokeOperation","resourceRead","listSessions","authenticate"],ep="x-hh-services://",TE=`${ep} and ${Dt}://<sourceId>`;var AE=["x-ahpd/agents/list","x-ahpd/agents/put","x-ahpd/agents/remove","x-ahpd/agents/enable","x-ahpd/agents/pause","x-ahpd/agents/disable",...Ql];var tp=1e4,vE=tp-1000;var kE=b({workspaceId:w().min(1),hostId:w().min(1),agentMemberId:w().min(1).optional(),caller:w().min(1).max(256).optional()}).strict(),np=["unmapped","timedOut","outside"],bE=b({reason:q(np)}).strict();var rp=b({resource:w().min(1),customizationId:w().min(1)}).strict(),Cc=b({available:qe(),reason:w().min(1).max(200).optional(),server:rp.optional()}).strict();var IE=b({resource:w().min(1),_meta:b({"hh/agentMemberId":w().min(1),"hh/hostTools":Cc.optional()}).strict()}).strict(),RE=b({channel:D("ahp-root://"),session:w().min(1),changes:b({_meta:b({"hh/agentMemberId":w().min(1),"hh/hostTools":Cc}).strict()}).strict()}).strict();var xE=b({channel:w().min(1),resource:w().min(1),reason:D("expired")}).strict();var op=["session/ready","chat/turnStarted","chat/turnComplete","x-hh/turnFailed"];var sp=["OPERATION_NOT_ALLOWLISTED","OPERATION_SHAPE_INVALID","INVALID_OPERATION_SHAPE","WORKSPACE_OR_MEMBER_UNKNOWN","UNKNOWN_HOUSE_OR_MEMBER","AGENT_NOT_MAPPED","UNMAPPED_LOCAL_AGENT","FOREIGN_SESSION","FOREIGN_SESSION_REFUSED","TOKEN_EXPIRED_OR_REVOKED","HOST_REVOKED","HOST_RESTARTED","INPUT_REQUIRED","APPROVAL_REQUIRED","VERSION_UNSUPPORTED","WAKE_NOT_SENT","TURN_TIMED_OUT","HOST_START_FAILED","WAKE_TEXT_NOT_ALLOWED","ROOM_ASKS_UNTRUSTED","ASK_UNSIGNED","KEY_NOT_FOR_AUTHOR","ASK_STALE","ASK_REPLAYED","SERVICE_NOT_ALLOWED","TURN_CANCELLED",...Yn],Lc=16,Pc=49152,Dc=262144,ip=b({id:w().min(1),from:b({memberId:w().min(1)}).strict(),text:w(),replyTo:w().min(1).optional(),deleted:D(!0).optional(),signed:b({keyId:w().min(1),createdAt:w().min(1),signature:w().min(1),clientId:w().min(1),attachmentIds:ne(w().min(1))}).strict().optional()}).strict(),ap=(e)=>new TextEncoder().encode(JSON.stringify(e)).byteLength,cp=ne(ip).min(1).superRefine((e,t)=>{if(e.length>Lc){t.addIssue({code:"custom",message:`a wake carries at most ${Lc} triggering envelopes, not ${e.length}`});return}if(new Set(e.map((r)=>r.id)).size!==e.length){t.addIssue({code:"custom",message:"a wake names each triggering message once"});return}let n=0;for(let r of e){let o=ap(r);if(o>Pc){t.addIssue({code:"custom",message:`triggering envelope ${r.id} is ${o} bytes, over the ${Pc}-byte limit`});return}n+=o}if(n>Dc)t.addIssue({code:"custom",message:`the triggering envelopes take ${n} bytes, over the ${Dc}-byte limit`})}),PE=b({workspaceId:w().min(1),deliveryId:w().min(1),turnId:w().min(1).optional(),agentMemberId:w().min(1),threadRef:w().min(1),afterMessageId:w().min(1).optional(),triggeringMessageIds:ne(w().min(1)).min(1).refine((e)=>new Set(e).size===e.length).optional(),triggering:cp.optional(),agentToken:w().min(1).max(4096).optional()}).strict().superRefine((e,t)=>{if(e.agentToken!==void 0&&e.triggering!==void 0)t.addIssue({code:"custom",message:"a wake carries its triggering envelopes or the older bearer, never both"})}),DE=b({event:q(op),channel:w().min(1),workspaceId:w().min(1),deliveryId:w().min(1),session:w().min(1),chat:w().min(1),turnId:w().min(1).optional(),clientSeq:le().int().min(1).optional(),turnState:q(["created","running","finished","error"]),statusCode:w().min(1).max(64),errorCode:q(sp).optional(),errorDetail:w().max(256).optional()}).strict();var up=["session/ready","chat/turnStarted","chat/turnComplete","chat/turnCancelled","chat/error"],$E=b({channel:w().min(1),serverSeq:le().int().min(0).optional(),origin:b({clientId:w().min(1),clientSeq:le().int().min(1)}).optional(),action:b({type:q(up),turnId:w().min(1).optional(),part:b({error:b({errorType:w().min(1)})}).optional()})});var a="Hightea-Host",d="x-hightea-host";async function zc(e,t){let n=_p(e)?[e]:t.split(gp).filter((r)=>r!=="").map((r)=>yp(r,e));for(let r of n)try{if(await fp(r,mp.X_OK),(await hp(r)).isFile())return!0}catch{}return!1}async function N(e=process.env.PATH??"",t=process.platform){let n=[];for(let r of Ve){let o=Mc[r];if(o===void 0)throw Error("HOST_JOIN_APPS_ROW_MISSING");if(!await zc(o.command,e))continue;let s=$c(o,t);n.push({id:r,name:Ke[r],command:o.command,...s===void 0?{}:{install:s},...o.page===void 0?{}:{page:o.page}})}return n}function u(e){if(e.install!==void 0)return e.install;return e.page===void 0?`install ${e.name}`:`install ${e.name}: ${e.page}`}function l(e,t=process.platform){let n=Mc[e];if(n===void 0)throw Error("HOST_JOIN_APPS_ROW_MISSING");let r=$c(n,t);return{id:e,name:Ke[e],command:n.command,...r===void 0?{}:{install:r},...n.page===void 0?{}:{page:n.page}}}async function y(e,t=process.env.PATH??""){return zc(e.command,t)}var R=(e)=>Ve.includes(e);function x(e=process.platform){return"no agent app on this computer: "+Ve.map((n)=>l(n,e)).map((n)=>`${n.name} (${u(n)})`).join("; ")+". Install one, then run the same command again. Nothing was redeemed and nothing was written."}
58
+ export{g,k,c,a,d,N,u,l,y,R,x};