@langgenius/syncless-darwin-x64 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import{n as e}from"./runtime_auth_helpers-BDWCKc_--CPDRhoOH.js";export{e as resolveSessionFromToken};
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="390b78fc-dbf7-5cf5-839d-de3892870508")}catch(e){}}();
3
- //# debugId=390b78fc-dbf7-5cf5-839d-de3892870508
1
+ import{n as e}from"./runtime_auth_helpers-RMpae5_X-BmKa0ad1.js";export{e as resolveSessionFromToken};
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6630709e-2598-5204-bad8-441060ccc7ad")}catch(e){}}();
3
+ //# debugId=6630709e-2598-5204-bad8-441060ccc7ad
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "echo-cli",
3
3
  "type": "module",
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "private": true,
6
6
  "files": [
7
7
  ".env.example",
@@ -1,130 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c048f316-a48f-52e1-88f7-3b9e5ad81d3a")}catch(e){}}();
3
- import{t as e}from"./chunk-Bdh3yLIe.js";var t;function n(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}var r=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});const a=globalThis.__zod_globalConfig;function o(e){return e&&Object.assign(a,e),a}function s(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 c(e,t){return typeof t==`bigint`?t.toString():t}function l(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function u(e){return e==null}function d(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ee(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function te(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ne(e){return JSON.stringify(e)}function re(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ie=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const oe=l(()=>{if(a.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function se(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ae(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ce(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const le=new Set([`string`,`number`,`symbol`]);function ue(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 de(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const fe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};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,te(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 ee(this,`shape`,e),e},checks:[]}))}function me(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,te(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 ee(this,`shape`,r),r},checks:[]}))}function he(e,t){if(!se(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,te(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ee(this,`shape`,n),n}}))}function ge(e,t){if(!se(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return h(e,te(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ee(this,`shape`,n),n}}))}function _e(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return h(e,te(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ee(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ve(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,te(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 ee(this,`shape`,i),i},checks:[]}))}function ye(e,t,n){return h(t,te(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 ee(this,`shape`,i),i}}))}function be(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 xe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Se(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ce(e){return typeof e==`string`?e:e?.message}function _(e,t,n){let r=e.message?e.message:Ce(e.inst?._zod.def?.error?.(e))??Ce(t?.error?.(e))??Ce(n.customError?.(e))??Ce(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function we(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Te(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Ee=(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,c,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},De=n(`$ZodError`,Ee),Oe=n(`$ZodError`,Ee,{Parent:Error});function ke(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 Ae(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const je=e=>(t,n,i,a)=>{let s=i?{...i,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){let t=new(a?.Err??e)(c.issues.map(e=>_(e,s,o())));throw ie(t,a?.callee),t}return c.value},Me=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>_(e,a,o())));throw ie(t,i?.callee),t}return s.value},Ne=e=>(t,n,i)=>{let a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??De)(s.issues.map(e=>_(e,a,o())))}:{success:!0,data:s.value}},Pe=Ne(Oe),Fe=e=>async(t,n,r)=>{let i=r?{...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=>_(e,i,o())))}:{success:!0,data:a.value}},Ie=Fe(Oe),Le=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return je(e)(t,n,i)},Re=e=>(t,n,r)=>je(e)(t,n,r),ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Me(e)(t,n,i)},Be=e=>async(t,n,r)=>Me(e)(t,n,r),Ve=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ne(e)(t,n,i)},He=e=>(t,n,r)=>Ne(e)(t,n,r),Ue=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fe(e)(t,n,i)},We=e=>async(t,n,r)=>Fe(e)(t,n,r),Ge=/^[cC][0-9a-z]{6,}$/,Ke=/^[0-9a-z]+$/,qe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Je=/^[0-9a-vA-V]{20}$/,Ye=/^[A-Za-z0-9]{27}$/,Xe=/^[a-zA-Z0-9_-]{21}$/,Ze=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qe=/^([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})$/,$e=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)$/,et=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function tt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const nt=/^(?:(?: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])$/,rt=/^(([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}|:))$/,it=/^((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])$/,at=/^(([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])$/,ot=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,st=/^[A-Za-z0-9_-]*$/,ct=/^https?$/,lt=/^\+[1-9]\d{6,14}$/,ut=`(?:(?:\\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])))`,dt=RegExp(`^${ut}$`);function ft(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 pt(e){return RegExp(`^${ft(e)}$`)}function mt(e){let t=ft({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(`^${ut}T(?:${r})$`)}const ht=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},gt=/^-?\d+$/,_t=/^-?\d+(?:\.\d+)?$/,vt=/^(?:true|false)$/i,yt=/^null$/i,bt=/^[^A-Z]*$/,xt=/^[^a-z]*$/,v=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),St={number:`number`,bigint:`bigint`,object:`date`},Ct=n(`$ZodCheckLessThan`,(e,t)=>{v.init(e,t);let n=St[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})}}),wt=n(`$ZodCheckGreaterThan`,(e,t)=>{v.init(e,t);let n=St[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})}}),Tt=n(`$ZodCheckMultipleOf`,(e,t)=>{v.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):f(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})}}),Et=n(`$ZodCheckNumberFormat`,(e,t)=>{v.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=fe[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=gt)}),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})}}),Dt=n(`$ZodCheckMaxLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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})}}),Ot=n(`$ZodCheckMinLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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})}}),kt=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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})}}),At=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;v.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=()=>{})}),jt=n(`$ZodCheckRegex`,(e,t)=>{At.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})}}),Mt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=bt,At.init(e,t)}),Nt=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=xt,At.init(e,t)}),Pt=n(`$ZodCheckIncludes`,(e,t)=>{v.init(e,t);let n=ue(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})}}),Ft=n(`$ZodCheckStartsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`^${ue(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})}}),It=n(`$ZodCheckEndsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`.*${ue(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})}}),Lt=n(`$ZodCheckOverwrite`,(e,t)=>{v.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Rt=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(`
4
- `).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(`
5
- `))}};const zt={major:4,minor:4,patch:3},y=n(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zt;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.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 i=be(e),a;for(let o of t){if(o._zod.def.when){if(xe(e)||!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new r;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=be(e,t))});else{if(e.issues.length===t)continue;i||=be(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(be(n))return n.aborted=!0,n;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(e=>t(e,i,o))}return t(s,i,o)}}m(e,`~standard`,()=>({validate:t=>{try{let n=Pe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ie(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Bt=n(`$ZodString`,(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ht(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}}),b=n(`$ZodStringFormat`,(e,t)=>{At.init(e,t),Bt.init(e,t)}),Vt=n(`$ZodGUID`,(e,t)=>{t.pattern??=Qe,b.init(e,t)}),Ht=n(`$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??=$e(e)}else t.pattern??=$e();b.init(e,t)}),Ut=n(`$ZodEmail`,(e,t)=>{t.pattern??=et,b.init(e,t)}),Wt=n(`$ZodURL`,(e,t)=>{b.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ct.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let 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})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Gt=n(`$ZodEmoji`,(e,t)=>{t.pattern??=tt(),b.init(e,t)}),Kt=n(`$ZodNanoID`,(e,t)=>{t.pattern??=Xe,b.init(e,t)}),qt=n(`$ZodCUID`,(e,t)=>{t.pattern??=Ge,b.init(e,t)}),Jt=n(`$ZodCUID2`,(e,t)=>{t.pattern??=Ke,b.init(e,t)}),Yt=n(`$ZodULID`,(e,t)=>{t.pattern??=qe,b.init(e,t)}),Xt=n(`$ZodXID`,(e,t)=>{t.pattern??=Je,b.init(e,t)}),Zt=n(`$ZodKSUID`,(e,t)=>{t.pattern??=Ye,b.init(e,t)}),Qt=n(`$ZodISODateTime`,(e,t)=>{t.pattern??=mt(t),b.init(e,t)}),$t=n(`$ZodISODate`,(e,t)=>{t.pattern??=dt,b.init(e,t)}),en=n(`$ZodISOTime`,(e,t)=>{t.pattern??=pt(t),b.init(e,t)}),tn=n(`$ZodISODuration`,(e,t)=>{t.pattern??=Ze,b.init(e,t)}),nn=n(`$ZodIPv4`,(e,t)=>{t.pattern??=nt,b.init(e,t),e._zod.bag.format=`ipv4`}),rn=n(`$ZodIPv6`,(e,t)=>{t.pattern??=rt,b.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})}}}),an=n(`$ZodCIDRv4`,(e,t)=>{t.pattern??=it,b.init(e,t)}),on=n(`$ZodCIDRv6`,(e,t)=>{t.pattern??=at,b.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 sn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const cn=n(`$ZodBase64`,(e,t)=>{t.pattern??=ot,b.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{sn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ln(e){if(!st.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return sn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const un=n(`$ZodBase64URL`,(e,t)=>{t.pattern??=st,b.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ln(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),dn=n(`$ZodE164`,(e,t)=>{t.pattern??=lt,b.init(e,t)});function fn(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 pn=n(`$ZodJWT`,(e,t)=>{b.init(e,t),e._zod.check=n=>{fn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),mn=n(`$ZodNumber`,(e,t)=>{y.init(e,t),e._zod.pattern=e._zod.bag.pattern??_t,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}}),hn=n(`$ZodNumberFormat`,(e,t)=>{Et.init(e,t),mn.init(e,t)}),gn=n(`$ZodBoolean`,(e,t)=>{y.init(e,t),e._zod.pattern=vt,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}}),_n=n(`$ZodNull`,(e,t)=>{y.init(e,t),e._zod.pattern=yt,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}}),vn=n(`$ZodUnknown`,(e,t)=>{y.init(e,t),e._zod.parse=e=>e}),yn=n(`$ZodNever`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function bn(e,t,n){e.issues.length&&t.issues.push(...Se(n,e.issues)),t.value[n]=e.value}const xn=n(`$ZodArray`,(e,t)=>{y.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=>bn(t,n,e))):bn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Sn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Se(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Cn(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=de(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||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=>Sn(e,n,i,t,u,d))):Sn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Tn=n(`$ZodObject`,(e,t)=>{if(y.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=l(()=>Cn(t));m(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=ae,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.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Sn(n,t,e,s,r,i))):Sn(a,t,e,s,r,i)}return i?wn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),En=n(`$ZodObjectJIT`,(e,t)=>{Tn.init(e,t);let n=e._zod.parse,r=l(()=>Cn(t)),i=e=>{let t=new Rt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ne(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=ne(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
6
- if (${n}.issues.length) {
7
- if (${o} in input) {
8
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
9
- ...iss,
10
- path: iss.path ? [${o}, ...iss.path] : [${o}]
11
- })));
12
- }
13
- }
14
-
15
- if (${n}.value === undefined) {
16
- if (${o} in input) {
17
- newResult[${o}] = undefined;
18
- }
19
- } else {
20
- newResult[${o}] = ${n}.value;
21
- }
22
-
23
- `):c?t.write(`
24
- if (${n}.issues.length) {
25
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
26
- ...iss,
27
- path: iss.path ? [${o}, ...iss.path] : [${o}]
28
- })));
29
- }
30
-
31
- if (${n}.value === undefined) {
32
- if (${o} in input) {
33
- newResult[${o}] = undefined;
34
- }
35
- } else {
36
- newResult[${o}] = ${n}.value;
37
- }
38
-
39
- `):t.write(`
40
- const ${n}_present = ${o} in input;
41
- if (${n}.issues.length) {
42
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
43
- ...iss,
44
- path: iss.path ? [${o}, ...iss.path] : [${o}]
45
- })));
46
- }
47
- if (!${n}_present && !${n}.issues.length) {
48
- payload.issues.push({
49
- code: "invalid_type",
50
- expected: "nonoptional",
51
- input: undefined,
52
- path: [${o}]
53
- });
54
- }
55
-
56
- if (${n}_present) {
57
- if (${n}.value === undefined) {
58
- newResult[${o}] = undefined;
59
- } else {
60
- newResult[${o}] = ${n}.value;
61
- }
62
- }
63
-
64
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=ae,c=!a.jitless,u=c&&oe.value,d=t.catchall,f;e._zod.parse=(a,l)=>{f??=r.value;let p=a.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=i(t.shape),a=o(a,l),d?wn([],p,a,l,f,e):a):n(a,l):(a.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),a)}});function Dn(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=>!be(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=>_(e,r,o())))}),t)}const On=n(`$ZodUnion`,(e,t)=>{y.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(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=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Dn(t,r,e,i)):Dn(o,r,e,i)}}),kn=n(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,On.init(e,t);let n=e._zod.parse;m(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=l(()=>{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(!ae(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||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),An=n(`$ZodIntersection`,(e,t)=>{y.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])=>Mn(e,t,n)):Mn(e,i,a)}});function jn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(se(e)&&se(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=jn(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=jn(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 Mn(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}),be(e))return e;let o=jn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Nn=n(`$ZodRecord`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!se(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],s=t.keyType._zod.values;if(s){n.value={};let c=new Set;for(let l of s)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let s=t.keyType._zod.run({value:l,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>_(e,r,o())),input:l,path:[l],inst:e});continue}let u=s.value,d=t.valueType._zod.run({value:i[l],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...Se(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...Se(l,d.issues)),n.value[u]=d.value)}let l;for(let e in i)c.has(e)||(l??=[],l.push(e));l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&_t.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>_(e,r,o())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...Se(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...Se(s,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Pn=n(`$ZodEnum`,(e,t)=>{y.init(e,t);let n=s(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>le.has(typeof e)).map(e=>typeof e==`string`?ue(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}}),Fn=n(`$ZodLiteral`,(e,t)=>{if(y.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`?ue(e):e?ue(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}}),In=n(`$ZodTransform`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,a)=>{if(a.direction===`backward`)throw new i(e.constructor.name);let o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new r;return n.value=o,n.fallback=!0,n}});function Ln(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Rn=n(`$ZodOptional`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ln(e,r)):Ln(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),zn=n(`$ZodExactOptional`,(e,t)=>{Rn.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Bn=n(`$ZodNullable`,(e,t)=>{y.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)}|null)$`):void 0}),m(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)}),Vn=n(`$ZodDefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,m(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=>Hn(e,t)):Hn(r,t)}});function Hn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Un=n(`$ZodPrefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,m(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))}),Wn=n(`$ZodNonOptional`,(e,t)=>{y.init(e,t),m(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=>Gn(t,e)):Gn(i,e)}});function Gn(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 Kn=n(`$ZodCatch`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,m(e._zod,`optout`,()=>t.innerType._zod.optout),m(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=>_(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),qn=n(`$ZodPipe`,(e,t)=>{y.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(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=>Jn(e,t.in,n)):Jn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Jn(e,t.out,n)):Jn(r,t.out,n)}});function Jn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Yn=n(`$ZodReadonly`,(e,t)=>{y.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(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(Xn):Xn(r)}});function Xn(e){return e.value=Object.freeze(e.value),e}const Zn=n(`$ZodLazy`,(e,t)=>{y.init(e,t),m(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),m(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),m(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),m(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),m(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Qn=n(`$ZodCustom`,(e,t)=>{v.init(e,t),y.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=>$n(t,n,r,e));$n(i,n,r,e)}});function $n(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(Te(e))}}var er,tr=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 nr(){return new tr}(er=globalThis).__zod_globalRegistry??(er.__zod_globalRegistry=nr());const rr=globalThis.__zod_globalRegistry;function ir(e,t){return new e({type:`string`,...g(t)})}function ar(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...g(t)})}function or(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...g(t)})}function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...g(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...g(t)})}function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...g(t)})}function ur(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...g(t)})}function dr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...g(t)})}function fr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...g(t)})}function pr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...g(t)})}function mr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...g(t)})}function hr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...g(t)})}function gr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...g(t)})}function _r(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...g(t)})}function vr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...g(t)})}function yr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...g(t)})}function br(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...g(t)})}function xr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...g(t)})}function Sr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...g(t)})}function Cr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...g(t)})}function wr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...g(t)})}function Tr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...g(t)})}function Er(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...g(t)})}function Dr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...g(t)})}function Or(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...g(t)})}function kr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...g(t)})}function Ar(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...g(t)})}function jr(e,t){return new e({type:`number`,checks:[],...g(t)})}function Mr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...g(t)})}function Nr(e,t){return new e({type:`boolean`,...g(t)})}function Pr(e,t){return new e({type:`null`,...g(t)})}function Fr(e){return new e({type:`unknown`})}function Ir(e,t){return new e({type:`never`,...g(t)})}function Lr(e,t){return new Ct({check:`less_than`,...g(t),value:e,inclusive:!1})}function Rr(e,t){return new Ct({check:`less_than`,...g(t),value:e,inclusive:!0})}function zr(e,t){return new wt({check:`greater_than`,...g(t),value:e,inclusive:!1})}function Br(e,t){return new wt({check:`greater_than`,...g(t),value:e,inclusive:!0})}function Vr(e,t){return new Tt({check:`multiple_of`,...g(t),value:e})}function Hr(e,t){return new Dt({check:`max_length`,...g(t),maximum:e})}function Ur(e,t){return new Ot({check:`min_length`,...g(t),minimum:e})}function Wr(e,t){return new kt({check:`length_equals`,...g(t),length:e})}function Gr(e,t){return new jt({check:`string_format`,format:`regex`,...g(t),pattern:e})}function Kr(e){return new Mt({check:`string_format`,format:`lowercase`,...g(e)})}function qr(e){return new Nt({check:`string_format`,format:`uppercase`,...g(e)})}function Jr(e,t){return new Pt({check:`string_format`,format:`includes`,...g(t),includes:e})}function Yr(e,t){return new Ft({check:`string_format`,format:`starts_with`,...g(t),prefix:e})}function Xr(e,t){return new It({check:`string_format`,format:`ends_with`,...g(t),suffix:e})}function Zr(e){return new Lt({check:`overwrite`,tx:e})}function Qr(e){return Zr(t=>t.normalize(e))}function $r(){return Zr(e=>e.trim())}function ei(){return Zr(e=>e.toLowerCase())}function ti(){return Zr(e=>e.toUpperCase())}function ni(){return Zr(e=>re(e))}function ri(e,t,n){return new e({type:`array`,element:t,...g(n)})}function ii(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...g(n)})}function ai(e,t){let n=oi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Te(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Te(r))}},e(t.value,t)),t);return n}function oi(e,t){let n=new v({check:`custom`,...g(t)});return n._zod.check=e,n}function si(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??rr,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 x(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,x(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`&&S(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ci(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>
65
-
66
- 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 li(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.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:di(t,`input`,e.processors),output:di(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function S(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 S(r.element,n);if(r.type===`set`)return S(r.valueType,n);if(r.type===`lazy`)return S(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 S(r.innerType,n);if(r.type===`intersection`)return S(r.left,n)||S(r.right,n);if(r.type===`record`||r.type===`map`)return S(r.keyType,n)||S(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:S(r.in,n)||S(r.out,n);if(r.type===`object`){for(let e in r.shape)if(S(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(S(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(S(e,n))return!0;return!!(r.rest&&S(r.rest,n))}return!1}const ui=(e,t={})=>n=>{let r=si({...n,processors:t});return x(e,r),ci(r,e),li(r,e)},di=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=si({...i??{},target:a,io:t,processors:n});return x(e,o),ci(o,e),li(o,e)},fi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},pi=(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=fi[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}))])}},mi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},hi=(e,t,n,r)=>{n.type=`boolean`},gi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},_i=(e,t,n,r)=>{n.not={}},vi=(e,t,n,r)=>{let i=e._zod.def,a=s(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},yi=(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},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Si=(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=x(a.element,t,{...r,path:[...r.path,`items`]})},Ci=(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]=x(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=x(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>x(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ti=(e,t,n,r)=>{let i=e._zod.def,a=x(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=x(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]]},Ei=(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=x(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=x(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=x(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)}},Di=(e,t,n,r)=>{let i=e._zod.def,a=x(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`}]},Oi=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ki=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ai=(e,t,n,r)=>{let i=e._zod.def;x(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)))},ji=(e,t,n,r)=>{let i=e._zod.def;x(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},Mi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;x(o,t,r);let s=t.seen.get(e);s.ref=o},Ni=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Pi=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fi=(e,t,n,r)=>{let i=e._zod.innerType;x(i,t,r);let a=t.seen.get(e);a.ref=i},Ii=n(`ZodISODateTime`,(e,t)=>{Qt.init(e,t),E.init(e,t)});function Li(e){return Dr(Ii,e)}const Ri=n(`ZodISODate`,(e,t)=>{$t.init(e,t),E.init(e,t)});function zi(e){return Or(Ri,e)}const Bi=n(`ZodISOTime`,(e,t)=>{en.init(e,t),E.init(e,t)});function Vi(e){return kr(Bi,e)}const Hi=n(`ZodISODuration`,(e,t)=>{tn.init(e,t),E.init(e,t)});function Ui(e){return Ar(Hi,e)}const C=n(`ZodError`,(e,t)=>{De.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ae(e,t)},flatten:{value:t=>ke(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wi=je(C),Gi=Me(C),Ki=Ne(C),qi=Fe(C),Ji=Le(C),Yi=Re(C),Xi=ze(C),Zi=Be(C),Qi=Ve(C),$i=He(C),ea=Ue(C),ta=We(C),na=new WeakMap;function ra(e,t,n){let r=Object.getPrototypeOf(e),i=na.get(r);if(i||(i=new Set,na.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const w=n(`ZodType`,(e,t)=>(y.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:di(e,`input`),output:di(e,`output`)}}),e.toJSONSchema=ui(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Wi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ki(e,t,n),e.parseAsync=async(t,n)=>Gi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>qi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ji(e,t,n),e.decode=(t,n)=>Yi(e,t,n),e.encodeAsync=async(t,n)=>Xi(e,t,n),e.decodeAsync=async(t,n)=>Zi(e,t,n),e.safeEncode=(t,n)=>Qi(e,t,n),e.safeDecode=(t,n)=>$i(e,t,n),e.safeEncodeAsync=async(t,n)=>ea(e,t,n),e.safeDecodeAsync=async(t,n)=>ta(e,t,n),ra(e,`ZodType`,{check(...e){let t=this.def;return this.clone(te(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return h(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bo(e,t))},superRefine(e,t){return this.check(xo(e,t))},overwrite(e){return this.check(Zr(e))},optional(){return $a(this)},exactOptional(){return to(this)},nullable(){return ro(this)},nullish(){return $a(ro(this))},nonoptional(e){return lo(this,e)},array(){return D(this)},or(e){return Ba([this,e])},and(e){return Wa(this,e)},transform(e){return mo(this,Za(e))},default(e){return ao(this,e)},prefault(e){return so(this,e)},catch(e){return fo(this,e)},pipe(e){return mo(this,e)},readonly(){return go(this)},describe(e){let t=this.clone();return rr.add(t,{description:e}),t},meta(...e){if(e.length===0)return rr.get(this);let t=this.clone();return rr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return rr.get(e)?.description},configurable:!0}),e)),ia=n(`_ZodString`,(e,t)=>{Bt.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ra(e,`_ZodString`,{regex(...e){return this.check(Gr(...e))},includes(...e){return this.check(Jr(...e))},startsWith(...e){return this.check(Yr(...e))},endsWith(...e){return this.check(Xr(...e))},min(...e){return this.check(Ur(...e))},max(...e){return this.check(Hr(...e))},length(...e){return this.check(Wr(...e))},nonempty(...e){return this.check(Ur(1,...e))},lowercase(e){return this.check(Kr(e))},uppercase(e){return this.check(qr(e))},trim(){return this.check($r())},normalize(...e){return this.check(Qr(...e))},toLowerCase(){return this.check(ei())},toUpperCase(){return this.check(ti())},slugify(){return this.check(ni())}})}),aa=n(`ZodString`,(e,t)=>{Bt.init(e,t),ia.init(e,t),e.email=t=>e.check(ar(oa,t)),e.url=t=>e.check(dr(la,t)),e.jwt=t=>e.check(Er(wa,t)),e.emoji=t=>e.check(fr(ua,t)),e.guid=t=>e.check(or(sa,t)),e.uuid=t=>e.check(sr(ca,t)),e.uuidv4=t=>e.check(cr(ca,t)),e.uuidv6=t=>e.check(lr(ca,t)),e.uuidv7=t=>e.check(ur(ca,t)),e.nanoid=t=>e.check(pr(da,t)),e.guid=t=>e.check(or(sa,t)),e.cuid=t=>e.check(mr(fa,t)),e.cuid2=t=>e.check(hr(pa,t)),e.ulid=t=>e.check(gr(ma,t)),e.base64=t=>e.check(Cr(xa,t)),e.base64url=t=>e.check(wr(Sa,t)),e.xid=t=>e.check(_r(ha,t)),e.ksuid=t=>e.check(vr(ga,t)),e.ipv4=t=>e.check(yr(_a,t)),e.ipv6=t=>e.check(br(va,t)),e.cidrv4=t=>e.check(xr(ya,t)),e.cidrv6=t=>e.check(Sr(ba,t)),e.e164=t=>e.check(Tr(Ca,t)),e.datetime=t=>e.check(Li(t)),e.date=t=>e.check(zi(t)),e.time=t=>e.check(Vi(t)),e.duration=t=>e.check(Ui(t))});function T(e){return ir(aa,e)}const E=n(`ZodStringFormat`,(e,t)=>{b.init(e,t),ia.init(e,t)}),oa=n(`ZodEmail`,(e,t)=>{Ut.init(e,t),E.init(e,t)}),sa=n(`ZodGUID`,(e,t)=>{Vt.init(e,t),E.init(e,t)}),ca=n(`ZodUUID`,(e,t)=>{Ht.init(e,t),E.init(e,t)}),la=n(`ZodURL`,(e,t)=>{Wt.init(e,t),E.init(e,t)}),ua=n(`ZodEmoji`,(e,t)=>{Gt.init(e,t),E.init(e,t)}),da=n(`ZodNanoID`,(e,t)=>{Kt.init(e,t),E.init(e,t)}),fa=n(`ZodCUID`,(e,t)=>{qt.init(e,t),E.init(e,t)}),pa=n(`ZodCUID2`,(e,t)=>{Jt.init(e,t),E.init(e,t)}),ma=n(`ZodULID`,(e,t)=>{Yt.init(e,t),E.init(e,t)}),ha=n(`ZodXID`,(e,t)=>{Xt.init(e,t),E.init(e,t)}),ga=n(`ZodKSUID`,(e,t)=>{Zt.init(e,t),E.init(e,t)}),_a=n(`ZodIPv4`,(e,t)=>{nn.init(e,t),E.init(e,t)}),va=n(`ZodIPv6`,(e,t)=>{rn.init(e,t),E.init(e,t)}),ya=n(`ZodCIDRv4`,(e,t)=>{an.init(e,t),E.init(e,t)}),ba=n(`ZodCIDRv6`,(e,t)=>{on.init(e,t),E.init(e,t)}),xa=n(`ZodBase64`,(e,t)=>{cn.init(e,t),E.init(e,t)}),Sa=n(`ZodBase64URL`,(e,t)=>{un.init(e,t),E.init(e,t)}),Ca=n(`ZodE164`,(e,t)=>{dn.init(e,t),E.init(e,t)}),wa=n(`ZodJWT`,(e,t)=>{pn.init(e,t),E.init(e,t)}),Ta=n(`ZodNumber`,(e,t)=>{mn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),ra(e,`ZodNumber`,{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Br(e,t))},min(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(Rr(e,t))},max(e,t){return this.check(Rr(e,t))},int(e){return this.check(Oa(e))},safe(e){return this.check(Oa(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Br(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(Rr(0,e))},multipleOf(e,t){return this.check(Vr(e,t))},step(e,t){return this.check(Vr(e,t))},finite(){return this}});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 Ea(e){return jr(Ta,e)}const Da=n(`ZodNumberFormat`,(e,t)=>{hn.init(e,t),Ta.init(e,t)});function Oa(e){return Mr(Da,e)}const ka=n(`ZodBoolean`,(e,t)=>{gn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function Aa(e){return Nr(ka,e)}const ja=n(`ZodNull`,(e,t)=>{_n.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function Ma(e){return Pr(ja,e)}const Na=n(`ZodUnknown`,(e,t)=>{vn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pa(){return Fr(Na)}const Fa=n(`ZodNever`,(e,t)=>{yn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function Ia(e){return Ir(Fa,e)}const La=n(`ZodArray`,(e,t)=>{xn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.element=t.element,ra(e,`ZodArray`,{min(e,t){return this.check(Ur(e,t))},nonempty(e){return this.check(Ur(1,e))},max(e,t){return this.check(Hr(e,t))},length(e,t){return this.check(Wr(e,t))},unwrap(){return this.element}})});function D(e,t){return ri(La,e,t)}const Ra=n(`ZodObject`,(e,t)=>{En.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),m(e,`shape`,()=>t.shape),ra(e,`ZodObject`,{keyof(){return Ja(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Pa()})},loose(){return this.clone({...this._zod.def,catchall:Pa()})},strict(){return this.clone({...this._zod.def,catchall:Ia()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return he(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return pe(this,e)},omit(e){return me(this,e)},partial(...e){return ve(Qa,this,e[0])},required(...e){return ye(co,this,e[0])}})});function O(e,t){return new Ra({type:`object`,shape:e??{},...g(t)})}const za=n(`ZodUnion`,(e,t)=>{On.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.options=t.options});function Ba(e,t){return new za({type:`union`,options:e,...g(t)})}const Va=n(`ZodDiscriminatedUnion`,(e,t)=>{za.init(e,t),kn.init(e,t)});function Ha(e,t,n){return new Va({type:`union`,options:t,discriminator:e,...g(n)})}const Ua=n(`ZodIntersection`,(e,t)=>{An.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r)});function Wa(e,t){return new Ua({type:`intersection`,left:e,right:t})}const Ga=n(`ZodRecord`,(e,t)=>{Nn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ka(e,t,n){return!t||!t._zod?new Ga({type:`record`,keyType:T(),valueType:e,...g(t)}):new Ga({type:`record`,keyType:e,valueType:t,...g(n)})}const qa=n(`ZodEnum`,(e,t)=>{Pn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(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 qa({...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 qa({...t,checks:[],...g(r),entries:i})}});function Ja(e,t){return new qa({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...g(t)})}function k(e,t){return new qa({type:`enum`,entries:e,...g(t)})}const Ya=n(`ZodLiteral`,(e,t)=>{Fn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(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 A(e,t){return new Ya({type:`literal`,values:Array.isArray(e)?e:[e],...g(t)})}const Xa=n(`ZodTransform`,(e,t)=>{In.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Te(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(Te(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function Za(e){return new Xa({type:`transform`,transform:e})}const Qa=n(`ZodOptional`,(e,t)=>{Rn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`optional`,innerType:e})}const eo=n(`ZodExactOptional`,(e,t)=>{zn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function to(e){return new eo({type:`optional`,innerType:e})}const no=n(`ZodNullable`,(e,t)=>{Bn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ro(e){return new no({type:`nullable`,innerType:e})}const io=n(`ZodDefault`,(e,t)=>{Vn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ao(e,t){return new io({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}const oo=n(`ZodPrefault`,(e,t)=>{Un.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function so(e,t){return new oo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}const co=n(`ZodNonOptional`,(e,t)=>{Wn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lo(e,t){return new co({type:`nonoptional`,innerType:e,...g(t)})}const uo=n(`ZodCatch`,(e,t)=>{Kn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fo(e,t){return new uo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const po=n(`ZodPipe`,(e,t)=>{qn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.in=t.in,e.out=t.out});function mo(e,t){return new po({type:`pipe`,in:e,out:t})}const ho=n(`ZodReadonly`,(e,t)=>{Yn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function go(e){return new ho({type:`readonly`,innerType:e})}const _o=n(`ZodLazy`,(e,t)=>{Zn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function vo(e){return new _o({type:`lazy`,getter:e})}const yo=n(`ZodCustom`,(e,t)=>{Qn.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r)});function bo(e,t={}){return ii(yo,e,t)}function xo(e,t){return ai(e,t)}const So={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};var Co;(function(e){})(Co||={});const wo={REVIEW_LIST_PENDING:`review.list_pending`,REVIEW_GET:`review.get`},To=vo(()=>Ba([T(),Ea(),Aa(),Ma(),D(To),Ka(T(),To)]));let Eo=function(e){return e.AUTOMATION=`automation`,e.BUG=`bug`,e.BUILD=`build`,e.CALENDAR=`calendar`,e.CODE=`code`,e.DEVICE=`device`,e.DOCUMENTS=`documents`,e.ENGINEERING=`engineering`,e.FINANCE=`finance`,e.IDEA=`idea`,e.INFORMATION=`information`,e.INBOX=`inbox`,e.INVITE=`invite`,e.MARKDOWN=`markdown`,e.PLANNING=`planning`,e.PRODUCT=`product`,e.REIMBURSEMENT=`reimbursement`,e.REQUIREMENTS=`requirements`,e.RESEARCH=`research`,e.REVIEW=`review`,e.SERVER=`server`,e.TEAM=`team`,e.TERMINAL=`terminal`,e.WEB=`web`,e}({}),Do=function(e){return e.AMBER_SOFT=`#FFEAD5`,e.GREEN_LIGHT=`#E4FBCC`,e.MINT_LIGHT=`#D3F8DF`,e.SKY_LIGHT=`#E0F2FE`,e.BLUE_LIGHT=`#E0EAFF`,e.GRAY_LIGHT=`#EFF1F5`,e.PURPLE_LIGHT=`#FBE8FF`,e.PINK_LIGHT=`#FCE7F6`,e.YELLOW_LIGHT=`#FEF7C3`,e.LIME_LIGHT=`#E6F4D7`,e.CYAN_LIGHT=`#D5F5F6`,e.AZURE_LIGHT=`#D1E9FF`,e.INDIGO_LIGHT=`#D1E0FF`,e.SLATE_LIGHT=`#D5D9EB`,e.VIOLET_LIGHT=`#ECE9FE`,e.ROSE_LIGHT=`#FFE4E8`,e}({}),Oo=function(e){return e.DOCUMENT=`document`,e.IMAGE=`image`,e.AUDIO=`audio`,e.VIDEO=`video`,e.OTHER=`other`,e}({});const ko=O({type:T().trim().min(1)}).catchall(To),Ao=O({version:A(1),blocks:D(ko)}),jo=O({type:A(`opening-options`),data:O({text:T().trim().max(500),instruction:T().trim().max(2e3).optional(),file:O({types:D(k(Oo)).min(1).max(5),otherExtensions:D(T().trim().min(1).max(24)).max(50).optional()}).optional()})}),Mo=O({hints:Ao.optional(),options:D(jo).max(20).optional()}),No=O({version:A(`1.0.0`),name:T().trim().max(128),description:T().trim().max(500),icon:k(Eo),background:k(Do),nodes:D(O({id:T().trim().min(1),position:O({x:Ea().finite(),y:Ea().finite()}),data:O({type:A(`task`),icon:k(Eo),background:k(Do),title:T().trim().min(1).max(30),instructions:T().max(1e5),conversation_opener:Mo.optional()})})),edges:D(O({id:T().trim().min(1),source:T().trim().min(1),target:T().trim().min(1)}))}).superRefine((e,t)=>{let n=new Set;for(let r of e.nodes)n.has(r.id)&&t.addIssue({code:So.custom,message:`Duplicate node id`,path:[`nodes`]}),n.add(r.id);let r=new Set,i=new Map,a=new Map;for(let o of e.edges){r.has(o.id)&&t.addIssue({code:So.custom,message:`Duplicate edge id`,path:[`edges`]}),r.add(o.id),o.source===o.target&&t.addIssue({code:So.custom,message:`Edge cannot connect a node to itself`,path:[`edges`]}),(!n.has(o.source)||!n.has(o.target))&&t.addIssue({code:So.custom,message:`Edge endpoint is missing`,path:[`edges`]});let e=(i.get(o.target)??0)+1;e>1&&t.addIssue({code:So.custom,message:`A node cannot have multiple upstream nodes`,path:[`edges`]}),i.set(o.target,e),a.set(o.source,[...a.get(o.source)??[],o.target])}let o=new Set,s=new Set,c=e=>{if(!s.has(e)){if(o.has(e)){t.addIssue({code:So.custom,message:`Graph cannot contain cycles`,path:[`edges`]});return}o.add(e);for(let t of a.get(e)??[])c(t);o.delete(e),s.add(e)}};for(let e of n)c(e)}),Po=O({id:T().trim().min(1),graph:No});let Fo=function(e){return e.TRANSLATE=`translate`,e.CHAT_BASIC=`chat_basic`,e.FAST_MODE=`fast_mode`,e.BALANCED_MODE=`balanced_mode`,e.MAX_MODE=`max_mode`,e.DOWNSTREAM_COMPLETION_SUMMARY=`downstream_completion_summary`,e.PROJECT_TEMPLATE_INSTRUCTION_GENERATION=`project_template_instruction_generation`,e.TASK_TITLE_GENERATION=`task_title_generation`,e.GUARDRAIL=`guardrail`,e}({}),Io=function(e){return e.PLATFORM=`platform`,e.WORKSPACE=`workspace`,e}({}),Lo=function(e){return e.OPENAI=`openai`,e.ANTHROPIC=`anthropic`,e.BEDROCK=`bedrock`,e.OPENROUTER=`openrouter`,e}({}),Ro=function(e){return e.CLAUDE_TOKEN=`claude_token`,e.OPENAI_TOKEN=`openai_token`,e.GEMINI_TOKEN=`gemini_token`,e}({}),zo=function(e){return e.CLAUDE=`claude`,e.OPENAI=`openai`,e.GEMINI=`gemini`,e}({}),Bo=function(e){return e.PLATFORM=`platform`,e.WORKSPACE=`workspace`,e}({});const Vo=Ka(T(),Pa()),Ho=O({contextWindowTokens:Ea().int().positive(),compactionThresholdRatio:Ea().positive().max(1)}),Uo=Ha(`type`,[Ho.extend({type:A(`prompt`)}).strict(),Ho.extend({type:A(`native`)}).strict()]),Wo=O({modelId:T().trim().min(1),family:k(zo),context:Uo,parameters:Vo.optional()}).strict(),Go=O({calculatorMethod:k(Ro),pricing:Ka(T(),To)}).strict(),Ko=O({provider:k(Lo),modelConfig:Wo}).strict().extend({billingConfig:Go}).strict(),qo=O({translate:T().trim().min(1),chat_basic:T().trim().min(1),fast_mode:T().trim().min(1),balanced_mode:T().trim().min(1),max_mode:T().trim().min(1),downstream_completion_summary:T().trim().min(1),project_template_instruction_generation:T().trim().min(1),task_title_generation:T().trim().min(1),guardrail:T().trim().min(1)});function Jo(e,t){for(let[n,r]of Object.entries(e.scenarios))e.models[r]||t.addIssue({code:So.custom,message:`Scenario references missing model config: ${r}`,path:[`scenarios`,n]})}const Yo=O({version:A(1),scenarios:qo,models:Ka(T().trim().min(1),Ko)}).strict().superRefine(Jo);O({expectedRevision:T().nullable(),config:Yo});const Xo=O({source:k(Bo),modelConfigId:T().trim().min(1)}).strict(),j=O({credentialId:T().trim().min(1),modelConfigRef:Xo}).strict(),Zo=O({translate:j.optional(),chat_basic:j.optional(),fast_mode:j.optional(),balanced_mode:j.optional(),max_mode:j.optional(),downstream_completion_summary:j.optional(),project_template_instruction_generation:j.optional(),task_title_generation:j.optional(),guardrail:j.optional()}).strict();O({enabled:Aa(),scenarioRoutes:Zo}).strict(),O({templates:D(Po)}).superRefine((e,t)=>{Qo(e.templates,t)}),O({expectedRevision:T().nullable(),templates:D(Po)}).superRefine((e,t)=>{Qo(e.templates,t)});function Qo(e,t){let n=new Set;for(let r of e)n.has(r.id)&&t.addIssue({code:So.custom,message:`Duplicate template blueprint id`,path:[`templates`]}),n.add(r.id)}const $o={TASK_LIST:`task.list`,TASK_SYNC:`task.sync`,TASK_GET:`task.get`,TASK_OPTIONS_SET:`task.options.set`,TASK_STATUS_SET:`task.status.set`,TASK_UNREADS_CLEAR:`task.unreads.clear`,TASK_CREATE:`task.create`,TASK_SEND:`task.send`,TASK_STOP:`task.stop`,TASK_TOOLS:`task.tools`,TASK_MESSAGES:`task.messages`,TASK_IN_FLIGHT_MESSAGES:`task.in_flight_messages`,TASK_TOOL_RESULT_GET:`task.tool_result.get`,TASK_PROMPT_EXPORT:`task.prompt_export`,TASK_AGENT_INSTRUCTION_GET:`task.agent_instruction.get`,TASK_AGENT_INSTRUCTION_SAVE:`task.agent_instruction.save`};let es=function(e){return e.PLATFORM=`platform`,e.WORKSPACE_CUSTOM=`workspace_custom`,e}({});const ts=Ja([`human`,`agent`]),ns=O({version:A(1),owner:k(Io),scenario:k(Fo),provider:k(Lo),model_id:T().trim().min(1),model_family:k(zo),model_config_id:T().trim().min(1),model_config_source:k(es)}).catchall(To);O({message_origin:ts.optional(),model_config_id:T().optional(),llm_route:ns.optional()}).catchall(To);const rs={WORKSPACE_LIST:`workspace.list`,WORKSPACE_SET_ACTIVE:`workspace.setActive`,WORKSPACE_UPDATE:`workspace.update`,WORKSPACE_MEMBERS_LIST:`workspace.members.list`,WORKSPACE_MEMBERS_INVITE:`workspace.members.invite`,WORKSPACE_MEMBERS_SET_STATUS:`workspace.members.setStatus`,WORKSPACE_TASK_USAGE_OVERVIEW:`workspace.taskUsageOverview`,WORKSPACE_LLM_CREDENTIALS_LIST:`workspace.llmCredentials.list`,WORKSPACE_LLM_CREDENTIAL_CREATE:`workspace.llmCredential.create`,WORKSPACE_LLM_CREDENTIAL_UPDATE:`workspace.llmCredential.update`,WORKSPACE_LLM_CREDENTIAL_DELETE:`workspace.llmCredential.delete`,WORKSPACE_LLM_CUSTOM_MODELS_LIST:`workspace.llmCustomModels.list`,WORKSPACE_LLM_CUSTOM_MODEL_CREATE:`workspace.llmCustomModel.create`,WORKSPACE_LLM_CUSTOM_MODEL_UPDATE:`workspace.llmCustomModel.update`,WORKSPACE_LLM_CUSTOM_MODEL_DELETE:`workspace.llmCustomModel.delete`,WORKSPACE_LLM_SETTINGS_GET:`workspace.llmSettings.get`,WORKSPACE_LLM_SETTINGS_UPDATE:`workspace.llmSettings.update`,WORKSPACE_LLM_ROUTE_TEST:`workspace.llmRoute.test`},is={AUTH_LOGIN_JWT:`auth:login:jwt`,CONNECTION_ACK:`connection.ack`,CONNECTION_EVENT_FILTER_SET:`connection.event_filter.set`},as={CONNECTION_HEARTBEAT:`connection.heartbeat`},os={PREFERENCES_GET:`preferences.get`,PREFERENCES_UPDATE:`preferences.update`},ss={USER_PIPELINE_SETTING_GET:`user.pipeline.setting.get`,USER_PIPELINE_SETTING_UPDATE:`user.pipeline.setting.update`},cs={displayName:`Syncless`,slug:`syncless`,domain:`syncless.ai`,apiBaseHost:`api.syncless.ai`},ls={web:`${cs.displayName} Web`,desktop:`${cs.displayName} Desktop`,mobile:`${cs.displayName} Mobile`,browserExtension:`${cs.displayName} Browser`},us={command:`syncless`,envPrefix:`SYNCLESS`},ds={scope:`@langgenius`,launcherPackageName:`@langgenius/syncless`,platformPackagePrefix:`@langgenius/syncless-`},fs=cs.displayName;cs.slug,ls.web,us.command,ds.launcherPackageName;const ps={USER_FACING:`user_facing`},ms={HEARTBEAT_SEND_FAILED:`HEARTBEAT_SEND_FAILED`,HEARTBEAT_RESPONSE_TIMEOUT:`HEARTBEAT_RESPONSE_TIMEOUT`,REQUEST_SEND_FAILED:`RPC request failed to send`,TRANSPORT_CLOSED:`NETWORK_TRANSPORT_CLOSED`,TRANSPORT_SEND_FAILED:`NETWORK_TRANSPORT_SEND_FAILED`},hs={SEND_FAILED:`send_failed`},M={RPC_ERROR_CLASS:`rpc_error_class`,RPC_RESULT:`rpc_result`,TRANSPORT_PHASE:`transport_phase`},gs={HEARTBEAT_TIMEOUT:`heartbeat_timeout`},_s={finish:()=>{}},vs=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),ys=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,flushReplay:async()=>!1,init:async()=>{},startInactiveSpan:e=>_s,withScope:e=>e(vs())}),bs=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},xs=e=>typeof e==`string`?e:String(e),Ss=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Cs=e=>{let t={clientApp:e.clientApp,environment:e.environment,runtime:e.runtime,...e.appVersion?{appVersion:e.appVersion}:{},...e.release?{release:e.release}:{}},n={client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{}};return{contexts:{client:t},tags:n,user:{id:null}}},ws=(e,t,n)=>{let r=Ss(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Ts=(e,t)=>{delete e.contexts[t]},Es=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=xs(n)},Ds=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Os=/^[a-f0-9]{16,}$/i,ks=/^\d{4,}$/,As=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),js=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),Ms=e=>e&&(Ds.test(e)?`:uuid`:ks.test(e)?`:id`:Os.test(e)?`:hash`:e),Ns=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,Ps=e=>{if(!e)return[];if(Ns(e)){let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t}return Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?t.map(t=>[e,String(t)]):t==null?[]:[[e,String(t)]])},Fs=e=>{let t={};for(let[n,r]of Ps(e)){let e=n.toLowerCase();js.has(e)||(t[e]=r)}return t},Is=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map(Ms).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{As.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},Ls=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,Rs=e=>e<=0?!1:e>=1?!0:Math.random()<e,zs=`cancelled`,Bs=e=>e.errorClass===ps.USER_FACING?`warning`:`error`,Vs=e=>!(e.status===`ok`||e.status===zs||e.status===hs.SEND_FAILED),Hs=e=>{switch(e){case`ok`:return`ok`;case zs:return`cancelled`;case`timeout`:return`deadline_exceeded`;case hs.SEND_FAILED:return`internal_error`;default:return`internal_error`}},Us=e=>e instanceof Error?e:Error(Ls(typeof e==`string`?e:`Unknown frontend stability error`)),Ws=e=>e??`info`,Gs=(e,t)=>{let n=e.flushTimeoutMs??1500,r=Cs(e),i=(e,n)=>t.withScope(t=>{for(let[e,n]of Object.entries(r.tags))t.setTag(e,n);for(let[e,n]of Object.entries(r.contexts))t.setContext(e,n);if(r.user.id&&t.setUser({id:r.user.id}),!e)return n();for(let[n,r]of Object.entries(e.tags??{}))r&&t.setTag(n,r);for(let[n,r]of Object.entries(e.contexts??{}))t.setContext(n,r);return e.level&&t.setLevel(e.level),e.fingerprint&&e.fingerprint.length>0&&t.setFingerprint(e.fingerprint),n()}),a=n=>{let r=bs({client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{},...n.attributes??{}});return t.startInactiveSpan({name:n.name,op:n.op,attributes:r})},o=e=>{if(!t.enabled)return;let{sampleRate:n,...r}=e;r.level!==`error`&&r.level!==`fatal`&&!Rs(n??.2)||t.addBreadcrumb({...r,level:Ws(r.level)})};return{addBreadcrumb:e=>{o(e)},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(Us(e))})},clearScopeContext:e=>{Ts(r,e)},clearUser:()=>{r.user={id:null}},createHttpPort:()=>({onRequestStart:({kind:e,method:n,timeoutMs:r,url:o})=>{let s=a({name:`${n} ${e}`,op:`http.client`,attributes:{http_kind:e,http_method:n,http_url:o,...r===void 0?{}:{http_timeout_ms:r}}});return{finish:({error:a,status:c,statusCode:l})=>{s.finish({attributes:{http_result:c,...l===void 0?{}:{http_status_code:l}},status:Hs(c)}),c===`error`&&a&&i({contexts:{http:{method:n,statusCode:l,timeoutMs:r,url:o}},level:`error`,tags:{http_kind:e,http_method:n,http_result:c}},()=>{t.captureException(Us(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:t})=>{o({category:`ws.heartbeat`,data:{intervalMs:t,[M.TRANSPORT_PHASE]:gs.HEARTBEAT_TIMEOUT},level:`warning`,message:e instanceof Error?e.message:`Heartbeat timed out`,sampleRate:1})},onRpcStart:({channel:e,timeoutMs:n})=>{let r=a({name:e,op:`rpc.client`,attributes:{rpc_channel:e,rpc_timeout_ms:n}});return{finish:a=>{if(r.finish({attributes:{[M.RPC_RESULT]:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{[M.RPC_ERROR_CLASS]:a.errorClass}:{}},status:Hs(a.status)}),a.status!==`ok`){if(!Vs(a)){o({category:`rpc.lifecycle`,data:{channel:e,...a.errorClass?{errorClass:a.errorClass}:{},[M.RPC_RESULT]:a.status,timeoutMs:n},level:`warning`,message:`RPC ${a.status}`,sampleRate:1});return}i({contexts:{rpc:{channel:e,code:a.code,domain:a.domain,errorClass:a.errorClass,timeoutMs:n}},level:Bs(a),tags:{rpc_channel:e,[M.RPC_RESULT]:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{[M.RPC_ERROR_CLASS]:a.errorClass}:{}}},()=>{t.captureException(Us(a.error))})}}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{[M.TRANSPORT_PHASE]:n}},()=>{t.captureException(Us(e))})},onWsConnectStart:({kind:e})=>{let n=a({name:`ws.${e}`,op:`ws.connect`,attributes:{ws_kind:e}});return{finish:({error:r,status:a})=>{n.finish({attributes:{ws_kind:e,ws_result:a},status:Hs(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(Us(r))})}}},onWsEvent:({channel:e})=>{Rs(.2)&&t.addBreadcrumb({category:`ws.event`,data:{channel:e},level:`info`,message:`Received ${e}`})},onWsStatusChange:({status:e})=>{t.enabled&&t.addBreadcrumb({category:`ws.status`,data:{status:e},level:e===`error`?`error`:`info`,message:`Transport ${e}`})}}),flush:async e=>t.enabled?await t.flush(e??n):!1,flushReplay:async e=>!t.enabled||!t.flushReplay?!1:await t.flushReplay(e),setScopeContext:(e,t)=>{ws(r,e,t)},setTag:(e,t)=>{Es(r,e,t)},setUser:e=>{r.user=e},startSpan:a}};function Ks(e,t){if(typeof e!=`string`)throw TypeError(`Expected string, received ${e===null?`null`:typeof e}`);return t(e)}function qs(e){return Ks(e,e=>e.trim().toLowerCase())}function Js(e){return Ks(e,e=>e.trim().toUpperCase())}const Ys=e=>e.length===0?[ys()]:e,Xs=e=>{let t=Ys(e);return t.find(e=>e.enabled)??t[0]??ys()},Zs=e=>{let t=Ys(e),n=Xs(t),r=t.filter(e=>e.enabled);return{addBreadcrumb:e=>{for(let n of t)try{n.addBreadcrumb(e)}catch{}},captureException:e=>{for(let n of t)try{n.captureException(e)}catch{}},destroy:async()=>{for(let e of t)if(e.destroy)try{await e.destroy()}catch{}},enabled:t.some(e=>e.enabled),flush:async e=>(await Promise.allSettled((r.length>0?r:t).map(async t=>{try{return await t.flush(e)}catch{return!1}}))).every(e=>e.status===`fulfilled`&&e.value===!0),flushReplay:async e=>{if(!n.flushReplay)return!1;try{return await n.flushReplay(e)}catch{return!1}},init:async()=>{for(let e of t)if(e.init)try{await e.init()}catch{}},startInactiveSpan:e=>{try{return n.startInactiveSpan(e)}catch{return ys().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return ys().withScope(t)}}}};let Qs=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const $s=new Set(Object.values(Qs)),ec=(e,t=[`sentry`])=>{let n=e?.trim();if(!n)return{invalidNames:[],names:[...t]};let r=n.split(`,`),i=[],a=[];for(let e of r){let t=qs(e);if(!t)continue;if(!$s.has(t)){i.push(t);continue}let n=t;a.includes(n)||a.push(n)}return a.length>0?{invalidNames:i,names:a}:{invalidNames:i,names:[]}},tc=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},nc=e=>Object.keys(e).length>0,rc=(e,t)=>{t.userId?e.setUser({id:t.userId}):e.clearUser(),e.setTag(`workspace_id`,t.workspaceId??null),e.setTag(`pipeline_id`,t.pipelineId??null),e.setTag(`task_id`,t.taskId??null),e.setTag(`environment_id`,t.environmentId??null),e.setTag(`route_view`,t.routeView??null),e.setTag(`command_name`,t.commandName??null),e.setTag(`auth_phase`,t.authPhase??null);let n=tc({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});nc(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=tc({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});nc(r)?e.setScopeContext(`surface`,r):e.clearScopeContext(`surface`),e.addBreadcrumb({category:`echo.client_context`,data:{auth_phase:t.authPhase,command_name:t.commandName,environment_id:t.environmentId,has_device:!!t.deviceCode,interactive:t.interactive,pipeline_id:t.pipelineId,route_template:t.routeTemplate,route_view:t.routeView,task_id:t.taskId,workspace_id:t.workspaceId},level:`info`,message:`Client context changed`,sampleRate:1})},ic={finish:()=>{}},ac={finish:()=>{}},oc={finish:()=>{}},sc=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>ic,onTransportError:()=>{},onWsConnectStart:()=>ac,onWsEvent:()=>{},onWsStatusChange:()=>{}}),cc=()=>({onRequestStart:()=>oc}),lc=/^[^@]+@([^+]+)(?:\+.+)?$/,uc=e=>{if(!e)return;let t=lc.exec(e.trim())?.[1]?.trim();if(t)return t},dc=/\/+$/,N=e=>e.replace(dc,``),fc=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,pc=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,mc=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??cc(),r=e.kind??`http`;return async(e,i)=>{let a=Is(fc(e)),o=pc(e,i).toUpperCase(),s=n.onRequestStart({kind:r,method:o,url:a});try{let n=await t(e,i);return s.finish({status:`ok`,statusCode:n.status}),n}catch(e){throw s.finish({status:`error`,error:e}),e}}};var hc;function P(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}var gc=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},_c=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(hc=globalThis).__zod_globalConfig??(hc.__zod_globalConfig={});const vc=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(vc,e),vc}function yc(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 bc(e,t){return typeof t==`bigint`?t.toString():t}function xc(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Sc(e){return e==null}function Cc(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function wc(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const Tc=Symbol(`evaluating`);function I(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Tc)return r===void 0&&(r=Tc,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ec(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Dc(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Oc(e){return JSON.stringify(e)}function kc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Ac=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function jc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Mc=xc(()=>{if(vc.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Nc(e){if(jc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(jc(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Pc(e){return Nc(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Fc=new Set([`string`,`number`,`symbol`]);function Ic(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Lc(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(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 Rc(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const zc={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Bc(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 Lc(e,Dc(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 Ec(this,`shape`,e),e},checks:[]}))}function Vc(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 Lc(e,Dc(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 Ec(this,`shape`,r),r},checks:[]}))}function Hc(e,t){if(!Nc(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 Lc(e,Dc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ec(this,`shape`,n),n}}))}function Uc(e,t){if(!Nc(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Lc(e,Dc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ec(this,`shape`,n),n}}))}function Wc(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Lc(e,Dc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ec(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Gc(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 Lc(t,Dc(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 Ec(this,`shape`,i),i},checks:[]}))}function Kc(e,t,n){return Lc(t,Dc(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 Ec(this,`shape`,i),i}}))}function qc(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 Jc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Yc(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Xc(e){return typeof e==`string`?e:e?.message}function R(e,t,n){let r=e.message?e.message:Xc(e.inst?._zod.def?.error?.(e))??Xc(t?.error?.(e))??Xc(n.customError?.(e))??Xc(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Zc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Qc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const $c=(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,bc,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},el=P(`$ZodError`,$c),tl=P(`$ZodError`,$c,{Parent:Error});function nl(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 rl(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const il=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new gc;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>R(e,a,F())));throw Ac(t,i?.callee),t}return o.value},al=e=>async(t,n,r,i)=>{let a=r?{...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=>R(e,a,F())));throw Ac(t,i?.callee),t}return o.value},ol=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 gc;return a.issues.length?{success:!1,error:new(e??el)(a.issues.map(e=>R(e,i,F())))}:{success:!0,data:a.value}},sl=ol(tl),cl=e=>async(t,n,r)=>{let i=r?{...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=>R(e,i,F())))}:{success:!0,data:a.value}},ll=cl(tl),ul=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return il(e)(t,n,i)},dl=e=>(t,n,r)=>il(e)(t,n,r),fl=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return al(e)(t,n,i)},pl=e=>async(t,n,r)=>al(e)(t,n,r),ml=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ol(e)(t,n,i)},hl=e=>(t,n,r)=>ol(e)(t,n,r),gl=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cl(e)(t,n,i)},_l=e=>async(t,n,r)=>cl(e)(t,n,r),vl=/^[cC][0-9a-z]{6,}$/,yl=/^[0-9a-z]+$/,bl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xl=/^[0-9a-vA-V]{20}$/,Sl=/^[A-Za-z0-9]{27}$/,Cl=/^[a-zA-Z0-9_-]{21}$/,wl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tl=/^([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})$/,El=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)$/,Dl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ol(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const kl=/^(?:(?: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])$/,Al=/^(([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}|:))$/,jl=/^((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])$/,Ml=/^(([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])$/,Nl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pl=/^[A-Za-z0-9_-]*$/,Fl=/^https?$/,Il=/^\+[1-9]\d{6,14}$/,Ll=`(?:(?:\\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])))`,Rl=RegExp(`^${Ll}$`);function zl(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 Bl(e){return RegExp(`^${zl(e)}$`)}function Vl(e){let t=zl({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(`^${Ll}T(?:${r})$`)}const Hl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ul=/^-?\d+$/,Wl=/^-?\d+(?:\.\d+)?$/,Gl=/^(?:true|false)$/i,Kl=/^null$/i,ql=/^[^A-Z]*$/,Jl=/^[^a-z]*$/,z=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Yl={number:`number`,bigint:`bigint`,object:`date`},Xl=P(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=Yl[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})}}),Zl=P(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=Yl[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})}}),Ql=P(`$ZodCheckMultipleOf`,(e,t)=>{z.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):wc(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})}}),$l=P(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=zc[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=Ul)}),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})}}),eu=P(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sc(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=Zc(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tu=P(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sc(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=Zc(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nu=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sc(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=Zc(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})}}),ru=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.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=()=>{})}),iu=P(`$ZodCheckRegex`,(e,t)=>{ru.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})}}),au=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ql,ru.init(e,t)}),ou=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Jl,ru.init(e,t)}),su=P(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=Ic(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})}}),cu=P(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${Ic(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})}}),lu=P(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${Ic(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})}}),uu=P(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var du=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(`
67
- `).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(`
68
- `))}};const fu={major:4,minor:4,patch:3},B=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fu;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=qc(e),i;for(let a of t){if(a._zod.def.when){if(Jc(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new gc;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=qc(e,t))});else{if(e.issues.length===t)continue;r||=qc(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(qc(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new gc;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,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 o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new gc;return o.then(e=>t(e,r,a))}return t(o,r,a)}}I(e,`~standard`,()=>({validate:t=>{try{let n=sl(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return ll(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),pu=P(`$ZodString`,(e,t)=>{B.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hl(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}}),V=P(`$ZodStringFormat`,(e,t)=>{ru.init(e,t),pu.init(e,t)}),mu=P(`$ZodGUID`,(e,t)=>{t.pattern??=Tl,V.init(e,t)}),hu=P(`$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??=El(e)}else t.pattern??=El();V.init(e,t)}),gu=P(`$ZodEmail`,(e,t)=>{t.pattern??=Dl,V.init(e,t)}),_u=P(`$ZodURL`,(e,t)=>{V.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Fl.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let 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})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),vu=P(`$ZodEmoji`,(e,t)=>{t.pattern??=Ol(),V.init(e,t)}),yu=P(`$ZodNanoID`,(e,t)=>{t.pattern??=Cl,V.init(e,t)}),bu=P(`$ZodCUID`,(e,t)=>{t.pattern??=vl,V.init(e,t)}),xu=P(`$ZodCUID2`,(e,t)=>{t.pattern??=yl,V.init(e,t)}),Su=P(`$ZodULID`,(e,t)=>{t.pattern??=bl,V.init(e,t)}),Cu=P(`$ZodXID`,(e,t)=>{t.pattern??=xl,V.init(e,t)}),wu=P(`$ZodKSUID`,(e,t)=>{t.pattern??=Sl,V.init(e,t)}),Tu=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=Vl(t),V.init(e,t)}),Eu=P(`$ZodISODate`,(e,t)=>{t.pattern??=Rl,V.init(e,t)}),Du=P(`$ZodISOTime`,(e,t)=>{t.pattern??=Bl(t),V.init(e,t)}),Ou=P(`$ZodISODuration`,(e,t)=>{t.pattern??=wl,V.init(e,t)}),ku=P(`$ZodIPv4`,(e,t)=>{t.pattern??=kl,V.init(e,t),e._zod.bag.format=`ipv4`}),Au=P(`$ZodIPv6`,(e,t)=>{t.pattern??=Al,V.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})}}}),ju=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=jl,V.init(e,t)}),Mu=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ml,V.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 Nu(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Pu=P(`$ZodBase64`,(e,t)=>{t.pattern??=Nl,V.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Nu(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Fu(e){if(!Pl.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Nu(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Iu=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=Pl,V.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Fu(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Lu=P(`$ZodE164`,(e,t)=>{t.pattern??=Il,V.init(e,t)});function Ru(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 zu=P(`$ZodJWT`,(e,t)=>{V.init(e,t),e._zod.check=n=>{Ru(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Bu=P(`$ZodNumber`,(e,t)=>{B.init(e,t),e._zod.pattern=e._zod.bag.pattern??Wl,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}}),Vu=P(`$ZodNumberFormat`,(e,t)=>{$l.init(e,t),Bu.init(e,t)}),Hu=P(`$ZodBoolean`,(e,t)=>{B.init(e,t),e._zod.pattern=Gl,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}}),Uu=P(`$ZodNull`,(e,t)=>{B.init(e,t),e._zod.pattern=Kl,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}}),Wu=P(`$ZodUnknown`,(e,t)=>{B.init(e,t),e._zod.parse=e=>e}),Gu=P(`$ZodNever`,(e,t)=>{B.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ku(e,t,n){e.issues.length&&t.issues.push(...Yc(n,e.issues)),t.value[n]=e.value}const qu=P(`$ZodArray`,(e,t)=>{B.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=>Ku(t,n,e))):Ku(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Ju(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Yc(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Yu(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=Rc(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Xu(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||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=>Ju(e,n,i,t,u,d))):Ju(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Zu=P(`$ZodObject`,(e,t)=>{if(B.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=xc(()=>Yu(t));I(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=jc,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.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Ju(n,t,e,s,r,i))):Ju(a,t,e,s,r,i)}return i?Xu(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Qu=P(`$ZodObjectJIT`,(e,t)=>{Zu.init(e,t);let n=e._zod.parse,r=xc(()=>Yu(t)),i=e=>{let t=new du([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Oc(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=Oc(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
69
- if (${n}.issues.length) {
70
- if (${o} in input) {
71
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
72
- ...iss,
73
- path: iss.path ? [${o}, ...iss.path] : [${o}]
74
- })));
75
- }
76
- }
77
-
78
- if (${n}.value === undefined) {
79
- if (${o} in input) {
80
- newResult[${o}] = undefined;
81
- }
82
- } else {
83
- newResult[${o}] = ${n}.value;
84
- }
85
-
86
- `):c?t.write(`
87
- if (${n}.issues.length) {
88
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
89
- ...iss,
90
- path: iss.path ? [${o}, ...iss.path] : [${o}]
91
- })));
92
- }
93
-
94
- if (${n}.value === undefined) {
95
- if (${o} in input) {
96
- newResult[${o}] = undefined;
97
- }
98
- } else {
99
- newResult[${o}] = ${n}.value;
100
- }
101
-
102
- `):t.write(`
103
- const ${n}_present = ${o} in input;
104
- if (${n}.issues.length) {
105
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
106
- ...iss,
107
- path: iss.path ? [${o}, ...iss.path] : [${o}]
108
- })));
109
- }
110
- if (!${n}_present && !${n}.issues.length) {
111
- payload.issues.push({
112
- code: "invalid_type",
113
- expected: "nonoptional",
114
- input: undefined,
115
- path: [${o}]
116
- });
117
- }
118
-
119
- if (${n}_present) {
120
- if (${n}.value === undefined) {
121
- newResult[${o}] = undefined;
122
- } else {
123
- newResult[${o}] = ${n}.value;
124
- }
125
- }
126
-
127
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=jc,s=!vc.jitless,c=s&&Mc.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Xu([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function $u(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=>!qc(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=>R(e,r,F())))}),t)}const ed=P(`$ZodUnion`,(e,t)=>{B.init(e,t),I(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),I(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),I(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),I(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=>Cc(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>$u(t,r,e,i)):$u(o,r,e,i)}}),td=P(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ed.init(e,t);let n=e._zod.parse;I(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=xc(()=>{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(!jc(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||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),nd=P(`$ZodIntersection`,(e,t)=>{B.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])=>id(e,t,n)):id(e,i,a)}});function rd(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Nc(e)&&Nc(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=rd(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=rd(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 id(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}),qc(e))return e;let o=rd(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const ad=P(`$ZodRecord`,(e,t)=>{B.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Nc(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 c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>R(e,r,F())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Yc(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Yc(c,u.issues)),n.value[l]=u.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__`||!Object.prototype.propertyIsEnumerable.call(i,o))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`&&Wl.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=>R(e,r,F())),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(...Yc(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Yc(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),od=P(`$ZodEnum`,(e,t)=>{B.init(e,t);let n=yc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Fc.has(typeof e)).map(e=>typeof e==`string`?Ic(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}}),sd=P(`$ZodLiteral`,(e,t)=>{if(B.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`?Ic(e):e?Ic(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}}),cd=P(`$ZodTransform`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _c(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.fallback=!0,n));if(i instanceof Promise)throw new gc;return n.value=i,n.fallback=!0,n}});function ld(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ud=P(`$ZodOptional`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Cc(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>ld(e,r)):ld(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),dd=P(`$ZodExactOptional`,(e,t)=>{ud.init(e,t),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),fd=P(`$ZodNullable`,(e,t)=>{B.init(e,t),I(e._zod,`optin`,()=>t.innerType._zod.optin),I(e._zod,`optout`,()=>t.innerType._zod.optout),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Cc(e.source)}|null)$`):void 0}),I(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)}),pd=P(`$ZodDefault`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,I(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=>md(e,t)):md(r,t)}});function md(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const hd=P(`$ZodPrefault`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,I(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))}),gd=P(`$ZodNonOptional`,(e,t)=>{B.init(e,t),I(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=>_d(t,e)):_d(i,e)}});function _d(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 vd=P(`$ZodCatch`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,I(e._zod,`optout`,()=>t.innerType._zod.optout),I(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=>R(e,n,F()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>R(e,n,F()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),yd=P(`$ZodPipe`,(e,t)=>{B.init(e,t),I(e._zod,`values`,()=>t.in._zod.values),I(e._zod,`optin`,()=>t.in._zod.optin),I(e._zod,`optout`,()=>t.out._zod.optout),I(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=>bd(e,t.in,n)):bd(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>bd(e,t.out,n)):bd(r,t.out,n)}});function bd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const xd=P(`$ZodPreprocess`,(e,t)=>{yd.init(e,t)}),Sd=P(`$ZodReadonly`,(e,t)=>{B.init(e,t),I(e._zod,`propValues`,()=>t.innerType._zod.propValues),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`optin`,()=>t.innerType?._zod?.optin),I(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(Cd):Cd(r)}});function Cd(e){return e.value=Object.freeze(e.value),e}const wd=P(`$ZodLazy`,(e,t)=>{B.init(e,t),I(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),I(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),I(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),I(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),I(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Td=P(`$ZodCustom`,(e,t)=>{z.init(e,t),B.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=>Ed(t,n,r,e));Ed(i,n,r,e)}});function Ed(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(Qc(e))}}var Dd,Od=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 kd(){return new Od}(Dd=globalThis).__zod_globalRegistry??(Dd.__zod_globalRegistry=kd());const Ad=globalThis.__zod_globalRegistry;function jd(e,t){return new e({type:`string`,...L(t)})}function Md(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function Nd(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function Pd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Fd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function Id(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function Ld(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Rd(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function zd(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Bd(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function Vd(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Hd(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Ud(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function Wd(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function Gd(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Kd(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function qd(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Jd(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Yd(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Xd(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Zd(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Qd(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function $d(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function ef(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function tf(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function nf(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function rf(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function af(e,t){return new e({type:`number`,checks:[],...L(t)})}function of(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function sf(e,t){return new e({type:`boolean`,...L(t)})}function cf(e,t){return new e({type:`null`,...L(t)})}function lf(e){return new e({type:`unknown`})}function uf(e,t){return new e({type:`never`,...L(t)})}function df(e,t){return new Xl({check:`less_than`,...L(t),value:e,inclusive:!1})}function ff(e,t){return new Xl({check:`less_than`,...L(t),value:e,inclusive:!0})}function pf(e,t){return new Zl({check:`greater_than`,...L(t),value:e,inclusive:!1})}function mf(e,t){return new Zl({check:`greater_than`,...L(t),value:e,inclusive:!0})}function hf(e,t){return new Ql({check:`multiple_of`,...L(t),value:e})}function gf(e,t){return new eu({check:`max_length`,...L(t),maximum:e})}function _f(e,t){return new tu({check:`min_length`,...L(t),minimum:e})}function vf(e,t){return new nu({check:`length_equals`,...L(t),length:e})}function yf(e,t){return new iu({check:`string_format`,format:`regex`,...L(t),pattern:e})}function bf(e){return new au({check:`string_format`,format:`lowercase`,...L(e)})}function xf(e){return new ou({check:`string_format`,format:`uppercase`,...L(e)})}function Sf(e,t){return new su({check:`string_format`,format:`includes`,...L(t),includes:e})}function Cf(e,t){return new cu({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function wf(e,t){return new lu({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function Tf(e){return new uu({check:`overwrite`,tx:e})}function Ef(e){return Tf(t=>t.normalize(e))}function Df(){return Tf(e=>e.trim())}function Of(){return Tf(e=>e.toLowerCase())}function kf(){return Tf(e=>e.toUpperCase())}function Af(){return Tf(e=>kc(e))}function jf(e,t,n){return new e({type:`array`,element:t,...L(n)})}function Mf(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function Nf(e,t){let n=Pf(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Qc(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Qc(r))}},e(t.value,t)),t);return n}function Pf(e,t){let n=new z({check:`custom`,...L(t)});return n._zod.check=e,n}function Ff(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??Ad,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 H(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,H(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`&&U(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function If(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>
128
-
129
- 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 Lf(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.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:zf(t,`input`,e.processors),output:zf(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function U(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 U(r.element,n);if(r.type===`set`)return U(r.valueType,n);if(r.type===`lazy`)return U(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 U(r.innerType,n);if(r.type===`intersection`)return U(r.left,n)||U(r.right,n);if(r.type===`record`||r.type===`map`)return U(r.keyType,n)||U(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:U(r.in,n)||U(r.out,n);if(r.type===`object`){for(let e in r.shape)if(U(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(U(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(U(e,n))return!0;return!!(r.rest&&U(r.rest,n))}return!1}const Rf=(e,t={})=>n=>{let r=Ff({...n,processors:t});return H(e,r),If(r,e),Lf(r,e)},zf=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ff({...i??{},target:a,io:t,processors:n});return H(e,o),If(o,e),Lf(o,e)},Bf={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vf=(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=Bf[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}))])}},Hf=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Uf=(e,t,n,r)=>{n.type=`boolean`},Wf=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Gf=(e,t,n,r)=>{n.not={}},Kf=(e,t,n,r)=>{let i=e._zod.def,a=yc(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},qf=(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},Jf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Yf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Xf=(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=H(a.element,t,{...r,path:[...r.path,`items`]})},Zf=(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]=H(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=H(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Qf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>H(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},$f=(e,t,n,r)=>{let i=e._zod.def,a=H(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=H(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]]},ep=(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=H(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=H(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=H(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)}},tp=(e,t,n,r)=>{let i=e._zod.def,a=H(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`}]},np=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rp=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ip=(e,t,n,r)=>{let i=e._zod.def;H(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)))},ap=(e,t,n,r)=>{let i=e._zod.def;H(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},op=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;H(o,t,r);let s=t.seen.get(e);s.ref=o},sp=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cp=(e,t,n,r)=>{let i=e._zod.def;H(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lp=(e,t,n,r)=>{let i=e._zod.innerType;H(i,t,r);let a=t.seen.get(e);a.ref=i},up=P(`ZodISODateTime`,(e,t)=>{Tu.init(e,t),q.init(e,t)});function dp(e){return ef(up,e)}const fp=P(`ZodISODate`,(e,t)=>{Eu.init(e,t),q.init(e,t)});function pp(e){return tf(fp,e)}const mp=P(`ZodISOTime`,(e,t)=>{Du.init(e,t),q.init(e,t)});function hp(e){return nf(mp,e)}const gp=P(`ZodISODuration`,(e,t)=>{Ou.init(e,t),q.init(e,t)});function _p(e){return rf(gp,e)}const W=P(`ZodError`,(e,t)=>{el.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rl(e,t)},flatten:{value:t=>nl(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,bc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,bc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),vp=il(W),yp=al(W),bp=ol(W),xp=cl(W),Sp=ul(W),Cp=dl(W),wp=fl(W),Tp=pl(W),Ep=ml(W),Dp=hl(W),Op=gl(W),kp=_l(W),Ap=new WeakMap;function jp(e,t,n){let r=Object.getPrototypeOf(e),i=Ap.get(r);if(i||(i=new Set,Ap.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const G=P(`ZodType`,(e,t)=>(B.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:zf(e,`input`),output:zf(e,`output`)}}),e.toJSONSchema=Rf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>vp(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>bp(e,t,n),e.parseAsync=async(t,n)=>yp(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xp(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Sp(e,t,n),e.decode=(t,n)=>Cp(e,t,n),e.encodeAsync=async(t,n)=>wp(e,t,n),e.decodeAsync=async(t,n)=>Tp(e,t,n),e.safeEncode=(t,n)=>Ep(e,t,n),e.safeDecode=(t,n)=>Dp(e,t,n),e.safeEncodeAsync=async(t,n)=>Op(e,t,n),e.safeDecodeAsync=async(t,n)=>kp(e,t,n),jp(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Dc(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Lc(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Zm(e,t))},superRefine(e,t){return this.check(Qm(e,t))},overwrite(e){return this.check(Tf(e))},optional(){return Am(this)},exactOptional(){return Mm(this)},nullable(){return Pm(this)},nullish(){return Am(Pm(this))},nonoptional(e){return Bm(this,e)},array(){return pm(this)},or(e){return gm([this,e])},and(e){return bm(this,e)},transform(e){return Wm(this,Om(e))},default(e){return Im(this,e)},prefault(e){return Rm(this,e)},catch(e){return Hm(this,e)},pipe(e){return Wm(this,e)},readonly(){return qm(this)},describe(e){let t=this.clone();return Ad.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ad.get(this);let t=this.clone();return Ad.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Ad.get(e)?.description},configurable:!0}),e)),Mp=P(`_ZodString`,(e,t)=>{pu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vf(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,jp(e,`_ZodString`,{regex(...e){return this.check(yf(...e))},includes(...e){return this.check(Sf(...e))},startsWith(...e){return this.check(Cf(...e))},endsWith(...e){return this.check(wf(...e))},min(...e){return this.check(_f(...e))},max(...e){return this.check(gf(...e))},length(...e){return this.check(vf(...e))},nonempty(...e){return this.check(_f(1,...e))},lowercase(e){return this.check(bf(e))},uppercase(e){return this.check(xf(e))},trim(){return this.check(Df())},normalize(...e){return this.check(Ef(...e))},toLowerCase(){return this.check(Of())},toUpperCase(){return this.check(kf())},slugify(){return this.check(Af())}})}),Np=P(`ZodString`,(e,t)=>{pu.init(e,t),Mp.init(e,t),e.email=t=>e.check(Md(Pp,t)),e.url=t=>e.check(Rd(Rp,t)),e.jwt=t=>e.check($d($p,t)),e.emoji=t=>e.check(zd(zp,t)),e.guid=t=>e.check(Nd(Ip,t)),e.uuid=t=>e.check(Pd(Lp,t)),e.uuidv4=t=>e.check(Fd(Lp,t)),e.uuidv6=t=>e.check(Id(Lp,t)),e.uuidv7=t=>e.check(Ld(Lp,t)),e.nanoid=t=>e.check(Bd(Bp,t)),e.guid=t=>e.check(Nd(Ip,t)),e.cuid=t=>e.check(Vd(Vp,t)),e.cuid2=t=>e.check(Hd(Hp,t)),e.ulid=t=>e.check(Ud(Up,t)),e.base64=t=>e.check(Xd(Xp,t)),e.base64url=t=>e.check(Zd(Zp,t)),e.xid=t=>e.check(Wd(Wp,t)),e.ksuid=t=>e.check(Gd(Gp,t)),e.ipv4=t=>e.check(Kd(Kp,t)),e.ipv6=t=>e.check(qd(qp,t)),e.cidrv4=t=>e.check(Jd(Jp,t)),e.cidrv6=t=>e.check(Yd(Yp,t)),e.e164=t=>e.check(Qd(Qp,t)),e.datetime=t=>e.check(dp(t)),e.date=t=>e.check(pp(t)),e.time=t=>e.check(hp(t)),e.duration=t=>e.check(_p(t))});function K(e){return jd(Np,e)}const q=P(`ZodStringFormat`,(e,t)=>{V.init(e,t),Mp.init(e,t)}),Pp=P(`ZodEmail`,(e,t)=>{gu.init(e,t),q.init(e,t)});function Fp(e){return Md(Pp,e)}const Ip=P(`ZodGUID`,(e,t)=>{mu.init(e,t),q.init(e,t)}),Lp=P(`ZodUUID`,(e,t)=>{hu.init(e,t),q.init(e,t)}),Rp=P(`ZodURL`,(e,t)=>{_u.init(e,t),q.init(e,t)}),zp=P(`ZodEmoji`,(e,t)=>{vu.init(e,t),q.init(e,t)}),Bp=P(`ZodNanoID`,(e,t)=>{yu.init(e,t),q.init(e,t)}),Vp=P(`ZodCUID`,(e,t)=>{bu.init(e,t),q.init(e,t)}),Hp=P(`ZodCUID2`,(e,t)=>{xu.init(e,t),q.init(e,t)}),Up=P(`ZodULID`,(e,t)=>{Su.init(e,t),q.init(e,t)}),Wp=P(`ZodXID`,(e,t)=>{Cu.init(e,t),q.init(e,t)}),Gp=P(`ZodKSUID`,(e,t)=>{wu.init(e,t),q.init(e,t)}),Kp=P(`ZodIPv4`,(e,t)=>{ku.init(e,t),q.init(e,t)}),qp=P(`ZodIPv6`,(e,t)=>{Au.init(e,t),q.init(e,t)}),Jp=P(`ZodCIDRv4`,(e,t)=>{ju.init(e,t),q.init(e,t)}),Yp=P(`ZodCIDRv6`,(e,t)=>{Mu.init(e,t),q.init(e,t)}),Xp=P(`ZodBase64`,(e,t)=>{Pu.init(e,t),q.init(e,t)}),Zp=P(`ZodBase64URL`,(e,t)=>{Iu.init(e,t),q.init(e,t)}),Qp=P(`ZodE164`,(e,t)=>{Lu.init(e,t),q.init(e,t)}),$p=P(`ZodJWT`,(e,t)=>{zu.init(e,t),q.init(e,t)}),em=P(`ZodNumber`,(e,t)=>{Bu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hf(e,t,n,r),jp(e,`ZodNumber`,{gt(e,t){return this.check(pf(e,t))},gte(e,t){return this.check(mf(e,t))},min(e,t){return this.check(mf(e,t))},lt(e,t){return this.check(df(e,t))},lte(e,t){return this.check(ff(e,t))},max(e,t){return this.check(ff(e,t))},int(e){return this.check(rm(e))},safe(e){return this.check(rm(e))},positive(e){return this.check(pf(0,e))},nonnegative(e){return this.check(mf(0,e))},negative(e){return this.check(df(0,e))},nonpositive(e){return this.check(ff(0,e))},multipleOf(e,t){return this.check(hf(e,t))},step(e,t){return this.check(hf(e,t))},finite(){return this}});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 tm(e){return af(em,e)}const nm=P(`ZodNumberFormat`,(e,t)=>{Vu.init(e,t),em.init(e,t)});function rm(e){return of(nm,e)}const im=P(`ZodBoolean`,(e,t)=>{Hu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uf(e,t,n,r)});function am(e){return sf(im,e)}const om=P(`ZodNull`,(e,t)=>{Uu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wf(e,t,n,r)});function sm(e){return cf(om,e)}const cm=P(`ZodUnknown`,(e,t)=>{Wu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function lm(){return lf(cm)}const um=P(`ZodNever`,(e,t)=>{Gu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gf(e,t,n,r)});function dm(e){return uf(um,e)}const fm=P(`ZodArray`,(e,t)=>{qu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xf(e,t,n,r),e.element=t.element,jp(e,`ZodArray`,{min(e,t){return this.check(_f(e,t))},nonempty(e){return this.check(_f(1,e))},max(e,t){return this.check(gf(e,t))},length(e,t){return this.check(vf(e,t))},unwrap(){return this.element}})});function pm(e,t){return jf(fm,e,t)}const mm=P(`ZodObject`,(e,t)=>{Qu.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zf(e,t,n,r),I(e,`shape`,()=>t.shape),jp(e,`ZodObject`,{keyof(){return wm(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:lm()})},loose(){return this.clone({...this._zod.def,catchall:lm()})},strict(){return this.clone({...this._zod.def,catchall:dm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Hc(this,e)},safeExtend(e){return Uc(this,e)},merge(e){return Wc(this,e)},pick(e){return Bc(this,e)},omit(e){return Vc(this,e)},partial(...e){return Gc(km,this,e[0])},required(...e){return Kc(zm,this,e[0])}})});function J(e,t){return new mm({type:`object`,shape:e??{},...L(t)})}const hm=P(`ZodUnion`,(e,t)=>{ed.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qf(e,t,n,r),e.options=t.options});function gm(e,t){return new hm({type:`union`,options:e,...L(t)})}const _m=P(`ZodDiscriminatedUnion`,(e,t)=>{hm.init(e,t),td.init(e,t)});function vm(e,t,n){return new _m({type:`union`,options:t,discriminator:e,...L(n)})}const ym=P(`ZodIntersection`,(e,t)=>{nd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$f(e,t,n,r)});function bm(e,t){return new ym({type:`intersection`,left:e,right:t})}const xm=P(`ZodRecord`,(e,t)=>{ad.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ep(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Sm(e,t,n){return!t||!t._zod?new xm({type:`record`,keyType:K(),valueType:e,...L(t)}):new xm({type:`record`,keyType:e,valueType:t,...L(n)})}const Cm=P(`ZodEnum`,(e,t)=>{od.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kf(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 Cm({...t,checks:[],...L(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 Cm({...t,checks:[],...L(r),entries:i})}});function wm(e,t){return new Cm({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}function Tm(e,t){return new Cm({type:`enum`,entries:e,...L(t)})}const Em=P(`ZodLiteral`,(e,t)=>{sd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qf(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 Y(e,t){return new Em({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}const Dm=P(`ZodTransform`,(e,t)=>{cd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yf(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _c(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qc(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(Qc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Om(e){return new Dm({type:`transform`,transform:e})}const km=P(`ZodOptional`,(e,t)=>{ud.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Am(e){return new km({type:`optional`,innerType:e})}const jm=P(`ZodExactOptional`,(e,t)=>{dd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mm(e){return new jm({type:`optional`,innerType:e})}const Nm=P(`ZodNullable`,(e,t)=>{fd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pm(e){return new Nm({type:`nullable`,innerType:e})}const Fm=P(`ZodDefault`,(e,t)=>{pd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Im(e,t){return new Fm({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pc(t)}})}const Lm=P(`ZodPrefault`,(e,t)=>{hd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ip(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rm(e,t){return new Lm({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pc(t)}})}const zm=P(`ZodNonOptional`,(e,t)=>{gd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>np(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bm(e,t){return new zm({type:`nonoptional`,innerType:e,...L(t)})}const Vm=P(`ZodCatch`,(e,t)=>{vd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ap(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hm(e,t){return new Vm({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Um=P(`ZodPipe`,(e,t)=>{yd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>op(e,t,n,r),e.in=t.in,e.out=t.out});function Wm(e,t){return new Um({type:`pipe`,in:e,out:t})}const Gm=P(`ZodPreprocess`,(e,t)=>{Um.init(e,t),xd.init(e,t)}),Km=P(`ZodReadonly`,(e,t)=>{Sd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qm(e){return new Km({type:`readonly`,innerType:e})}const Jm=P(`ZodLazy`,(e,t)=>{wd.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lp(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Ym(e){return new Jm({type:`lazy`,getter:e})}const Xm=P(`ZodCustom`,(e,t)=>{Td.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jf(e,t,n,r)});function Zm(e,t={}){return Mf(Xm,e,t)}function Qm(e,t){return Nf(e,t)}function $m(e,t){return new Gm({type:`pipe`,in:Om(e),out:t})}const eh=[`en`,`zh-Hans`];J({identityToken:K().trim().min(1),nonce:K().trim().optional().nullable(),email:K().trim().email().optional().nullable(),name:J({firstName:K().trim().optional().nullable(),lastName:K().trim().optional().nullable()}).optional().nullable(),preferredLanguage:wm(eh)}),J({isAvailable:am()});const th=e=>$m(e=>e===null?void 0:e,e.optional()),nh=Ym(()=>gm([K(),tm(),am(),sm(),pm(nh),Sm(K(),nh)])),rh=K().trim().pipe(Fp()),ih=J({error:K().trim().min(1),details:Sm(K(),nh)}),ah=J({expiresAt:dp(),updatedAt:dp()}),oh=J({id:K().trim().min(1),email:rh,name:K(),image:K().nullable()}),sh=J({token:K().trim().min(1),onboardingCompleted:am(),projectTemplateOnboardingCompleted:am(),session:ah,user:oh}),ch=J({token:K().trim().min(1)});J({token:K().trim().min(1)});const X={PENDING:`pending`,COMPLETED:`completed`,EXPIRED:`expired`,ERROR:`error`};X.COMPLETED,X.EXPIRED,X.ERROR;const lh={BROWSER_PAGE:`browser_page`,DEEP_LINK:`deep_link`},uh={GITHUB:`github`,GOOGLE:`google`,SLACK:`slack`},dh={GOOGLE_WORKSPACE:`google-workspace`},fh=wm([lh.BROWSER_PAGE,lh.DEEP_LINK]),ph=wm([uh.GITHUB,uh.GOOGLE,uh.SLACK]),mh=wm([dh.GOOGLE_WORKSPACE]);J({returnMode:fh,preferredLanguage:wm(eh)});const hh=J({authorizationUrl:K().trim().min(1),expiresAt:K().datetime(),state:K().trim().min(1)}),gh=hh.extend({provider:ph}),_h=hh.extend({provider:mh}),vh=J({state:K().trim().min(1)}),yh=vh.extend({expiresAt:K().datetime(),name:K(),token:K().trim().min(1),userId:K().trim().min(1),avatarUrl:K()}),bh=vh.extend({reason:K().trim().min(1),status:Y(X.ERROR)}),xh=vm(`status`,[vh.extend({provider:ph,status:Y(X.PENDING)}),yh.extend({provider:ph,status:Y(X.COMPLETED)}),vh.extend({provider:ph,status:Y(X.EXPIRED)}),bh.extend({provider:ph})]),Sh=vm(`status`,[vh.extend({provider:mh,status:Y(X.PENDING)}),yh.extend({provider:mh,status:Y(X.COMPLETED)}),vh.extend({provider:mh,status:Y(X.EXPIRED)}),bh.extend({provider:mh})]);var Ch=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.USE_PROXY=e.UNSUPPORTED_MEDIA_TYPE=e.UNPROCESSABLE_ENTITY=e.UNAUTHORIZED=e.TOO_MANY_REQUESTS=e.TEMPORARY_REDIRECT=e.SWITCHING_PROTOCOLS=e.SERVICE_UNAVAILABLE=e.SEE_OTHER=e.RESET_CONTENT=e.REQUESTED_RANGE_NOT_SATISFIABLE=e.REQUEST_URI_TOO_LONG=e.REQUEST_TOO_LONG=e.REQUEST_TIMEOUT=e.REQUEST_HEADER_FIELDS_TOO_LARGE=e.PROXY_AUTHENTICATION_REQUIRED=e.PROCESSING=e.PRECONDITION_REQUIRED=e.PRECONDITION_FAILED=e.PERMANENT_REDIRECT=e.PAYMENT_REQUIRED=e.PARTIAL_CONTENT=e.OK=e.NOT_MODIFIED=e.NOT_IMPLEMENTED=e.NOT_FOUND=e.NOT_ACCEPTABLE=e.NON_AUTHORITATIVE_INFORMATION=e.NO_CONTENT=e.NETWORK_AUTHENTICATION_REQUIRED=e.MULTIPLE_CHOICES=e.MULTI_STATUS=e.MOVED_TEMPORARILY=e.MOVED_PERMANENTLY=e.METHOD_NOT_ALLOWED=e.METHOD_FAILURE=e.LOCKED=e.LENGTH_REQUIRED=e.INTERNAL_SERVER_ERROR=e.INSUFFICIENT_STORAGE=e.INSUFFICIENT_SPACE_ON_RESOURCE=e.IM_A_TEAPOT=e.HTTP_VERSION_NOT_SUPPORTED=e.GONE=e.GATEWAY_TIMEOUT=e.FORBIDDEN=e.FAILED_DEPENDENCY=e.EXPECTATION_FAILED=e.CREATED=e.CONTINUE=e.CONFLICT=e.BAD_REQUEST=e.BAD_GATEWAY=e.ACCEPTED=void 0,e.ACCEPTED=202,e.BAD_GATEWAY=502,e.BAD_REQUEST=400,e.CONFLICT=409,e.CONTINUE=100,e.CREATED=201,e.EXPECTATION_FAILED=417,e.FAILED_DEPENDENCY=424,e.FORBIDDEN=403,e.GATEWAY_TIMEOUT=504,e.GONE=410,e.HTTP_VERSION_NOT_SUPPORTED=505,e.IM_A_TEAPOT=418,e.INSUFFICIENT_SPACE_ON_RESOURCE=419,e.INSUFFICIENT_STORAGE=507,e.INTERNAL_SERVER_ERROR=500,e.LENGTH_REQUIRED=411,e.LOCKED=423,e.METHOD_FAILURE=420,e.METHOD_NOT_ALLOWED=405,e.MOVED_PERMANENTLY=301,e.MOVED_TEMPORARILY=302,e.MULTI_STATUS=207,e.MULTIPLE_CHOICES=300,e.NETWORK_AUTHENTICATION_REQUIRED=511,e.NO_CONTENT=204,e.NON_AUTHORITATIVE_INFORMATION=203,e.NOT_ACCEPTABLE=406,e.NOT_FOUND=404,e.NOT_IMPLEMENTED=501,e.NOT_MODIFIED=304,e.OK=200,e.PARTIAL_CONTENT=206,e.PAYMENT_REQUIRED=402,e.PERMANENT_REDIRECT=308,e.PRECONDITION_FAILED=412,e.PRECONDITION_REQUIRED=428,e.PROCESSING=102,e.PROXY_AUTHENTICATION_REQUIRED=407,e.REQUEST_HEADER_FIELDS_TOO_LARGE=431,e.REQUEST_TIMEOUT=408,e.REQUEST_TOO_LONG=413,e.REQUEST_URI_TOO_LONG=414,e.REQUESTED_RANGE_NOT_SATISFIABLE=416,e.RESET_CONTENT=205,e.SEE_OTHER=303,e.SERVICE_UNAVAILABLE=503,e.SWITCHING_PROTOCOLS=101,e.TEMPORARY_REDIRECT=307,e.TOO_MANY_REQUESTS=429,e.UNAUTHORIZED=401,e.UNPROCESSABLE_ENTITY=422,e.UNSUPPORTED_MEDIA_TYPE=415,e.USE_PROXY=305,e.default={ACCEPTED:e.ACCEPTED,BAD_GATEWAY:e.BAD_GATEWAY,BAD_REQUEST:e.BAD_REQUEST,CONFLICT:e.CONFLICT,CONTINUE:e.CONTINUE,CREATED:e.CREATED,EXPECTATION_FAILED:e.EXPECTATION_FAILED,FORBIDDEN:e.FORBIDDEN,GATEWAY_TIMEOUT:e.GATEWAY_TIMEOUT,GONE:e.GONE,HTTP_VERSION_NOT_SUPPORTED:e.HTTP_VERSION_NOT_SUPPORTED,IM_A_TEAPOT:e.IM_A_TEAPOT,INSUFFICIENT_SPACE_ON_RESOURCE:e.INSUFFICIENT_SPACE_ON_RESOURCE,INSUFFICIENT_STORAGE:e.INSUFFICIENT_STORAGE,INTERNAL_SERVER_ERROR:e.INTERNAL_SERVER_ERROR,LENGTH_REQUIRED:e.LENGTH_REQUIRED,LOCKED:e.LOCKED,METHOD_FAILURE:e.METHOD_FAILURE,METHOD_NOT_ALLOWED:e.METHOD_NOT_ALLOWED,MOVED_PERMANENTLY:e.MOVED_PERMANENTLY,MOVED_TEMPORARILY:e.MOVED_TEMPORARILY,MULTI_STATUS:e.MULTI_STATUS,MULTIPLE_CHOICES:e.MULTIPLE_CHOICES,NETWORK_AUTHENTICATION_REQUIRED:e.NETWORK_AUTHENTICATION_REQUIRED,NO_CONTENT:e.NO_CONTENT,NON_AUTHORITATIVE_INFORMATION:e.NON_AUTHORITATIVE_INFORMATION,NOT_ACCEPTABLE:e.NOT_ACCEPTABLE,NOT_FOUND:e.NOT_FOUND,NOT_IMPLEMENTED:e.NOT_IMPLEMENTED,NOT_MODIFIED:e.NOT_MODIFIED,OK:e.OK,PARTIAL_CONTENT:e.PARTIAL_CONTENT,PAYMENT_REQUIRED:e.PAYMENT_REQUIRED,PERMANENT_REDIRECT:e.PERMANENT_REDIRECT,PRECONDITION_FAILED:e.PRECONDITION_FAILED,PRECONDITION_REQUIRED:e.PRECONDITION_REQUIRED,PROCESSING:e.PROCESSING,PROXY_AUTHENTICATION_REQUIRED:e.PROXY_AUTHENTICATION_REQUIRED,REQUEST_HEADER_FIELDS_TOO_LARGE:e.REQUEST_HEADER_FIELDS_TOO_LARGE,REQUEST_TIMEOUT:e.REQUEST_TIMEOUT,REQUEST_TOO_LONG:e.REQUEST_TOO_LONG,REQUEST_URI_TOO_LONG:e.REQUEST_URI_TOO_LONG,REQUESTED_RANGE_NOT_SATISFIABLE:e.REQUESTED_RANGE_NOT_SATISFIABLE,RESET_CONTENT:e.RESET_CONTENT,SEE_OTHER:e.SEE_OTHER,SERVICE_UNAVAILABLE:e.SERVICE_UNAVAILABLE,SWITCHING_PROTOCOLS:e.SWITCHING_PROTOCOLS,TEMPORARY_REDIRECT:e.TEMPORARY_REDIRECT,TOO_MANY_REQUESTS:e.TOO_MANY_REQUESTS,UNAUTHORIZED:e.UNAUTHORIZED,UNPROCESSABLE_ENTITY:e.UNPROCESSABLE_ENTITY,UNSUPPORTED_MEDIA_TYPE:e.UNSUPPORTED_MEDIA_TYPE,USE_PROXY:e.USE_PROXY}})),wh=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reasonPhraseToStatusCode=e.statusCodeToReasonPhrase=void 0,e.statusCodeToReasonPhrase={202:`Accepted`,502:`Bad Gateway`,400:`Bad Request`,409:`Conflict`,100:`Continue`,201:`Created`,417:`Expectation Failed`,424:`Failed Dependency`,403:`Forbidden`,504:`Gateway Timeout`,410:`Gone`,505:`HTTP Version Not Supported`,418:`I'm a teapot`,419:`Insufficient Space on Resource`,507:`Insufficient Storage`,500:`Internal Server Error`,411:`Length Required`,423:`Locked`,420:`Method Failure`,405:`Method Not Allowed`,301:`Moved Permanently`,302:`Moved Temporarily`,207:`Multi-Status`,300:`Multiple Choices`,511:`Network Authentication Required`,204:`No Content`,203:`Non Authoritative Information`,406:`Not Acceptable`,404:`Not Found`,501:`Not Implemented`,304:`Not Modified`,200:`OK`,206:`Partial Content`,402:`Payment Required`,308:`Permanent Redirect`,412:`Precondition Failed`,428:`Precondition Required`,102:`Processing`,103:`Early Hints`,426:`Upgrade Required`,407:`Proxy Authentication Required`,431:`Request Header Fields Too Large`,408:`Request Timeout`,413:`Request Entity Too Large`,414:`Request-URI Too Long`,416:`Requested Range Not Satisfiable`,205:`Reset Content`,303:`See Other`,503:`Service Unavailable`,101:`Switching Protocols`,307:`Temporary Redirect`,429:`Too Many Requests`,401:`Unauthorized`,451:`Unavailable For Legal Reasons`,422:`Unprocessable Entity`,415:`Unsupported Media Type`,305:`Use Proxy`,421:`Misdirected Request`},e.reasonPhraseToStatusCode={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421}})),Th=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStatusText=e.getStatusCode=e.getReasonPhrase=void 0;var t=wh();function n(e){var n=t.statusCodeToReasonPhrase[e.toString()];if(!n)throw Error(`Status code does not exist: `+e);return n}e.getReasonPhrase=n;function r(e){var n=t.reasonPhraseToStatusCode[e];if(!n)throw Error(`Reason phrase does not exist: `+e);return n}e.getStatusCode=r,e.getStatusText=n})),Eh=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatusCodes=void 0,(function(e){e[e.CONTINUE=100]=`CONTINUE`,e[e.SWITCHING_PROTOCOLS=101]=`SWITCHING_PROTOCOLS`,e[e.PROCESSING=102]=`PROCESSING`,e[e.EARLY_HINTS=103]=`EARLY_HINTS`,e[e.OK=200]=`OK`,e[e.CREATED=201]=`CREATED`,e[e.ACCEPTED=202]=`ACCEPTED`,e[e.NON_AUTHORITATIVE_INFORMATION=203]=`NON_AUTHORITATIVE_INFORMATION`,e[e.NO_CONTENT=204]=`NO_CONTENT`,e[e.RESET_CONTENT=205]=`RESET_CONTENT`,e[e.PARTIAL_CONTENT=206]=`PARTIAL_CONTENT`,e[e.MULTI_STATUS=207]=`MULTI_STATUS`,e[e.MULTIPLE_CHOICES=300]=`MULTIPLE_CHOICES`,e[e.MOVED_PERMANENTLY=301]=`MOVED_PERMANENTLY`,e[e.MOVED_TEMPORARILY=302]=`MOVED_TEMPORARILY`,e[e.SEE_OTHER=303]=`SEE_OTHER`,e[e.NOT_MODIFIED=304]=`NOT_MODIFIED`,e[e.USE_PROXY=305]=`USE_PROXY`,e[e.TEMPORARY_REDIRECT=307]=`TEMPORARY_REDIRECT`,e[e.PERMANENT_REDIRECT=308]=`PERMANENT_REDIRECT`,e[e.BAD_REQUEST=400]=`BAD_REQUEST`,e[e.UNAUTHORIZED=401]=`UNAUTHORIZED`,e[e.PAYMENT_REQUIRED=402]=`PAYMENT_REQUIRED`,e[e.FORBIDDEN=403]=`FORBIDDEN`,e[e.NOT_FOUND=404]=`NOT_FOUND`,e[e.METHOD_NOT_ALLOWED=405]=`METHOD_NOT_ALLOWED`,e[e.NOT_ACCEPTABLE=406]=`NOT_ACCEPTABLE`,e[e.PROXY_AUTHENTICATION_REQUIRED=407]=`PROXY_AUTHENTICATION_REQUIRED`,e[e.REQUEST_TIMEOUT=408]=`REQUEST_TIMEOUT`,e[e.CONFLICT=409]=`CONFLICT`,e[e.GONE=410]=`GONE`,e[e.LENGTH_REQUIRED=411]=`LENGTH_REQUIRED`,e[e.PRECONDITION_FAILED=412]=`PRECONDITION_FAILED`,e[e.REQUEST_TOO_LONG=413]=`REQUEST_TOO_LONG`,e[e.REQUEST_URI_TOO_LONG=414]=`REQUEST_URI_TOO_LONG`,e[e.UNSUPPORTED_MEDIA_TYPE=415]=`UNSUPPORTED_MEDIA_TYPE`,e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]=`REQUESTED_RANGE_NOT_SATISFIABLE`,e[e.EXPECTATION_FAILED=417]=`EXPECTATION_FAILED`,e[e.IM_A_TEAPOT=418]=`IM_A_TEAPOT`,e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]=`INSUFFICIENT_SPACE_ON_RESOURCE`,e[e.METHOD_FAILURE=420]=`METHOD_FAILURE`,e[e.MISDIRECTED_REQUEST=421]=`MISDIRECTED_REQUEST`,e[e.UNPROCESSABLE_ENTITY=422]=`UNPROCESSABLE_ENTITY`,e[e.LOCKED=423]=`LOCKED`,e[e.FAILED_DEPENDENCY=424]=`FAILED_DEPENDENCY`,e[e.UPGRADE_REQUIRED=426]=`UPGRADE_REQUIRED`,e[e.PRECONDITION_REQUIRED=428]=`PRECONDITION_REQUIRED`,e[e.TOO_MANY_REQUESTS=429]=`TOO_MANY_REQUESTS`,e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]=`REQUEST_HEADER_FIELDS_TOO_LARGE`,e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]=`UNAVAILABLE_FOR_LEGAL_REASONS`,e[e.INTERNAL_SERVER_ERROR=500]=`INTERNAL_SERVER_ERROR`,e[e.NOT_IMPLEMENTED=501]=`NOT_IMPLEMENTED`,e[e.BAD_GATEWAY=502]=`BAD_GATEWAY`,e[e.SERVICE_UNAVAILABLE=503]=`SERVICE_UNAVAILABLE`,e[e.GATEWAY_TIMEOUT=504]=`GATEWAY_TIMEOUT`,e[e.HTTP_VERSION_NOT_SUPPORTED=505]=`HTTP_VERSION_NOT_SUPPORTED`,e[e.INSUFFICIENT_STORAGE=507]=`INSUFFICIENT_STORAGE`,e[e.NETWORK_AUTHENTICATION_REQUIRED=511]=`NETWORK_AUTHENTICATION_REQUIRED`})(e.StatusCodes||={})})),Dh=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReasonPhrases=void 0,(function(e){e.ACCEPTED=`Accepted`,e.BAD_GATEWAY=`Bad Gateway`,e.BAD_REQUEST=`Bad Request`,e.CONFLICT=`Conflict`,e.CONTINUE=`Continue`,e.CREATED=`Created`,e.EXPECTATION_FAILED=`Expectation Failed`,e.FAILED_DEPENDENCY=`Failed Dependency`,e.FORBIDDEN=`Forbidden`,e.GATEWAY_TIMEOUT=`Gateway Timeout`,e.GONE=`Gone`,e.HTTP_VERSION_NOT_SUPPORTED=`HTTP Version Not Supported`,e.IM_A_TEAPOT=`I'm a teapot`,e.INSUFFICIENT_SPACE_ON_RESOURCE=`Insufficient Space on Resource`,e.INSUFFICIENT_STORAGE=`Insufficient Storage`,e.INTERNAL_SERVER_ERROR=`Internal Server Error`,e.LENGTH_REQUIRED=`Length Required`,e.LOCKED=`Locked`,e.METHOD_FAILURE=`Method Failure`,e.METHOD_NOT_ALLOWED=`Method Not Allowed`,e.MOVED_PERMANENTLY=`Moved Permanently`,e.MOVED_TEMPORARILY=`Moved Temporarily`,e.MULTI_STATUS=`Multi-Status`,e.MULTIPLE_CHOICES=`Multiple Choices`,e.NETWORK_AUTHENTICATION_REQUIRED=`Network Authentication Required`,e.NO_CONTENT=`No Content`,e.NON_AUTHORITATIVE_INFORMATION=`Non Authoritative Information`,e.NOT_ACCEPTABLE=`Not Acceptable`,e.NOT_FOUND=`Not Found`,e.NOT_IMPLEMENTED=`Not Implemented`,e.NOT_MODIFIED=`Not Modified`,e.OK=`OK`,e.PARTIAL_CONTENT=`Partial Content`,e.PAYMENT_REQUIRED=`Payment Required`,e.PERMANENT_REDIRECT=`Permanent Redirect`,e.PRECONDITION_FAILED=`Precondition Failed`,e.PRECONDITION_REQUIRED=`Precondition Required`,e.PROCESSING=`Processing`,e.EARLY_HINTS=`Early Hints`,e.UPGRADE_REQUIRED=`Upgrade Required`,e.PROXY_AUTHENTICATION_REQUIRED=`Proxy Authentication Required`,e.REQUEST_HEADER_FIELDS_TOO_LARGE=`Request Header Fields Too Large`,e.REQUEST_TIMEOUT=`Request Timeout`,e.REQUEST_TOO_LONG=`Request Entity Too Large`,e.REQUEST_URI_TOO_LONG=`Request-URI Too Long`,e.REQUESTED_RANGE_NOT_SATISFIABLE=`Requested Range Not Satisfiable`,e.RESET_CONTENT=`Reset Content`,e.SEE_OTHER=`See Other`,e.SERVICE_UNAVAILABLE=`Service Unavailable`,e.SWITCHING_PROTOCOLS=`Switching Protocols`,e.TEMPORARY_REDIRECT=`Temporary Redirect`,e.TOO_MANY_REQUESTS=`Too Many Requests`,e.UNAUTHORIZED=`Unauthorized`,e.UNAVAILABLE_FOR_LEGAL_REASONS=`Unavailable For Legal Reasons`,e.UNPROCESSABLE_ENTITY=`Unprocessable Entity`,e.UNSUPPORTED_MEDIA_TYPE=`Unsupported Media Type`,e.USE_PROXY=`Use Proxy`,e.MISDIRECTED_REQUEST=`Misdirected Request`})(e.ReasonPhrases||={})})),Z=e((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__exportStar||function(e,t){for(var r in e)r!==`default`&&!t.hasOwnProperty(r)&&n(t,e,r)},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0});var a=i(Ch()),o=Th(),s=Th();Object.defineProperty(e,`getStatusCode`,{enumerable:!0,get:function(){return s.getStatusCode}}),Object.defineProperty(e,`getReasonPhrase`,{enumerable:!0,get:function(){return s.getReasonPhrase}}),Object.defineProperty(e,`getStatusText`,{enumerable:!0,get:function(){return s.getStatusText}});var c=Eh();Object.defineProperty(e,`StatusCodes`,{enumerable:!0,get:function(){return c.StatusCodes}});var l=Dh();Object.defineProperty(e,`ReasonPhrases`,{enumerable:!0,get:function(){return l.ReasonPhrases}}),r(Ch(),e),e.default=t(t({},a.default),{getStatusCode:o.getStatusCode,getStatusText:o.getStatusText})}))();const Q=(e,t)=>{let n=JSON.parse(e),r=t.safeParse(n);if(!r.success)throw r.error;return r.data};let Oh=function(e){return e.OK=`ok`,e.UNAUTHORIZED=`unauthorized`,e}({});const kh=J({success:am()}),Ah=J({token:K().trim().min(1),userId:K().trim().min(1),email:K().trim().email(),expiresAt:K().datetime(),updatedAt:K().datetime(),name:K(),avatarUrl:K()}),jh=J({ok:Y(!0),revokedAt:K().datetime(),sessionId:K().trim().min(1)}),$=async(e,t)=>{let n=Q(await e.text(),ih);throw Error(n.error)},Mh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/email-otp/send-verification-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email})});return r.status===Z.StatusCodes.NO_CONTENT?{success:!0}:r.status===Z.StatusCodes.OK?Q(await r.text(),kh):await $(r,`Failed to request sign-in code`)},Nh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/sign-in/email-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email,otp:t.otp,preferredLanguage:t.preferredLanguage})});return r.status===Z.StatusCodes.OK?Q(await r.text(),ch):await $(r,`Failed to verify sign-in code`)},Ph=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/oauth/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===Z.StatusCodes.OK?Q(await r.text(),gh):await $(r,`Failed to start external OAuth login`)},Fh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/oauth/${encodeURIComponent(t.provider)}/completion`,N(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===Z.StatusCodes.OK?Q(await a.text(),xh):await $(a,`Failed to load external OAuth completion state`)},Ih=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/sso/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===Z.StatusCodes.OK?Q(await r.text(),_h):await $(r,`Failed to start external SSO login`)},Lh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/sso/${encodeURIComponent(t.provider)}/completion`,N(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===Z.StatusCodes.OK?Q(await a.text(),Sh):await $(a,`Failed to load external SSO completion state`)},Rh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/cli-session/exchange`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return r.status===Z.StatusCodes.OK?Q(await r.text(),Ah):await $(r,`Failed to create CLI session`)},zh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${N(e)}/api/auth/cli-session/logout`,{method:`POST`,headers:{authorization:`Bearer ${t.token}`}});if(r.status===Z.StatusCodes.UNAUTHORIZED)throw Error(`Stored auth is invalid or expired`);return r.status===Z.StatusCodes.OK?Q(await r.text(),jh):await $(r,`Failed to revoke CLI session`)},Bh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/get-session`,N(e));i.searchParams.set(`disableCookieCache`,`true`),t.disableRefresh&&i.searchParams.set(`disableRefresh`,`true`);let a=await r(i,{method:`GET`,headers:{authorization:`Bearer ${t.token}`}});return a.status===Z.StatusCodes.OK?{status:`ok`,session:Q(await a.text(),sh),error:null}:a.status===Z.StatusCodes.UNAUTHORIZED?{status:`unauthorized`,session:null,error:Q(await a.text(),ih)}:await $(a,`Failed to refresh session`)};var Vh=class extends Error{constructor(e,t){super(e),this.name=`HttpClientResponseError`,this.status=t.status,this.statusText=t.statusText,this.bodyText=t.bodyText,t.cause!==void 0&&(this.cause=t.cause)}};const Hh=async e=>{try{return await e.clone().text()}catch{return}},Uh=async(e,t=`HTTP request failed`)=>{if(e.ok)return;let n=await Hh(e);throw new Vh(t,{status:e.status,statusText:e.statusText,bodyText:n})},Wh=/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,Gh=/^\d+$/;let Kh=function(e){return e.CLI=`cli`,e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.BROWSER_USE=`browser-use`,e}({}),qh=function(e){return e.STABLE=`stable`,e.BETA=`beta`,e.PREVIEW=`preview`,e}({}),Jh=function(e){return e.COMMAND=`command`,e.DOWNLOAD=`download`,e.STORE=`store`,e.DOCS=`docs`,e}({}),Yh=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.WIN_X64=`win-x64`,e}({}),Xh=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.LINUX_X64=`linux-x64`,e.LINUX_ARM64=`linux-arm64`,e}({}),Zh=function(e){return e.IOS=`ios`,e.ANDROID=`android`,e}({}),Qh=function(e){return e.CHROME=`chrome`,e}({});const $h=new Set(Object.values(Kh)),eg=new Set(Object.values(qh)),tg=new Set(Object.values(Jh)),ng=Object.values(Yh),rg={cli:Object.values(Xh),desktop:ng,mobile:Object.values(Zh),"browser-use":Object.values(Qh)},ig=e=>typeof e==`object`&&!!e,ag=(e,t)=>{if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string`);return e.trim()},og=(e,t)=>{if(e!=null){if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string when provided`);return e.trim()}},sg=(e,t)=>{if(e!=null){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`Release manifest ${t} must be a finite number when provided`);return e}},cg=(e,t)=>{let n=sg(e,t);if(n!=null){if(!Number.isInteger(n)||n<0)throw Error(`Release manifest ${t} must be a non-negative integer when provided`);return n}},lg=(e,t)=>{let n=Gh.test(e),r=Gh.test(t);return n&&r?Number(e)-Number(t):n?-1:r?1:e.localeCompare(t)},ug=e=>{let t=e.trim().match(Wh);if(!t)throw Error(`Invalid release version: ${e}`);return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:t[4]?t[4].split(`.`):[]}},dg=e=>$h.has(e),fg=e=>eg.has(e),pg=e=>tg.has(e),mg=(e,t)=>rg[e].includes(t),hg=(e,t)=>{let n=ug(e),r=ug(t);if(n.major!==r.major)return n.major-r.major;if(n.minor!==r.minor)return n.minor-r.minor;if(n.patch!==r.patch)return n.patch-r.patch;let i=n.prerelease.length>0,a=r.prerelease.length>0;if(!i&&!a)return 0;if(!i)return 1;if(!a)return-1;let o=Math.max(n.prerelease.length,r.prerelease.length);for(let e=0;e<o;e+=1){let t=n.prerelease[e],i=r.prerelease[e];if(t==null)return-1;if(i==null)return 1;let a=lg(t,i);if(a!==0)return a}return 0},gg=(e,t)=>hg(t,e.minimumSupportedVersion)<0?`update_required`:hg(t,e.latestVersion)<0?`update_available`:`up_to_date`,_g=e=>{if(!mg(e.product,e.platform))throw Error(`Unsupported release platform '${e.platform}' for product '${e.product}'`);return`v1/releases/${e.product}/${e.channel}/${e.platform}.json`},vg=e=>{if(!ig(e))throw TypeError(`Release manifest must be an object`);let t=e.schemaVersion;if(t!==1)throw Error(`Unsupported release manifest schema version: ${String(t)}`);let n=ag(e.product,`product`);if(!dg(n))throw Error(`Unsupported release product: ${n}`);let r=ag(e.channel,`channel`);if(!fg(r))throw Error(`Unsupported release channel: ${r}`);let i=ag(e.platform,`platform`);if(!mg(n,i))throw Error(`Unsupported release platform '${i}' for product '${n}'`);let a=i,o=e.actions;if(!Array.isArray(o))throw TypeError(`Release manifest actions must be an array`);let s=o.map((e,t)=>{if(!ig(e))throw TypeError(`Release manifest actions[${t}] must be an object`);let n=ag(e.kind,`actions[${t}].kind`);if(!pg(n))throw Error(`Unsupported release action kind: ${n}`);return{kind:n,label:ag(e.label,`actions[${t}].label`),url:og(e.url,`actions[${t}].url`),command:og(e.command,`actions[${t}].command`),sha256:og(e.sha256,`actions[${t}].sha256`),size:cg(e.size,`actions[${t}].size`)}}),c=sg(e.rolloutPercentage,`rolloutPercentage`);if(c!=null&&(!Number.isInteger(c)||c<0||c>100))throw Error(`Release manifest rolloutPercentage must be an integer between 0 and 100`);return{schemaVersion:1,product:n,channel:r,platform:a,latestVersion:ag(e.latestVersion,`latestVersion`),minimumSupportedVersion:ag(e.minimumSupportedVersion,`minimumSupportedVersion`),publishedAt:ag(e.publishedAt,`publishedAt`),releaseNotesUrl:og(e.releaseNotesUrl,`releaseNotesUrl`),message:og(e.message,`message`),rolloutPercentage:c,actions:s}},yg=new Set([`localhost`,`127.0.0.1`,`::1`]),bg=e=>yg.has(e),xg=e=>{let t=N(e.trim()),n=new URL(t);if(n.protocol===`https:`||n.protocol===`http:`&&bg(n.hostname))return N(n.toString());throw Error(`Updates base URL must use https or localhost http: ${e}`)},Sg=e=>`${xg(e.baseUrl)}/${_g({product:e.product,channel:e.channel,platform:e.platform})}`,Cg=async e=>e.json(),wg=async e=>{let t=new AbortController,n=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n=await e.fetchImpl(e.url,{method:`GET`,signal:t.signal,headers:{accept:`application/json`}});return await Uh(n,`Release manifest request failed`),vg(await Cg(n))}finally{clearTimeout(n)}},Tg=async e=>{let t=e.fetch??fetch,n=await wg({url:Sg({baseUrl:e.baseUrl,product:e.product,channel:e.channel,platform:e.platform}),fetchImpl:t,timeoutMs:e.timeoutMs??5e3});return{availability:gg(n,e.currentVersion),manifest:n}};export{os as $,mc as A,Fs as B,Tm as C,K as D,Sm as E,ec as F,us as G,Is as H,uc as I,M as J,ms as K,qs as L,rc as M,Zs as N,gm as O,sc as P,is as Q,Js as R,Y as S,J as T,bs as U,Ls as V,ys as W,fs as X,gs as Y,as as Z,wm as _,Oh as a,Aa as at,vm as b,Bh as c,O as ct,Mh as d,wo as et,Nh as f,th as g,nh as h,Kh as i,Ja as it,Qs as j,lm as k,Lh as l,Ka as lt,Ih as m,Xh as n,ss as nt,Rh as o,Ha as ot,Ph as p,hs as q,qh as r,rs as rt,Fh as s,A as st,Tg as t,$o as tt,zh as u,T as ut,pm as v,tm as w,Ym as x,am as y,Gs as z};
130
- //# debugId=c048f316-a48f-52e1-88f7-3b9e5ad81d3a