eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
40 lines • 131 kB
JavaScript
import{r as e}from"./rolldown-runtime-DPpTSio4.js";import t from"node:crypto";function n(e,t,n){let r=Symbol.for(`${e}/v${t}`),i=globalThis,a=i[r];if(a!==void 0)return a;let o=n();return i[r]=o,o}const r=Object.freeze({status:`aborted`});function i(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}const a=Symbol(`zod_brand`);var o=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},s=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const c={};function l(e){return e&&Object.assign(c,e),c}var u=e({BIGINT_FORMAT_RANGES:()=>Ne,Class:()=>et,NUMBER_FORMAT_RANGES:()=>Me,aborted:()=>Ve,allowsEval:()=>Se,assert:()=>ie,assertEqual:()=>ee,assertIs:()=>ne,assertNever:()=>re,assertNotEqual:()=>te,assignProp:()=>f,base64ToUint8Array:()=>Je,base64urlToUint8Array:()=>Xe,cached:()=>ce,captureStackTrace:()=>be,cleanEnum:()=>qe,cleanRegex:()=>ue,clone:()=>h,cloneDef:()=>me,createTransparentProxy:()=>ke,defineLazy:()=>d,esc:()=>ve,escapeRegex:()=>m,extend:()=>Ie,finalizeIssue:()=>v,floatSafeRemainder:()=>de,getElementAtPath:()=>he,getEnumValues:()=>ae,getLengthableOrigin:()=>We,getParsedType:()=>Ee,getSizableOrigin:()=>Ue,hexToUint8Array:()=>Qe,isObject:()=>xe,isPlainObject:()=>Ce,issue:()=>Ke,joinValues:()=>oe,jsonStringifyReplacer:()=>se,merge:()=>Re,mergeDefs:()=>p,normalizeParams:()=>g,nullish:()=>le,numKeys:()=>Te,objectClone:()=>pe,omit:()=>Fe,optionalKeys:()=>je,parsedType:()=>Ge,partial:()=>ze,pick:()=>Pe,prefixIssues:()=>_,primitiveTypes:()=>Oe,promiseAllObject:()=>ge,propertyKeyTypes:()=>De,randomString:()=>_e,required:()=>Be,safeExtend:()=>Le,shallowClone:()=>we,slugify:()=>ye,stringifyPrimitive:()=>Ae,uint8ArrayToBase64:()=>Ye,uint8ArrayToBase64url:()=>Ze,uint8ArrayToHex:()=>$e,unwrapMessage:()=>He});function ee(e){return e}function te(e){return e}function ne(e){}function re(e){throw Error(`Unexpected value in exhaustive check`)}function ie(e){}function ae(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function oe(e,t=`|`){return e.map(e=>Ae(e)).join(t)}function se(e,t){return typeof t==`bigint`?t.toString():t}function ce(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function le(e){return e==null}function ue(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function de(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const fe=Symbol(`evaluating`);function d(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==fe)return r===void 0&&(r=fe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function pe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function me(e){return p(e._zod.def)}function he(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function ge(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function _e(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function ve(e){return JSON.stringify(e)}function ye(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const be=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Se=ce(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ce(e){if(xe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return xe(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function we(e){return Ce(e)?{...e}:Array.isArray(e)?[...e]:e}function Te(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const Ee=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},De=new Set([`string`,`number`,`symbol`]),Oe=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function h(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function g(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}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ke(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function Ae(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function je(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Me={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ne={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Pe(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`);return h(e,p(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,`shape`,e),e},checks:[]}))}function Fe(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`);return h(e,p(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,`shape`,r),r},checks:[]}))}function Ie(e,t){if(!Ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return h(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function Le(e,t){if(!Ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return h(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function Re(e,t){return h(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return f(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function ze(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return h(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return f(this,`shape`,i),i},checks:[]}))}function Be(e,t,n){return h(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return f(this,`shape`,i),i}}))}function Ve(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 _(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function He(e){return typeof e==`string`?e:e?.message}function v(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=He(e.inst?._zod.def?.error?.(e))??He(t?.error?.(e))??He(n.customError?.(e))??He(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ue(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function We(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ge(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 t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ke(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function qe(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Je(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Ye(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Xe(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Je(t+`=`.repeat((4-t.length%4)%4))}function Ze(e){return Ye(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Qe(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function $e(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var et=class{constructor(...e){}};const tt=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,se,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nt=i(`$ZodError`,tt),y=i(`$ZodError`,tt,{Parent:Error});function rt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function it(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function at(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??(r.properties={}),(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??(r.items=[]),(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function ot(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function st(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${ot(e.path)}`);return t.join(`
`)}const ct=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new o;if(s.issues.length){let t=new((i?.Err)??e)(s.issues.map(e=>v(e,a,l())));throw be(t,i?.callee),t}return s.value},lt=ct(y),ut=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>v(e,a,l())));throw be(t,i?.callee),t}return o.value},dt=ut(y),ft=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new o;return a.issues.length?{success:!1,error:new(e??nt)(a.issues.map(e=>v(e,i,l())))}:{success:!0,data:a.value}},pt=ft(y),mt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>v(e,i,l())))}:{success:!0,data:a.value}},ht=mt(y),gt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ct(e)(t,n,i)},_t=gt(y),vt=e=>(t,n,r)=>ct(e)(t,n,r),yt=vt(y),bt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ut(e)(t,n,i)},xt=bt(y),St=e=>async(t,n,r)=>ut(e)(t,n,r),Ct=St(y),wt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ft(e)(t,n,i)},Tt=wt(y),Et=e=>(t,n,r)=>ft(e)(t,n,r),Dt=Et(y),Ot=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mt(e)(t,n,i)},kt=Ot(y),At=e=>async(t,n,r)=>mt(e)(t,n,r),jt=At(y);var Mt=e({base64:()=>an,base64url:()=>on,bigint:()=>gn,boolean:()=>yn,browserEmail:()=>Zt,cidrv4:()=>nn,cidrv6:()=>rn,cuid:()=>Nt,cuid2:()=>Pt,date:()=>dn,datetime:()=>mn,domain:()=>cn,duration:()=>zt,e164:()=>ln,email:()=>Kt,emoji:()=>Qt,extendedDuration:()=>Bt,guid:()=>Vt,hex:()=>wn,hostname:()=>sn,html5Email:()=>qt,idnEmail:()=>Xt,integer:()=>_n,ipv4:()=>$t,ipv6:()=>en,ksuid:()=>Lt,lowercase:()=>Sn,mac:()=>tn,md5_base64:()=>On,md5_base64url:()=>kn,md5_hex:()=>Dn,nanoid:()=>Rt,null:()=>bn,number:()=>vn,rfc5322Email:()=>Jt,sha1_base64:()=>jn,sha1_base64url:()=>Mn,sha1_hex:()=>An,sha256_base64:()=>Pn,sha256_base64url:()=>Fn,sha256_hex:()=>Nn,sha384_base64:()=>Ln,sha384_base64url:()=>Rn,sha384_hex:()=>In,sha512_base64:()=>Bn,sha512_base64url:()=>Vn,sha512_hex:()=>zn,string:()=>hn,time:()=>pn,ulid:()=>Ft,undefined:()=>xn,unicodeEmail:()=>Yt,uppercase:()=>Cn,uuid:()=>Ht,uuid4:()=>Ut,uuid6:()=>Wt,uuid7:()=>Gt,xid:()=>It});const Nt=/^[cC][^\s-]{8,}$/,Pt=/^[0-9a-z]+$/,Ft=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,It=/^[0-9a-vA-V]{20}$/,Lt=/^[A-Za-z0-9]{27}$/,Rt=/^[a-zA-Z0-9_-]{21}$/,zt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Bt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vt=/^([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})$/,Ht=e=>e?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})$`):/^([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)$/,Ut=Ht(4),Wt=Ht(6),Gt=Ht(7),Kt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Jt=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Yt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Xt=Yt,Zt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function Qt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const $t=/^(?:(?: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])$/,en=/^(([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}|:))$/,tn=e=>{let t=m(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nn=/^((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])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,an=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,on=/^[A-Za-z0-9_-]*$/,sn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,cn=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ln=/^\+[1-9]\d{6,14}$/,un=`(?:(?:\\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])))`,dn=RegExp(`^${un}$`);function fn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function pn(e){return RegExp(`^${fn(e)}$`)}function mn(e){let t=fn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${un}T(?:${r})$`)}const hn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},gn=/^-?\d+n?$/,_n=/^-?\d+$/,vn=/^-?\d+(?:\.\d+)?$/,yn=/^(?:true|false)$/i,bn=/^null$/i,xn=/^undefined$/i,Sn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,wn=/^[0-9a-fA-F]*$/;function Tn(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function En(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Dn=/^[0-9a-fA-F]{32}$/,On=Tn(22,`==`),kn=En(22),An=/^[0-9a-fA-F]{40}$/,jn=Tn(27,`=`),Mn=En(27),Nn=/^[0-9a-fA-F]{64}$/,Pn=Tn(43,`=`),Fn=En(43),In=/^[0-9a-fA-F]{96}$/,Ln=Tn(64,``),Rn=En(64),zn=/^[0-9a-fA-F]{128}$/,Bn=Tn(86,`==`),Vn=En(86),b=i(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hn={number:`number`,bigint:`bigint`,object:`date`},Un=i(`$ZodCheckLessThan`,(e,t)=>{b.init(e,t);let n=Hn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin: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})}}),Wn=i(`$ZodCheckGreaterThan`,(e,t)=>{b.init(e,t);let n=Hn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin: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})}}),Gn=i(`$ZodCheckMultipleOf`,(e,t)=>{b.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):de(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Kn=i(`$ZodCheckNumberFormat`,(e,t)=>{b.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Me[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=_n)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),qn=i(`$ZodCheckBigIntFormat`,(e,t)=>{b.init(e,t);let[n,r]=Ne[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Jn=i(`$ZodCheckMaxSize`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:Ue(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Yn=i(`$ZodCheckMinSize`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:Ue(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xn=i(`$ZodCheckSizeEquals`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Ue(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Zn=i(`$ZodCheckMaxLength`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=We(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qn=i(`$ZodCheckMinLength`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=We(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$n=i(`$ZodCheckLengthEquals`,(e,t)=>{var n;b.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!le(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=We(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),er=i(`$ZodCheckStringFormat`,(e,t)=>{var n,r;b.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),tr=i(`$ZodCheckRegex`,(e,t)=>{er.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),nr=i(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sn,er.init(e,t)}),rr=i(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cn,er.init(e,t)}),ir=i(`$ZodCheckIncludes`,(e,t)=>{b.init(e,t);let n=m(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ar=i(`$ZodCheckStartsWith`,(e,t)=>{b.init(e,t);let n=RegExp(`^${m(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),or=i(`$ZodCheckEndsWith`,(e,t)=>{b.init(e,t);let n=RegExp(`.*${m(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function sr(e,t,n){e.issues.length&&t.issues.push(..._(n,e.issues))}const cr=i(`$ZodCheckProperty`,(e,t)=>{b.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>sr(n,e,t.property));sr(n,e,t.property)}}),lr=i(`$ZodCheckMimeType`,(e,t)=>{b.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ur=i(`$ZodCheckOverwrite`,(e,t)=>{b.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var dr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
`))}};const fr={major:4,minor:3,patch:6},x=i(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Ve(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=a._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new o;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=Ve(e,t))});else{if(e.issues.length===t)continue;r||=Ve(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ve(n))return n.aborted=!0,n;let s=t(i,r,a);if(s instanceof Promise){if(a.async===!1)throw new o;return s.then(t=>e._zod.parse(t,a))}return e._zod.parse(s,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let s=e._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new o;return s.then(e=>t(e,r,a))}return t(s,r,a)}}d(e,`~standard`,()=>({validate:t=>{try{let n=pt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return ht(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),pr=i(`$ZodString`,(e,t)=>{x.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),S=i(`$ZodStringFormat`,(e,t)=>{er.init(e,t),pr.init(e,t)}),mr=i(`$ZodGUID`,(e,t)=>{t.pattern??=Vt,S.init(e,t)}),hr=i(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ht(e)}else t.pattern??=Ht();S.init(e,t)}),gr=i(`$ZodEmail`,(e,t)=>{t.pattern??=Kt,S.init(e,t)}),_r=i(`$ZodURL`,(e,t)=>{S.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.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?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),vr=i(`$ZodEmoji`,(e,t)=>{t.pattern??=Qt(),S.init(e,t)}),yr=i(`$ZodNanoID`,(e,t)=>{t.pattern??=Rt,S.init(e,t)}),br=i(`$ZodCUID`,(e,t)=>{t.pattern??=Nt,S.init(e,t)}),xr=i(`$ZodCUID2`,(e,t)=>{t.pattern??=Pt,S.init(e,t)}),Sr=i(`$ZodULID`,(e,t)=>{t.pattern??=Ft,S.init(e,t)}),Cr=i(`$ZodXID`,(e,t)=>{t.pattern??=It,S.init(e,t)}),wr=i(`$ZodKSUID`,(e,t)=>{t.pattern??=Lt,S.init(e,t)}),Tr=i(`$ZodISODateTime`,(e,t)=>{t.pattern??=mn(t),S.init(e,t)}),Er=i(`$ZodISODate`,(e,t)=>{t.pattern??=dn,S.init(e,t)}),Dr=i(`$ZodISOTime`,(e,t)=>{t.pattern??=pn(t),S.init(e,t)}),Or=i(`$ZodISODuration`,(e,t)=>{t.pattern??=zt,S.init(e,t)}),kr=i(`$ZodIPv4`,(e,t)=>{t.pattern??=$t,S.init(e,t),e._zod.bag.format=`ipv4`}),Ar=i(`$ZodIPv6`,(e,t)=>{t.pattern??=en,S.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),jr=i(`$ZodMAC`,(e,t)=>{t.pattern??=tn(t.delimiter),S.init(e,t),e._zod.bag.format=`mac`}),Mr=i(`$ZodCIDRv4`,(e,t)=>{t.pattern??=nn,S.init(e,t)}),Nr=i(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rn,S.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Pr(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Fr=i(`$ZodBase64`,(e,t)=>{t.pattern??=an,S.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Pr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ir(e){if(!on.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Pr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Lr=i(`$ZodBase64URL`,(e,t)=>{t.pattern??=on,S.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ir(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Rr=i(`$ZodE164`,(e,t)=>{t.pattern??=ln,S.init(e,t)});function zr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Br=i(`$ZodJWT`,(e,t)=>{S.init(e,t),e._zod.check=n=>{zr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Vr=i(`$ZodCustomStringFormat`,(e,t)=>{S.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Hr=i(`$ZodNumber`,(e,t)=>{x.init(e,t),e._zod.pattern=e._zod.bag.pattern??vn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ur=i(`$ZodNumberFormat`,(e,t)=>{Kn.init(e,t),Hr.init(e,t)}),Wr=i(`$ZodBoolean`,(e,t)=>{x.init(e,t),e._zod.pattern=yn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Gr=i(`$ZodBigInt`,(e,t)=>{x.init(e,t),e._zod.pattern=gn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),Kr=i(`$ZodBigIntFormat`,(e,t)=>{qn.init(e,t),Gr.init(e,t)}),qr=i(`$ZodSymbol`,(e,t)=>{x.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),Jr=i(`$ZodUndefined`,(e,t)=>{x.init(e,t),e._zod.pattern=xn,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),Yr=i(`$ZodNull`,(e,t)=>{x.init(e,t),e._zod.pattern=bn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Xr=i(`$ZodAny`,(e,t)=>{x.init(e,t),e._zod.parse=e=>e}),Zr=i(`$ZodUnknown`,(e,t)=>{x.init(e,t),e._zod.parse=e=>e}),Qr=i(`$ZodNever`,(e,t)=>{x.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),$r=i(`$ZodVoid`,(e,t)=>{x.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),ei=i(`$ZodDate`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function ti(e,t,n){e.issues.length&&t.issues.push(..._(n,e.issues)),t.value[n]=e.value}const ni=i(`$ZodArray`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>ti(t,n,e))):ti(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ri(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(..._(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ii(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=je(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ai(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ri(e,n,i,t,u))):ri(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const oi=i(`$ZodObject`,(e,t)=>{if(x.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=ce(()=>ii(t));d(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=xe,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>ri(n,t,e,s,r))):ri(i,t,e,s,r)}return i?ai(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),si=i(`$ZodObjectJIT`,(e,t)=>{oi.init(e,t);let n=e._zod.parse,r=ce(()=>ii(t)),i=e=>{let t=new dr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ve(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ve(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
if (${n}.issues.length) {
if (${o} in input) {
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
...iss,
path: iss.path ? [${o}, ...iss.path] : [${o}]
})));
}
}
if (${n}.value === undefined) {
if (${o} in input) {
newResult[${o}] = undefined;
}
} else {
newResult[${o}] = ${n}.value;
}
`):t.write(`
if (${n}.issues.length) {
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
...iss,
path: iss.path ? [${o}, ...iss.path] : [${o}]
})));
}
if (${n}.value === undefined) {
if (${o} in input) {
newResult[${o}] = undefined;
}
} else {
newResult[${o}] = ${n}.value;
}
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=xe,s=!c.jitless,l=s&&Se.value,u=t.catchall,ee;e._zod.parse=(c,te)=>{ee??=r.value;let ne=c.value;return o(ne)?s&&l&&te?.async===!1&&te.jitless!==!0?(a||=i(t.shape),c=a(c,te),u?ai([],ne,c,te,ee,e):c):n(c,te):(c.issues.push({expected:`object`,code:`invalid_type`,input:ne,inst:e}),c)}});function ci(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ve(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>v(e,r,l())))}),t)}const li=i(`$ZodUnion`,(e,t)=>{x.init(e,t),d(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),d(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),d(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ue(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>ci(t,i,e,a)):ci(s,i,e,a)}});function ui(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>v(e,r,l())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}const di=i(`$ZodXor`,(e,t)=>{li.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>ui(t,i,e,a)):ui(s,i,e,a)}}),fi=i(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,li.init(e,t);let n=e._zod.parse;d(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ce(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!xe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),pi=i(`$ZodIntersection`,(e,t)=>{x.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>hi(e,t,n)):hi(e,i,a)}});function mi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ce(e)&&Ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}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 i=e[r],a=t[r],o=mi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ve(e))return e;let o=mi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const gi=i(`$ZodTuple`,(e,t)=>{x.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length<c-1;if(t||i)return r.issues.push({...t?{code:`too_big`,maximum:n.length,inclusive:!0}:{code:`too_small`,minimum:n.length},input:a,inst:e,origin:`array`}),r}let l=-1;for(let e of n){if(l++,l>=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>_i(e,r,l))):_i(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>_i(e,r,l))):_i(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function _i(e,t,n){e.issues.length&&t.issues.push(..._(n,e.issues)),t.value[n]=e.value}const vi=i(`$ZodRecord`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ce(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(..._(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(..._(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&vn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>v(e,r,l())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(..._(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(..._(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),yi=i(`$ZodMap`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{bi(t,a,n,o,i,e,r)})):bi(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function bi(e,t,n,r,i,a,o){e.issues.length&&(De.has(typeof r)?n.issues.push(..._(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>v(e,o,l()))})),t.issues.length&&(De.has(typeof r)?n.issues.push(..._(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>v(e,o,l()))})),n.value.set(e.value,t.value)}const xi=i(`$ZodSet`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>Si(e,n))):Si(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function Si(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const Ci=i(`$ZodEnum`,(e,t)=>{x.init(e,t);let n=ae(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>De.has(typeof e)).map(e=>typeof e==`string`?m(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),wi=i(`$ZodLiteral`,(e,t)=>{if(x.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?m(e):e?m(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ti=i(`$ZodFile`,(e,t)=>{x.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),Ei=i(`$ZodTransform`,(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new s(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new o;return n.value=i,n}});function Di(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Oi=i(`$ZodOptional`,(e,t)=>{x.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ue(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Di(t,e.value)):Di(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ki=i(`$ZodExactOptional`,(e,t)=>{Oi.init(e,t),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ai=i(`$ZodNullable`,(e,t)=>{x.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ue(e.source)}|null)$`):void 0}),d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ji=i(`$ZodDefault`,(e,t)=>{x.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Mi(e,t)):Mi(r,t)}});function Mi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ni=i(`$ZodPrefault`,(e,t)=>{x.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Pi=i(`$ZodNonOptional`,(e,t)=>{x.init(e,t),d(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Fi(t,e)):Fi(i,e)}});function Fi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Ii=i(`$ZodSuccess`,(e,t)=>{x.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new s(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),Li=i(`$ZodCatch`,(e,t)=>{x.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>v(e,n,l()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>v(e,n,l()))},input:e.value}),e.issues=[]),e)}}),Ri=i(`$ZodNaN`,(e,t)=>{x.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),zi=i(`$ZodPipe`,(e,t)=>{x.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Bi(e,t.in,n)):Bi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Bi(e,t.out,n)):Bi(r,t.out,n)}});function Bi(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Vi=i(`$ZodCodec`,(e,t)=>{x.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hi(e,t,n)):Hi(r,t,n)}{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Hi(e,t,n)):Hi(r,t,n)}}});function Hi(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>Ui(e,r,t.out,n)):Ui(e,r,t.out,n)}{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>Ui(e,r,t.in,n)):Ui(e,r,t.in,n)}}function Ui(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const Wi=i(`$ZodReadonly`,(e,t)=>{x.init(e,t),d(e._zod,`propValues`,()=>t.innerType._zod.propValues),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`optin`,()=>t.innerType?._zod?.optin),d(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gi):Gi(r)}});function Gi(e){return e.value=Object.freeze(e.value),e}const Ki=i(`$ZodTemplateLiteral`,(e,t)=>{x.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||Oe.has(typeof e))n.push(m(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),qi=i(`$ZodFunction`,(e,t)=>(x.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?lt(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?lt(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await dt(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await dt(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(t.value=e._def.output&&e._def.output._zod.def.type===`promise`?e.implementAsync(t.value):e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new gi({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),Ji=i(`$ZodPromise`,(e,t)=>{x.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),Yi=i(`$ZodLazy`,(e,t)=>{x.init(e,t),d(e._zod,`innerType`,()=>t.getter()),d(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),d(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),d(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),d(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Xi=i(`$ZodCustom`,(e,t)=>{b.init(e,t),x.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Zi(t,n,r,e));Zi(i,n,r,e)}});function Zi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ke(e))}}var Qi;const $i=Symbol(`ZodOutput`),ea=Symbol(`ZodInput`);var ta=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),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 na(){return new ta}(Qi=globalThis).__zod_globalRegistry??(Qi.__zod_globalRegistry=na());const C=globalThis.__zod_globalRegistry;function ra(e,t){return new e({type:`string`,...g(t)})}function ia(e,t){return new e({type:`string`,coerce:!0,...g(t)})}function aa(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...g(t)})}function oa(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...g(t)})}function sa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...g(t)})}function ca(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...g(t)})}function la(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...g(t)})}function ua(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...g(t)})}function da(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...g(t)})}function fa(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...g(t)})}function pa(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...g(t)})}function ma(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...g(t)})}function ha(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...g(t)})}function ga(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...g(t)})}function _a(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...g(t)})}function va(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...g(t)})}function ya(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...g(t)})}function ba(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...g(t)})}function xa(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...g(t)})}function Sa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...g(t)})}function Ca(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...g(t)})}function wa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...g(t)})}function Ta(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...g(t)})}function Ea(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...g(t)})}function Da(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...g(t)})}const Oa={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function ka(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...g(t)})}function Aa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...g(t)})}function ja(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...g(t)})}function Ma(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...g(t)})}function Na(e,t){return new e({type:`number`,checks:[],...g(t)})}function Pa(e,t){return new e({type:`number`,coerce:!0,checks:[],...g(t)})}function Fa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...g(t)})}function Ia(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...g(t)})}function La(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...g(t)})}function Ra(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...g(t)})}function za(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...g(t)})}function Ba(e,t){return new e({type:`boolean`,...g(t)})}function Va(e,t){return new e({type:`boolean`,coerce:!0,...g(t)})}function Ha(e,t){return new e({type:`bigint`,...g(t)})}function Ua(e,t){return new e({type:`bigint`,coerce:!0,...g(t)})}function Wa(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...g(t)})}function Ga(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...g(t)})}function Ka(e,t){return new e({type:`symbol`,...g(t)})}function qa(e,t){return new e({type:`undefined`,...g(t)})}function Ja(e,t){return new e({type:`null`,...g(t)})}function Ya(e){return new e({type:`any`})}function Xa(e){return new e({type:`unknown`})}function Za(e,t){return new e({type:`never`,...g(t)})}function Qa(e,t){return new e({type:`void`,...g(t)})}function $a(e,t){return new e({type:`date`,...g(t)})}function eo(e,t){return new e({type:`date`,coerce:!0,...g(t)})}function to(e,t){return new e({type:`nan`,...g(t)})}function no(e,t){return new Un({check:`less_than`,...g(t),value:e,inclusive:!1})}function w(e,t){return new Un({check:`less_than`,...g(t),value:e,inclusive:!0})}function ro(e,t){return new Wn({check:`greater_than`,...g(t),value:e,inclusive:!1})}function T(e,t){return new Wn({check:`greater_than`,...g(t),value:e,inclusive:!0})}function io(e){return ro(0,e)}function ao(e){return no(0,e)}function oo(e){return w(0,e)}function so(e){return T(0,e)}function co(e,t){return new Gn({check:`multiple_of`,...g(t),value:e})}function lo(e,t){return new Jn({check:`max_size`,...g(t),maximum:e})}function uo(e,t){return new Yn({check:`min_size`,...g(t),minimum:e})}function fo(e,t){return new Xn({check:`size_equals`,...g(t),size:e})}function po(e,t){return new Zn({check:`max_length`,...g(t),maximum:e})}function mo(e,t){return new Qn({check:`min_length`,...g(t),minimum:e})}function ho(e,t){return new $n({check:`length_equals`,...g(t),length:e})}function go(e,t){return new tr({check:`string_format`,format:`regex`,...g(t),pattern:e})}function _o(e){return new nr({check:`string_format`,format:`lowercase`,...g(e)})}function vo(e){return new rr({check:`string_format`,format:`uppercase`,...g(e)})}function yo(e,t){return new ir({check:`string_format`,format:`includes`,...g(t),includes:e})}function bo(e,t){return new ar({check:`string_format`,format:`starts_with`,...g(t),prefix:e})}function xo(e,t){return new or({check:`string_format`,format:`ends_with`,...g(t),suffix:e})}function So(e,t,n){return new cr({check:`property`,property:e,schema:t,...g(n)})}function Co(e,t){return new lr({check:`mime_type`,mime:e,...g(t)})}function wo(e){return new ur({check:`overwrite`,tx:e})}function To(e){return wo(t=>t.normalize(e))}function Eo(){return wo(e=>e.trim())}function Do(){return wo(e=>e.toLowerCase())}function Oo(){return wo(e=>e.toUpperCase())}function ko(){return wo(e=>ye(e))}function Ao(e,t,n){return new e({type:`array`,element:t,...g(n)})}function jo(e,t,n){return new e({type:`union`,options:t,...g(n)})}function Mo(e,t,n){return new e({type:`union`,options:t,inclusive:!1,...g(n)})}function No(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,...g(r)})}function Po(e,t,n){return new e({type:`intersection`,left:t,right:n})}function Fo(e,t,n,r){let i=n instanceof x;return new e({type:`tuple`,items:t,rest:i?n:null,...g(i?r:n)})}function Io(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,...g(r)})}function Lo(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,...g(r)})}function Ro(e,t,n){return new e({type:`set`,valueType:t,...g(n)})}function zo(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...g(n)})}function Bo(e,t,n){return new e({type:`enum`,entries:t,...g(n)})}function Vo(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],...g(n)})}function Ho(e,t){return new e({type:`file`,...g(t)})}function Uo(e,t){return new e({type:`transform`,transform:t})}function Wo(e,t){return new e({type:`optional`,innerType:t})}function Go(e,t){return new e({type:`nullable`,innerType:t})}function Ko(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():we(n)}})}function qo(e,t,n){return new e({type:`nonoptional`,innerType:t,...g(n)})}function Jo(e,t){return new e({type:`success`,innerType:t})}function Yo(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function Xo(e,t,n){return new e({type:`pipe`,in:t,out:n})}function Zo(e,t){return new e({type:`readonly`,innerType:t})}function Qo(e,t,n){return new e({type:`template_literal`,parts:t,...g(n)})}function $o(e,t){return new e({type:`lazy`,getter:t})}function es(e,t){return new e({type:`promise`,innerType:t})}function ts(e,t,n){let r=g(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ns(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...g(n)})}function rs(e){let t=is(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Ke(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Ke(r))}},e(n.value,n)));return t}function is(e,t){let n=new b({check:`custom`,...g(t)});return n._zod.check=e,n}function as(e){let t=new b({check:`describe`});return t._zod.onattach=[t=>{let n=C.get(t)??{};C.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function os(e){let t=new b({check:`meta`});return t._zod.onattach=[t=>{let n=C.get(t)??{};C.add(t,{...n,...e})}],t._zod.check=()=>{},t}function ss(e,t){let n=g(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??Vi,c=e.Boolean??Wr,l=new s({type:`pipe`,in:new(e.String??pr)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:!o.has(r)&&(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function cs(e,t,n,r={}){let i=g(r),a={...g(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function ls(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??C,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function E(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,E(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&D(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function us(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ds(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ps(t,`input`,e.processors),output:ps(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function D(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 D(r.element,n);if(r.type===`set`)return D(r.valueType,n);if(r.type===`lazy`)return D(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`)return D(r.innerType,n);if(r.type===`intersection`)return D(r.left,n)||D(r.right,n);if(r.type===`record`||r.type===`map`)return D(r.keyType,n)||D(r.valueType,n);if(r.type===`pipe`)return D(r.in,n)||D(r.out,n);if(r.type===`object`){for(let e in r.shape)if(D(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(D(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(D(e,n))return!0;return!!(r.rest&&D(r.rest,n))}return!1}const fs=(e,t={})=>n=>{let r=ls({...n,processors:t});return E(e,r),us(r,e),ds(r,e)},ps=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ls({...i??{},target:a,io:t,processors:n});return E(e,o),us(o,e),ds(o,e)},ms={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hs=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ms[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},gs=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},_s=(e,t,n,r)=>{n.type=`boolean`},vs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},ys=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},bs=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},xs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Ss=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Cs=(e,t,n,r)=>{n.not={}},ws=(e,t,n,r)=>{},Ts=(e,t,n,r)=>{},Es=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Ds=(e,t,n,r)=>{let i=e._zod.def,a=ae(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Os=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ks=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},As=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},js=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Ms=(e,t,n,r)=>{n.type=`boolean`},Ns=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ps=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Fs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Is=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Ls=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Rs=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=E(a.element,t,{...r,path:[...r.path,`items`]})},zs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=E(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=E(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bs=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>E(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vs=(e,t,n,r)=>{let i=e._zod.def,a=E(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=E(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Hs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>E(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?E(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:ee}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof ee==`number`&&(i.maxItems=ee)},Us=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=E(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=E(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=E(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ws=(e,t,n,r)=>{let i=e._zod.def,a=E(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Gs=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ks=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qs=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Js=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ys=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;E(a,t,r);let o=t.seen.get(e);o.ref=a},Xs=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Zs=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qs=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$s=(e,t,n,r)=>{let i=e._zod.innerType;E(i,t,r);let a=t.seen.get(e);a.ref=i},ec={string:hs,number:gs,boolean:_s,bigint:vs,symbol:ys,null:bs,undefined:xs,void:Ss,never:Cs,any:ws,unknown:Ts,date:Es,enum:Ds,literal:Os,nan:ks,template_literal:As,file:js,success:Ms,custom:Ns,function:Ps,transform:Fs,map:Is,set:Ls,array:Rs,object:zs,union:Bs,intersection:Vs,tuple:Hs,record:Us,nullable:Ws,nonoptional:Gs,default:Ks,prefault:qs,catch:Js,pipe:Ys,readonly:Xs,promise:Zs,optional:Qs,lazy:$s};function tc(e,t){if(`_idmap`in e){let n=e,r=ls({...t,processors:ec}),i={};for(let e of n._idmap.entries()){let[t,n]=e;E(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;us(r,n),a[t]=ds(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ls({...t,processors:ec});return E(e,n),us(n,e),ds(n,e)}var nc=e({ZodISODate:()=>ac,ZodISODateTime:()=>rc,ZodISODuration:()=>lc,ZodISOTime:()=>sc,date:()=>oc,datetime:()=>ic,duration:()=>uc,time:()=>cc});const rc=i(`ZodISODateTime`,(e,t)=>{Tr.init(e,t),j.init(e,t)});function ic(e){return ka(rc,e)}const ac=i(`ZodISODate`,(e,t)=>{Er.init(e,t),j.init(e,t)});function oc(e){return Aa(ac,e)}const sc=i(`ZodISOTime`,(e,t)=>{Dr.init(e,t),j.init(e,t)});function cc(e){return ja(sc,e)}const lc=i(`ZodISODuration`,(e,t)=>{Or.init(e,t),j.init(e,t)});function uc(e){return Ma(lc,e)}const dc=(e,t)=>{nt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>it(e,t)},flatten:{value:t=>rt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,se,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,se,2)}},isEmpty:{get(){return e.issues.length===0}}})},fc=i(`ZodError`,dc),O=i(`ZodError`,dc,{Parent:Error}),pc=ct(O),mc=ut(O),hc=ft(O),gc=mt(O),_c=gt(O),vc=vt(O),yc=bt(O),bc=St(O),xc=wt(O),Sc=Et(O),Cc=Ot(O),wc=At(O);var Tc=e({ZodAny:()=>Bl,ZodArray:()=>Jl,ZodBase64:()=>ll,ZodBase64URL:()=>dl,ZodBigInt:()=>Al,ZodBigIntFormat:()=>Ml,ZodBoolean:()=>kl,ZodCIDRv4:()=>al,ZodCIDRv6:()=>sl,ZodCUID:()=>Uc,ZodCUID2:()=>Gc,ZodCatch:()=>Ru,ZodCodec:()=>Wu,ZodCustom:()=>nd,ZodCustomStringFormat:()=>_l,ZodDate:()=>Kl,ZodDefault:()=>Au,ZodDiscriminatedUnion:()=>ru,ZodE164:()=>pl,ZodEmail:()=>Oc,ZodEmoji:()=>zc,ZodEnum:()=>gu,ZodExactOptional:()=>Tu,ZodFile:()=>yu,ZodFunction:()=>ed,ZodGUID:()=>Ac,ZodIPv4:()=>$c,ZodIPv6:()=>rl,ZodIntersection:()=>au,ZodJWT:()=>hl,ZodKSUID:()=>Zc,ZodLazy:()=>Xu,ZodLiteral:()=>vu,ZodMAC:()=>tl,ZodMap:()=>fu,ZodNaN:()=>Bu,ZodNanoID:()=>Vc,ZodNever:()=>Hl,ZodNonOptional:()=>Pu,ZodNull:()=>Rl,ZodNullable:()=>Du,ZodNumber:()=>Sl,ZodNumberFormat:()=>Cl,ZodObject:()=>Xl,ZodOptional:()=>Cu,ZodPipe:()=>Hu,ZodPrefault:()=>Mu,ZodPromise:()=>Qu,ZodReadonly:()=>Ku,ZodRecord:()=>lu,ZodSet:()=>mu,ZodString:()=>Dc,ZodStringFormat:()=>j,ZodSuccess:()=>Iu,ZodSymbol:()=>Fl,ZodTemplateLiteral:()=>Ju,ZodTransform:()=>xu,ZodTuple:()=>su,ZodType:()=>k,ZodULID:()=>qc,ZodURL:()=>Ic,ZodUUID:()=>M,ZodUndefined:()=>Ll,ZodUnion:()=>$l,ZodUnknown:()=>Vl,ZodVoid:()=>Wl,ZodXID:()=>Yc,ZodXor:()=>tu,_ZodString:()=>Ec,_default:()=>ju,_function:()=>td,any:()=>I,array:()=>R,base64:()=>ul,base64url:()=>fl,bigint:()=>jl,boolean:()=>P,catch:()=>zu,check:()=>rd,cidrv4:()=>ol,cidrv6:()=>cl,codec:()=>Gu,cuid:()=>Wc,cuid2:()=>Kc,custom:()=>id,date:()=>ql,describe:()=>sd,discriminatedUnion:()=>iu,e164:()=>ml,email:()=>kc,emoji:()=>Bc,enum:()=>V,exactOptional:()=>Eu,file:()=>bu,float32:()=>Tl,float64:()=>El,function:()=>td,guid:()=>jc,hash:()=>xl,hex:()=>bl,hostname:()=>yl,httpUrl:()=>Rc,instanceof:()=>ld,int:()=>wl,int32:()=>Dl,int64:()=>Nl,intersection:()=>ou,ipv4:()=>el,ipv6:()=>il,json:()=>dd,jwt:()=>gl,keyof:()=>Yl,ksuid:()=>Qc,lazy:()=>Zu,literal:()=>H,looseObject:()=>Ql,looseRecord:()=>du,mac:()=>nl,map:()=>pu,meta:()=>cd,nan:()=>Vu,nanoid:()=>Hc,nativeEnum:()=>_u,never:()=>Ul,nonoptional:()=>Fu,null:()=>zl,nullable:()=>Ou,nullish:()=>ku,number:()=>N,object:()=>z,optional:()=>wu,partialRecord:()=>uu,pipe:()=>Uu,prefault:()=>Nu,preprocess:()=>fd,promise:()=>$u,readonly:()=>qu,record:()=>B,refine:()=>ad,set:()=>hu,strictObject:()=>Zl,string:()=>A,stringFormat:()=>vl,stringbool:()=>ud,success:()=>Lu,superRefine:()=>od,symbol:()=>Il,templateLiteral:()=>Yu,transform:()=>Su,tuple:()=>cu,uint32:()=>Ol,uint64:()=>Pl,ulid:()=>Jc,undefined:()=>F,union:()=>eu,unknown:()=>L,url:()=>Lc,uuid:()=>Mc,uuidv4:()=>Nc,uuidv6:()=>Pc,uuidv7:()=>Fc,void:()=>Gl,xid:()=>Xc,xor:()=>nu});const k=i(`ZodType`,(e,t)=>(x.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ps(e,`input`),output:ps(e,`output`)}}),e.toJSONSchema=fs(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(p(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>h(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>pc(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>hc(e,t,n),e.parseAsync=async(t,n)=>mc(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>gc(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>_c(e,t,n),e.decode=(t,n)=>vc(e,t,n),e.encodeAsync=async(t,n)=>yc(e,t,n),e.decodeAsync=async(t,n)=>bc(e,t,n),e.safeEncode=(t,n)=>xc(e,t,n),e.safeDecode=(t,n)=>Sc(e,t,n),e.safeEncodeAsync=async(t,n)=>Cc(e,t,n),e.safeDecodeAsync=async(t,n)=>wc(e,t,n),e.refine=(t,n)=>e.check(ad(t,n)),e.superRefine=t=>e.check(od(t)),e.overwrite=t=>e.check(wo(t)),e.optional=()=>wu(e),e.exactOptional=()=>Eu(e),e.nullable=()=>Ou(e),e.nullish=()=>wu(Ou(e)),e.nonoptional=t=>Fu(e,t),e.array=()=>R(e),e.or=t=>eu([e,t]),e.and=t=>ou(e,t),e.transform=t=>Uu(e,Su(t)),e.default=t=>ju(e,t),e.prefault=t=>Nu(e,t),e.catch=t=>zu(e,t),e.pipe=t=>Uu(e,t),e.readonly=()=>qu(e),e.describe=t=>{let n=e.clone();return C.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return C.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return C.get(e);let n=e.clone();return C.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Ec=i(`_ZodString`,(e,t)=>{pr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(go(...t)),e.includes=(...t)=>e.check(yo(...t)),e.startsWith=(...t)=>e.check(bo(...t)),e.endsWith=(...t)=>e.check(xo(...t)),e.min=(...t)=>e.check(mo(...t)),e.max=(...t)=>e.check(po(...t)),e.length=(...t)=>e.check(ho(...t)),e.nonempty=(...t)=>e.check(mo(1,...t)),e.lowercase=t=>e.check(_o(t)),e.uppercase=t=>e.check(vo(t)),e.trim=()=>e.check(Eo()),e.normalize=(...t)=>e.check(To(...t)),e.toLowerCase=()=>e.check(Do()),e.toUpperCase=()=>e.check(Oo()),e.slugify=()=>e.check(ko())}),Dc=i(`ZodString`,(e,t)=>{pr.init(e,t),Ec.init(e,t),e.email=t=>e.check(aa(Oc,t)),e.url=t=>e.check(da(Ic,t)),e.jwt=t=>e.check(Da(hl,t)),e.emoji=t=>e.check(fa(zc,t)),e.guid=t=>e.check(oa(Ac,t)),e.uuid=t=>e.check(sa(M,t)),e.uuidv4=t=>e.check(ca(M,t)),e.uuidv6=t=>e.check(la(M,t)),e.uuidv7=t=>e.check(ua(M,t)),e.nanoid=t=>e.check(pa(Vc,t)),e.guid=t=>e.check(oa(Ac,t)),e.cuid=t=>e.check(ma(Uc,t)),e.cuid2=t=>e.check(ha(Gc,t)),e.ulid=t=>e.check(ga(qc,t)),e.base64=t=>e.check(wa(ll,t)),e.base64url=t=>e.check(Ta(dl,t)),e.xid=t=>e.check(_a(Yc,t)),e.ksuid=t=>e.check(va(Zc,t)),e.ipv4=t=>e.check(ya($c,t)),e.ipv6=t=>e.check(ba(rl,t)),e.cidrv4=t=>e.check(Sa(al,t)),e.cidrv6=t=>e.check(Ca(sl,t)),e.e164=t=>e.check(Ea(pl,t)),e.datetime=t=>e.check(ic(t)),e.date=t=>e.check(oc(t)),e.time=t=>e.check(cc(t)),e.duration=t=>e.check(uc(t))});function A(e){return ra(Dc,e)}const j=i(`ZodStringFormat`,(e,t)=>{S.init(e,t),Ec.init(e,t)}),Oc=i(`ZodEmail`,(e,t)=>{gr.init(e,t),j.init(e,t)});function kc(e){return aa(Oc,e)}const Ac=i(`ZodGUID`,(e,t)=>{mr.init(e,t),j.init(e,t)});function jc(e){return oa(Ac,e)}const M=i(`ZodUUID`,(e,t)=>{hr.init(e,t),j.init(e,t)});function Mc(e){return sa(M,e)}function Nc(e){return ca(M,e)}function Pc(e){return la(M,e)}function Fc(e){return ua(M,e)}const Ic=i(`ZodURL`,(e,t)=>{_r.init(e,t),j.init(e,t)});function Lc(e){return da(Ic,e)}function Rc(e){return da(Ic,{protocol:/^https?$/,hostname:cn,...g(e)})}const zc=i(`ZodEmoji`,(e,t)=>{vr.init(e,t),j.init(e,t)});function Bc(e){return fa(zc,e)}const Vc=i(`ZodNanoID`,(e,t)=>{yr.init(e,t),j.init(e,t)});function Hc(e){return pa(Vc,e)}const Uc=i(`ZodCUID`,(e,t)=>{br.init(e,t),j.init(e,t)});function Wc(e){return ma(Uc,e)}const Gc=i(`ZodCUID2`,(e,t)=>{xr.init(e,t),j.init(e,t)});function Kc(e){return ha(Gc,e)}const qc=i(`ZodULID`,(e,t)=>{Sr.init(e,t),j.init(e,t)});function Jc(e){return ga(qc,e)}const Yc=i(`ZodXID`,(e,t)=>{Cr.init(e,t),j.init(e,t)});function Xc(e){return _a(Yc,e)}const Zc=i(`ZodKSUID`,(e,t)=>{wr.init(e,t),j.init(e,t)});function Qc(e){return va(Zc,e)}const $c=i(`ZodIPv4`,(e,t)=>{kr.init(e,t),j.init(e,t)});function el(e){return ya($c,e)}const tl=i(`ZodMAC`,(e,t)=>{jr.init(e,t),j.init(e,t)});function nl(e){return xa(tl,e)}const rl=i(`ZodIPv6`,(e,t)=>{Ar.init(e,t),j.init(e,t)});function il(e){return ba(rl,e)}const al=i(`ZodCIDRv4`,(e,t)=>{Mr.init(e,t),j.init(e,t)});function ol(e){return Sa(al,e)}const sl=i(`ZodCIDRv6`,(e,t)=>{Nr.init(e,t),j.init(e,t)});function cl(e){return Ca(sl,e)}const ll=i(`ZodBase64`,(e,t)=>{Fr.init(e,t),j.init(e,t)});function ul(e){return wa(ll,e)}const dl=i(`ZodBase64URL`,(e,t)=>{Lr.init(e,t),j.init(e,t)});function fl(e){return Ta(dl,e)}const pl=i(`ZodE164`,(e,t)=>{Rr.init(e,t),j.init(e,t)});function ml(e){return Ea(pl,e)}const hl=i(`ZodJWT`,(e,t)=>{Br.init(e,t),j.init(e,t)});function gl(e){return Da(hl,e)}const _l=i(`ZodCustomStringFormat`,(e,t)=>{Vr.init(e,t),j.init(e,t)});function vl(e,t,n={}){return cs(_l,e,t,n)}function yl(e){return cs(_l,`hostname`,sn,e)}function bl(e){return cs(_l,`hex`,wn,e)}function xl(e,t){let n=`${e}_${t?.enc??`hex`}`,r=Mt[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return cs(_l,n,r,t)}const Sl=i(`ZodNumber`,(e,t)=>{Hr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gs(e,t,n,r),e.gt=(t,n)=>e.check(ro(t,n)),e.gte=(t,n)=>e.check(T(t,n)),e.min=(t,n)=>e.check(T(t,n)),e.lt=(t,n)=>e.check(no(t,n)),e.lte=(t,n)=>e.check(w(t,n)),e.max=(t,n)=>e.check(w(t,n)),e.int=t=>e.check(wl(t)),e.safe=t=>e.check(wl(t)),e.positive=t=>e.check(ro(0,t)),e.nonnegative=t=>e.check(T(0,t)),e.negative=t=>e.check(no(0,t)),e.nonpositive=t=>e.check(w(0,t)),e.multipleOf=(t,n)=>e.check(co(t,n)),e.step=(t,n)=>e.check(co(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function N(e){return Na(Sl,e)}const Cl=i(`ZodNumberFormat`,(e,t)=>{Ur.init(e,t),Sl.init(e,t)});function wl(e){return Fa(Cl,e)}function Tl(e){return Ia(Cl,e)}function El(e){return La(Cl,e)}function Dl(e){return Ra(Cl,e)}function Ol(e){return za(Cl,e)}const kl=i(`ZodBoolean`,(e,t)=>{Wr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r)});function P(e){return Ba(kl,e)}const Al=i(`ZodBigInt`,(e,t)=>{Gr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r),e.gte=(t,n)=>e.check(T(t,n)),e.min=(t,n)=>e.check(T(t,n)),e.gt=(t,n)=>e.check(ro(t,n)),e.gte=(t,n)=>e.check(T(t,n)),e.min=(t,n)=>e.check(T(t,n)),e.lt=(t,n)=>e.check(no(t,n)),e.lte=(t,n)=>e.check(w(t,n)),e.max=(t,n)=>e.check(w(t,n)),e.positive=t=>e.check(ro(BigInt(0),t)),e.negative=t=>e.check(no(BigInt(0),t)),e.nonpositive=t=>e.check(w(BigInt(0),t)),e.nonnegative=t=>e.check(T(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(co(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function jl(e){return Ha(Al,e)}const Ml=i(`ZodBigIntFormat`,(e,t)=>{Kr.init(e,t),Al.init(e,t)});function Nl(e){return Wa(Ml,e)}function Pl(e){return Ga(Ml,e)}const Fl=i(`ZodSymbol`,(e,t)=>{qr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r)});function Il(e){return Ka(Fl,e)}const Ll=i(`ZodUndefined`,(e,t)=>{Jr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r)});function F(e){return qa(Ll,e)}const Rl=i(`ZodNull`,(e,t)=>{Yr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r)});function zl(e){return Ja(Rl,e)}const Bl=i(`ZodAny`,(e,t)=>{Xr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function I(){return Ya(Bl)}const Vl=i(`ZodUnknown`,(e,t)=>{Zr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function L(){return Xa(Vl)}const Hl=i(`ZodNever`,(e,t)=>{Qr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,t,n,r)});function Ul(e){return Za(Hl,e)}const Wl=i(`ZodVoid`,(e,t)=>{$r.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ss(e,t,n,r)});function Gl(e){return Qa(Wl,e)}const Kl=i(`ZodDate`,(e,t)=>{ei.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.min=(t,n)=>e.check(T(t,n)),e.max=(t,n)=>e.check(w(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function ql(e){return $a(Kl,e)}const Jl=i(`ZodArray`,(e,t)=>{ni.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(mo(t,n)),e.nonempty=t=>e.check(mo(1,t)),e.max=(t,n)=>e.check(po(t,n)),e.length=(t,n)=>e.check(ho(t,n)),e.unwrap=()=>e.element});function R(e,t){return Ao(Jl,e,t)}function Yl(e){let t=e._zod.def.shape;return V(Object.keys(t))}const Xl=i(`ZodObject`,(e,t)=>{si.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zs(e,t,n,r),d(e,`shape`,()=>t.shape),e.keyof=()=>V(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:L()}),e.loose=()=>e.clone({...e._zod.def,catchall:L()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ul()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ie(e,t),e.safeExtend=t=>Le(e,t),e.merge=t=>Re(e,t),e.pick=t=>Pe(e,t),e.omit=t=>Fe(e,t),e.partial=(...t)=>ze(Cu,e,t[0]),e.required=(...t)=>Be(Pu,e,t[0])});function z(e,t){let n={type:`object`,shape:e??{},...g(t)};return new Xl(n)}function Zl(e,t){return new Xl({type:`object`,shape:e,catchall:Ul(),...g(t)})}function Ql(e,t){return new Xl({type:`object`,shape:e,catchall:L(),...g(t)})}const $l=i(`ZodUnion`,(e,t)=>{li.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r),e.options=t.options});function eu(e,t){return new $l({type:`union`,options:e,...g(t)})}const tu=i(`ZodXor`,(e,t)=>{$l.init(e,t),di.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r),e.options=t.options});function nu(e,t){return new tu({type:`union`,options:e,inclusive:!1,...g(t)})}const ru=i(`ZodDiscriminatedUnion`,(e,t)=>{$l.init(e,t),fi.init(e,t)});function iu(e,t,n){return new ru({type:`union`,options:t,discriminator:e,...g(n)})}const au=i(`ZodIntersection`,(e,t)=>{pi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r)});function ou(e,t){return new au({type:`intersection`,left:e,right:t})}const su=i(`ZodTuple`,(e,t)=>{gi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function cu(e,t,n){let r=t instanceof x;return new su({type:`tuple`,items:e,rest:r?t:null,...g(r?n:t)})}const lu=i(`ZodRecord`,(e,t)=>{vi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return new lu({type:`record`,keyType:e,valueType:t,...g(n)})}function uu(e,t,n){let r=h(e);return r._zod.values=void 0,new lu({type:`record`,keyType:r,valueType:t,...g(n)})}function du(e,t,n){return new lu({type:`record`,keyType:e,valueType:t,mode:`loose`,...g(n)})}const fu=i(`ZodMap`,(e,t)=>{yi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(uo(...t)),e.nonempty=t=>e.check(uo(1,t)),e.max=(...t)=>e.check(lo(...t)),e.size=(...t)=>e.check(fo(...t))});function pu(e,t,n){return new fu({type:`map`,keyType:e,valueType:t,...g(n)})}const mu=i(`ZodSet`,(e,t)=>{xi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.min=(...t)=>e.check(uo(...t)),e.nonempty=t=>e.check(uo(1,t)),e.max=(...t)=>e.check(lo(...t)),e.size=(...t)=>e.check(fo(...t))});function hu(e,t){return new mu({type:`set`,valueType:e,...g(t)})}const gu=i(`ZodEnum`,(e,t)=>{Ci.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gu({...t,checks:[],...g(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gu({...t,checks:[],...g(r),entries:i})}});function V(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new gu({type:`enum`,entries:n,...g(t)})}function _u(e,t){return new gu({type:`enum`,entries:e,...g(t)})}const vu=i(`ZodLiteral`,(e,t)=>{wi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function H(e,t){return new vu({type:`literal`,values:Array.isArray(e)?e:[e],...g(t)})}const yu=i(`ZodFile`,(e,t)=>{Ti.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.min=(t,n)=>e.check(uo(t,n)),e.max=(t,n)=>e.check(lo(t,n)),e.mime=(t,n)=>e.check(Co(Array.isArray(t)?t:[t],n))});function bu(e){return Ho(yu,e)}const xu=i(`ZodTransform`,(e,t)=>{Ei.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new s(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ke(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ke(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Su(e){return new xu({type:`transform`,transform:e})}const Cu=i(`ZodOptional`,(e,t)=>{Oi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wu(e){return new Cu({type:`optional`,innerType:e})}const Tu=i(`ZodExactOptional`,(e,t)=>{ki.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eu(e){return new Tu({type:`optional`,innerType:e})}const Du=i(`ZodNullable`,(e,t)=>{Ai.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ws(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ou(e){return new Du({type:`nullable`,innerType:e})}function ku(e){return wu(Ou(e))}const Au=i(`ZodDefault`,(e,t)=>{ji.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ju(e,t){return new Au({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Mu=i(`ZodPrefault`,(e,t)=>{Ni.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nu(e,t){return new Mu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Pu=i(`ZodNonOptional`,(e,t)=>{Pi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fu(e,t){return new Pu({type:`nonoptional`,innerType:e,...g(t)})}const Iu=i(`ZodSuccess`,(e,t)=>{Ii.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new Iu({type:`success`,innerType:e})}const Ru=i(`ZodCatch`,(e,t)=>{Li.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zu(e,t){return new Ru({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Bu=i(`ZodNaN`,(e,t)=>{Ri.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r)});function Vu(e){return to(Bu,e)}const Hu=i(`ZodPipe`,(e,t)=>{zi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ys(e,t,n,r),e.in=t.in,e.out=t.out});function Uu(e,t){return new Hu({type:`pipe`,in:e,out:t})}const Wu=i(`ZodCodec`,(e,t)=>{Hu.init(e,t),Vi.init(e,t)});function Gu(e,t,n){return new Wu({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const Ku=i(`ZodReadonly`,(e,t)=>{Wi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qu(e){return new Ku({type:`readonly`,innerType:e})}const Ju=i(`ZodTemplateLiteral`,(e,t)=>{Ki.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r)});function Yu(e,t){return new Ju({type:`template_literal`,parts:e,...g(t)})}const Xu=i(`ZodLazy`,(e,t)=>{Yi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Zu(e){return new Xu({type:`lazy`,getter:e})}const Qu=i(`ZodPromise`,(e,t)=>{Ji.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new Qu({type:`promise`,innerType:e})}const ed=i(`ZodFunction`,(e,t)=>{qi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r)});function td(e){return new ed({type:`function`,input:Array.isArray(e?.input)?cu(e?.input):e?.input??R(L()),output:e?.output??L()})}const nd=i(`ZodCustom`,(e,t)=>{Xi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r)});function rd(e){let t=new b({check:`custom`});return t._zod.check=e,t}function id(e,t){return ts(nd,e??(()=>!0),t)}function ad(e,t={}){return ns(nd,e,t)}function od(e){return rs(e)}const sd=as,cd=os;function ld(e,t={}){let n=new nd({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...g(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const ud=(...e)=>ss({Codec:Wu,Boolean:kl,String:Dc},...e);function dd(e){let t=Zu(()=>eu([A(e),N(),P(),zl(),R(t),B(A(),t)]));return t}function fd(e,t){return Uu(Su(e),t)}var pd=e({bigint:()=>_d,boolean:()=>gd,date:()=>U,number:()=>hd,string:()=>md});function md(e){return ia(Dc,e)}function hd(e){return Pa(Sl,e)}function gd(e){return Va(kl,e)}function _d(e){return Ua(Al,e)}function U(e){return eo(Kl,e)}const vd=`$rootRunId`,yd=`$parentRunId`,bd=`$retention`,xd=`default`,Sd=/^(?:0|[1-9]\d*)$/;function Cd(e){let t=e?.[bd];return t===void 0?{mode:`default`,wellFormed:!1,unsupported:!1}:Sd.test(t)?t===`0`?{mode:`none`,raw:t,wellFormed:!0,unsupported:!1}:{mode:`default`,raw:t,wellFormed:!0,unsupported:!0}:{mode:`default`,raw:t,wellFormed:!1,unsupported:t!==xd}}const wd=new TextEncoder;var W=class extends Error{constructor(e){super(e),this.name=`AttributeValidationError`}};function Td(e,t){if(typeof e!=`string`)throw new W(`Attribute key must be a string, got ${typeof e}`);if(e.length===0)throw new W(`Attribute key must not be empty`);if(e.length>256)throw new W(`Attribute key length ${e.length} exceeds limit 256: ${JSON.stringify(e.slice(0,32))}…`);if(!t&&e.startsWith(`$`))throw new W(`Attribute key ${JSON.stringify(e)} starts with reserved prefix "\$" — that namespace is reserved for framework/library code. Set { allowReservedAttributes: true } only if your caller is framework-level.`)}function Ed(e){if(e!==null&&typeof e!=`string`)throw new W(`Attribute value must be a string or null, got ${typeof e}`);if(e===null)return;let t=wd.encode(e).length;if(t>256)throw new W(`Attribute value byte length ${t} exceeds limit 256`)}function Dd(e,t,n){return t===null?n?.has(e)?-1:0:+(n===void 0||!n.has(e))}function Od(e,t={}){let n=new Set,r=t.existingKeys===void 0?void 0:t.existingKeys instanceof Set?t.existingKeys:new Set(t.existingKeys),i=r?.size??0;for(let{key:t,value:a}of e){if(n.has(t))throw new W(`Attribute key ${JSON.stringify(t)} appears more than once in the same batch`);n.add(t),i+=Dd(t,a,r)}if(i>64)throw new W(`Run attribute count would exceed limit 64 (post-merge ${i})`)}function kd(e,t={}){for(let{key:n,value:r}of e)Td(n,t.allowReservedAttributes===!0),Ed(r);Od(e,t)}function Ad(e,t){let n={...e??{}};for(let{key:e,value:r}of t)r===null?delete n[e]:n[e]=r;return n}const jd=new TextEncoder,Md=A().min(1,{error:`Attribute key must not be empty`}).max(256,{error:`Attribute key exceeds limit 256`}),Nd=A().refine(e=>jd.encode(e).length<=256,{error:`Attribute value exceeds limit 256 UTF-8 bytes`}).nullable(),Pd=R(z({key:Md,value:Nd})).superRefine((e,t)=>{try{Od(e)}catch(n){if(!(n instanceof W))throw n;t.addIssue({code:`custom`,message:n.message,input:e})}});function Fd(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Id(e){return e.eventType===`noop`}const Ld={attr_set:`attr_set`,step_created:`step_created`,step_started:`step_started`,step_retrying:`step_retrying`,step_completed:`step_terminal`,step_failed:`step_terminal`,wait_created:`wait_created`,wait_completed:`wait_completed`,hook_created:`hook_created`,hook_disposed:`hook_disposed`,run_started:`run_started`};function Rd(e){return Fd(Ld,e)}function zd(e){let t=Rd(e.eventType);if(t!==void 0)return t===`run_started`?{eventClass:t,entity:``}:e.correlationId?{eventClass:t,entity:e.correlationId}:void 0}const Bd={run_created:[`input`],run_started:[`input`],run_completed:[`output`],run_failed:[`error`],step_created:[`input`],step_started:[`input`],step_completed:[`result`],step_failed:[`error`],step_retrying:[`error`],hook_created:[`metadata`],hook_received:[`payload`]},Vd=[];function Hd(e){return Fd(Bd,e)??Vd}function Ud(e){return Hd(e)[0]}const G=eu([ld(Uint8Array),I()]),K=V([`run_created`,`run_started`,`run_completed`,`run_failed`,`run_cancelled`,`attr_set`,`step_created`,`step_completed`,`step_failed`,`step_retrying`,`step_started`,`hook_created`,`hook_received`,`hook_disposed`,`hook_conflict`,`wait_created`,`wait_completed`,`noop`]);K.extract([`run_created`,`run_started`,`run_completed`,`run_failed`,`run_cancelled`]).options;const Wd=K.extract([`run_completed`,`run_failed`,`run_cancelled`]).options;function Gd(e){return Wd.includes(e)}const Kd=K.extract([`step_created`,`step_completed`,`step_failed`,`step_retrying`,`step_started`]).options;function qd(e){return Kd.includes(e)}K.extract([`step_completed`,`step_failed`]).options;const Jd=K.extract([`hook_created`,`hook_received`,`hook_disposed`]).options;function Yd(e){return Jd.includes(e)}const Xd=K.extract([`hook_disposed`,`hook_received`]).options;function Zd(e){return Xd.includes(e)}K.extract([`wait_created`,`wait_completed`]).options;const Qd=K.extract([`step_created`,`hook_created`,`wait_created`]).options;function $d(e){return Qd.includes(e)}function ef(e,t){if(t!==`none`||!(`eventData`in e))return e;let n=e.eventData;if(!n||typeof n!=`object`){let{eventData:t,...n}=e;return n}let r=Hd(e.eventType);if(r.length===0)return e;let i={...n};for(let e of r)delete i[e];let{eventData:a,...o}=e;return{...o,...Object.keys(i).length>0?{eventData:i}:{}}}const q=z({eventType:K,correlationId:A().optional(),specVersion:N().optional()}),tf={ttfs:N().optional(),stso:N().optional(),stepCount:N().int().positive().optional(),eventCount:N().int().positive().optional(),rsfs:N().optional(),finalSchedulingReplay:N().optional(),optimizations:R(A()).optional()},nf=q.extend({eventType:H(`step_completed`),correlationId:A(),eventData:z({stepName:A().optional(),workflowName:A().optional(),result:G,...tf})}),rf=q.extend({eventType:H(`step_failed`),correlationId:A(),eventData:z({stepName:A().optional(),error:G,...tf})}),af=q.extend({eventType:H(`step_retrying`),correlationId:A(),eventData:z({stepName:A().optional(),error:G,retryAfter:U().optional()})}),of=q.extend({eventType:H(`step_started`),correlationId:A(),eventData:z({stepName:A().optional(),attempt:N().optional(),workflowName:A().optional(),input:G.optional(),ownerMessageId:A().optional()}).optional()}),sf=q.extend({eventType:H(`step_created`),correlationId:A(),eventData:z({stepName:A(),workflowName:A().optional(),input:G})}),cf=q.extend({eventType:H(`hook_created`),correlationId:A(),eventData:z({token:A(),tokenRetentionUntil:U().optional(),metadata:G.optional(),isWebhook:P().optional(),isSystem:P().optional()})}),lf=q.extend({eventType:H(`hook_received`),correlationId:A(),eventData:z({token:A().optional(),payload:G})}),uf=q.extend({eventType:H(`hook_disposed`),correlationId:A(),eventData:z({token:A().optional()}).optional()}),df=q.extend({eventType:H(`hook_conflict`),correlationId:A(),eventData:z({token:A(),conflictingRunId:A().optional()})}),ff=q.extend({eventType:H(`noop`),eventData:z({sealed:P().optional()}).passthrough().optional()}),pf=q.extend({eventType:H(`wait_created`),correlationId:A(),eventData:z({resumeAt:U()})}),mf=q.extend({eventType:H(`wait_completed`),correlationId:A(),eventData:z({resumeAt:U().optional()}).optional()}),hf=iu(`type`,[z({type:H(`workflow`)}),z({type:H(`step`),stepId:A(),attempt:N()})]),gf=q.extend({eventType:H(`attr_set`),correlationId:A().optional(),eventData:z({changes:Pd,writer:hf,allowReservedAttributes:H(!0).optional()})}),_f=q.extend({eventType:H(`run_created`),eventData:z({deploymentId:A(),workflowName:A(),input:G,executionContext:B(A(),I()).optional(),attributes:B(A(),A()).optional(),allowReservedAttributes:H(!0).optional(),encryptionPublicKey:A().optional()})}),vf=q.extend({eventType:H(`run_started`),eventData:z({input:G.optional(),deploymentId:A().optional(),workflowName:A().optional(),executionContext:B(A(),I()).optional(),attributes:B(A(),A()).optional(),allowReservedAttributes:H(!0).optional(),encryptionPublicKey:A().optional()}).optional()}),yf=q.extend({eventType:H(`run_completed`),eventData:z({output:G.optional()})}),bf=q.extend({eventType:H(`run_failed`),eventData:z({error:G,errorCode:A().optional()})}),xf=q.extend({eventType:H(`run_cancelled`),eventData:z({cancelReason:A().max(512).optional()}).optional()});iu(`eventType`,[_f,vf,yf,bf,xf,gf,sf,nf,rf,af,of,cf,lf,uf,pf,mf]);const Sf=iu(`eventType`,[_f,vf,yf,bf,xf,gf,sf,nf,rf,af,of,cf,lf,uf,df,pf,mf,ff]).and(z({runId:A(),eventId:A(),createdAt:U(),occurredAt:U().optional(),specVersion:N().optional(),resumeId:A().optional()}));function Cf(e){return $d(e.eventType)?!0:e.eventType===`step_started`&&typeof e.eventData?.stepName==`string`&&e.eventData.input!==void 0}const wf=V([`pending`,`running`,`completed`,`failed`,`cancelled`]),Tf=wf.extract([`completed`,`failed`,`cancelled`]).options;function Ef(e){return Tf.includes(e)}const Df=z({runId:A(),status:wf,deploymentId:A(),workflowName:A(),specVersion:N().optional(),executionContext:B(A(),I()).optional(),input:G.optional(),output:G.optional(),error:G.optional(),errorCode:A().optional(),attributes:B(A(),A()).default({}),encryptionPublicKey:A().optional(),expiredAt:U().optional(),startedAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U()}),Of=iu(`status`,[Df.extend({status:V([`pending`,`running`]),output:F().optional(),error:F().optional(),completedAt:F().optional()}),Df.extend({status:H(`cancelled`),output:F().optional(),error:F().optional(),completedAt:U()}),Df.extend({status:H(`completed`),output:G.optional(),error:F().optional(),completedAt:U()}),Df.extend({status:H(`failed`),output:F().optional(),error:G.optional(),completedAt:U()})]),kf=z({runIds:R(A()).min(1).max(500).refine(e=>new Set(e).size===e.length,{message:`runIds must not contain duplicates`}),cancelReason:A().max(512).optional()}),Af=iu(`outcome`,[z({runId:A(),outcome:H(`cancelled`)}),z({runId:A(),outcome:H(`already_cancelled`)}),z({runId:A(),outcome:H(`not_cancellable`),status:A()}),z({runId:A(),outcome:H(`not_found`)}),z({runId:A(),outcome:H(`failed`),code:A(),retryable:P()})]),jf=z({summary:z({requested:N(),cancelled:N(),alreadyCancelled:N(),notCancellable:N(),notFound:N(),failed:N()}),results:R(Af)}),Mf=V([`pending`,`running`,`completed`,`failed`,`cancelled`]),Nf=z({runId:A(),stepId:A(),stepName:A(),status:Mf,input:G.optional(),output:G.optional(),error:G.optional(),attempt:N(),startedAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U(),retryAfter:U().optional(),specVersion:N().optional()}),Pf=Mf.extract([`completed`,`failed`,`cancelled`]).options;function Ff(e){return Pf.includes(e)}const If=V([`waiting`,`completed`]),Lf=z({waitId:A(),runId:A(),status:If,resumeAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U(),specVersion:N().optional()}),Rf=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/,J=fd(e=>typeof e==`string`&&Rf.test(e)?`${e.replace(` `,`T`)}Z`:e,U()),Y=J.nullable().optional(),X=A().nullable().optional(),Z=P().nullable().optional(),zf=z({runId:A(),status:wf,deploymentId:A(),workflowName:A(),specVersion:hd().optional(),attributes:B(A(),A()).default({}),createdAt:J,updatedAt:J,startedAt:Y,completedAt:Y,errorCode:X,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),Bf=z({runId:A(),stepId:A(),stepName:X,status:Mf,attempt:N().optional(),createdAt:J,updatedAt:J,startedAt:Y,completedAt:Y,retryAfter:Y,errorCode:X,workflowCoreVersion:X,workflowEncryptionEnabled:Z,computeInstanceId:X}),Vf=z({runId:A(),eventId:A(),eventType:K,correlationId:X,entityId:X,stepName:X,workflowName:A(),deploymentId:A(),specVersion:hd().optional(),runCreatedAt:J,createdAt:J,region:X,vercelId:X,requestId:X,computeInstanceId:X,resumeAt:Y,retryAfter:Y,errorCode:X,workflowCoreVersion:X,isWebhook:Z,isSystem:Z,workflowEncryptionEnabled:Z}),Hf=z({runId:A(),hookId:A(),status:V([`created`,`received`,`disposed`,`conflict`]),createdAt:J,updatedAt:J,receivedAt:Y,disposedAt:Y,isWebhook:Z,isSystem:Z,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),Uf=z({runId:A(),waitId:A(),status:If,resumeAt:Y,createdAt:J,updatedAt:J,completedAt:Y,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),Wf=z({key:A(),runCount:hd(),firstSeenAt:J,lastSeenAt:J}),Gf=1e3,Kf=Symbol.for(`@workflow/world//warnedEnvValues/v1`),qf=globalThis,Jf=qf[Kf]??=new Set;function Yf(e,t){Jf.has(e)||(Jf.add(e),console.warn(`[workflow] ${t}`))}function Xf(e,t,n={}){let r=process.env[e];if(r===void 0||r===``)return t;let{min:i=0,max:a,integer:o=!1}=n,s=Number(r);return!Number.isFinite(s)||o&&!Number.isInteger(s)?(Yf(`${e}=${r}`,`Ignoring ${e}: not a ${o?`finite integer`:`finite number`}; using default ${t}`),t):s<i?(Yf(`${e}=${r}`,`${e} below minimum ${i}; clamped`),i):a!==void 0&&s>a?(Yf(`${e}=${r}`,`${e} above maximum ${a}; clamped`),a):s}function Zf(e,t,n=process.env){let r=n[e];if(r===void 0||r===``)return t;let i=r.toLowerCase();return i===`0`||i===`false`?!1:i===`1`||i===`true`||(Yf(`${e}=${r}`,`Ignoring ${e}: expected 0/1/true/false; using default ${t}`),t)}const Qf=25e3;function $f(){let e=Xf(`WORKFLOW_MAX_EVENTS`,Qf,{integer:!0});return e>0?e:Qf}const ep=A().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/,`Must match __wkf_workflow_ or __{namespace}_wkf_workflow_`),tp=A().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/,`Must be a valid queue name with a recognized prefix`),np=A().regex(/^[a-z][a-z0-9]*$/,`Must be lowercase alphanumeric, starting with a letter`);function rp(e){return e??process.env.WORKFLOW_QUEUE_NAMESPACE??void 0}function ip(e,t){if(e!==`workflow`)throw Error(`Unsupported queue kind: ${e}`);return t===void 0?`__wkf_workflow_`:(np.parse(t),`__${t}_wkf_workflow_`)}function ap(e){let t=e.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_workflow_)(.+)$/);if(!t)throw Error(`Invalid queue name: ${e}`);return{prefix:ep.parse(t[1]),id:t[2]}}const op=A().brand().describe(`A stored queue message ID`),sp=B(A(),A()),cp=z({input:L(),deploymentId:A(),workflowName:A(),specVersion:N(),executionContext:B(A(),I()).optional(),attributes:B(A(),A()).optional(),allowReservedAttributes:H(!0).optional(),environment:A().optional()}),lp=z({input:id(e=>e instanceof Uint8Array,{message:`stepInput.input must be a Uint8Array`})}),up=z({resumeId:A(),hookId:A(),token:A(),payload:L(),payloadDigest:A(),deploymentId:A().optional()}),dp=z({resumeRequestedAtMs:N(),queuePublishRequestedAtMs:N(),strategy:A().optional(),consumerStartedAtMs:N().optional(),replayStartedAtMs:N().optional(),nextStepEncounteredAtMs:N().optional(),setupSource:A().optional()}),fp=z({runId:A(),traceCarrier:sp.optional(),requestedAt:U().optional(),replayDivergence:z({eventId:A(),count:N().int().positive()}).optional(),preconditionReinvocations:N().int().positive().optional(),serverErrorRetryCount:N().int().optional(),deploymentMismatchRetryCount:N().int().nonnegative().optional(),waitContinuation:z({correlationId:A(),attempt:N().int().nonnegative()}).optional().catch(void 0),stepId:A().optional(),stepName:A().optional(),runInput:cp.optional(),hookInput:up.optional(),stepInput:lp.optional(),hookResumeTiming:dp.optional().catch(void 0)}),pp=z({__healthCheck:H(!0),correlationId:A(),runId:A().optional()}),mp=eu([pp,fp]),hp=z({deploymentId:A(),workflowName:A(),runSpecVersion:N().optional(),workflowCoreVersion:A().optional(),traceCarrier:sp.optional(),encryptionPublicKey:A().optional(),hookResumeInputVersion:N().optional()}),gp=z({hookResumeDedupVersion:N()}),_p=z({runId:A(),hookId:A(),token:A(),ownerId:A(),projectId:A(),environment:A(),metadata:G.optional(),createdAt:U(),specVersion:N().optional(),isWebhook:P().optional(),isSystem:P().optional(),tokenRetentionUntil:U().optional(),resumeContext:hp.optional(),resumeCapabilities:gp.optional()}),vp=`WORKFLOW_NODE_HTTP`;function yp(e=process.env){return Zf(vp,!1,e)}async function bp(e,t,n,r){let i=ip(`workflow`,rp(r)),a=0;for(let r of[`pending`,`running`]){let o,s=!0;for(;s;){let c=await e.list({status:r,resolveData:`none`,pagination:{cursor:o}});for(let e of c.data)try{await t(`${i}${e.workflowName}`,{runId:e.runId}),a++}catch(t){console.warn(`[${n}] Failed to re-enqueue run ${e.runId}: ${t}`)}s=c.hasMore,o=c.cursor??void 0}}a>0&&xp()&&console.debug(`[${n}] Re-enqueued ${a} active run(s) on startup`)}function xp(){let e=typeof process<`u`?process.env.DEBUG:void 0;return typeof e==`string`?e.includes(`workflow:`)||e===`*`:!1}const Sp=Zu(()=>eu([A(),N(),P(),zl(),R(Sp),B(A(),Sp)])),Cp=z({currentLookbackDays:N(),maxLookbackDays:N(),currentWindowStart:U(),maxWindowStart:U(),upgradeAvailable:P()}),wp=e=>z({data:R(e),cursor:A().nullable(),hasMore:P(),pageInfo:Cp.optional()}),Tp=z({message:A(),stack:A().optional(),code:A().optional()}),Ep=`evnt_`;function Dp(e){if(e.length!==26)return!1;for(let t=0;t<10;t++)if(e[t]!==`0`)return!1;for(let t=10;t<26;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function Op(e){let t=e.indexOf(`_`);return t===-1?e:e.slice(t+1)}function kp(e){return Dp(Op(e))}function Ap(e){if(!Number.isSafeInteger(e)||e<1)throw RangeError(`Invalid event slot: ${e}`);return`${Ep}${String(e).padStart(26,`0`)}`}function jp(e){let t=Op(e);if(!Dp(t))return null;let n=Number(t);return Number.isSafeInteger(n)&&n>=1?n:null}function Mp(e){let t=jp(e);if(t===null)throw Error(`Event id is not slot-numbered: ${e}. This World allocates event positions the runtime cannot read.`);return t}function Np(e=process.env){return Zf(`WORKFLOW_SEALED_LOG`,!0,e)?7:6}function Pp(e){return e==null||e<=1}function Fp(e){return e!=null&&e>7}const Ip=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`;var Q;(function(e){e.Base32IncorrectEncoding=`B32_ENC_INVALID`,e.DecodeTimeInvalidCharacter=`DEC_TIME_CHAR`,e.DecodeTimeValueMalformed=`DEC_TIME_MALFORMED`,e.EncodeTimeNegative=`ENC_TIME_NEG`,e.EncodeTimeSizeExceeded=`ENC_TIME_SIZE_EXCEED`,e.EncodeTimeValueMalformed=`ENC_TIME_MALFORMED`,e.PRNGDetectFailure=`PRNG_DETECT`,e.ULIDInvalid=`ULID_INVALID`,e.Unexpected=`UNEXPECTED`,e.UUIDInvalid=`UUID_INVALID`})(Q||={});var $=class extends Error{constructor(e,t){super(`${t} (${e})`),this.name=`ULIDError`,this.code=e}};function Lp(e){let t=Math.floor(e()*32)%32;return Ip.charAt(t)}function Rp(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function zp(e){let t,n=e.length,r,i,a=e;for(;!t&&n-->=0;){if(r=a[n],i=Ip.indexOf(r),i===-1)throw new $(Q.Base32IncorrectEncoding,`Incorrectly encoded string`);if(i===31){a=Rp(a,n,Ip[0]);continue}t=Rp(a,n,Ip[i+1])}if(typeof t==`string`)return t;throw new $(Q.Base32IncorrectEncoding,`Failed incrementing string`)}function Bp(e){if(e.length!==26)throw new $(Q.DecodeTimeValueMalformed,`Malformed ULID`);let t=e.substr(0,10).toUpperCase().split(``).reverse().reduce((e,t,n)=>{let r=Ip.indexOf(t);if(r===-1)throw new $(Q.DecodeTimeInvalidCharacter,`Time decode error: Invalid character: ${t}`);return e+=r*32**n},0);if(t>0xffffffffffff)throw new $(Q.DecodeTimeValueMalformed,`Malformed ULID: timestamp too large: ${t}`);return t}function Vp(e){let n=Hp(),r=n&&(n.crypto||n.msCrypto)||(t===void 0?null:t);if(typeof r?.getRandomValues==`function`)return()=>{let e=new Uint8Array(1);return r.getRandomValues(e),e[0]/256};if(typeof r?.randomBytes==`function`)return()=>r.randomBytes(1).readUInt8()/256;if(t?.randomBytes)return()=>t.randomBytes(1).readUInt8()/256;throw new $(Q.PRNGDetectFailure,`Failed to find a reliable PRNG`)}function Hp(){return Gp()?self:typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:null}function Up(e,t){let n=``;for(;e>0;e--)n=Lp(t)+n;return n}function Wp(e,t=10){if(isNaN(e))throw new $(Q.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new $(Q.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${e}`);if(e<0)throw new $(Q.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new $(Q.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r=``;for(let i=t;i>0;i--)n=e%32,r=Ip.charAt(n)+r,e=(e-n)/32;return r}function Gp(){return typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope}function Kp(e){let t=e||Vp(),n=0,r;return function(e){let i=!e||isNaN(e)?Date.now():e;if(i<=n){let e=r=zp(r);return Wp(n,10)+e}n=i;let a=r=Up(16,t);return Wp(i,10)+a}}function qp(e,t){let n=t||Vp();return Wp(!e||isNaN(e)?Date.now():e,10)+Up(16,n)}const Jp=A().ulid(),Yp=Yu([`wrun_`,Jc()]),Xp=864e5,Zp=3e5;function Qp(e){if(Dp(e))return null;let t=Jp.safeParse(e);return t.success?new Date(Bp(t.data)):null}function $p(e,t,n=Xp,r=Zp){let i=Qp(e.startsWith(t)?e.slice(t.length):e);if(!i)return`Invalid runId: "${e}" is not a valid ULID`;let a=new Date().getTime()-i.getTime();return a>0&&a<=n||a<=0&&-a<=r?null:`Invalid runId timestamp: embedded timestamp is ${Math.round(Math.abs(a)/1e3)}s in the ${a>0?`past`:`future`} (threshold: ${Math.round((a>0?n:r)/1e3)}s)`}var em=e({ANALYTICS_EVENTS_GET_MANY_LIMIT:()=>100,ANALYTICS_MAX_ATTRIBUTE_FILTERS:()=>8,ANALYTICS_PAGE_LIMIT:()=>100,ANALYTICS_RUN_SCOPED_PAGE_LIMIT:()=>Gf,ATTRIBUTE_KEY_MAX_LENGTH:()=>256,ATTRIBUTE_MAX_PER_RUN:()=>64,ATTRIBUTE_VALUE_MAX_BYTES:()=>256,BULK_CANCEL_MAX_RUN_IDS:()=>500,DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS:()=>Zp,DEFAULT_TIMESTAMP_THRESHOLD_MS:()=>DEFAULT_TIMESTAMP_THRESHOLD_MS,DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS:()=>Xp,EVENT_ID_BODY_LENGTH:()=>26,EVENT_ID_PREFIX:()=>Ep,FIRST_EVENT_SLOT:()=>1,HOOK_RESUME_DEDUP_VERSION:()=>1,HOOK_RESUME_INPUT_VERSION:()=>1,HookSchema:()=>_p,NODE_HTTP_DEFAULT:()=>!1,NODE_HTTP_ENV_VAR:()=>vp,RESERVED_ATTRIBUTE_KEY_PREFIX:()=>`$`,RETENTION_DEFAULT:()=>xd,RETENTION_ZERO:()=>`0`,RUN_ENTITY_KEY:()=>``,SEALED_LOG_ENV_VAR:()=>`WORKFLOW_SEALED_LOG`,SPEC_VERSION_CURRENT:()=>7,SPEC_VERSION_LEGACY:()=>1,SPEC_VERSION_MAX_SUPPORTED:()=>7,SPEC_VERSION_SUPPORTS_ATTRIBUTES:()=>4,SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT:()=>3,SPEC_VERSION_SUPPORTS_COMPRESSION:()=>5,SPEC_VERSION_SUPPORTS_EVENT_SOURCING:()=>2,SPEC_VERSION_SUPPORTS_SEALED_LOG:()=>7,SPEC_VERSION_SUPPORTS_SLOT_IDENTITY:()=>6});export{G as $,Bo as $a,bt as $c,is as $i,sd as $n,ea as $o,ud as $r,zi as $s,Hl as $t,Gf as A,ba as Aa,Wn as Ac,fc as Ai,Ae as Al,Ec as An,Do as Ao,Vu as Ar,Ar as As,_l as At,kf as B,_o as Ba,Gn as Bc,fs as Bi,R as Bn,Xa as Bo,uu as Br,jr as Bs,ed as Bt,tp as C,oa as Ca,Ir as Cc,mc as Ci,it as Cl,M as Cn,ra as Co,Zu as Cr,vr as Cs,al as Ct,rp as D,Wa as Da,b as Dc,Cc as Di,h as Dl,Wl as Dn,rs as Do,nl as Dr,qi as Ds,Ru as Dt,ap as E,Ra as Ea,dr as Ec,xc as Ei,at as El,Vl as En,Jo as Eo,du as Er,Ti as Es,Gc as Et,Bf as F,Da as Fa,Zn as Fc,sc as Fi,i as Fl,ld as Fn,za as Fo,Ou as Fr,pi as Fs,Oc as Ft,Sf as G,po as Ga,Xn as Gc,Oa as Gi,rd as Gn,la as Go,qu as Gr,Pi as Gs,hl as Gt,Df as H,w as Ha,ur as Hc,ds as Hi,fl as Hn,da as Ho,Nu as Hr,Ri as Hs,$c as Ht,Uf as I,va as Ia,Jn as Ic,nc as Ii,r as Il,zl as In,Ga as Io,ku as Ir,Br as Is,zc as It,Zd as J,mo as Ja,rr as Jc,wa as Ji,Gu as Jn,_a as Jo,Tc as Jr,Hr as Js,vu as Jt,K,lo as Ka,ar as Kc,Ya as Ki,ol as Kn,ua as Ko,B as Kr,Yr as Ks,Zc as Kt,Lf as L,$o as La,lr as Lc,ec as Li,l as Ll,F as Ln,ga as Lo,N as Lr,wr as Ls,gu as Lt,Vf as M,ka as Ma,$n as Mc,ac as Mi,o as Ml,ju as Mn,Uo as Mo,_u as Mr,Tr as Ms,Au as Mt,Hf as N,Ma as Na,Un as Nc,rc as Ni,s as Nl,V as Nn,Eo as No,Ul as Nr,Or as Ns,ru as Nt,Xf as O,Po as Oa,qn as Oc,hc as Oi,oe as Ol,Yc as On,Ka as Oo,pu as Or,mr as Os,Wu as Ot,zf as P,ja as Pa,nr as Pc,lc as Pi,a as Pl,td as Pn,Fo as Po,Fu as Pr,Dr as Ps,pl as Pt,ef as Q,pa as Qa,gt as Qc,Yo as Qi,ql as Qn,ta as Qo,vl as Qr,Oi as Qs,Vc as Qt,Nf as R,ho as Ra,Qn as Rc,tc as Ri,c as Rl,Gl as Rn,qa as Ro,z as Rr,Yi as Rs,Tu as Rt,mp as S,T as Sa,Pr as Sc,pc as Si,rt as Sl,Ic as Sn,bo as So,Qc as Sr,gr as Ss,kl as St,ip as T,Fa as Ta,fr as Tc,wc as Ti,ot as Tl,$l as Tn,ss as To,Ql as Tr,ki as Ts,Uc as Tt,Of as U,xa as Ua,cr as Uc,ls as Ui,jl as Un,sa as Uo,fd as Ur,yr as Us,rl as Ut,jf as V,no as Va,Kn as Vc,us as Vi,ul as Vn,vo as Vo,Uu as Vr,yi as Vs,Ac as Vt,Ef as W,Lo as Wa,tr as Wc,E as Wi,P as Wn,ca as Wo,$u as Wr,Qr as Ws,au as Wt,qd as X,co as Xa,vt as Xc,Ha as Xi,Kc as Xn,as as Xo,Zl as Xr,oi as Xs,fu as Xt,Yd as Y,uo as Ya,Mt as Yc,Ta as Yi,Wc as Yn,Mo as Yo,hu as Yr,Ur as Ys,tl as Yt,Gd as Z,to as Za,St as Zc,Ba as Zi,id as Zn,os as Zo,A as Zr,si as Zs,Bu as Zt,bp as _,zo as _a,li as _c,nu as _i,kt as _l,Ju as _n,ns as _o,el as _r,Vr as _s,Jl as _t,Bp as a,Pa as aa,pr as ac,cu as ai,Ot as al,Xl as an,To as ao,bu as ar,Fr as as,Nd as at,pp as b,La as ba,Cr as bc,_c as bi,nt as bl,k as bn,fo as bo,gl as br,fi as bs,Al as bt,Pp as c,ha as ca,qr as cc,Jc as ci,yt as cl,Mu as cn,Na as co,jc as cr,Kr as cs,bd as ct,jp as d,Ko as da,gi as dc,Lc as di,xt as dl,lu as dn,Xo as do,yl as dr,Nr as ds,Cd as dt,Sa as ea,Ni as ec,Lu as ei,ct as el,Pu as en,ao as eo,iu as er,$i as es,zd as et,kp as f,No as fa,x as fc,Mc as fi,lt as fl,mu as fn,io as fo,Rc as fr,br as fs,kd as ft,Tp as g,xo as ga,Jr as gc,Xc as gi,Tt as gl,Fl as gn,Io as go,ou as gr,Xi as gs,Bl as gt,wp as h,fa as ha,hr as hc,Fc as hi,jt as hl,Iu as hn,Zo as ho,Nl as hr,Vi as hs,hd as ht,Yp as i,eo as ia,xi as ic,Su as ii,wt as il,Cl as in,oo as io,Eu as ir,ni as is,Md as it,Wf as j,Aa as ja,ir as jc,O as ji,u as jl,zu as jn,Oo as jo,Hc as jr,Er as js,Kl as jt,$f as k,ya as ka,or as kc,gc as ki,Ge as kl,tu as kn,Qo as ko,cd as kr,kr as ks,nd as kt,Np as l,ts as la,Ki as lc,eu as li,Ct as ll,Qu as ln,Wo as lo,xl as lr,Wr as ls,vd as lt,Ap as m,aa as ma,_r as mc,Pc as mi,Dt as ml,j as mn,So as mo,Dl as mr,Li as ms,U as mt,Qp as n,Ua as na,Wi as nc,Il as ni,Et as nl,Du as nn,so as no,kc as nr,na as ns,Hd as nt,Kp as o,ia as oa,S as oc,Ol as oi,ft as ol,Cu as on,Ja as oo,Tl as or,Lr as os,W as ot,Mp as p,Ea as pa,Sr as pc,Nc as pi,dt as pl,Dc as pn,es as po,wl as pr,xr as ps,pd as pt,Cf as q,Co as qa,er as qc,Ao as qi,cl as qn,Qa as qo,ad as qr,Ai as qs,Xu as qt,$p as r,Va as ra,vi as rc,Yu as ri,At as rl,Sl as rn,qo as ro,Bc as rr,Xr as rs,Id as rt,qp as s,ma as sa,Ii as sc,Pl as si,mt as sl,Hu as sn,Go as so,El as sr,Gr as ss,yd as st,em as t,Ca as ta,Ji as tc,od as ti,ut as tl,Rl as tn,Za as to,ml as tr,C as ts,Ud as tt,Fp as u,$a as ua,Ei as uc,L as ui,_t as ul,Ku as un,wo as uo,bl as ur,Mr as us,Ad as ut,yp as v,Ho as va,Zr as vc,vc as vi,pt as vl,xu as vn,go as vo,il as vr,ei as vs,ll as vt,fp as w,yo as wa,zr as wc,Sc as wi,st as wl,Ll as wn,cs as wo,H as wr,Ci as ws,sl as wt,op as x,ro as xa,di as xc,yc as xi,y as xl,qc as xn,ko as xo,Yl as xr,Rr as xs,Ml as xt,_p as y,Ia as ya,$r as yc,bc as yi,ht as yl,su as yn,Ro as yo,dd as yr,ji as ys,dl as yt,Ff as z,Vo as za,Yn as zc,ps as zi,n as zl,I as zn,jo as zo,wu as zr,wi as zs,yu as zt};